//////////////////////////////////// // KRATTA Task merger // for the Asy-Eos experiment // TKratMerger DECLARATION // Mar 2013 // revison 03/2013 // E.d.F ver 1.0 // sebastian.kupny@uj.edu.pl // Changes: //////////////////////////////////// #ifndef KRATTA_MERGER_H #define KRATTA_MERGER_H #include #include #include "TClonesArray.h" #include "TF1.h" #include "TGraph.h" #include "TLine.h" #include "TMarker.h" #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" #include "FairTask.h" #include "TEvtBuffer.h" #include "TMbsInfo.h" #include "mktreeraw.h" #include "mktreedstchain_sct_fitABC.h" class TKratMerger : public FairTask { public: /** Default constructor **/ TKratMerger(); /** Constructor * Verbose modes: * 0 - quiet * 1 - normal (warnings and errors printed) * 2 - additional inf * 3 and high - Debug mode * 10 - stop analysis when events not same * **/ TKratMerger (const char* name, TString runlist, TString pathToDst, Int_t iVerbose = 1); TKratMerger(Int_t verbose); /** Destructor **/ ~TKratMerger(); /** Virtual method Init **/ virtual InitStatus Init(); /** Virtual method Exec **/ virtual void Exec(Option_t* opt); virtual void Finish(); virtual void Reset(); void SetVerboseLevel( Int_t verbose ) { fVerbose = verbose; } Int_t GetVerboseLevel( void ) { return fVerbose; } /** Call this function to print to the terminal CAMAC * and KRATTA.DST timestamps * For printCamacAndDstTimeStamps == 2 the timestamps are printed * one above the other */ void SetPrintCamacAndDstTimeStamps( const Int_t printCamacAndDstTimeStamps = 1 ) { fPrintCamacAndDstTimeStamps = printCamacAndDstTimeStamps; } Int_t GetPrintCamacAndDstTimeStamps( void ) const { return fPrintCamacAndDstTimeStamps; } void PrintLoadedDstFiles(); /** KRATTA_IN **/ void SetKratContInName( TString ASYEventFromFileName ){ fASYEventFromFileName = ASYEventFromFileName; } TString GetKratContInName( void ) const { return fASYEventFromFileName; } /** MBS_TS **/ void SetMbstsContInName( TString MbstsContInName ){; fMbstsContInName = MbstsContInName; } TString GetMbstsContInName( void ) const { return fMbstsContInName; } /** MBS_INFO **/ void SetMbsinfoContInName( TString MbsinfoContInName ){ fMbsinfoContInName = MbsinfoContInName; } TString GetMbsinfoContInName( void ) const { return fMbsinfoContInName; } /** KRATTA_OUT **/ void SetKratContOutName( TString ASYEventFromFileCopyName ){ fASYEventFromFileCopyName = ASYEventFromFileCopyName; } TString GetKratContOutName( void ) const { return fASYEventFromFileCopyName; } /** DOES WRITE OUTPUT DATA CONTAINER TO THE FILE **/ void SaveOutputIntoTree(Bool_t saveOutputToTree = kTRUE){ fSaveOutputToTree = saveOutputToTree; } Bool_t DoesSaveOutputIntoTree( void ){ return fSaveOutputToTree; } protected: /// Methods /** Loads input files from fRunlist and * store them on map fDstFilesMap*/ Long64_t LoadDstFilesFromRunlist ( void ); /** Parse and return run number from LMD file name */ Int_t GetRunNumberFromFileName ( TString A_string ); /** Parse and return related KRATTA DST file for given LMD file * this function use variable fPathToKrattaDstFiles */ TString GetDstFileNameFromFileName ( TString A_string ); /** Returns true, if given file exist */ bool CheckIfFileExist ( const char *filename ); /** Open and give access to KRATTA DST file * for given run number, if there is no such file there will be no * access to data: pointers and data structures are reset */ Int_t LoadFileWithRunNumber( Int_t RunNo ); /** Print to the output time stamp from CAMAC and DST Kratta event*/ void PrintTimeStamps() const; /// Members /** Container with mapping run <=> Kratta DST file */ std::map fDstFilesMap; /** Flie with list of LMD files to analyse */ TString fRunlist; /** Path to dir in which are stored KRATTA DST files */ TString fPathToKrattaDstFiles; /** Current KRATTA DST file which is read*/ TFile *fInputDstFile; /** The main tree in KRATTA DST file */ TTree *fFileMainTree; /** Name of the main tree in KRATTA DST file (cbmsim)*/ TString fFileMainTreeName; /** Number of events in current analysed tree */ Long64_t fNEventsInTree; /** Current event which is analysed */ Long64_t fEntryIndex; /** Counter for events read from KRATTA dst */ Long64_t fEventsCounterKratta; /** Counter for events read from the unpackers (LAND, CHIMERA, ATOF, uBALL, etc.) */ Long64_t fEventsCounterLcau; /** ASYEOS structures reads for synchronisation */ TRootTS *fMBSTS; TClonesArray *fRootMBSTSCopy; TString fMbstsContInName; // MbsTS input data container TMbsInfo *fMbsInfo; TClonesArray *fMbsInfoClone; TString fMbsinfoContInName; // MbsInfo input data container /** KRATTA structures reads from KRATTA DST files and synchronised */ ASYEvent *fASYEventFromFile; TString fASYEventFromFileName; /** KRATTA structures stored on memory and eventually in output file */ TClonesArray *fASYEventFromFileCopy; TString fASYEventFromFileCopyName; /** Members used in synchronization*/ Int_t fMbsRunNo; Long64_t fMbsEventNo; unsigned long int fMbsTimeStamp; Int_t fKrattaDstRunNo; Long64_t fKrattaDstEventNo; unsigned long int fKrattaDstTimeStamp; Int_t fPrintCamacAndDstTimeStamps; private: TKratMerger(const TKratMerger&); TKratMerger& operator=(const TKratMerger&){ return *this; } virtual void SetParContainers(); Bool_t fSaveOutputToTree; ClassDef(TKratMerger,1); }; #endif ///KRATTA_MERGER_H