13 #include "FairMCPoint.h"
14 #include "FairRootManager.h"
17 #include "TClonesArray.h"
35 fName =
"STSTrackFinderIdeal";
44 fName =
"STSTrackFinderIdeal";
58 FairRootManager* ioman = FairRootManager::Instance();
60 cout <<
"-E- " << fName <<
"::Init: "
61 <<
"RootManager not instantised!" << endl;
68 cout <<
"-E- " << fName <<
"::Init: No MCTrack array!" << endl;
75 cout <<
"-E- " << fName <<
"::Init: No MCPoint array!" << endl;
85 Bool_t success = kTRUE;
89 cout <<
"-E- " << fName <<
"::DoFind: "
90 <<
"MCTrack array missing! " << endl;
94 cout <<
"-E- " << fName <<
"::DoFind: "
95 <<
"MCPoint array missing! " << endl;
100 cout <<
"-E- " << fName <<
"::DoFind: "
101 <<
"Hit array missing! " << endl;
106 cout <<
"-E- " << fName <<
"::DoFind: "
107 <<
"Track array missing! " << endl;
112 Int_t nNoMCTrack = 0;
114 Int_t nNoStsPoint = 0;
119 FairMCPoint* pMCpt = NULL;
124 Int_t nHits =
fStsHits->GetEntriesFast();
129 Int_t mcTrackIndex = 0;
130 Int_t trackIndex = 0;
134 map<Int_t, Int_t> hitMap;
137 for (Int_t iHit = 0; iHit < nHits; iHit++) {
141 if (ptIndex < 0)
continue;
143 if (!pMCpt)
continue;
144 mcTrackIndex = pMCpt->GetTrackID();
145 hitMap[mcTrackIndex]++;
149 map<Int_t, Int_t> trackMap;
155 for (Int_t iMCTrack = 0; iMCTrack <
nMCTracks; iMCTrack++) {
157 if (!pMCtr)
continue;
160 if (hitMap[iMCTrack] < 3)
continue;
163 cout <<
"-I- " << fName <<
": StsTrack " << nTracks
164 <<
" created from MCTrack " << iMCTrack <<
" ("
166 trackMap[iMCTrack] = nTracks++;
169 if (
fVerbose > 2) cout <<
"-I- " << GetName() <<
": " << endl;
172 for (Int_t iHit = 0; iHit < nHits; iHit++) {
175 cout <<
"-E- " << fName <<
"::DoFind: Empty slot "
176 <<
"in StsHitArray at position " << iHit << endl;
182 if (ptIndex < 0)
continue;
185 cout <<
"-E- " << fName <<
"::DoFind: No reference "
186 <<
"MCPoint " << ptIndex <<
" for hit " << iHit << endl;
191 mcTrackIndex = pMCpt->GetTrackID();
192 if (mcTrackIndex < 0 || mcTrackIndex >
nMCTracks) {
193 cout <<
"-E- " << fName <<
"::DoFind: "
194 <<
"MCTrack index out of range. " << mcTrackIndex <<
" " <<
nMCTracks
200 if (trackMap.find(mcTrackIndex) == trackMap.end())
continue;
201 trackIndex = trackMap[mcTrackIndex];
204 cout <<
"-E- " << fName <<
"::DoFind: "
205 <<
"No StsTrack pointer. " << iHit <<
" " << ptIndex <<
" "
206 << mcTrackIndex <<
" " << trackIndex << endl;
213 cout <<
"Sts Hit " << iHit <<
" from StsPoint " << ptIndex <<
" (MCTrack "
214 << mcTrackIndex <<
") added to StsTrack " << trackIndex << endl;
220 cout <<
"-------------------------------------------------------" << endl;
221 cout <<
"-I- " << fName << endl;
222 cout <<
"Sts hits: " << nHits << endl;
223 cout <<
"MCTracks: total " <<
nMCTracks <<
", accepted " << nMCacc
224 <<
", reconstructable: " << nTracks << endl;
225 if (nNoStsHit) cout <<
"StsHits not found : " << nNoStsHit << endl;
226 if (nNoStsPoint) cout <<
"StsPoints not found : " << nNoStsPoint << endl;
227 if (nNoMCTrack) cout <<
"MCTracks not found : " << nNoMCTrack << endl;
228 if (nNoTrack) cout <<
"StsTracks not found : " << nNoTrack << endl;
229 cout <<
"-------------------------------------------------------" << endl;
234 cout << setw(15) << left << fName <<
": " <<
nMCTracks <<
", acc. " << nMCacc
235 <<
", rec. " << nTracks << endl;