15 #include "FairBaseParSet.h"
16 #include "FairDetector.h"
17 #include "FairMCPoint.h"
18 #include "FairRootManager.h"
19 #include "FairRunAna.h"
20 #include "FairRuntimeDb.h"
23 #include "TClonesArray.h"
24 #include "TObjArray.h"
38 , fTrdHitMatches(NULL)
39 , fTrdHitProducerType(
"")
47 FairRootManager* ioman = FairRootManager::Instance();
49 Fatal(
"-E- CbmTrdTrackFinderIdeal::Init",
"RootManager not instantised!");
51 fMcTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
53 Fatal(
"-E- CbmTrdTrackFinderIdeal::Init",
"No MCTrack array!");
55 fTrdPoints = (TClonesArray*) ioman->GetObject(
"TrdPoint");
57 Fatal(
"-E- CbmTrdTrackFinderIdeal::Init",
"No TrdPoint array!");
59 TClonesArray* digis = (TClonesArray*) ioman->GetObject(
"TrdDigi");
66 Fatal(
"-E- CbmTrdTrackFinderIdeal::Init",
"No TrdHitMatch array!");
73 TClonesArray* trdTracks) {
74 cout <<
"CbmTrdTrackFinderIdeal, event no. " <<
fEventNum <<
" "
78 Fatal(
"-E- CbmTrdTrackFinderIdeal::DoFind",
"No TrdHitArray!");
79 if (NULL == trdTracks)
80 Fatal(
"-E- CbmTrdTrackFinderIdeal::DoFind",
"No TrdTrackArray!");
82 Int_t nofTrdHits = trdHits->GetEntriesFast();
85 map<Int_t, CbmTrdTrack*> mcTrackToTrdTrack;
86 for (Int_t iHit = 0; iHit < nofTrdHits; iHit++) {
88 if (NULL == trdHit)
continue;
99 if (trdPointInd < 0)
continue;
100 FairMCPoint* trdPoint =
101 static_cast<FairMCPoint*
>(
fTrdPoints->At(trdPointInd));
102 if (NULL == trdPoint)
continue;
104 int mcTrackInd = trdPoint->GetTrackID();
105 if (NULL == mcTrackToTrdTrack[mcTrackInd])
107 mcTrackToTrdTrack[mcTrackInd]->AddHit(iHit,
kTRDHIT);
111 for (map<int, CbmTrdTrack*>::iterator it = mcTrackToTrdTrack.begin();
112 it != mcTrackToTrdTrack.end();
114 new ((*trdTracks)[trackCount])
CbmTrdTrack(*it->second);
118 return mcTrackToTrdTrack.size();