]>
Commit | Line | Data |
---|---|---|
ff2f0f94 | 1 | // $Id: AliHLTTPCCompModelAnalysis.cxx,v 1.2 2006/08/10 09:46:51 richterm Exp $ |
2 | ||
3 | /************************************************************************** | |
4 | * TPCCompModelAnalysisright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Authors: J. Wagner <jwagner@cern.ch> * | |
7 | * for The ALICE Off-line Project. * | |
8 | * * | |
9 | * Permission to use, copy, modify and distribute this software and its * | |
10 | * documentation strictly for non-commercial purposes is hereby granted * | |
11 | * without fee, provided that the above copyright notice appears in all * | |
12 | * copies and that both the copyright notice and this permission notice * | |
13 | * appear in the supporting documentation. The authors make no claims * | |
14 | * about the suitability of this software for any purpose. It is * | |
15 | * provided "as is" without express or implied warranty. * | |
16 | **************************************************************************/ | |
17 | ||
18 | /** @file AliHLTTPCCompModelAnalysis.cxx | |
19 | @author J. Wagner jwagner@cern.ch | |
20 | @date 17-11-2007 | |
21 | @brief A processing analysis component for the HLT */ | |
22 | ||
23 | #if __GNUC__ >= 3 | |
24 | using namespace std; | |
25 | #endif | |
26 | ||
27 | #include "AliHLTTPCCompModelAnalysis.h" | |
28 | #include "AliHLTTPCTransform.h" | |
29 | #include "AliHLTTPCModelTrack.h" | |
30 | #include "AliHLTTPCCompDataCompressorHelper.h" | |
31 | #include "TFile.h" | |
32 | #include "TH1.h" | |
33 | #include <cerrno> | |
34 | ||
35 | /** constructor **/ | |
36 | AliHLTTPCCompModelAnalysis::AliHLTTPCCompModelAnalysis(Bool_t modelanalysis, Bool_t trackanalysis, TString dumpfilename, TString graphfilename): | |
37 | fModelAnalysis(modelanalysis), | |
38 | fTrackAnalysis(trackanalysis), | |
39 | fDumpFileName(dumpfilename), | |
40 | fGraphFileName(graphfilename), | |
41 | fFirstTrackArray(), | |
42 | fSecondTrackArray(), | |
43 | fFirstTrackList(NULL), | |
44 | fSecondTrackList(NULL), | |
45 | fFirstTrashTracks(0), | |
46 | fSecondTrashTracks(0), | |
47 | fTotalComparedTracks(0), | |
48 | fMatchedFirstTrashTracks(0), | |
49 | fMatchedSecondTrashTracks(0), | |
50 | fFirstUnmatchedTracks(0), | |
51 | fSecondUnmatchedTracks(0), | |
52 | fToleranceDeviation(0.0), | |
53 | fTrackListPointer(NULL), | |
54 | fTotalDiscardedClusters(0), | |
55 | fValuableDiscardedClusters(0), | |
56 | fTrashTracks(0) | |
57 | { | |
58 | // see header file for class documentation | |
59 | } | |
60 | ||
61 | /** destructor **/ | |
62 | AliHLTTPCCompModelAnalysis::~AliHLTTPCCompModelAnalysis() | |
63 | { | |
64 | for ( UInt_t slice=0; slice<36; slice++ ) | |
65 | for ( UInt_t patch=0; patch<6; patch++ ) | |
66 | { | |
67 | if ( fDiscardedClusters[slice][patch]->fSpacePoints ) | |
68 | { | |
69 | delete [] fDiscardedClusters[slice][patch]; | |
70 | } | |
71 | } | |
72 | } | |
73 | ||
74 | /** initialise arrays for tracks/ discarded clusters depending on model-flags **/ | |
75 | Int_t AliHLTTPCCompModelAnalysis::Init() | |
76 | { | |
77 | // see header file for class documentation | |
78 | ||
79 | if(fTrackAnalysis) // track quantities are to be initialised | |
80 | { | |
81 | fFirstTrackArray.Reset(); | |
82 | fSecondTrackArray.Reset(); | |
83 | ||
84 | fFirstTrackList = NULL; | |
85 | fSecondTrackList = NULL; | |
86 | ||
87 | fFirstTrashTracks = 0; | |
88 | fSecondTrashTracks = 0; | |
89 | ||
90 | fTotalComparedTracks = 0; | |
91 | fMatchedFirstTrashTracks = 0; | |
92 | fMatchedSecondTrashTracks = 0; | |
93 | ||
94 | fFirstUnmatchedTracks = 0; | |
95 | fSecondUnmatchedTracks = 0; | |
96 | ||
97 | fToleranceDeviation = 0.001; | |
98 | ||
99 | } | |
100 | ||
101 | if(fModelAnalysis) // cluster array to be initialised | |
102 | { | |
103 | for ( UInt_t slice=0; slice<36; slice++ ) | |
104 | { | |
105 | for ( UInt_t patch=0; patch<6; patch++ ) | |
106 | { | |
107 | fDiscardedClusters[slice][patch] = NULL; | |
108 | } | |
109 | } | |
110 | ||
111 | // initialise trash track list to store discarded tracks | |
112 | fTrackListPointer = NULL; | |
113 | ||
114 | // set all counters to zero: | |
115 | fTrashTracks = 0; | |
116 | fTotalDiscardedClusters = 0; | |
117 | fValuableDiscardedClusters = 0; | |
118 | } | |
119 | ||
120 | return 0; | |
121 | } | |
122 | ||
123 | Int_t AliHLTTPCCompModelAnalysis::DisplayResults() | |
124 | { | |
125 | // see header file for class documentation | |
126 | HLTInfo("--------------------DISPLAYING RESULTS---------------------"); | |
127 | // if model loss analysis, then display these results, else display track results | |
128 | if (fModelAnalysis) | |
129 | { | |
130 | DisplayModelResults(); | |
131 | }; | |
132 | ||
133 | if (fTrackAnalysis) | |
134 | { | |
135 | DisplayTrackResults(); | |
136 | }; | |
137 | ||
138 | // error message: if no analysis flag is switched on | |
139 | if( (!fModelAnalysis) && (!fTrackAnalysis) ) | |
140 | { | |
141 | HLTError("Error! Display Results called without any analysis flag switched on."); | |
142 | return 1; | |
143 | } | |
144 | ||
145 | return 0; | |
146 | } | |
147 | ||
148 | Int_t AliHLTTPCCompModelAnalysis::SetTracks(AliHLTTPCTrackletData* tracklets, Bool_t fillingfirsttracks) | |
149 | { | |
150 | // see header file for class documentation | |
151 | // if fFillingFirstTrackArray is true (i.e. first input file in component is processed) | |
152 | // first input track array is filled | |
153 | // else the second track array is filled | |
154 | ||
155 | if(fillingfirsttracks) | |
156 | { | |
157 | HLTDebug( "Reading %u tracks in first array", (unsigned) tracklets->fTrackletCnt ); | |
158 | ||
159 | if(tracklets->fTrackletCnt == 0) | |
160 | { | |
161 | HLTError("Error! No tracklets to fill into first track array!"); | |
162 | return EINVAL; | |
163 | } | |
164 | else | |
165 | { | |
166 | fFirstTrackArray.FillTracks(tracklets->fTrackletCnt, tracklets->fTracklets ); | |
167 | } | |
168 | ||
169 | } | |
170 | else | |
171 | { | |
172 | if(tracklets->fTrackletCnt == 0) | |
173 | { | |
174 | HLTError("Error! No tracklets to fill into second track array!"); | |
175 | return EINVAL; | |
176 | } | |
177 | else | |
178 | { | |
179 | fSecondTrackArray.FillTracks(tracklets->fTrackletCnt, tracklets->fTracklets ); | |
180 | } | |
181 | // read in tracks in second array (tracks from clusters after Vestbo in second tracking process) | |
182 | HLTDebug( "Reading %u tracks in second array", (unsigned) tracklets->fTrackletCnt ); | |
183 | ||
184 | } | |
185 | ||
186 | return 0; | |
187 | } | |
188 | ||
189 | Int_t AliHLTTPCCompModelAnalysis::CompareTracks() | |
190 | { | |
191 | // see header file for class documentation | |
192 | // define variables for number of tracks in track arrays: | |
193 | Int_t firsttracks = fFirstTrackArray.GetNTracks(); | |
194 | Int_t secondtracks = fSecondTrackArray.GetNTracks(); | |
195 | ||
196 | // error checking: if second array has been filled or not: | |
197 | if(firsttracks == 0) | |
198 | { | |
199 | HLTError("No tracks in first track array!"); | |
200 | return EINVAL; | |
201 | }; | |
202 | ||
203 | ||
204 | if(secondtracks == 0) | |
205 | { | |
206 | HLTError("No tracks in second track array!"); | |
207 | return EINVAL; | |
208 | }; | |
209 | ||
210 | // take track from first tracking, | |
211 | for(Int_t ii=0; ii < firsttracks; ii++) | |
212 | { | |
213 | // build track list for all tracks in first array | |
214 | AliHLTTPCTrackList* currenttrackentry = new AliHLTTPCTrackList; | |
215 | currenttrackentry->track = *(fFirstTrackArray.GetCheckedTrack(ii)); | |
216 | ||
217 | // get its pythia information, | |
218 | currenttrackentry->pythiatrack = GetComparableTrackPythiaInfo(currenttrackentry->track); | |
219 | ||
220 | currenttrackentry->matchingindicator = 0; | |
221 | ||
222 | // put this element as first in list | |
223 | currenttrackentry->next = fFirstTrackList; | |
224 | fFirstTrackList = currenttrackentry; | |
225 | ||
226 | // count tracks below 0.1GeV | |
227 | if(currenttrackentry->track.GetPt()<0.1) | |
228 | { | |
229 | ++fFirstTrashTracks; | |
230 | } | |
231 | ||
232 | } | |
233 | ||
234 | // take track from second tracking, | |
235 | for(Int_t ii=0; ii < secondtracks; ii++) | |
236 | { | |
237 | // build track list for all tracks in second array | |
238 | AliHLTTPCTrackList* currenttrackentry = new AliHLTTPCTrackList; | |
239 | currenttrackentry->track = *(fSecondTrackArray.GetCheckedTrack(ii)); | |
240 | ||
241 | // get its pythia information, | |
242 | currenttrackentry->pythiatrack = GetComparableTrackPythiaInfo(currenttrackentry->track); | |
243 | ||
244 | // put this element as first in list | |
245 | currenttrackentry->next = fSecondTrackList; | |
246 | fSecondTrackList = currenttrackentry; | |
247 | ||
248 | // count tracks below 0.1GeV | |
249 | if(currenttrackentry->track.GetPt()<0.1) | |
250 | { | |
251 | ++fSecondTrashTracks; | |
252 | } | |
253 | ||
254 | } | |
255 | ||
256 | // search for matching track from secondary tracking | |
257 | AliHLTTPCTrackList* firstmatchpointer = fFirstTrackList; | |
258 | ||
259 | while(firstmatchpointer != NULL) | |
260 | { | |
261 | AliHLTTPCTrackList* secondmatchpointer = fSecondTrackList; | |
262 | ||
263 | while(secondmatchpointer != NULL) | |
264 | { | |
265 | ||
266 | // compare paramters of the two tracks, | |
267 | // match only when coincidence >= 50% in fToleranceDeviation range! | |
268 | if ((CompareTrackInfo(firstmatchpointer, secondmatchpointer) > 4)) | |
269 | { | |
270 | ||
271 | if((CompareTrackInfo(firstmatchpointer, secondmatchpointer) > firstmatchpointer->matchingindicator)) | |
272 | { | |
273 | // look if current better matching track has already been matched before | |
274 | if((CompareTrackInfo(firstmatchpointer, secondmatchpointer) > secondmatchpointer->matchingindicator)) | |
275 | { | |
276 | ||
277 | // set previously assigned matchingindicator (if there was one) of secondary track back to zero | |
278 | if(firstmatchpointer->matchingindicator > 0) | |
279 | { | |
280 | firstmatchpointer->matchingtrack->matchingindicator = 0; | |
281 | firstmatchpointer->matchingtrack->matchingtrack = NULL; | |
282 | } | |
283 | ||
284 | if(secondmatchpointer->matchingindicator > 0) | |
285 | { | |
286 | secondmatchpointer->matchingtrack->matchingindicator = 0; | |
287 | secondmatchpointer->matchingtrack->matchingtrack = NULL; | |
288 | } | |
289 | ||
290 | // compare according to tracks themselves (other possibility: compare pythiatracks - better!) | |
291 | secondmatchpointer->matchingindicator = CompareTrackInfo(firstmatchpointer, secondmatchpointer) ; | |
292 | firstmatchpointer->matchingindicator = CompareTrackInfo(firstmatchpointer, secondmatchpointer); | |
293 | ||
294 | // remember which track matches which | |
295 | secondmatchpointer->matchingtrack = firstmatchpointer; | |
296 | firstmatchpointer->matchingtrack = secondmatchpointer; | |
297 | ||
298 | } // end if compare > second matching indicator | |
299 | ||
300 | } // end if compare > first matching indicator | |
301 | ||
302 | }// end if compare > 4 | |
303 | ||
304 | secondmatchpointer = secondmatchpointer->next; | |
305 | } | |
306 | ||
307 | // go on with next original track | |
308 | firstmatchpointer = firstmatchpointer->next; | |
309 | } | |
310 | ||
311 | // count not matched tracks in first and second track list | |
312 | AliHLTTPCTrackList* nomatchcounter = fFirstTrackList; | |
313 | ||
314 | while(nomatchcounter != NULL) | |
315 | { | |
316 | if(nomatchcounter->matchingindicator == 0) | |
317 | { | |
318 | ++fFirstUnmatchedTracks; | |
319 | } | |
320 | else | |
321 | { | |
322 | ++fTotalComparedTracks; | |
323 | ||
324 | // count matched trash tracks | |
325 | if(nomatchcounter->track.GetPt() < 0.1) | |
326 | { | |
327 | ++fMatchedFirstTrashTracks; | |
328 | }; | |
329 | } | |
330 | nomatchcounter = nomatchcounter->next; | |
331 | } | |
332 | ||
333 | nomatchcounter = fSecondTrackList; | |
334 | while(nomatchcounter != NULL) | |
335 | { | |
336 | if(nomatchcounter->matchingindicator == 0) | |
337 | { | |
338 | ++fSecondUnmatchedTracks; | |
339 | } | |
340 | else | |
341 | { | |
342 | // count matched trash tracks | |
343 | if(nomatchcounter->track.GetPt() < 0.1) | |
344 | { | |
345 | ++fMatchedSecondTrashTracks; | |
346 | }; | |
347 | } | |
348 | ||
349 | nomatchcounter = nomatchcounter->next; | |
350 | } | |
351 | ||
352 | // consistency check: fFirstUnmatchedTracks + fTotalComparedTracks = # of tracks in first array | |
353 | // ...and analogously for second array: | |
354 | if(fFirstUnmatchedTracks + fTotalComparedTracks != firsttracks) | |
355 | { | |
356 | HLTWarning("Warning! Possible inconsistency in original track array: Number of compared and unmatched tracks not equal to total number of tracks!"); | |
357 | }; | |
358 | ||
359 | if(fSecondUnmatchedTracks + fTotalComparedTracks != secondtracks) | |
360 | { | |
361 | HLTWarning("Warning! Possible inconsistency in second track array: Number of compared and unmatched tracks not equal to total number of tracks!"); | |
362 | }; | |
363 | ||
364 | return 0; | |
365 | } | |
366 | ||
367 | AliHLTTPCTrack AliHLTTPCCompModelAnalysis::GetComparableTrackPythiaInfo(AliHLTTPCTrack comparabletrack) | |
368 | { | |
369 | // see headerfile for class documentation | |
370 | ||
371 | AliHLTTPCTrack pythiatrack = comparabletrack; | |
372 | ||
373 | return pythiatrack; | |
374 | } | |
375 | ||
376 | Int_t AliHLTTPCCompModelAnalysis::MarkTrashTrack(AliHLTTPCTrack *lowpttrack) | |
377 | { | |
378 | // see header file for class documentation | |
379 | ||
380 | // save track first in lowpttrack list (all lowpttracks are displayed in display function altogether) | |
381 | AliHLTTPCTrackList* tracklistentry = new AliHLTTPCTrackList; | |
382 | tracklistentry->track = *lowpttrack; | |
383 | tracklistentry->wronglydiscarded = GetTrashTrackPythiaInfo(lowpttrack); | |
384 | tracklistentry->matchingindicator = 0; // not needed here, therefore initialised to zero | |
385 | tracklistentry->next = fTrackListPointer; | |
386 | tracklistentry->matchingtrack = NULL; // not needed here, therefore initialised to NULL | |
387 | fTrackListPointer = tracklistentry; | |
388 | ||
389 | ++fTrashTracks; | |
390 | ||
391 | return 0; | |
392 | } | |
393 | ||
394 | Int_t AliHLTTPCCompModelAnalysis::MarkTrashCluster(AliHLTTPCClusterData *discardedcluster, UInt_t slice, UInt_t patch) | |
395 | { | |
396 | // see header file for class documentation | |
397 | ||
398 | // get Pythia information of discarded cluster | |
399 | Bool_t wronglydiscarded = GetClusterPythiaInfo(discardedcluster); | |
400 | ||
401 | // if cluster has been discarded wrongly, save information | |
402 | if(wronglydiscarded) | |
403 | { | |
404 | // store cluster | |
405 | fDiscardedClusters[slice][patch] = discardedcluster; | |
406 | // increase number of valuable discarded clusters | |
407 | ++fValuableDiscardedClusters; | |
408 | } | |
409 | ||
410 | ++fTotalDiscardedClusters; | |
411 | ||
412 | return 0; | |
413 | } | |
414 | ||
415 | Bool_t AliHLTTPCCompModelAnalysis::GetTrashTrackPythiaInfo(AliHLTTPCTrack* discardedtrack) | |
416 | { | |
417 | // see header file for class documentation | |
418 | // store information from pythia in current track list entry | |
419 | // fTrackListPointer.pythiatrack = FillFromPythia... | |
420 | ||
421 | return 0; | |
422 | } | |
423 | ||
424 | Bool_t AliHLTTPCCompModelAnalysis::GetClusterPythiaInfo(AliHLTTPCClusterData* discardedcluster) | |
425 | { | |
426 | // see header file for class documentation | |
427 | // Pythia information can be | |
428 | // either: cluster belongs to discarded track with pt < 0.1 Gev (--> cluster correctly discarded) | |
429 | // or: cluster is discarded and does not belong to any pythia track (--> correctly discarded) | |
430 | // or: cluster is discarded but belongs to pythia track (--> cluster WRONGLY discarded!!!) | |
431 | ||
432 | return 0; | |
433 | } | |
434 | ||
435 | Int_t AliHLTTPCCompModelAnalysis::CompareTrackInfo(AliHLTTPCTrackList* firsttracklistelement, AliHLTTPCTrackList* secondtracklistelement) | |
436 | { | |
437 | // see header file for class documentation | |
438 | // calculate matching indicator accoring to the track information | |
439 | // ++matchingindicator for every paramter that matches | |
440 | ||
441 | Int_t currentmatchingindicator = 0; | |
442 | ||
443 | // tolerance range of 1 percent deviation for each quantity | |
444 | ||
445 | // compare start point (x,y,z) | |
446 | if(abs((firsttracklistelement->track.GetFirstPointX() - secondtracklistelement->track.GetFirstPointX()))/firsttracklistelement->track.GetFirstPointX() <= fToleranceDeviation) | |
447 | ++currentmatchingindicator; | |
448 | ||
449 | if(abs((firsttracklistelement->track.GetFirstPointY() - secondtracklistelement->track.GetFirstPointY()))/firsttracklistelement->track.GetFirstPointY() <= fToleranceDeviation) | |
450 | ++currentmatchingindicator; | |
451 | ||
452 | if(abs((firsttracklistelement->track.GetFirstPointZ() - secondtracklistelement->track.GetFirstPointZ()))/firsttracklistelement->track.GetFirstPointZ() <= fToleranceDeviation) | |
453 | ++currentmatchingindicator; | |
454 | ||
455 | // compare end point | |
456 | if(abs((firsttracklistelement->track.GetLastPointX() - secondtracklistelement->track.GetLastPointX()))/firsttracklistelement->track.GetLastPointX() <= fToleranceDeviation) | |
457 | ++currentmatchingindicator; | |
458 | ||
459 | if(abs((firsttracklistelement->track.GetLastPointY() - secondtracklistelement->track.GetLastPointY()))/firsttracklistelement->track.GetLastPointY() <= fToleranceDeviation) | |
460 | ++currentmatchingindicator; | |
461 | ||
462 | if(abs((firsttracklistelement->track.GetLastPointZ() - secondtracklistelement->track.GetLastPointZ()))/firsttracklistelement->track.GetLastPointZ() <= fToleranceDeviation) | |
463 | ++currentmatchingindicator; | |
464 | ||
465 | // compare pt, psi, tgl | |
466 | if(abs((firsttracklistelement->track.GetPt() - secondtracklistelement->track.GetPt()))/firsttracklistelement->track.GetPt() <= fToleranceDeviation) | |
467 | ++currentmatchingindicator; | |
468 | ||
469 | if(abs((firsttracklistelement->track.GetPsi() - secondtracklistelement->track.GetPsi()))/firsttracklistelement->track.GetPsi() <= fToleranceDeviation) | |
470 | ++currentmatchingindicator; | |
471 | ||
472 | if(abs((firsttracklistelement->track.GetTgl() - secondtracklistelement->track.GetTgl()))/firsttracklistelement->track.GetTgl() <= fToleranceDeviation) | |
473 | ++currentmatchingindicator; | |
474 | ||
475 | // compare number of assigned cluster hits | |
476 | if(abs((firsttracklistelement->track.GetNHits() - secondtracklistelement->track.GetNHits()))/firsttracklistelement->track.GetNHits() <= fToleranceDeviation) | |
477 | ++currentmatchingindicator; | |
478 | ||
479 | return currentmatchingindicator; | |
480 | } | |
481 | ||
482 | Int_t AliHLTTPCCompModelAnalysis::ComparePythiaTrackInfo(AliHLTTPCTrackList* firsttracklistelement, AliHLTTPCTrackList* secondtracklistelement) | |
483 | { | |
484 | // see header file for class documentation | |
485 | // calculate matching indicator accoring to the track information | |
486 | // ++matchingindicator for every paramter that matches | |
487 | ||
488 | Int_t currentmatchingindicator = 0; | |
489 | ||
490 | // tolerance range of 1 percent deviation for each quantity | |
491 | ||
492 | // compare start point (x,y,z) | |
493 | if(firsttracklistelement->pythiatrack.GetFirstPointX() == secondtracklistelement->pythiatrack.GetFirstPointX()) | |
494 | ++currentmatchingindicator; | |
495 | ||
496 | if(firsttracklistelement->pythiatrack.GetFirstPointY() == secondtracklistelement->pythiatrack.GetFirstPointY()) | |
497 | ++currentmatchingindicator; | |
498 | ||
499 | if(firsttracklistelement->pythiatrack.GetFirstPointZ() == secondtracklistelement->pythiatrack.GetFirstPointZ()) | |
500 | ++currentmatchingindicator; | |
501 | ||
502 | // compare end point | |
503 | if(firsttracklistelement->pythiatrack.GetLastPointX() == secondtracklistelement->pythiatrack.GetLastPointX()) | |
504 | ++currentmatchingindicator; | |
505 | ||
506 | if(firsttracklistelement->pythiatrack.GetLastPointY() == secondtracklistelement->pythiatrack.GetLastPointY()) | |
507 | ++currentmatchingindicator; | |
508 | ||
509 | if(firsttracklistelement->pythiatrack.GetLastPointZ() == secondtracklistelement->pythiatrack.GetLastPointZ()) | |
510 | ++currentmatchingindicator; | |
511 | ||
512 | // compare pt, psi, tgl | |
513 | if(firsttracklistelement->pythiatrack.GetPt() == secondtracklistelement->pythiatrack.GetPt()) | |
514 | ++currentmatchingindicator; | |
515 | ||
516 | if(firsttracklistelement->pythiatrack.GetPsi() == secondtracklistelement->pythiatrack.GetPsi()) | |
517 | ++currentmatchingindicator; | |
518 | ||
519 | if(firsttracklistelement->pythiatrack.GetTgl() == secondtracklistelement->pythiatrack.GetTgl()) | |
520 | ++currentmatchingindicator; | |
521 | ||
522 | // compare number of assigned cluster hits | |
523 | if(firsttracklistelement->pythiatrack.GetNHits() == secondtracklistelement->pythiatrack.GetNHits()) | |
524 | ++currentmatchingindicator; | |
525 | ||
526 | return currentmatchingindicator; | |
527 | } | |
528 | ||
529 | Int_t AliHLTTPCCompModelAnalysis::CreateGraphs(Bool_t relativedifferences) | |
530 | { | |
531 | // see header file for class documentation | |
532 | AliHLTTPCTrackList* tracklistpointer = fFirstTrackList; | |
533 | ||
534 | AliHLTTPCTrackList* trackmatchingpointer; | |
535 | ||
536 | // set up histogram ranges | |
537 | Double_t difffirstxmin, difffirstxmax; | |
538 | Double_t difffirstymin, difffirstymax; | |
539 | Double_t difffirstzmin, difffirstzmax; | |
540 | Int_t difffirstxbins, difffirstybins, difffirstzbins; | |
541 | ||
542 | Double_t difflastxmin, difflastxmax; | |
543 | Double_t difflastymin, difflastymax; | |
544 | Double_t difflastzmin, difflastzmax; | |
545 | Int_t difflastxbins, difflastybins, difflastzbins; | |
546 | ||
547 | Double_t diffptmin, diffptmax; | |
548 | Double_t diffpsimin, diffpsimax; | |
549 | Double_t difftglmin, difftglmax; | |
550 | Int_t diffptbins, diffpsibins, difftglbins; | |
551 | ||
552 | Double_t diffclustermin, diffclustermax; | |
553 | Int_t diffclusterbins; | |
554 | ||
555 | // resolution histograms (currently not working since pterr = 0 for every track!) | |
556 | Double_t diffpterrmin, diffpterrmax; | |
557 | Double_t diffpsierrmin, diffpsierrmax; | |
558 | Double_t difftglerrmin, difftglerrmax; | |
559 | Int_t diffpterrbins, diffpsierrbins, difftglerrbins; | |
560 | ||
561 | if(!relativedifferences) | |
562 | { | |
563 | difffirstxmin = -2; | |
564 | difffirstxmax = +2; | |
565 | difffirstxbins = (Int_t) ((difffirstxmax - difffirstxmin)/0.0001); | |
566 | ||
567 | difffirstymin = -2; | |
568 | difffirstymax = +2; | |
569 | difffirstybins = (Int_t) ((difffirstymax - difffirstymin)/0.0001); | |
570 | ||
571 | difffirstzmin = -2; | |
572 | difffirstzmax = +2; | |
573 | difffirstzbins = (Int_t) ((difffirstzmax - difffirstzmin)/0.0001); | |
574 | ||
575 | difflastxmin = -2; | |
576 | difflastxmax = +2; | |
577 | difflastxbins = (Int_t) ((difflastxmax - difflastxmin)/0.0001); | |
578 | ||
579 | difflastymin = -2; | |
580 | difflastymax = +2; | |
581 | difflastybins = (Int_t) ((difflastymax - difflastymin)/0.0001); | |
582 | ||
583 | difflastzmin = -2; | |
584 | difflastzmax = +2; | |
585 | difflastzbins = (Int_t) ((difflastzmax - difflastzmin)/0.0001); | |
586 | ||
587 | diffptmin = -1; | |
588 | diffptmax = +1; | |
589 | diffptbins = (Int_t) ((diffptmax - diffptmin)/0.0001); | |
590 | ||
591 | diffpsimin = -1; | |
592 | diffpsimax = +1; | |
593 | diffpsibins = (Int_t) ((diffpsimax - diffpsimin)/0.0001); | |
594 | ||
595 | difftglmin = -1; | |
596 | difftglmax = +1; | |
597 | difftglbins = (Int_t) ((difftglmax - difftglmin)/0.0001); | |
598 | ||
599 | diffclustermin = -50; | |
600 | diffclustermax = +50; | |
601 | diffclusterbins = (Int_t) ((diffclustermax - diffclustermin)/1); | |
602 | ||
603 | #if 0 | |
604 | diffpterrmin = -1; | |
605 | diffpterrmax = 1; | |
606 | diffpterrbins = (Int_t) ((diffpterrmax - diffpterrmin)/1); | |
607 | ||
608 | diffpsierrmin = -1; | |
609 | diffpsierrmax = 1; | |
610 | diffpsierrbins = (Int_t) ((diffpsierrmax - diffpsierrmin)/1); | |
611 | ||
612 | difftglerrmin = -1; | |
613 | difftglerrmax = 1; | |
614 | difftglerrbins = (Int_t) ((difftglerrmax - difftglerrmin)/1); | |
615 | #endif | |
616 | ||
617 | } | |
618 | else | |
619 | { | |
620 | difffirstxmin = -1; | |
621 | difffirstxmax = +1; | |
622 | difffirstxbins = (Int_t) ((difffirstxmax - difffirstxmin)/0.0001); | |
623 | ||
624 | difffirstymin = -1; | |
625 | difffirstymax = +1; | |
626 | difffirstybins = (Int_t) ((difffirstymax - difffirstymin)/0.0001); | |
627 | ||
628 | difffirstzmin = -1; | |
629 | difffirstzmax = +1; | |
630 | difffirstzbins = (Int_t) ((difffirstzmax - difffirstzmin)/0.0001); | |
631 | ||
632 | difflastxmin = -1; | |
633 | difflastxmax = +1; | |
634 | difflastxbins = (Int_t) ((difflastxmax - difflastxmin)/0.0001); | |
635 | ||
636 | difflastymin = -1; | |
637 | difflastymax = +1; | |
638 | difflastybins = (Int_t) ((difflastymax - difflastymin)/0.0001); | |
639 | ||
640 | difflastzmin = -1; | |
641 | difflastzmax = +1; | |
642 | difflastzbins = (Int_t) ((difflastzmax - difflastzmin)/0.0001); | |
643 | ||
644 | diffptmin = -1; | |
645 | diffptmax = +1; | |
646 | diffptbins = (Int_t) ((diffptmax - diffptmin)/0.0001); | |
647 | ||
648 | diffpsimin = -1; | |
649 | diffpsimax = +1; | |
650 | diffpsibins = (Int_t) ((diffpsimax - diffpsimin)/0.0001); | |
651 | ||
652 | difftglmin = -1; | |
653 | difftglmax = +1; | |
654 | difftglbins = (Int_t) ((difftglmax - difftglmin)/0.0001); | |
655 | ||
656 | diffclustermin = -1; | |
657 | diffclustermax = +1; | |
658 | diffclusterbins = (Int_t) ((diffclustermax - diffclustermin)/0.0001); | |
659 | ||
660 | #if 0 | |
661 | diffpterrmin = -1; | |
662 | diffpterrmax = 1; | |
663 | diffpterrbins = (Int_t) ((diffpterrmax - diffpterrmin)/0.0001); | |
664 | ||
665 | diffpsierrmin = -1; | |
666 | diffpsierrmax = 1; | |
667 | diffpsierrbins = (Int_t) ((diffpsierrmax - diffpsierrmin)/0.0001); | |
668 | ||
669 | difftglerrmin = -1; | |
670 | difftglerrmax = 1; | |
671 | difftglerrbins = (Int_t) ((difftglerrmax - difftglerrmin)/0.0001); | |
672 | #endif | |
673 | } | |
674 | ||
675 | // intialise histogramms | |
676 | TH1F* firstxhisto = new TH1F("Differences of first x (original - secondary) track", "Differences of first x (original - secondary) track", difffirstxbins, difffirstxmin, difffirstxmax); | |
677 | TH1F* firstyhisto = new TH1F("Differences of first y (original - secondary) track", "Differences of first y (original - secondary) track", difffirstybins, difffirstymin, difffirstymax); | |
678 | TH1F* firstzhisto = new TH1F("Differences of first z (original - secondary) track", "Differences of first z (original - secondary) track", difffirstzbins, difffirstzmin, difffirstzmax); | |
679 | TH1F* lastxhisto = new TH1F("Differences of last x (original - secondary) track", "Differences of last x (original - secondary) track", difflastxbins, difflastxmin, difflastxmax); | |
680 | TH1F* lastyhisto = new TH1F("Differences of last y (original - secondary) track", "Differences of last y (original - secondary) track", difflastybins, difflastymin, difflastymax); | |
681 | TH1F* lastzhisto = new TH1F("Differences of last z (original - secondary) track", "Differences of last z (original - secondary) track", difflastzbins, difflastzmin, difflastzmax); | |
682 | TH1F* pthisto = new TH1F("Differences of pt (original - secondary) track", "Differences of pt (original - secondary) track", diffptbins, diffptmin, diffptmax); | |
683 | TH1F* psihisto = new TH1F("Differences of psi (original - secondary) track", "Differences of psi (original - secondary) track", diffpsibins, diffpsimin, diffpsimax); | |
684 | TH1F* tglhisto = new TH1F("Differences of tgl (original - secondary) track", "Differences of tgl (original - secondary) track", difftglbins, difftglmin, difftglmax); | |
685 | TH1F* clusterhisto = new TH1F("Differences of asserted clusters (original - secondary) track", "Differences of asserted clusters (original - secondary) track", diffclusterbins, diffclustermin, diffclustermax); | |
686 | ||
687 | #if 0 | |
688 | // commented out since pterr is zero for every track! | |
689 | TH1F* pterrhisto = new TH1F("Differences of pt error (original - secondary) track", "Differences of pt error (original - secondary) track", diffpterrbins, diffpterrmin, diffpterrmax); | |
690 | TH1F* psierrhisto = new TH1F("Differences of psi error (original - secondary) track", "Differences of psi error (original - secondary) track", diffpsierrbins, diffpsierrmin, diffpsierrmax); | |
691 | TH1F* tglerrhisto = new TH1F("Differences of tgl error (original - secondary) track", "Differences of tgl error (original - secondary) track", difftglerrbins, difftglerrmin, difftglerrmax); | |
692 | ||
693 | #endif | |
694 | ||
695 | // evaluate quality of fit: | |
696 | TH1I* matchinghisto = new TH1I("Matching indicator (5 - 10)", "Matching indicator (5 - 10)", 11, 0, 11); | |
697 | ||
698 | while(tracklistpointer != NULL) | |
699 | { | |
700 | // if currently processed track is matched, store differences of their parameters in histogram | |
701 | if(tracklistpointer->matchingindicator > 0) | |
702 | { | |
703 | // matching track | |
704 | trackmatchingpointer = tracklistpointer->matchingtrack; | |
705 | ||
706 | if(relativedifferences == 1) // fill histogram with relative differences | |
707 | { | |
708 | firstxhisto->Fill((tracklistpointer->track.GetFirstPointX()-trackmatchingpointer->track.GetFirstPointX())/tracklistpointer->track.GetFirstPointX(),1); | |
709 | firstyhisto->Fill((tracklistpointer->track.GetFirstPointY()-trackmatchingpointer->track.GetFirstPointY())/tracklistpointer->track.GetFirstPointY(),1); | |
710 | firstzhisto->Fill((tracklistpointer->track.GetFirstPointZ()-trackmatchingpointer->track.GetFirstPointZ())/tracklistpointer->track.GetFirstPointZ(),1); | |
711 | lastxhisto->Fill((tracklistpointer->track.GetLastPointX()-trackmatchingpointer->track.GetLastPointX())/tracklistpointer->track.GetLastPointX(),1); | |
712 | lastyhisto->Fill((tracklistpointer->track.GetLastPointY()-trackmatchingpointer->track.GetLastPointY())/tracklistpointer->track.GetLastPointY(),1); | |
713 | lastzhisto->Fill((tracklistpointer->track.GetLastPointZ()-trackmatchingpointer->track.GetLastPointZ())/tracklistpointer->track.GetLastPointZ(),1); | |
714 | pthisto->Fill((tracklistpointer->track.GetPt()-trackmatchingpointer->track.GetPt())/tracklistpointer->track.GetPt(),1); | |
715 | psihisto->Fill((tracklistpointer->track.GetPsi()-trackmatchingpointer->track.GetPsi())/tracklistpointer->track.GetPsi(),1); | |
716 | tglhisto->Fill((tracklistpointer->track.GetTgl()-trackmatchingpointer->track.GetTgl())/tracklistpointer->track.GetTgl(),1); | |
717 | clusterhisto->Fill((tracklistpointer->track.GetNHits()-trackmatchingpointer->track.GetNHits())/tracklistpointer->track.GetNHits(),1); | |
718 | ||
719 | #if 0 | |
720 | pterrhisto->Fill((tracklistpointer->track.GetPterr()-trackmatchingpointer->track.GetPterr())/tracklistpointer->track.GetPterr(),1); | |
721 | psierrhisto->Fill((tracklistpointer->track.GetPsierr()-trackmatchingpointer->track.GetPsierr())/tracklistpointer->track.GetPsierr(),1); | |
722 | tglerrhisto->Fill((tracklistpointer->track.GetTglerr()-trackmatchingpointer->track.GetTglerr())/tracklistpointer->track.GetTglerr(),1); | |
723 | ||
724 | HLTInfo("Pterr: 1st:%f 2nd:%f value:%f",tracklistpointer->track.GetPterr(),trackmatchingpointer->track.GetPterr(),(tracklistpointer->track.GetPterr()-trackmatchingpointer->track.GetPterr())/tracklistpointer->track.GetPterr()); | |
725 | HLTInfo("Psierr: 1st:%f 2nd:%f value:%f",tracklistpointer->track.GetPsierr(),trackmatchingpointer->track.GetPsierr(),(tracklistpointer->track.GetPsierr()-trackmatchingpointer->track.GetPsierr())/tracklistpointer->track.GetPsierr()); | |
726 | HLTInfo("Tglerr: 1st:%f 2nd:%f value:%f",tracklistpointer->track.GetTglerr(),trackmatchingpointer->track.GetTglerr(),(tracklistpointer->track.GetTglerr()-trackmatchingpointer->track.GetTglerr())/tracklistpointer->track.GetTglerr()); | |
727 | #endif | |
728 | } | |
729 | else // otherwise fill histogram with absolute differences | |
730 | { | |
731 | firstxhisto->Fill(tracklistpointer->track.GetFirstPointX()-trackmatchingpointer->track.GetFirstPointX(),1); | |
732 | firstyhisto->Fill(tracklistpointer->track.GetFirstPointY()-trackmatchingpointer->track.GetFirstPointY(),1); | |
733 | firstzhisto->Fill(tracklistpointer->track.GetFirstPointZ()-trackmatchingpointer->track.GetFirstPointZ(),1); | |
734 | lastxhisto->Fill(tracklistpointer->track.GetLastPointX()-trackmatchingpointer->track.GetLastPointX(),1); | |
735 | lastyhisto->Fill(tracklistpointer->track.GetLastPointY()-trackmatchingpointer->track.GetLastPointY(),1); | |
736 | lastzhisto->Fill(tracklistpointer->track.GetLastPointZ()-trackmatchingpointer->track.GetLastPointZ(),1); | |
737 | pthisto->Fill(tracklistpointer->track.GetPt()-trackmatchingpointer->track.GetPt(),1); | |
738 | psihisto->Fill(tracklistpointer->track.GetPsi()-trackmatchingpointer->track.GetPsi(),1); | |
739 | tglhisto->Fill(tracklistpointer->track.GetTgl()-trackmatchingpointer->track.GetTgl(),1); | |
740 | clusterhisto->Fill(tracklistpointer->track.GetNHits()-trackmatchingpointer->track.GetNHits(),1); | |
741 | #if 0 | |
742 | // commented out since pterr is always zero for every track! | |
743 | pterrhisto->Fill(tracklistpointer->track.GetPterr()-trackmatchingpointer->track.GetPterr(),1); | |
744 | psierrhisto->Fill(tracklistpointer->track.GetPsierr()-trackmatchingpointer->track.GetPsierr(),1); | |
745 | tglerrhisto->Fill(tracklistpointer->track.GetTglerr()-trackmatchingpointer->track.GetTglerr(),1); | |
746 | #endif | |
747 | } | |
748 | ||
749 | // fill histogram that determines the quality of the fit | |
750 | matchinghisto->Fill(tracklistpointer->matchingindicator,1); | |
751 | } | |
752 | ||
753 | tracklistpointer = tracklistpointer->next; | |
754 | } | |
755 | ||
756 | // write histograms to root file specified in command line argument -graphs <filename>.ROOT | |
757 | if(!fGraphFileName.IsNull()) | |
758 | { | |
759 | TFile* graphrootfile = new TFile(fGraphFileName, "recreate"); | |
760 | ||
761 | graphrootfile->WriteObject(firstxhisto,"firstxhistogram"); | |
762 | //firstxhisto->Write(); | |
763 | graphrootfile->WriteObject(firstyhisto,"firstyhistogram"); | |
764 | //firstyhisto->Write(); | |
765 | graphrootfile->WriteObject(firstzhisto,"firstzhistogram"); | |
766 | //firstzhisto->Write(); | |
767 | graphrootfile->WriteObject(lastxhisto,"lastxhistogram"); | |
768 | //lastxhisto->Write(); | |
769 | graphrootfile->WriteObject(lastyhisto,"lastyhistogram"); | |
770 | //lastyhisto->Write(); | |
771 | graphrootfile->WriteObject(lastzhisto,"lastzhistogram"); | |
772 | //lastzhisto->Write(); | |
773 | graphrootfile->WriteObject(pthisto,"pthistogram"); | |
774 | //pthisto->Write(); | |
775 | graphrootfile->WriteObject(psihisto,"psihistogram"); | |
776 | //psihisto->Write(); | |
777 | graphrootfile->WriteObject(tglhisto,"tglhistogram"); | |
778 | //tglhisto->Write(); | |
779 | graphrootfile->WriteObject(clusterhisto,"clusterhistogram"); | |
780 | //clusterhisto->Write(); | |
781 | graphrootfile->WriteObject(matchinghisto,"matchinghistogram"); | |
782 | //matchinghisto->Write(); | |
783 | #if 0 | |
784 | // errors in tracking (commented out since pterr is always 0 for every track!) | |
785 | graphrootfile->WriteObject(pterrhisto, "pterrhistogram"); | |
786 | //pterrhisto->Write(); | |
787 | graphrootfile->WriteObject(psierrhisto, "psierrhistogram"); | |
788 | //psierrhisto->Write(); | |
789 | graphrootfile->WriteObject(tglerrhisto, "tglerrhistogram"); | |
790 | //tglerrhisto->Write(); | |
791 | #endif | |
792 | graphrootfile->Close(); | |
793 | } | |
794 | else | |
795 | { | |
796 | HLTError("Error! No file for graphical output specified."); | |
797 | return EINVAL; | |
798 | } | |
799 | ||
800 | return 0; | |
801 | } | |
802 | ||
803 | Int_t AliHLTTPCCompModelAnalysis::DisplayModelResults() | |
804 | { | |
805 | // see header file for class documentation | |
806 | ||
807 | //print out parameters of discarded track: | |
808 | AliHLTTPCTrackList* trackprintpointer = fTrackListPointer; | |
809 | AliHLTTPCTrackList* tracklistdeleter= trackprintpointer; | |
810 | ||
811 | FILE* dumpfile = NULL; | |
812 | ||
813 | if(!fDumpFileName.IsNull()) | |
814 | { | |
815 | // open new file specified by command line argument | |
816 | dumpfile = fopen(fDumpFileName.Data(),"a"); | |
817 | fprintf(dumpfile,"---------------MODEL ANALYSIS--------------- \n"); | |
818 | fprintf(dumpfile,"---------------DISCARDED TRACKS: %d --------------- \n", fTrashTracks); | |
819 | }; | |
820 | ||
821 | if(fTrackListPointer == NULL) | |
822 | { | |
823 | HLTInfo("No tracks discarded"); | |
824 | HLTInfo("--------------"); | |
825 | } | |
826 | else | |
827 | { | |
828 | ||
829 | HLTInfo("---------------DISCARDED TRACKS: %d ---------------", fTrashTracks); | |
830 | ||
831 | Int_t trashtrackcounter = 1; | |
832 | ||
833 | while(trackprintpointer != NULL) | |
834 | { | |
835 | ||
836 | // infos about found track | |
837 | HLTInfo("%d : Discarding track with %d clusters.", trashtrackcounter, trackprintpointer->track.GetNHits()); | |
838 | //PYTHIA INFORMATION ABOUT PARTICLE ID | |
839 | HLTInfo("Track parameters of discarded track:"); | |
840 | HLTInfo("First x: %9.6f \t first y: %9.6f \t first z: %9.6f",trackprintpointer->track.GetFirstPointX(),trackprintpointer->track.GetFirstPointY(),trackprintpointer->track.GetFirstPointZ()); | |
841 | HLTInfo(" Last x: %9.6f \t last y: %9.6f \t last z: %9.6f", trackprintpointer->track.GetLastPointX(),trackprintpointer->track.GetLastPointY(),trackprintpointer->track.GetLastPointZ()); | |
842 | HLTInfo(" Pt: %9.6f \t Psi: %9.6f \t Tgl: %9.6f", trackprintpointer->track.GetPt(), trackprintpointer->track.GetPsi(), trackprintpointer->track.GetTgl()); | |
843 | ||
844 | // write results to file if specified by command line argument | |
845 | if(!fDumpFileName.IsNull()) | |
846 | { | |
847 | fprintf(dumpfile,"%d : Discarding track with %d clusters. \n", trashtrackcounter, trackprintpointer->track.GetNHits()); | |
848 | fprintf(dumpfile,"Track parameters of discarded track: \n"); | |
849 | fprintf(dumpfile,"First x: %9.6f \t first y: %9.6f \t first z: %9.6f \n",trackprintpointer->track.GetFirstPointX(),trackprintpointer->track.GetFirstPointY(),trackprintpointer->track.GetFirstPointZ()); | |
850 | fprintf(dumpfile," Last x: %9.6f \t last y: %9.6f \t last z: %9.6f \n", trackprintpointer->track.GetLastPointX(),trackprintpointer->track.GetLastPointY(),trackprintpointer->track.GetLastPointZ()); | |
851 | fprintf(dumpfile," Pt: %9.6f \t Psi: %9.6f \t Tgl: %9.6f \n", trackprintpointer->track.GetPt(), trackprintpointer->track.GetPsi(), trackprintpointer->track.GetTgl()); | |
852 | }; | |
853 | ||
854 | // comparison with pythia information | |
855 | if(trackprintpointer->wronglydiscarded) | |
856 | { | |
857 | HLTInfo("Found track has been wrongly discarded according to Pythia information."); | |
858 | ||
859 | // write results to file if specified by command line argument | |
860 | if(!fDumpFileName.IsNull()) | |
861 | { | |
862 | fprintf(dumpfile,"Found track has been wrongly discarded accoring to Pythia information. \n"); | |
863 | }; | |
864 | ||
865 | }; | |
866 | ||
867 | // found pt must be in range pt_pythia \pm 10% to be accepted | |
868 | Double_t ptmin = trackprintpointer->pythiatrack.GetPt() - 0.1*trackprintpointer->pythiatrack.GetPt(); | |
869 | Double_t ptmax = trackprintpointer->pythiatrack.GetPt() + 0.1*trackprintpointer->pythiatrack.GetPt(); | |
870 | ||
871 | if( (trackprintpointer->track.GetPt() < ptmin) ||(trackprintpointer->track.GetPt() > ptmax) ) | |
872 | { | |
873 | HLTInfo("Pt of found track %f differs more than 10 %% from pt of pythia track %f.",trackprintpointer->track.GetPt(), trackprintpointer->pythiatrack.GetPt()); | |
874 | ||
875 | if(!fDumpFileName.IsNull()) | |
876 | { | |
877 | // write result to file if specified by command line argument | |
878 | fprintf(dumpfile,"Pt of found track %f differs more than 10 %% from pt of pythia track %f. \n",trackprintpointer->track.GetPt(), trackprintpointer->pythiatrack.GetPt()); | |
879 | }; | |
880 | ||
881 | }; | |
882 | ||
883 | HLTInfo("--------------"); | |
884 | ||
885 | if(!fDumpFileName.IsNull()) | |
886 | { | |
887 | fprintf(dumpfile,"-------------- \n"); | |
888 | }; | |
889 | ||
890 | ||
891 | // go to next element in trash track list | |
892 | tracklistdeleter = trackprintpointer; | |
893 | trackprintpointer = trackprintpointer->next; | |
894 | ||
895 | ++trashtrackcounter; | |
896 | ||
897 | // free space | |
898 | delete tracklistdeleter; | |
899 | tracklistdeleter = NULL; | |
900 | ||
901 | } // end of while(trackpointer != NULL) | |
902 | ||
903 | } // end of else | |
904 | ||
905 | // print out number of noise clusters (not assigned to any track and not valid) | |
906 | HLTInfo("Number of discarded clusters not assigned to any track: %d", fTotalDiscardedClusters); | |
907 | HLTInfo("--------------"); | |
908 | ||
909 | // write results to file if specified by command line argument | |
910 | if(!fDumpFileName.IsNull()) | |
911 | { | |
912 | fprintf(dumpfile,"Number of discarded clusters not assigned to any track: %d \n", fTotalDiscardedClusters); | |
913 | fprintf(dumpfile,"-------------- \n"); | |
914 | }; | |
915 | ||
916 | // print out paramters of discarded valuable clusters | |
917 | HLTInfo("Number of discarded VALUABLE clusters: %d", fValuableDiscardedClusters); | |
918 | ||
919 | HLTInfo("--------------"); | |
920 | ||
921 | if(!fDumpFileName.IsNull()) | |
922 | { | |
923 | ||
924 | fprintf(dumpfile,"Number of discarded VALUABLE clusters: %d \n", fValuableDiscardedClusters); | |
925 | fclose(dumpfile); | |
926 | }; | |
927 | ||
928 | return 0; | |
929 | } | |
930 | ||
931 | Int_t AliHLTTPCCompModelAnalysis::DisplayTrackResults() | |
932 | { | |
933 | // see header file for class documentation | |
934 | // start with comparison | |
935 | if(CompareTracks() != 0) | |
936 | { | |
937 | return EINVAL; | |
938 | }; | |
939 | ||
940 | // if dumptofile is activated, append results to output analysis file | |
941 | FILE* dumpfile = NULL; | |
942 | ||
943 | if(!fDumpFileName.IsNull()) | |
944 | { | |
945 | // open new file specified by command line argument | |
946 | dumpfile = fopen(fDumpFileName.Data(),"a"); | |
947 | ||
948 | fprintf(dumpfile,"---------------TRACK ANALYSIS--------------- \n"); | |
949 | ||
950 | } | |
951 | ||
952 | // print out number of compared tracks | |
953 | HLTInfo("---------------ORIGINAL TRACKS: %d ---------------", fFirstTrackArray.GetNTracks()); | |
954 | HLTInfo("Number of tracks with pt < 0.1 GeV: %d", fFirstTrashTracks); | |
955 | HLTInfo("Number of matched tracks with pt < 0.1 GeV: %d", fMatchedFirstTrashTracks); | |
956 | //PYTHIA INFORMATION ABOUT PARTICLE IDs | |
957 | HLTInfo("---------------2NDARY TRACKS: %d ---------------", fSecondTrackArray.GetNTracks()); | |
958 | HLTInfo("Number of tracks with pt < 0.1 GeV: %d", fSecondTrashTracks); | |
959 | HLTInfo("Number of matched tracks with pt < 0.1 GeV: %d", fMatchedSecondTrashTracks); | |
960 | //PYTHIA INFORMATION ABOUT PARTICLE IDs | |
961 | HLTInfo("--------------"); | |
962 | HLTInfo("Comparison of tracks within parameter precision: %f", fToleranceDeviation); | |
963 | HLTInfo("Number of compared tracks: %d", fTotalComparedTracks); | |
964 | HLTInfo("Number of unmatched original tracks: %d", fFirstUnmatchedTracks); | |
965 | HLTInfo("Number of unmatched secondary tracks: %d", fSecondUnmatchedTracks); | |
966 | HLTInfo("--------------"); | |
967 | ||
968 | // print results to file | |
969 | if(!fDumpFileName.IsNull()) | |
970 | { | |
971 | fprintf(dumpfile, "---------------%d ORIGINAL TRACKS---------------\n", fFirstTrackArray.GetNTracks()); | |
972 | fprintf(dumpfile,"Number of tracks with pt < 0.1 GeV: %d \n", fFirstTrashTracks); | |
973 | fprintf(dumpfile,"Number of matched tracks with pt < 0.1 GeV: %d \n", fMatchedFirstTrashTracks); | |
974 | fprintf(dumpfile,"---------------%d 2NDARY TRACKS---------------\n", fSecondTrackArray.GetNTracks()); | |
975 | fprintf(dumpfile,"Number of tracks with pt < 0.1 GeV: %d \n", fSecondTrashTracks); | |
976 | fprintf(dumpfile,"Number of matched tracks with pt < 0.1 GeV: %d \n", fMatchedSecondTrashTracks); | |
977 | fprintf(dumpfile,"--------------\n"); | |
978 | fprintf(dumpfile,"Comparison of tracks within parameter precision: %f \n", fToleranceDeviation); | |
979 | fprintf(dumpfile,"Number of compared tracks: %d \n", fTotalComparedTracks); | |
980 | fprintf(dumpfile,"Number of unmatched original tracks: %d \n", fFirstUnmatchedTracks); | |
981 | fprintf(dumpfile,"Number of unmatched secondary tracks: %d \n", fSecondUnmatchedTracks); | |
982 | fprintf(dumpfile,"--------------\n"); | |
983 | } | |
984 | ||
985 | ////////////////////////////////////////////////////////////////////// | |
986 | // additional files temporarily necessary for output information | |
987 | FILE* infofile = fopen("/afsuser/jwagner/TrackerTest_25092007/cosmics/fullanalysis08012008/trackingefficiency.out","a"); | |
988 | FILE* info2file = fopen("/afsuser/jwagner/TrackerTest_25092007/cosmics/fullanalysis08012008/parameters.out", "a"); | |
989 | ||
990 | // consistent = 0 if tracks and second tracks match perfectly, i.e. no doubly assigned tracks,etc. | |
991 | Int_t consistentfirst = fFirstTrackArray.GetNTracks() - fTotalComparedTracks - fFirstUnmatchedTracks; | |
992 | Int_t consistentsecond = fSecondTrackArray.GetNTracks() - fTotalComparedTracks - fSecondUnmatchedTracks; | |
993 | ||
994 | //fprintf(infofile, "1st tracks, 2nd tracks, compared, 1st uncompared, 2nd uncompared, cons.1st, cons.2nd \n"); | |
995 | fprintf(info2file, " %d \t %d \t %d \t %d \t %d \t %d \t %d \n", fFirstTrackArray.GetNTracks(), fSecondTrackArray.GetNTracks(), fTotalComparedTracks, fFirstUnmatchedTracks, fSecondUnmatchedTracks, consistentfirst, consistentsecond); | |
996 | ||
997 | //fprintf(infofile, "1st trash tracks, 2nd trash tracks, 1st matched trash tracks, 2nd matched trash tracks \n"); | |
998 | fprintf(infofile, "%d \t %d \t %d \t %d \n", fFirstTrashTracks, fSecondTrashTracks, fMatchedFirstTrashTracks, fMatchedSecondTrashTracks); | |
999 | ||
1000 | fclose(infofile); | |
1001 | fclose(info2file); | |
1002 | //////////////////////////////////////////////////////////////////// | |
1003 | ||
1004 | // print out deviations | |
1005 | Int_t tracknumber = 1; | |
1006 | AliHLTTPCTrackList* listprintpointer = fFirstTrackList; | |
1007 | while(listprintpointer != NULL) | |
1008 | { | |
1009 | // print out parameters of original track in comparison to secondary track: | |
1010 | ||
1011 | if(listprintpointer->matchingindicator != 0) | |
1012 | { | |
1013 | ||
1014 | #if 0 | |
1015 | HLTInfo("Track %d:", tracknumber); | |
1016 | HLTInfo("Original track matched to secondary track with matchingindicator %d", listprintpointer->matchingindicator); | |
1017 | ||
1018 | HLTInfo("Parameter comparison: Original vs. Secondary"); | |
1019 | ||
1020 | HLTInfo("Clusters: %d \t %d ",listprintpointer->track.GetNHits(), listprintpointer->matchingtrack->track.GetNHits()); | |
1021 | HLTInfo("First x: %9.6f \t %9.6f", listprintpointer->track.GetFirstPointX(), listprintpointer->matchingtrack->track.GetFirstPointX()); | |
1022 | HLTInfo("First y: %9.6f \t %9.6f", listprintpointer->track.GetFirstPointY(), listprintpointer->matchingtrack->track.GetFirstPointY()); | |
1023 | HLTInfo("First z: %9.6f \t %9.6f", listprintpointer->track.GetFirstPointZ(), listprintpointer->matchingtrack->track.GetFirstPointZ()); | |
1024 | HLTInfo("Last x: %9.6f \t %9.6f", listprintpointer->track.GetLastPointX(), listprintpointer->matchingtrack->track.GetLastPointX()); | |
1025 | HLTInfo("Last y: %9.6f \t %9.6f", listprintpointer->track.GetLastPointY(), listprintpointer->matchingtrack->track.GetLastPointY()); | |
1026 | HLTInfo("Last z: %9.6f \t %9.6f", listprintpointer->track.GetLastPointZ(), listprintpointer->matchingtrack->track.GetLastPointZ()); | |
1027 | HLTInfo(" Pt: %9.6f \t %9.6f", listprintpointer->track.GetPt(), listprintpointer->matchingtrack->track.GetPt()); | |
1028 | HLTInfo(" Psi: %9.6f \t %9.6f", listprintpointer->track.GetPsi(), listprintpointer->matchingtrack->track.GetPsi()); | |
1029 | HLTInfo(" Tgl: %9.6f \t %9.6f", listprintpointer->track.GetTgl(), listprintpointer->matchingtrack->track.GetTgl()); | |
1030 | ||
1031 | HLTInfo(" Pterr: %9.6f \t %9.6f", listprintpointer->track.GetPterr(), listprintpointer->matchingtrack->track.GetPterr()); | |
1032 | HLTInfo("Psierr: %9.6f \t %9.6f", listprintpointer->track.GetPsierr(), listprintpointer->matchingtrack->track.GetPsierr()); | |
1033 | HLTInfo("Tglerr: %9.6f \t %9.6f", listprintpointer->track.GetTglerr(), listprintpointer->matchingtrack->track.GetTglerr()); | |
1034 | ||
1035 | HLTInfo("--------------"); | |
1036 | #endif | |
1037 | // print these results to file | |
1038 | if(!fDumpFileName.IsNull()) | |
1039 | { | |
1040 | fprintf(dumpfile, "Track %d: \n", tracknumber); | |
1041 | fprintf(dumpfile, "Original track matched to secondary track with matchingindicator %d \n", listprintpointer->matchingindicator); | |
1042 | fprintf(dumpfile, "Parameter comparison: Original vs. Secondary \n"); | |
1043 | fprintf(dumpfile, "Clusters: %d \t %d \n ",listprintpointer->track.GetNHits(), listprintpointer->matchingtrack->track.GetNHits()); | |
1044 | fprintf(dumpfile, "First x: %9.6f \t %9.6f \n", listprintpointer->track.GetFirstPointX(), listprintpointer->matchingtrack->track.GetFirstPointX()); | |
1045 | fprintf(dumpfile, "First y: %9.6f \t %9.6f \n", listprintpointer->track.GetFirstPointY(), listprintpointer->matchingtrack->track.GetFirstPointY()); | |
1046 | fprintf(dumpfile, "First z: %9.6f \t %9.6f \n", listprintpointer->track.GetFirstPointZ(), listprintpointer->matchingtrack->track.GetFirstPointZ()); | |
1047 | fprintf(dumpfile, "Last x: %9.6f \t %9.6f \n", listprintpointer->track.GetLastPointX(), listprintpointer->matchingtrack->track.GetLastPointX()); | |
1048 | fprintf(dumpfile, "Last y: %9.6f \t %9.6f \n", listprintpointer->track.GetLastPointY(), listprintpointer->matchingtrack->track.GetLastPointY()); | |
1049 | fprintf(dumpfile, "Last z: %9.6f \t %9.6f \n", listprintpointer->track.GetLastPointZ(), listprintpointer->matchingtrack->track.GetLastPointZ()); | |
1050 | fprintf(dumpfile, " Pt: %9.6f \t %9.6f \n", listprintpointer->track.GetPt(), listprintpointer->matchingtrack->track.GetPt()); | |
1051 | fprintf(dumpfile, " Psi: %9.6f \t %9.6f \n", listprintpointer->track.GetPsi(), listprintpointer->matchingtrack->track.GetPsi()); | |
1052 | fprintf(dumpfile, " Tgl: %9.6f \t %9.6f \n", listprintpointer->track.GetTgl(), listprintpointer->matchingtrack->track.GetTgl()); | |
1053 | fprintf(dumpfile, "--------------\n"); | |
1054 | } | |
1055 | ++tracknumber; | |
1056 | } | |
1057 | ||
1058 | listprintpointer = listprintpointer->next; | |
1059 | } | |
1060 | ||
1061 | ||
1062 | // print out not matched tracks from first track array: | |
1063 | listprintpointer = fFirstTrackList; | |
1064 | Int_t notmatchedtracknumber = 1; | |
1065 | ||
1066 | while(listprintpointer != NULL) | |
1067 | { | |
1068 | if(listprintpointer->matchingindicator == 0) | |
1069 | { | |
1070 | #if 0 | |
1071 | HLTInfo("Original Track, not matched with secondary track %d:", notmatchedtracknumber); | |
1072 | HLTInfo("Clusters: %d",listprintpointer->track.GetNHits()); | |
1073 | //PYTHIA INFORMATION ABOUT PARTICLE ID | |
1074 | HLTInfo("First x: %9.6f \t first y: %9.6f \t first z: %9.6f",listprintpointer->track.GetFirstPointX(),listprintpointer->track.GetFirstPointY(),listprintpointer->track.GetFirstPointZ()); | |
1075 | HLTInfo(" Last x: %9.6f \t last y: %9.6f \t last z: %9.6f", listprintpointer->track.GetLastPointX(),listprintpointer->track.GetLastPointY(),listprintpointer->track.GetLastPointZ()); | |
1076 | HLTInfo(" Pt: %9.6f \t Psi: %9.6f \t Tgl: %9.6f", listprintpointer->track.GetPt(), listprintpointer->track.GetPsi(), listprintpointer->track.GetTgl()); | |
1077 | HLTInfo("--------------"); | |
1078 | #endif | |
1079 | ||
1080 | // print these results to file | |
1081 | if(!fDumpFileName.IsNull()) | |
1082 | { | |
1083 | fprintf(dumpfile, "Original Track, not matched with secondary track %d: \n", notmatchedtracknumber); | |
1084 | fprintf(dumpfile, "Clusters: %d \n",listprintpointer->track.GetNHits()); | |
1085 | fprintf(dumpfile, "First x: %9.6f \t first y: %9.6f \t first z: %9.6f \n",listprintpointer->track.GetFirstPointX(),listprintpointer->track.GetFirstPointY(),listprintpointer->track.GetFirstPointZ()); | |
1086 | fprintf(dumpfile, " Last x: %9.6f \t last y: %9.6f \t last z: %9.6f \n", listprintpointer->track.GetLastPointX(),listprintpointer->track.GetLastPointY(),listprintpointer->track.GetLastPointZ()); | |
1087 | fprintf(dumpfile, " Pt: %9.6f \t Psi: %9.6f \t Tgl: %9.6f \n", listprintpointer->track.GetPt(), listprintpointer->track.GetPsi(), listprintpointer->track.GetTgl()); | |
1088 | fprintf(dumpfile, "--------------\n"); | |
1089 | } | |
1090 | ||
1091 | ++notmatchedtracknumber; | |
1092 | } | |
1093 | ||
1094 | listprintpointer = listprintpointer->next; | |
1095 | } | |
1096 | ||
1097 | // print out not matched tracks from second track array: | |
1098 | listprintpointer = fSecondTrackList; | |
1099 | notmatchedtracknumber = 1; | |
1100 | ||
1101 | while(listprintpointer != NULL) | |
1102 | { | |
1103 | if(listprintpointer->matchingindicator == 0) | |
1104 | { | |
1105 | #if 0 | |
1106 | HLTInfo("Secondary Track, not matched with original track %d:", notmatchedtracknumber); | |
1107 | HLTInfo("Clusters: %d",listprintpointer->track.GetNHits()); | |
1108 | //PYTHIA INFORMATION ABOUT PARTICLE ID | |
1109 | HLTInfo("First x: %9.6f \t first y: %9.6f \t first z: %9.6f",listprintpointer->track.GetFirstPointX(),listprintpointer->track.GetFirstPointY(),listprintpointer->track.GetFirstPointZ()); | |
1110 | HLTInfo(" Last x: %9.6f \t last y: %9.6f \t last z: %9.6f", listprintpointer->track.GetLastPointX(),listprintpointer->track.GetLastPointY(),listprintpointer->track.GetLastPointZ()); | |
1111 | HLTInfo(" Pt: %9.6f \t Psi: %9.6f \t Tgl: %9.6f", listprintpointer->track.GetPt(), listprintpointer->track.GetPsi(), listprintpointer->track.GetTgl()); | |
1112 | HLTInfo("--------------"); | |
1113 | #endif | |
1114 | // print these results to file | |
1115 | if(!fDumpFileName.IsNull()) | |
1116 | { | |
1117 | fprintf(dumpfile, "Secondary Track, not matched with original track %d: \n", notmatchedtracknumber); | |
1118 | fprintf(dumpfile, "Clusters: %d \n",listprintpointer->track.GetNHits()); | |
1119 | fprintf(dumpfile, "First x: %9.6f \t first y: %9.6f \t first z: %9.6f \n",listprintpointer->track.GetFirstPointX(),listprintpointer->track.GetFirstPointY(),listprintpointer->track.GetFirstPointZ()); | |
1120 | fprintf(dumpfile, " Last x: %9.6f \t last y: %9.6f \t last z: %9.6f \n", listprintpointer->track.GetLastPointX(),listprintpointer->track.GetLastPointY(),listprintpointer->track.GetLastPointZ()); | |
1121 | fprintf(dumpfile, " Pt: %9.6f \t Psi: %9.6f \t Tgl: %9.6f \n", listprintpointer->track.GetPt(), listprintpointer->track.GetPsi(), listprintpointer->track.GetTgl()); | |
1122 | fprintf(dumpfile, "--------------\n"); | |
1123 | } | |
1124 | ||
1125 | ++notmatchedtracknumber; | |
1126 | } | |
1127 | ||
1128 | listprintpointer = listprintpointer->next; | |
1129 | } | |
1130 | ||
1131 | // close output analysis file | |
1132 | if(!fDumpFileName.IsNull()) | |
1133 | { | |
1134 | fclose(dumpfile); | |
1135 | }; | |
1136 | ||
1137 | // if results should be written to graphical output: | |
1138 | if(!fGraphFileName.IsNull()) | |
1139 | { | |
1140 | CreateGraphs(1); // specifiy if absolute or rel. differences should be saved (CreateGraphs(0) or CreateGraphs()/ CreateGraphs(1) | |
1141 | }; | |
1142 | ||
1143 | // free reserved space | |
1144 | ||
1145 | return 0; | |
1146 | } |