15 #include "FairRootManager.h"
16 #include "FairTrackParam.h"
18 #include "TClonesArray.h"
38 FairRootManager* ioman = FairRootManager::Instance();
40 Fatal(
"CbmRichRingTrackAssignClosestD::Init",
41 "RootManager not instantised!");
44 fGlobalTracks = (TClonesArray*) ioman->GetObject(
"GlobalTrack");
46 Fatal(
"CbmRichRingTrackAssignClosestD::Init",
"No GlobalTrack array!");
49 fTrdTracks = (TClonesArray*) ioman->GetObject(
"TrdTrack");
71 Int_t nofTracks =
richProj->GetEntriesFast();
72 Int_t nofRings =
rings->GetEntriesFast();
73 vector<Int_t> trackIndex;
74 vector<Double_t> trackDist;
75 trackIndex.resize(nofRings);
76 trackDist.resize(nofRings);
77 for (UInt_t
i = 0;
i < trackIndex.size();
i++) {
82 for (Int_t iIter = 0; iIter < 4; iIter++) {
83 for (Int_t iRing = 0; iRing < nofRings; iRing++) {
84 if (trackIndex[iRing] != -1)
continue;
86 if (NULL == pRing)
continue;
94 for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
95 vector<Int_t>::iterator it =
96 find(trackIndex.begin(), trackIndex.end(), iTrack);
97 if (it != trackIndex.end())
continue;
99 FairTrackParam* pTrack = (FairTrackParam*)
richProj->At(iTrack);
100 Double_t xTrack = pTrack->GetX();
101 Double_t yTrack = pTrack->GetY();
103 if (xTrack == 0 && yTrack == 0)
continue;
107 Double_t dist = TMath::Sqrt((xRing - xTrack) * (xRing - xTrack)
108 + (yRing - yTrack) * (yRing - yTrack));
115 trackIndex[iRing] = iTrackMin;
116 trackDist[iRing] = rMin;
119 for (UInt_t i1 = 0; i1 < trackIndex.size(); i1++) {
120 for (UInt_t i2 = 0; i2 < trackIndex.size(); i2++) {
121 if (i1 == i2)
continue;
122 if (trackIndex[i1] == trackIndex[i2] && trackIndex[i1] != -1) {
123 if (trackDist[i1] >= trackDist[i2]) {
124 trackDist[i1] = 999.;
127 trackDist[i2] = 999.;
136 for (UInt_t
i = 0;
i < trackIndex.size();
i++) {
139 if (trackIndex[
i] == -1)
continue;
147 Int_t nofTracks =
richProj->GetEntriesFast();
148 Int_t nofRings =
rings->GetEntriesFast();
150 for (Int_t iTrack = 0; iTrack < nofTracks; iTrack++) {
155 FairTrackParam* pTrack = (FairTrackParam*)
richProj->At(iTrack);
156 Double_t xTrack = pTrack->GetX();
157 Double_t yTrack = pTrack->GetY();
158 if (xTrack == 0 && yTrack == 0)
continue;
160 Double_t rMin = 999.;
162 for (Int_t iRing = 0; iRing < nofRings; iRing++) {
164 if (NULL == pRing)
continue;
169 Double_t dist = TMath::Sqrt((xRing - xTrack) * (xRing - xTrack)
170 + (yRing - yTrack) * (yRing - yTrack));
176 if (iRingMin < 0)
continue;
185 if (trdIndex == -1)
return false;
187 if (NULL == trdTrack)
return false;