// ------------------------------------------------------------------------- // ----- Merger source file ------ // ----- Created 13/04/12 by P. Russotto ------ // ----- Modified by A. Le Fevre, 11/2012 (CAMAC, INFO, ATOF) ------ // ------------------------------------------------------------------------- #include "Merger.h" #include "FairLogger.h" #include "TClonesArray.h" #include "FairRunAna.h" #include using std::cout; using std::endl; Merger::Merger() :FairTask() { //init calibration } // ------------------------------------------------------------------------- Merger::Merger(const char* name, Int_t iVerbose) : FairTask(name, iVerbose), fRootCHITSCopy(0), fRootMBSTSCopy(0), fRootMBallEventCopy(0), fRootMBallGlobalCopy(0), fRootATOFhitEventCopy(0), // ALF, 11/2012 fRootATOFtrackEventCopy(0), // ALF, 11/2012 fRootATOFcalEventCopy(0), // ALF, 11/2012 fRootATOFglobalEventCopy(0), // ALF, 02/2013 fRootCAMACEventCopy(0), // ALF, 11/2012 fRootINFOEventCopy(0), // ALF, 11/2012 fRootCHIEventCopy(0), fRootCHIGlobalCopy(0) { } // ------------------------------------------------------------------------- Merger::~Merger() { } // ------------------------------------------------------------------------- InitStatus Merger::Init() { fLogger->Info(MESSAGE_ORIGIN," Merger::Init()------------------Start "); FairRootManager* ioman = FairRootManager::Instance(); if ( ! ioman ) Fatal("Init", "No FairRootManager"); fRootCHIEventCopy = (TClonesArray*) ioman->GetObject("CHIEVENTCLONE"); fRootCHIGlobalCopy = (TClonesArray*) ioman->GetObject("CHIGLOBALCLONE"); fRootMBallEventCopy = (TClonesArray*) ioman->GetObject("MBALLEVENTCLONE"); fRootMBallGlobalCopy = (TClonesArray*) ioman->GetObject("MBALLGLOBALCLONE"); //fRootLANDEventCopy = (TClonesArray*) ioman->GetObject("LANDEVENTCLONE"); fRootATOFhitEventCopy = (TClonesArray*) ioman->GetObject("ATOFHITEVENTCLONE");// ALF, 11/2012 fRootATOFtrackEventCopy = (TClonesArray*) ioman->GetObject("ATOFTRACKEVENTCLONE");// ALF, 11/2012 fRootATOFcalEventCopy = (TClonesArray*) ioman->GetObject("ATOFCALEVENTCLONE");// ALF, 11/2012 fRootATOFglobalEventCopy = (TClonesArray*) ioman->GetObject("ATOFGLOBALCLONE");// ALF, 02/2013 fRootCAMACEventCopy = (TClonesArray*) ioman->GetObject("CAMACEVENTCLONE");// ALF, 11/2012 fRootINFOEventCopy = (TClonesArray*) ioman->GetObject("INFOEVENTCLONE");// ALF, 11/2012 fRootCHITSCopy = (TClonesArray*) ioman->GetObject("CHITSCLONE"); fRootMBSTSCopy = (TClonesArray*) ioman->GetObject("MBSTSCLONE"); fCHITS = (TRootTS*)fRootCHITSCopy; fMBSTS = (TRootTS*)fRootMBSTSCopy; //fLANDEvent = (TRootLANDEvent*)fRootLANDEventCopy; fMBallEvent = (TRootMBallEvent*)fRootMBallEventCopy; fMBallGlobal = (TRootMBallGlobal*)fRootMBallGlobalCopy; fATOFhitEvent = (TRootATOFhitEvent*)fRootATOFhitEventCopy;// ALF, 11/2012 fATOFtrackEvent = (TRootATOFtrackEvent*)fRootATOFtrackEventCopy;// ALF, 11/2012 fATOFcalEvent = (TRootATOFcalEvent*)fRootATOFcalEventCopy;// ALF, 11/2012 fATOFglobalEvent = (TRootATOFglobalEvent*)fRootATOFglobalEventCopy;// ALF, 11/2012 fCAMACEvent = (TRootCAMACEvent*)fRootCAMACEventCopy;// ALF, 11/2012 fINFOEvent = (TRootINFOEvent*)fRootINFOEventCopy;// ALF, 11/2012 fCHIEvent = (TRootCHIEvent*)fRootCHIEventCopy; fCHIGlobal = (TRootCHIGlobal*)fRootCHIGlobalCopy; ioman->Register("CHIEVENT", "CHIMERA_EVENT_TREE", fCHIEvent, kFALSE); ioman->Register("CHIGLOBAL", "CHIMERA_GLOBAL_TREE", fCHIGlobal, kTRUE); ioman->Register("CHITS", "CHIMERA TIMESTAMP", fCHITS, kFALSE); ioman->Register("MBALLEVENT", "MBALL_EVENT TREE", fMBallEvent, kFALSE); ioman->Register("MBALLGLOBAL", "MBALL_GLOBAL_TREE", fMBallGlobal, kTRUE); //ioman->Register("LANDEVENT", "LAND_EVENT TREE", fLANDEvent, kFALSE); ioman->Register("ATOFHITEVENT", "ATOF HIT EVENT TREE", fATOFhitEvent, kFALSE);// ALF, 11/2012 ioman->Register("ATOFTRACKEVENT", "ATOF TRACK EVENT TREE", fATOFtrackEvent, kFALSE);// ALF, 11/2012 ioman->Register("ATOFCALEVENT", "ATOF CAL EVENT TREE", fATOFcalEvent, kFALSE);// ALF, 11/2012 ioman->Register("ATOFGLOBAL", "ATOF_GLOBAL_TREE", fATOFglobalEvent, kTRUE);// ALF, 02/2013 ioman->Register("CAMACEVENT", "CAMAC EVENT TREE", fCAMACEvent, kTRUE);// ALF, 11/2012 ioman->Register("INFOEVENT", "INFO EVENT TREE", fINFOEvent, kTRUE);// ALF, 11/2012 ioman->Register("MBSTS", "MBS_TIME_STAMP", fMBSTS, kFALSE); fLogger->Info(MESSAGE_ORIGIN," Merger::Init()------------------End "); cout << " ...return to continue..."<< endl; getchar(); } // ------------------------------------------------------------------------- void Merger::SetParTask() { } // ------------------------------------------------------------------------- void Merger::Finish() { } // ------------------------------------------------------------------------- void Merger::Reset() { } // ------------------------------------------------------------------------- void Merger::Exec(Option_t* opt) { // cout <<"Mereger::Exec*****************BEGIN***************"<Info(MESSAGE_ORIGIN," Merger::Exec(Option_t* opt) "); // cout << "fMBallEvent->uBallmulti= "<< fMBallEvent->uBallmulti<< endl; // cout << "fCHIEvent->Idmulti= "<< fCHIEvent->Idmulti<< endl; CHIMERA_TimeStamp=fCHITS->TSM*65535+fCHITS->TSS; MBS_TimeStamp= fMBSTS->TSM*65535+fMBSTS->TSS; // cout << " i due time stamps " << endl; // cout << CHIMERA_TimeStamp << " " << MBS_TimeStamp << endl; if(CHIMERA_TimeStamp >MBS_TimeStamp){ diff=CHIMERA_TimeStamp-MBS_TimeStamp; }else{ diff=MBS_TimeStamp-CHIMERA_TimeStamp; } diff = CHIMERA_TimeStamp-MBS_TimeStamp; // cout <<" diff= " << diff << endl; if(diff<100 ){ // cout << " da mergere " << endl; // cout << " da mergere " << endl; fCHITS->correlated=1; fMBSTS->correlated=1; }else{ cout <<"[Merger::Exec] something wrong in timestamps"<GetLMDProcessingStatus() << endl; if(FairRunAna::Instance()->GetLMDProcessingStatus() && fMBSTS->correlated==1){ cout <<"[Merger::Exec] This is last couples of event...it is better to keep uncorrelated..."<correlated=0; fMBSTS->correlated=0; } // cout <<"[Merger::Exec] ******************END***************"<GetLMDProcessingStatus() && fMBSTS->correlated==1){ cout <<"[Merger::Exec] This is last couples of event...it is better to keep uncorrelated..."<correlated=0; fMBSTS->correlated=0; } /* cout <<"Mereger::Exec******************END***************"<>>>>>> .r18290 cout <<" "<