// : Author J.Markert //_HADES_CLASS_DESCRIPTION /////////////////////////////////////////////////////////////////////////////// // // HOnlineMdcMon // /////////////////////////////////////////////////////////////////////////////// using namespace std; #include "honlinephysicsmon.h" #include "honlinephysicshistfiller.h" #include "honlinephysicshistbooker.h" #include "hmdcdef.h" #include "hmdctrackddef.h" #include "hmdctrackgdef.h" #include "tofdef.h" #include "tofinodef.h" #include "showerdef.h" #include "richdef.h" #include "hcategory.h" #include "hdebug.h" #include "hades.h" #include "hiterator.h" #include "hruntimedb.h" #include "hspectrometer.h" #include "hdetector.h" #include "hevent.h" #include "hmetamatch2.h" #include "hsplinetrack.h" #include "hmdctrkcand.h" #include "hmdcseg.h" #include "htofhit.h" #include "hshowerhittof.h" #include "hrichhit.h" #include #include #include #include "TIterator.h" ClassImp(HOnlinePhysicsMon) HOnlinePhysicsHistBooker* HOnlinePhysicsMon::physicsHistbooker=0; HOnlinePhysicsMon::HOnlinePhysicsMon(void) { // Default constructor . initVariables(); } HOnlinePhysicsMon::HOnlinePhysicsMon(const Text_t* name,const Text_t* title) : HReconstructor(name,title) { // Constructor calls the constructor of class HReconstructor with the name // and the title as arguments. initVariables(); } HOnlinePhysicsMon::~HOnlinePhysicsMon(void) { // destructor deletes the iterator if(iterMdcTrkCand) {delete iterMdcTrkCand; iterMdcTrkCand =0;} if(iterMdcSeg) {delete iterMdcSeg; iterMdcSeg =0;} if(iterTofHit) {delete iterTofHit; iterTofHit =0;} if(iterShowerTofHit){delete iterShowerTofHit;iterShowerTofHit=0;} if(iterSplineTrack) {delete iterSplineTrack; iterSplineTrack =0;} if(iterMetaMatch) {delete iterMetaMatch; iterMetaMatch =0;} } void HOnlinePhysicsMon::initVariables() { // iterator+categories MdcTrkCandCat =0; MdcSegCat =0; TofHitCat =0; ShowerTofHitCat =0; SplineTrackCat =0; MetaMatchCat =0; RichHitCat =0; iterMdcTrkCand =0; iterMdcSeg =0; iterTofHit =0; iterShowerTofHit=0; iterSplineTrack =0; iterMetaMatch =0; iterRichHit =0; } void HOnlinePhysicsMon::printStatus(){ cout << "************* HOnlinePhysicsMon *************" << endl; cout << "******************************************" << endl; } void HOnlinePhysicsMon::setParContainers() { physicsHistbooker = HOnlinePhysicsHistBooker::getExObject(); if(!physicsHistbooker) { Error("HOnlinePhysicsMon::setParContainers()","ZERO POINTER FOR HPHYSICSHISTBOOKER RECEIVED!"); exit(1); } } Bool_t HOnlinePhysicsMon::init(void) { Bool_t test=kFALSE; setParContainers(); test=getCategories(); printStatus(); fActive=kTRUE; return test; } Bool_t HOnlinePhysicsMon::reinit(void) { physicsHistbooker = HOnlinePhysicsHistBooker::getExObject(); physicsHistbooker->printStatus(); fActive=kTRUE; return kTRUE; } Bool_t HOnlinePhysicsMon::getCategories() { MdcTrkCandCat =(HCategory*)gHades->getCurrentEvent()->getCategory(catMdcTrkCand); if(!catMdcTrkCand) { Error("getCategories()","NO catMdcTrkCand in input!"); return kFALSE; } else { iterMdcTrkCand=(HIterator*)MdcTrkCandCat->MakeIterator("native"); } MdcSegCat =(HCategory*)gHades->getCurrentEvent()->getCategory(catMdcSeg); if(!MdcSegCat) { Error("getCategories()","NO catMdcSeg in input!"); return kFALSE; } else { iterMdcSeg=(HIterator*)MdcSegCat->MakeIterator("native"); } TofHitCat =(HCategory*)gHades->getCurrentEvent()->getCategory(catTofHit); if(!TofHitCat) { Error("getCategories()","NO catTofHit in input!"); return kFALSE; } else { iterTofHit=(HIterator*)TofHitCat->MakeIterator("native"); } ShowerTofHitCat =(HCategory*)gHades->getCurrentEvent()->getCategory(catShowerHitTof); if(!ShowerTofHitCat) { Error("getCategories()","NO catShowerHitTof in input!"); return kFALSE; } else { iterShowerTofHit=(HIterator*)ShowerTofHitCat->MakeIterator("native"); } SplineTrackCat =(HCategory*)gHades->getCurrentEvent()->getCategory(catSplineTrack); if(!SplineTrackCat) { Warning("getCategories()","NO catShowerHitTof in input!"); } else { iterSplineTrack=(HIterator*)SplineTrackCat->MakeIterator("native"); } MetaMatchCat =(HCategory*)gHades->getCurrentEvent()->getCategory(catMetaMatch); if(!MetaMatchCat) { Warning("getCategories()","NO catMetaMatch in input!"); } else { iterMetaMatch=(HIterator*)MetaMatchCat->MakeIterator("native"); } RichHitCat =(HCategory*)gHades->getCurrentEvent()->getCategory(catRichHit); if(!RichHitCat) { Warning("getCategories()","NO catRichHit in input!"); } else { iterRichHit=(HIterator*)RichHitCat->MakeIterator("native"); } return kTRUE; } Int_t HOnlinePhysicsMon::execute() { //physicsHistbooker->resetActiveList(2,gHades->getEventCounter()); // if feature of incremental update should be used HSplineTrack* spline; HMetaMatch2* metamatch; HMdcTrkCand* trk; HMdcSeg* seg; HTofHit* tofhit; HShowerHitTof* showertofhit; HRichHit* richhit; spline =0; metamatch =0; trk =0; seg =0; tofhit =0; showertofhit=0; richhit =0; //############################ MDC DEDX ############################################## if(MetaMatchCat&&SplineTrackCat) { iterMetaMatch->Reset(); while ((metamatch=(HMetaMatch2 *)iterMetaMatch->Next())!=0) { Int_t trkindex =metamatch->getTrkCandInd(); trk =(HMdcTrkCand*)MdcTrkCandCat->getObject(trkindex); Int_t splineindex=metamatch->getSplineInd(); if(splineindex!=-1) { // if spline track exists spline =(HSplineTrack*)SplineTrackCat->getObject(splineindex); if(spline) physicsHistbooker->getPhysicsFiller()->fillMdcDeDx(spline,trk); } } } //############################ TOF DEDX ############################################## if(MetaMatchCat&&SplineTrackCat&&TofHitCat) { iterMetaMatch->Reset(); while ((metamatch=(HMetaMatch2 *)iterMetaMatch->Next())!=0) { Int_t trkindex =metamatch->getTrkCandInd(); trk =(HMdcTrkCand*)MdcTrkCandCat->getObject(trkindex); Int_t splineindex=metamatch->getSplineInd(); if(splineindex!=-1) { // if spline track exists spline =(HSplineTrack*)SplineTrackCat->getObject(splineindex); if(spline) { //------------------------------------- // loop over all posible tofhits for this // metamatch for(Int_t i=0;igetTofHit1Ind(i); if(indtof!=-1) { tofhit=(HTofHit*)TofHitCat->getObject(indtof); if(tofhit)physicsHistbooker->getPhysicsFiller()->fillTofDeDx(spline,tofhit); } indtof = metamatch->getTofHit2Ind(i); if(indtof!=-1) { tofhit=(HTofHit*)TofHitCat->getObject(indtof); if(tofhit)physicsHistbooker->getPhysicsFiller()->fillTofDeDx(spline,tofhit); } } //------------------------------------- } } } } //############################ CORR PHI MDC TOF ####################################### if(MdcSegCat&&TofHitCat) { iterMdcSeg->Reset(); while ((seg=(HMdcSeg *)iterMdcSeg->Next())!=0) { iterTofHit->Reset(); while ((tofhit=(HTofHit *)iterTofHit->Next())!=0) { physicsHistbooker->getPhysicsFiller()->fillMdcTofPhi(seg,tofhit); } } } //############################ CORR PHI MDC SHOWERTOFINO ############################## /* // SHOULD BE REPLACED BY RPC if(MdcSegCat&&ShowerTofHitCat) { iterMdcSeg->Reset(); while ((seg=(HMdcSeg *)iterMdcSeg->Next())!=0) { iterShowerTofHit->Reset(); while ((showertofhit=(HShowerHitTof *)iterShowerTofHit->Next())!=0) { physicsHistbooker->getPhysicsFiller()->fillMdcTofinoPhi(seg,showertofhit); } } } */ //############################ CORR PHI MDC RICH ####################################### if(MdcSegCat&&RichHitCat) { iterMdcSeg->Reset(); while ((seg=(HMdcSeg *)iterMdcSeg->Next())!=0) { iterRichHit->Reset(); while ((richhit=(HRichHit *)iterRichHit->Next())!=0) { physicsHistbooker->getPhysicsFiller()->fillMdcRichPhi(seg,richhit); } } } return 0; } Bool_t HOnlinePhysicsMon::finalize() { return kTRUE; }