15 fIoman = FairRootManager::Instance();
16 fHits = (TClonesArray*)
fIoman->GetObject(
"FTSHit");
24 cout <<
"#################### Event nr " <<
eventNum <<
" ####################" << endl;
27 map<Int_t,vector<PndFtsHit*>> mcToHits =
getMcTracks();
31 cout <<
"Found " <<mcToHits.size() <<
" MC-Tracks"<< endl;
32 for(
map<Int_t,vector<PndFtsHit*>>::iterator
i=mcToHits.begin();
i!=mcToHits.end();
i++){
33 Int_t mcTrackID =
i->first;
34 vector<PndFtsHit*>
hits =
i->second;
35 cout <<
"----------- Analyze MC-Track " <<
i->first <<
" -----------" << endl;
48 cout <<
"--------------------- Quality Results: ----------------------" << endl;
56 Double_t foundTracksRel = 100-notFoundRel-notEnoughFoundRel;
57 cout <<
"Tracks: " << trackCount << endl;
58 cout <<
"Found " << trackCount-
notFound-notEnoughFound <<
" Tracks (" << foundTracksRel <<
"%)" << endl;
59 cout <<
" Found complete and clean : " <<
completeClean <<
" (" << completeCleanRel <<
"%)" << endl;
60 cout <<
" Found complete and unclean : " <<
completeUnclean <<
" (" << completeUncleanRel <<
"%)" << endl;
61 cout <<
" Found incomplete and clean : " <<
incompleteClean <<
" (" << incompleteCleanRel <<
"%)" << endl;
62 cout <<
" Found incomplete and unclean : " <<
incompleteUnclean <<
" (" << incompleteUncleanRel <<
"%)" << endl;
63 cout <<
"Not found(under 70%): " << notEnoughFound <<
" (" << notEnoughFoundRel <<
"%)" << endl;
64 cout <<
"Not found : " <<
notFound <<
" (" << notFoundRel <<
"%)" << endl;
66 cout <<
"correlation:" << endl;
67 cout <<
"momentum:" << endl;
68 for(
int i=0;
i<10;
i++){
72 cout <<
"hits:" << endl;
73 for(
int i=0;
i<10;
i++){
77 cout <<
"TrackCount:" << endl;
78 for(
int i=0;
i<10;
i++){
84 cout <<
"sum of all tracks:" << endl;
85 cout <<
"momentum:" << endl;
86 for(
int i=0;
i<10;
i++){
90 cout <<
"hits:" << endl;
91 for(
int i=0;
i<10;
i++){
95 cout <<
"TrackCount:" << endl;
96 for(
int i=0;
i<10;
i++){
103 ofs.open(
"results.csv",ios::app);
105 ofs << trackCount <<
";";
110 ofs << notEnoughFound<<
";";
116 cout <<
"Only one Hit per layer: " <<
oneHitPerLayer <<
": (" << ohRel <<
"%)" << endl;
117 cout <<
"More than 2 Hits per layer: " <<
moreThan3Hits <<
": (" << mhRel <<
"%)" << endl;
118 cout <<
"TwoTracksOneTube " <<
twoTracksOneTube <<
": (" << mtRel <<
"%)" << endl;
122 Int_t branchID =
fIoman->GetBranchId(
"FTSHit");
124 map<Int_t,vector<PndFtsHit*>> mcTracksToHits;
146 set<FairLink> linksToHits = cand.GetLinksWithType(branchID).GetLinks();
148 for (std::set<FairLink>::iterator it = linksToHits.begin();it!=linksToHits.end();it++) {
151 mcTracksToHits[
i].push_back(hit);
165 return mcTracksToHits;
169 map<Int_t,vector<PndFtsHit*>*> hitToTrack;
170 cout <<
"Found " <<
fSolution->GetEntries() <<
" reconstructed Tracks" << endl;
176 vector<PndFtsHit*> *
hits =
new vector<PndFtsHit*>();
177 std::set<FairLink> linksToHits = trackCand->GetLinksWithType(
fIoman->GetBranchId(
"FTSHit")).GetLinks();
178 for (std::set<FairLink>::iterator iter = linksToHits.begin();
179 iter != linksToHits.end(); iter++) {
180 FairLink link = *iter;
182 hit->SetEntryNr(*iter);
183 hits->push_back(hit);
186 for(
size_t j=0;j<hits->size();j++){
196 vector<vector<PndFtsHit*>*> tracksToMc;
197 cout <<
"Track has " << hits.size() <<
" Hits" << endl;
198 for(
size_t i=0;
i<hits.size();
i++){
199 vector<PndFtsHit*> *
track = tracks[hits[
i]->GetTubeID()];
200 if(track==0)
continue;
203 for(
size_t j=0;j<tracksToMc.size();j++){
204 if(tracksToMc[j]==track){
210 if(!exists)tracksToMc.push_back(track);
228 cout <<
"Found " << tracksToMc.size() <<
" reconstructed tracks to MC-track" << endl;
229 if(tracksToMc.size()==0){
230 cout <<
">>Track not found --! (0 Hits)" << endl;
248 for(
size_t i=1;
i<tracksToMc.size();
i++){
250 if(bestResult[1]<nextResult[1]) bestResult = nextResult;
253 cout <<
"Mc-Hits: " << bestResult[0] << endl;
254 cout <<
"Correct found: " << bestResult[1] << endl;
255 cout <<
"Hits not found: " << bestResult[2] << endl;
256 cout <<
"Wrong hits: " << bestResult[3] << endl;
257 if(bestResult[0]==bestResult[1]){
258 if(bestResult[3]==0) {
260 cout <<
">>Found complete track, track is clean(++)"<< endl;
263 cout <<
">>Found complete track, track is not clean(+-)"<< endl;
265 }
else if(bestResult[0]*0.7 < bestResult[1]){
266 if(bestResult[3]==0) {
268 cout <<
">>Found incomplete track, track is clean(-+)"<< endl;
271 cout <<
">>Found incomplete track, track is not clean(--)"<< endl;
273 cout <<
"Found Hits: (" << bestResult[1] <<
"/" << bestResult[0] <<
")" << endl;
276 cout <<
">>Track not found(Under 70%) --!" << endl;
277 cout <<
"Found Hits: (" << bestResult[1] <<
"/" << bestResult[0] <<
")" << endl;
297 Int_t mcHitCount = mcHits.size();
298 Int_t correctHits = 0;
299 Int_t hitsNotFound = 0;
303 for(
size_t i=0;
i<mcHits.size();
i++){
306 Int_t hitFound = kFALSE;
307 for(
size_t j=0;j<reconstructedHits->size();j++){
308 PndFtsHit *recoHit = (*reconstructedHits)[j];
315 if(hitFound)correctHits++;
319 for(
size_t i=0;
i<reconstructedHits->size();
i++){
321 Int_t hitFound = kFALSE;
322 for(
size_t j=0;j<mcHits.size();j++){
329 if(!hitFound)wrongHits++;
332 vector<Int_t> result;
333 result.push_back(mcHitCount);
334 result.push_back(correctHits);
335 result.push_back(hitsNotFound);
336 result.push_back(wrongHits);
342 for(
map<Int_t,vector<PndFtsHit*>>::iterator
i=mcTracks.begin();
i!=mcTracks.end();
i++){
345 for(
int j=0;j<24;j++) layer[j]=0;
346 for(
int j=0;j<10000;j++) tubeID[j]=0;
347 for(
size_t j=0;j<
i->second.size();j++){
354 for(
int j=0;j<24;j++){
361 for(
int j=0;j<24;j++){
368 for(
int j=0;j<10000;j++){
TClonesArray * fIdealTrack
virtual void FinishEvent()
map< Int_t, Int_t > mcToHitCount
vector< Int_t > analyzeMCTrack(vector< PndFtsHit * > mcHits, vector< PndFtsHit * > *reconstructedHits)
virtual void Exec(Option_t *opt)
TString m2(TString pts, TString exts="e px py pz")
map< Int_t, vector< PndFtsHit * > * > getReconstructedTracks()
map< Int_t, Double_t > momentum
PndTrackCand GetTrackCand()
Int_t trackCountArray[10]
Double_t momentumArray2[10]
Double_t momentumArray[10]
virtual InitStatus Init()
Int_t trackCountArray2[10]
map< Int_t, vector< PndFtsHit * > > getMcTracks()
void analyzeMCTracks(vector< PndFtsHit * > hits, map< Int_t, vector< PndFtsHit * > * > tracks, Int_t trackID, Int_t trackCount)
PndTrackCand * GetTrackCandPtr()
virtual ~PndAnalysisForwardTask()
FairTrackParP GetParamFirst()
void anaSpecialCases(map< Int_t, vector< PndFtsHit * >> mcTracks)