15 #include "FairMCPoint.h"
16 #include "FairRootManager.h"
18 #include "TClonesArray.h"
28 : FairTask(
"CbmRichMatchRings")
44 FairRootManager* ioman = FairRootManager::Instance();
46 Fatal(
"CbmRichMatchRings::Init",
"RootManager not instantiated!");
49 fHits = (TClonesArray*) ioman->GetObject(
"RichHit");
50 if (NULL ==
fHits) { Fatal(
"CbmRichMatchRings::Init",
"No RichHit array!"); }
52 fRings = (TClonesArray*) ioman->GetObject(
"RichRing");
54 Fatal(
"CbmRichMatchRings::Init",
"No RichRing array!");
57 fPoints = (TClonesArray*) ioman->GetObject(
"RichPoint");
59 Fatal(
"CbmRichMatchRings::Init",
"No RichPoint array!");
62 fTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
64 Fatal(
"CbmRichMatchRings::Init",
"No MCTrack array!");
68 fMatches =
new TClonesArray(
"CbmTrackMatchNew", 100);
69 ioman->Register(
"RichRingMatch",
72 IsOutputBranchPersistent(
"RichRingMatch"));
80 map<Int_t, Int_t>::iterator it;
106 Int_t nRings =
fRings->GetEntriesFast();
107 for (Int_t iRing = 0; iRing < nRings; iRing++) {
109 if (NULL == ring)
continue;
124 for (Int_t iHit = 0; iHit < nHits; iHit++) {
126 if (NULL == hit)
continue;
134 FairMCPoint* point = (FairMCPoint*)
fPoints->At(iPoint);
135 if (NULL == point)
continue;
137 Int_t iMCTrack = point->GetTrackID();
144 ringMatch->
AddLink(1., iMother);
152 if (it->second > nTrue) {
153 iMCTrack = it->first;
159 nWrong = nAll - nTrue;