//////////////////////////////////// // KRATTA Task merger // for the Asy-Eos experiment // TKratCalibMerger DECLARATION // Mar 2013 // revison 03/2013 // E.d.F ver 1.0 // sebastian.kupny@uj.edu.pl // Changes: //////////////////////////////////// #ifndef KRATTA_CALIB_MERGER_H #define KRATTA_CALIB_MERGER_H #include #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 "TRootKRATEvent.h" class TKratCalibMerger : public FairTask { public: /** Default constructor **/ TKratCalibMerger(); /** 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 * **/ TKratCalibMerger (const char* name, TString runlist, TString pathToCalib, Int_t iVerbose = 1); TKratCalibMerger(Int_t verbose); /** Destructor **/ ~TKratCalibMerger(); /** 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.CALIB timestamps * For printCamacAndCalibTimeStamps == 2 the timestamps are printed * one above the other */ void SetPrintCamacAndCalibTimeStamps( const Int_t printCamacAndCalibTimeStamps = 1 ) { fPrintCamacAndCalibTimeStamps = printCamacAndCalibTimeStamps; } Int_t GetPrintCamacAndCalibTimeStamps( void ) const { return fPrintCamacAndCalibTimeStamps; } void PrintLoadedCalibFiles(); /** KRATTA_IN **/ void SetKratContInName( TString TRootKRATEventFromFileName ){ fTRootKRATEventFromFileName = TRootKRATEventFromFileName; } TString GetKratContInName( void ) const { return fTRootKRATEventFromFileName; } /** 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 TRootKRATEventFromFileCopyName ){ fTRootKRATEventFromFileCopyName = TRootKRATEventFromFileCopyName; } TString GetKratContOutName( void ) const { return fTRootKRATEventFromFileCopyName; } /** 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 fCalibFilesMap*/ Long64_t LoadCalibFilesFromRunlist ( void ); /** Parse and return run number from LMD file name */ Int_t GetRunNumberFromFileName ( TString A_string ); /** Parse and return related KRATTA CALIB file for given LMD file * this function use variable fPathToKrattaCalibFiles */ TString GetCalibFileNameFromFileName ( TString A_string ); /** Returns true, if given file exist */ bool CheckIfFileExist ( const char *filename ); /** Open and give access to KRATTA CALIB 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 CALIB Kratta event*/ void PrintTimeStamps() const; /// Members /** Container with mapping run <=> Kratta CALIB file */ std::map fCalibFilesMap; /** Flie with list of LMD files to analyse */ TString fRunlist; /** Path to dir in which are stored KRATTA CALIB files */ TString fPathToKrattaCalibFiles; /** Current KRATTA CALIB file which is read*/ TFile *fInputCalibFile; /** The main tree in KRATTA CALIB file */ TTree *fFileMainTree; /** Name of the main tree in KRATTA CALIB file (cbmsim)*/ TString fFileMainTreeName; /** Number of events in current analysed tree */ Long64_t fNEventsInTree; /** Current event which is analysed */ Long64_t fEntryIndex; /** 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 CALIB files and synchronized */ TRootKRATEvent *fTRootKRATEventFromFile; TString fTRootKRATEventFromFileName; /** KRATTA structures stored on memory and eventually in output file */ TClonesArray *fTRootKRATEventFromFileCopy; TString fTRootKRATEventFromFileCopyName; /** Members used in synchronisation*/ Int_t fMbsRunNo; Long64_t fMbsEventNo; unsigned long int fMbsTimeStamp; Int_t fKrattaCalibRunNo; Long64_t fKrattaCalibEventNo; unsigned long int fKrattaCalibTimeStamp; Int_t fPrintCamacAndCalibTimeStamps; private: TKratCalibMerger(const TKratCalibMerger&); TKratCalibMerger& operator=(const TKratCalibMerger&){ return *this; } virtual void SetParContainers(); Bool_t fSaveOutputToTree; ClassDef(TKratCalibMerger,1); }; #endif ///KRATTA_CALIB_MERGER_H