// ------------------------------------------------------------------------- // ----- PndTrackCandDraw source file ----- // ----- Created 03/01/08 by M. Al-Turany ----- // ------------------------------------------------------------------------- #include "PndTrackCandDraw.h" #include "FairHit.h" //#include "TClonesArray.h" #include "TObjArray.h" #include "TEveManager.h" #include "TEveBoxSet.h" #include "GFTrackCand.h" #include "PndTrackCand.h" #include "PndTrackCandHit.h" #include "FairRootManager.h" #include "PndTpcCluster.h" #include "PndLhePidTrack.h" //#include "PndTpcLheGFTrack.h" #include "PndDetectorList.h" #include using std::cout; using std::endl; // ----- Standard constructor ------------------------------------------ PndTrackCandDraw::PndTrackCandDraw(const char* TrackCandName, Int_t iVerbose):FairBoxSetDraw(TrackCandName, iVerbose) { } // ------------------------------------------------------------------------- InitStatus PndTrackCandDraw::Init() { FairBoxSetDraw::Init(); if(fVerbose>1) cout<< "PndTrackCandDraw::Init()" << endl; fManager = FairRootManager::Instance(); fPixPointList = (TClonesArray *)fManager->GetObject("MVDHitsPixel"); fStripPointList = (TClonesArray *)fManager->GetObject("MVDHitsStrip"); fTpcClusterList = (TClonesArray *)fManager->GetObject("PndTpcCluster"); fSttHelixList = (TClonesArray *)fManager->GetObject("SttHelixHit"); fGemHitList = (TClonesArray* )fManager->GetObject("GEMHit"); if (fTpcClusterList == 0) fTpcClusterList = (TClonesArray*)fManager->GetObject("PndTpcClusterMerged"); if(fPixPointList==0){ cout << "PndTrackCandDraw::Init() branch MVDHitsPixel Not found! Task will be deactivated "<< endl; //SetActive(kFALSE); } if(fStripPointList==0){ cout << "PndTrackCandDraw::Init() branch MVDHitsStrip Not found! Task will be deactivated "<< endl; //SetActive(kFALSE); } if(fTpcClusterList==0){ cout << "PndTrackCandDraw::Init() branch PndTpcCluster or PndTpcClusterMerged Not found! Task will be deactivated "<< endl; //SetActive(kFALSE); } if(fSttHelixList==0){ cout << "PndTrackCandDraw::Init() branch SttHelixList Not found! Task will be deactivated "<< endl; //SetActive(kFALSE); } if(fGemHitList==0){ cout << "PndTrackCandDraw::Init() branch GemHitList Not found! Task will be deactivated "<< endl; //SetActive(kFALSE); } if(fVerbose>2){ cout<< "PndTrackCandDraw::Init() get pix points list" << fPixPointList<< endl; cout<< "PndTrackCandDraw::Init() get strip points list" << fStripPointList<< endl; cout<< "PndTrackCandDraw::Init() get tpc cluster list" << fTpcClusterList<ClassName(), "GFTrackCand") || 0 == strcmp(obj->ClassName(), "PndLhePidTrack")) AddBoxesTrackCand(set, obj, i); else if (0 == strcmp(obj->ClassName(), "PndTrackCand")) AddBoxesPndTrackCand(set, obj, i); } void PndTrackCandDraw::AddBoxesTrackCand(TEveBoxSet* set, TObject* obj, Int_t i) { GFTrackCand *tc; PndLhePidTrack *pidtc; if( 0 == strcmp(obj->ClassName() , "GFTrackCand")) { tc=(GFTrackCand *)obj; std::cout<<"fTrackCandList is full of GFTrackCands"<ClassName() , "PndLhePidTrack") ) { pidtc=(PndLhePidTrack *)fTrackCandList->At(i); std::cout<<"fTrackCandList is full of PndLhePidTracks"<GetTrackCand(), i); } else if ( 0 == strcmp(obj->ClassName(), "PndTpcLheTrack")){ std::cout<<"fTrackCandList is full of PndTpcLheTracks"<GetTrackCand(); } else { std::cout<<"fTrackCandList is full of UNKNOWN "<ClassName()<<"?"<getNHits(); j++){ unsigned int detId, hitId; tc->getHit(j, detId, hitId); TVector3 point = GetVector(detId, hitId); set->AddBox(point.X(), point.Y(), point.Z()); set->DigitValue(i); } } void PndTrackCandDraw::AddBoxesPndTrackCand(TEveBoxSet* set, TObject* obj, Int_t i) { PndTrackCand* pndtc = (PndTrackCand*)obj; for (Int_t j = 0; j < pndtc->GetNHits(); j++){ PndTrackCandHit hit = pndtc->GetSortedHit(j); TVector3 point = GetVector(hit.GetDetId(), hit.GetHitId()); set->AddBox(point.X(), point.Y(), point.Z()); set->DigitValue(i); } } TVector3 PndTrackCandDraw::GetVector(Int_t detId, Int_t hitId) { FairHit * p; FairRootManager* ioman = FairRootManager::Instance(); TString branchName = ioman->GetBranchName(detId); TClonesArray* data = (TClonesArray*)(ioman->GetObject(branchName)); if (branchName == "MVDHitsStrip" || branchName == "MVDHitsPixel" || branchName == "SttHelixHit" || branchName == "GemHit" || branchName == "PndTpcCluster") { p = (FairHit*)data->At(hitId); // if (detId == kMVDHitsPixel) // { // p = (FairHit *) fPixPointList->At(hitId); // } // else if (detId == kMVDHitsStrip) // { // p = (FairHit *) fStripPointList->At(hitId); // } // else if (detId == kSttHelixHit){ // p = (FairHit *) fSttHelixList->At(hitId); // } // else if (detId == kGemHit){ // p = (FairHit *) fGemHitList->At(hitId); // } return (TVector3(p->GetX(), p->GetY(), p->GetZ())); } // else if (branchName == "PndTpcCluster"){ // return ((PndTpcCluster*)data->At(hitId))->pos(); // } else std::cout << "-E- PndTrackCandDraw::GetVector : Unknown Detector with ID: " << detId << std::endl; return TVector3(); } // ----- Destructor ---------------------------------------------------- PndTrackCandDraw::~PndTrackCandDraw() { } // ------------------------------------------------------------------------- ClassImp(PndTrackCandDraw)