]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/tracking-ca/AliHLTTPCCAPerformance.cxx
Comment debugging lines
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAPerformance.cxx
CommitLineData
d54804bf 1// $Id$
ce565086 2// **************************************************************************
fbb9b71b 3// This file is property of and copyright by the ALICE HLT Project *
d54804bf 4// ALICE Experiment at CERN, All rights reserved. *
5// *
6// Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> *
7// Ivan Kisel <kisel@kip.uni-heidelberg.de> *
8// for The ALICE HLT Project. *
9// *
10// Permission to use, copy, modify and distribute this software and its *
11// documentation strictly for non-commercial purposes is hereby granted *
12// without fee, provided that the above copyright notice appears in all *
13// copies and that both the copyright notice and this permission notice *
14// appear in the supporting documentation. The authors make no claims *
15// about the suitability of this software for any purpose. It is *
16// provided "as is" without express or implied warranty. *
ce565086 17// *
d54804bf 18//***************************************************************************
19
ce565086 20
d54804bf 21#include "AliHLTTPCCAPerformance.h"
d54804bf 22#include "AliHLTTPCCAMCTrack.h"
eb30eb49 23#include "AliHLTTPCCAMCPoint.h"
d54804bf 24#include "AliHLTTPCCATracker.h"
ce565086 25#include "AliHLTTPCCATracklet.h"
6de2bc40 26#include "AliHLTTPCCAStandaloneFramework.h"
0f1f07c3 27#include "AliHLTTPCCASliceOutTrack.h"
6de2bc40 28#include "AliHLTTPCCASliceOutput.h"
29#include "AliHLTTPCCAMergerOutput.h"
30#include "AliHLTTPCCAMergedTrack.h"
eb30eb49 31
d54804bf 32#include "TMath.h"
33#include "TROOT.h"
4687b8fc 34#include "Riostream.h"
d54804bf 35#include "TFile.h"
36#include "TH1.h"
eb30eb49 37#include "TH2.h"
d54804bf 38#include "TProfile.h"
6de2bc40 39#include "TRandom.h"
42bf4dc9 40#include <cmath>
d54804bf 41
693d2443 42AliHLTTPCCAPerformance &AliHLTTPCCAPerformance::Instance()
43{
44 // reference to static object
45 static AliHLTTPCCAPerformance gAliHLTTPCCAPerformance;
46 return gAliHLTTPCCAPerformance;
47}
d54804bf 48
d54804bf 49AliHLTTPCCAPerformance::AliHLTTPCCAPerformance()
fbb9b71b 50 :
fbb9b71b 51 fHitLabels( 0 ),
52 fNHits( 0 ),
53 fMCTracks( 0 ),
54 fNMCTracks( 0 ),
55 fMCPoints( 0 ),
56 fNMCPoints( 0 ),
57 fDoClusterPulls( 0 ),
58 fStatNEvents( 0 ),
59 fStatTime( 0 ),
60 fStatSeedNRecTot( 0 ),
61 fStatSeedNRecOut( 0 ),
62 fStatSeedNGhost( 0 ),
63 fStatSeedNMCAll( 0 ),
64 fStatSeedNRecAll( 0 ),
65 fStatSeedNClonesAll( 0 ),
66 fStatSeedNMCRef( 0 ),
67 fStatSeedNRecRef( 0 ),
68 fStatSeedNClonesRef( 0 ),
69 fStatCandNRecTot( 0 ),
70 fStatCandNRecOut( 0 ),
71 fStatCandNGhost( 0 ),
72 fStatCandNMCAll( 0 ),
73 fStatCandNRecAll( 0 ),
74 fStatCandNClonesAll( 0 ),
75 fStatCandNMCRef( 0 ),
76 fStatCandNRecRef( 0 ),
77 fStatCandNClonesRef( 0 ),
78 fStatNRecTot( 0 ),
79 fStatNRecOut( 0 ),
80 fStatNGhost( 0 ),
81 fStatNMCAll( 0 ),
82 fStatNRecAll( 0 ),
83 fStatNClonesAll( 0 ),
84 fStatNMCRef( 0 ),
85 fStatNRecRef( 0 ),
86 fStatNClonesRef( 0 ),
87 fStatGBNRecTot( 0 ),
88 fStatGBNRecOut( 0 ),
89 fStatGBNGhost( 0 ),
90 fStatGBNMCAll( 0 ),
91 fStatGBNRecAll( 0 ),
92 fStatGBNClonesAll( 0 ),
93 fStatGBNMCRef( 0 ),
94 fStatGBNRecRef( 0 ),
95 fStatGBNClonesRef( 0 ),
96 fHistoDir( 0 ),
97 fhResY( 0 ),
98 fhResZ( 0 ),
99 fhResSinPhi( 0 ),
100 fhResDzDs( 0 ),
101 fhResPt( 0 ),
102 fhPullY( 0 ),
103 fhPullZ( 0 ),
104 fhPullSinPhi( 0 ),
105 fhPullDzDs( 0 ),
106 fhPullQPt( 0 ),
107 fhPullYS( 0 ),
108 fhPullZT( 0 ),
4acc2401 109 fhHitErrY( 0 ),
110 fhHitErrZ( 0 ),
111 fhHitResY( 0 ),
112 fhHitResZ( 0 ),
113 fhHitPullY( 0 ),
114 fhHitPullZ( 0 ),
115 fhHitShared( 0 ),
116 fhHitResY1( 0 ),
117 fhHitResZ1( 0 ),
118 fhHitPullY1( 0 ),
119 fhHitPullZ1( 0 ),
fbb9b71b 120 fhCellPurity( 0 ),
121 fhCellNHits( 0 ),
122 fhCellPurityVsN( 0 ),
123 fhCellPurityVsPt( 0 ),
124 fhEffVsP( 0 ),
125 fhSeedEffVsP( 0 ),
126 fhCandEffVsP( 0 ),
127 fhGBEffVsP( 0 ),
128 fhGBEffVsPt( 0 ),
129 fhNeighQuality( 0 ),
130 fhNeighEff( 0 ),
131 fhNeighQualityVsPt( 0 ),
132 fhNeighEffVsPt( 0 ),
133 fhNeighDy( 0 ),
134 fhNeighDz( 0 ),
135 fhNeighChi( 0 ),
136 fhNeighDyVsPt( 0 ),
137 fhNeighDzVsPt( 0 ),
138 fhNeighChiVsPt( 0 ),
139 fhNeighNCombVsArea( 0 ),
140 fhNHitsPerSeed ( 0 ),
141 fhNHitsPerTrackCand( 0 ),
142 fhTrackLengthRef( 0 ),
143 fhRefRecoX( 0 ),
144 fhRefRecoY( 0 ),
145 fhRefRecoZ( 0 ),
146 fhRefRecoP( 0 ),
147 fhRefRecoPt( 0 ),
148 fhRefRecoAngleY( 0 ),
149 fhRefRecoAngleZ( 0 ),
150 fhRefRecoNHits( 0 ),
151 fhRefNotRecoX( 0 ),
152 fhRefNotRecoY( 0 ),
153 fhRefNotRecoZ( 0 ),
154 fhRefNotRecoP( 0 ),
155 fhRefNotRecoPt( 0 ),
156 fhRefNotRecoAngleY( 0 ),
157 fhRefNotRecoAngleZ( 0 ),
158 fhRefNotRecoNHits( 0 )
d54804bf 159{
160 //* constructor
a986b6c6 161 for( int i=0; i<4; i++){
162 fhLinkEff[i] = 0;
163 fhLinkAreaY[i] = 0;
164 fhLinkAreaZ[i] = 0;
165 fhLinkChiRight[i] = 0;
166 fhLinkChiWrong[i] = 0;
167 }
d54804bf 168}
169
170
fbb9b71b 171AliHLTTPCCAPerformance::AliHLTTPCCAPerformance( const AliHLTTPCCAPerformance& )
172 :
fbb9b71b 173 fHitLabels( 0 ),
174 fNHits( 0 ),
175 fMCTracks( 0 ),
176 fNMCTracks( 0 ),
177 fMCPoints( 0 ),
178 fNMCPoints( 0 ),
179 fDoClusterPulls( 0 ),
180 fStatNEvents( 0 ),
181 fStatTime( 0 ),
182 fStatSeedNRecTot( 0 ),
183 fStatSeedNRecOut( 0 ),
184 fStatSeedNGhost( 0 ),
185 fStatSeedNMCAll( 0 ),
186 fStatSeedNRecAll( 0 ),
187 fStatSeedNClonesAll( 0 ),
188 fStatSeedNMCRef( 0 ),
189 fStatSeedNRecRef( 0 ),
190 fStatSeedNClonesRef( 0 ),
191 fStatCandNRecTot( 0 ),
192 fStatCandNRecOut( 0 ),
193 fStatCandNGhost( 0 ),
194 fStatCandNMCAll( 0 ),
195 fStatCandNRecAll( 0 ),
196 fStatCandNClonesAll( 0 ),
197 fStatCandNMCRef( 0 ),
198 fStatCandNRecRef( 0 ),
199 fStatCandNClonesRef( 0 ),
200 fStatNRecTot( 0 ),
201 fStatNRecOut( 0 ),
202 fStatNGhost( 0 ),
203 fStatNMCAll( 0 ),
204 fStatNRecAll( 0 ),
205 fStatNClonesAll( 0 ),
206 fStatNMCRef( 0 ),
207 fStatNRecRef( 0 ),
208 fStatNClonesRef( 0 ),
209 fStatGBNRecTot( 0 ),
210 fStatGBNRecOut( 0 ),
211 fStatGBNGhost( 0 ),
212 fStatGBNMCAll( 0 ),
213 fStatGBNRecAll( 0 ),
214 fStatGBNClonesAll( 0 ),
215 fStatGBNMCRef( 0 ),
216 fStatGBNRecRef( 0 ),
217 fStatGBNClonesRef( 0 ),
218 fHistoDir( 0 ),
219 fhResY( 0 ),
220 fhResZ( 0 ),
221 fhResSinPhi( 0 ),
222 fhResDzDs( 0 ),
223 fhResPt( 0 ),
224 fhPullY( 0 ),
225 fhPullZ( 0 ),
226 fhPullSinPhi( 0 ),
227 fhPullDzDs( 0 ),
228 fhPullQPt( 0 ),
229 fhPullYS( 0 ),
230 fhPullZT( 0 ),
4acc2401 231 fhHitErrY( 0 ),
232 fhHitErrZ( 0 ),
233 fhHitResY( 0 ),
234 fhHitResZ( 0 ),
235 fhHitPullY( 0 ),
236 fhHitPullZ( 0 ),
237 fhHitShared( 0 ),
238 fhHitResY1( 0 ),
239 fhHitResZ1( 0 ),
240 fhHitPullY1( 0 ),
241 fhHitPullZ1( 0 ),
fbb9b71b 242 fhCellPurity( 0 ),
243 fhCellNHits( 0 ),
244 fhCellPurityVsN( 0 ),
245 fhCellPurityVsPt( 0 ),
246 fhEffVsP( 0 ),
247 fhSeedEffVsP( 0 ),
248 fhCandEffVsP( 0 ),
249 fhGBEffVsP( 0 ),
250 fhGBEffVsPt( 0 ),
251 fhNeighQuality( 0 ),
252 fhNeighEff( 0 ),
253 fhNeighQualityVsPt( 0 ),
254 fhNeighEffVsPt( 0 ),
255 fhNeighDy( 0 ),
256 fhNeighDz( 0 ),
257 fhNeighChi( 0 ),
258 fhNeighDyVsPt( 0 ),
259 fhNeighDzVsPt( 0 ),
260 fhNeighChiVsPt( 0 ),
261 fhNeighNCombVsArea( 0 ),
262 fhNHitsPerSeed ( 0 ),
263 fhNHitsPerTrackCand( 0 ),
264 fhTrackLengthRef( 0 ),
265 fhRefRecoX( 0 ),
266 fhRefRecoY( 0 ),
267 fhRefRecoZ( 0 ),
268 fhRefRecoP( 0 ),
269 fhRefRecoPt( 0 ),
270 fhRefRecoAngleY( 0 ),
271 fhRefRecoAngleZ( 0 ),
272 fhRefRecoNHits( 0 ),
273 fhRefNotRecoX( 0 ),
274 fhRefNotRecoY( 0 ),
275 fhRefNotRecoZ( 0 ),
276 fhRefNotRecoP( 0 ),
277 fhRefNotRecoPt( 0 ),
278 fhRefNotRecoAngleY( 0 ),
279 fhRefNotRecoAngleZ( 0 ),
280 fhRefNotRecoNHits( 0 )
d54804bf 281{
282 //* dummy
a986b6c6 283 for( int i=0; i<4; i++){
284 fhLinkEff[i] = 0;
285 fhLinkAreaY[i] = 0;
286 fhLinkAreaZ[i] = 0;
287 fhLinkChiRight[i] = 0;
288 fhLinkChiWrong[i] = 0;
289 }
d54804bf 290}
291
fbb9b71b 292const AliHLTTPCCAPerformance &AliHLTTPCCAPerformance::operator=( const AliHLTTPCCAPerformance& ) const
d54804bf 293{
294 //* dummy
295 return *this;
296}
297
298AliHLTTPCCAPerformance::~AliHLTTPCCAPerformance()
299{
300 //* destructor
301 StartEvent();
302}
303
d54804bf 304void AliHLTTPCCAPerformance::StartEvent()
305{
306 //* clean up arrays
fbb9b71b 307 if ( !fHistoDir ) CreateHistos();
308 if ( fHitLabels ) delete[] fHitLabels;
d54804bf 309 fHitLabels = 0;
310 fNHits = 0;
fbb9b71b 311 if ( fMCTracks ) delete[] fMCTracks;
d54804bf 312 fMCTracks = 0;
313 fNMCTracks = 0;
fbb9b71b 314 if ( fMCPoints ) delete[] fMCPoints;
eb30eb49 315 fMCPoints = 0;
316 fNMCPoints = 0;
d54804bf 317}
318
fbb9b71b 319void AliHLTTPCCAPerformance::SetNHits( int NHits )
d54804bf 320{
321 //* set number of hits
fbb9b71b 322 if ( fHitLabels ) delete[] fHitLabels;
d54804bf 323 fHitLabels = 0;
324 fHitLabels = new AliHLTTPCCAHitLabel[ NHits ];
325 fNHits = NHits;
fbb9b71b 326}
d54804bf 327
fbb9b71b 328void AliHLTTPCCAPerformance::SetNMCTracks( int NumberOfMCTracks )
d54804bf 329{
330 //* set number of MC tracks
fbb9b71b 331 if ( fMCTracks ) delete[] fMCTracks;
d54804bf 332 fMCTracks = 0;
693d2443 333 fMCTracks = new AliHLTTPCCAMCTrack[ NumberOfMCTracks ];
334 fNMCTracks = NumberOfMCTracks;
fbb9b71b 335}
d54804bf 336
fbb9b71b 337void AliHLTTPCCAPerformance::SetNMCPoints( int NMCPoints )
eb30eb49 338{
339 //* set number of MC points
fbb9b71b 340 if ( fMCPoints ) delete[] fMCPoints;
eb30eb49 341 fMCPoints = 0;
342 fMCPoints = new AliHLTTPCCAMCPoint[ NMCPoints ];
343 fNMCPoints = 0;
fbb9b71b 344}
eb30eb49 345
fbb9b71b 346void AliHLTTPCCAPerformance::ReadHitLabel( int HitID,
347 int lab0, int lab1, int lab2 )
d54804bf 348{
349 //* read the hit labels
350 AliHLTTPCCAHitLabel hit;
351 hit.fLab[0] = lab0;
352 hit.fLab[1] = lab1;
353 hit.fLab[2] = lab2;
354 fHitLabels[HitID] = hit;
355}
356
fbb9b71b 357void AliHLTTPCCAPerformance::ReadMCTrack( int index, const TParticle *part )
d54804bf 358{
eb30eb49 359 //* read mc track to the local array
fbb9b71b 360 fMCTracks[index] = AliHLTTPCCAMCTrack( part );
d54804bf 361}
362
fbb9b71b 363void AliHLTTPCCAPerformance::ReadMCTPCTrack( int index, float X, float Y, float Z,
364 float Px, float Py, float Pz )
eb30eb49 365{
366 //* read mc track parameters at TPC
fbb9b71b 367 fMCTracks[index].SetTPCPar( X, Y, Z, Px, Py, Pz );
eb30eb49 368}
369
fbb9b71b 370void AliHLTTPCCAPerformance::ReadMCPoint( int TrackID, float X, float Y, float Z, float Time, int iSlice )
eb30eb49 371{
372 //* read mc point to the local array
373 AliHLTTPCCAMCPoint &p = fMCPoints[fNMCPoints];
693d2443 374 p.SetTrackID( TrackID );
375 p.SetX( X );
376 p.SetY( Y );
377 p.SetZ( Z );
378 p.SetTime( Time );
379 p.SetISlice( iSlice );
fbb9b71b 380 float sx, sy, sz;
b22af1bf 381 AliHLTTPCCAStandaloneFramework::Instance().Param( iSlice ).Global2Slice( X, Y, Z, &sx, &sy, &sz );
fbb9b71b 382 p.SetSx( sx );
383 p.SetSy( sy );
384 p.SetSz( sz );
385 if ( X*X + Y*Y > 10. ) fNMCPoints++;
eb30eb49 386}
387
d54804bf 388void AliHLTTPCCAPerformance::CreateHistos()
389{
390 //* create performance histogramms
391 TDirectory *curdir = gDirectory;
fbb9b71b 392 fHistoDir = gROOT->mkdir( "HLTTPCCATrackerPerformance" );
d54804bf 393 fHistoDir->cd();
00d07bcd 394
fbb9b71b 395 gDirectory->mkdir( "Links" );
396 gDirectory->cd( "Links" );
397
398 fhLinkEff[0] = new TProfile( "fhLinkEffPrimRef", "fhLinkEffPrimRef vs row", 156, 2., 158. );
399 fhLinkEff[1] = new TProfile( "fhLinkEffPrimExt", "fhLinkEffPrimExt vs row", 156, 2., 158. );
400 fhLinkEff[2] = new TProfile( "fhLinkEffSecRef", "fhLinkEffSecRef vs row", 156, 2., 158. );
401 fhLinkEff[3] = new TProfile( "fhLinkEffSecExt", "fhLinkEffSecExt vs row", 156, 2., 158. );
402 fhLinkAreaY[0] = new TH1D( "fhLinkAreaYPrimRef", "fhLinkAreaYPrimRef", 100, 0, 10 );
403 fhLinkAreaZ[0] = new TH1D( "fhLinkAreaZPrimRef", "fhLinkAreaZPrimRef", 100, 0, 10 );
404 fhLinkAreaY[1] = new TH1D( "fhLinkAreaYPrimExt", "fhLinkAreaYPrimExt", 100, 0, 10 );
405 fhLinkAreaZ[1] = new TH1D( "fhLinkAreaZPrimExt", "fhLinkAreaZPrimExt", 100, 0, 10 );
406 fhLinkAreaY[2] = new TH1D( "fhLinkAreaYSecRef", "fhLinkAreaYSecRef", 100, 0, 10 );
407 fhLinkAreaZ[2] = new TH1D( "fhLinkAreaZSecRef", "fhLinkAreaZSecRef", 100, 0, 10 );
408 fhLinkAreaY[3] = new TH1D( "fhLinkAreaYSecExt", "fhLinkAreaYSecExt", 100, 0, 10 );
409 fhLinkAreaZ[3] = new TH1D( "fhLinkAreaZSecExt", "fhLinkAreaZSecExt", 100, 0, 10 );
410 fhLinkChiRight[0] = new TH1D( "fhLinkChiRightPrimRef", "fhLinkChiRightPrimRef", 100, 0, 10 );
411 fhLinkChiRight[1] = new TH1D( "fhLinkChiRightPrimExt", "fhLinkChiRightPrimExt", 100, 0, 10 );
412 fhLinkChiRight[2] = new TH1D( "fhLinkChiRightSecRef", "fhLinkChiRightSecRef", 100, 0, 10 );
413 fhLinkChiRight[3] = new TH1D( "fhLinkChiRightSecExt", "fhLinkChiRightSecExt", 100, 0, 10 );
414 fhLinkChiWrong[0] = new TH1D( "fhLinkChiWrongPrimRef", "fhLinkChiWrongPrimRef", 100, 0, 10 );
415 fhLinkChiWrong[1] = new TH1D( "fhLinkChiWrongPrimExt", "fhLinkChiWrongPrimExt", 100, 0, 10 );
416 fhLinkChiWrong[2] = new TH1D( "fhLinkChiWrongSecRef", "fhLinkChiWrongSecRef", 100, 0, 10 );
417 fhLinkChiWrong[3] = new TH1D( "fhLinkChiWrongSecExt", "fhLinkChiWrongSecExt", 100, 0, 10 );
418
419 gDirectory->cd( ".." );
420
421 gDirectory->mkdir( "Neighbours" );
422 gDirectory->cd( "Neighbours" );
423
424 fhNeighQuality = new TProfile( "NeighQuality", "Neighbours Quality vs row", 160, 0., 160. );
425 fhNeighEff = new TProfile( "NeighEff", "Neighbours Efficiency vs row", 160, 0., 160. );
426 fhNeighQualityVsPt = new TProfile( "NeighQualityVsPt", "Neighbours Quality vs Pt", 100, 0., 5. );
427 fhNeighEffVsPt = new TProfile( "NeighEffVsPt", "Neighbours Efficiency vs Pt", 100, 0., 5. );
428 fhNeighDy = new TH1D( "NeighDy", "Neighbours dy", 100, -10, 10 );
429 fhNeighDz = new TH1D( "NeighDz", "Neighbours dz", 100, -10, 10 );
430 fhNeighChi = new TH1D( "NeighChi", "Neighbours chi", 100, 0, 20 );
431
432 fhNeighDyVsPt = new TH2D( "NeighDyVsPt", "NeighDyVsPt", 100, 0, 5, 100, -20, 20 );
433 fhNeighDzVsPt = new TH2D( "NeighDzVsPt", "NeighDzVsPt", 100, 0, 5, 100, -20, 20 );
434 fhNeighChiVsPt = new TH2D( "NeighChiVsPt", "NeighChiVsPt", 100, 0, 5, 100, 0, 40 );
435 fhNeighNCombVsArea = new TH2D( "NeighNCombVsArea", "NeighNCombVsArea", 15, 0, 3, 40, 0, 40 );
436
437 gDirectory->cd( ".." );
438
439 gDirectory->mkdir( "Tracklets" );
440 gDirectory->cd( "Tracklets" );
441
442 fhNHitsPerSeed = new TH1D( "NHitsPerSeed", "NHitsPerSeed", 160, 0, 160 );
443 fhSeedEffVsP = new TProfile( "fhSeedEffVsP", "Track Seed Eff vs P", 100, 0., 5. );
444
445 gDirectory->cd( ".." );
446
447 gDirectory->mkdir( "TrackCandidates" );
448 gDirectory->cd( "TrackCandidates" );
449
450 fhNHitsPerTrackCand = new TH1D( "NHitsPerTrackCand", "NHitsPerTrackCand", 160, 0, 160 );
451 fhCandEffVsP = new TProfile( "fhCandEffVsP", "Track Candidate Eff vs P", 100, 0., 5. );
452
453 gDirectory->cd( ".." );
454
455 gDirectory->mkdir( "Tracks" );
456 gDirectory->cd( "Tracks" );
457
458 fhTrackLengthRef = new TH1D( "TrackLengthRef", "TrackLengthRef", 100, 0, 1 );
459
460 fhRefRecoX = new TH1D( "fhRefRecoX", "fhRefRecoX", 100, 0, 200. );
461 fhRefRecoY = new TH1D( "fhRefRecoY", "fhRefRecoY", 100, -200, 200. );
462 fhRefRecoZ = new TH1D( "fhRefRecoZ", "fhRefRecoZ", 100, -250, 250. );
463
464
465 fhRefRecoP = new TH1D( "fhRefRecoP", "fhRefRecoP", 100, 0, 10. );
466 fhRefRecoPt = new TH1D( "fhRefRecoPt", "fhRefRecoPt", 100, 0, 10. );
467 fhRefRecoAngleY = new TH1D( "fhRefRecoAngleY", "fhRefRecoAngleY", 100, -180., 180. );
468 fhRefRecoAngleZ = new TH1D( "fhRefRecoAngleZ", "fhRefRecoAngleZ", 100, -180., 180 );
469 fhRefRecoNHits = new TH1D( "fhRefRecoNHits", "fhRefRecoNHits", 100, 0., 200 );
470
471 fhRefNotRecoX = new TH1D( "fhRefNotRecoX", "fhRefNotRecoX", 100, 0, 200. );
472 fhRefNotRecoY = new TH1D( "fhRefNotRecoY", "fhRefNotRecoY", 100, -200, 200. );
473 fhRefNotRecoZ = new TH1D( "fhRefNotRecoZ", "fhRefNotRecoZ", 100, -250, 250. );
474
475
476 fhRefNotRecoP = new TH1D( "fhRefNotRecoP", "fhRefNotRecoP", 100, 0, 10. );
477 fhRefNotRecoPt = new TH1D( "fhRefNotRecoPt", "fhRefNotRecoPt", 100, 0, 10. );
478 fhRefNotRecoAngleY = new TH1D( "fhRefNotRecoAngleY", "fhRefNotRecoAngleY", 100, -180., 180. );
479 fhRefNotRecoAngleZ = new TH1D( "fhRefNotRecoAngleZ", "fhRefNotRecoAngleZ", 100, -180., 180 );
480 fhRefNotRecoNHits = new TH1D( "fhRefNotRecoNHits", "fhRefNotRecoNHits", 100, 0., 200 );
481
482 gDirectory->cd( ".." );
483
484 gDirectory->mkdir( "TrackFit" );
485 gDirectory->cd( "TrackFit" );
486
487 fhResY = new TH1D( "resY", "track Y resoltion [cm]", 30, -.5, .5 );
488 fhResZ = new TH1D( "resZ", "track Z resoltion [cm]", 30, -.5, .5 );
489 fhResSinPhi = new TH1D( "resSinPhi", "track SinPhi resoltion ", 30, -.03, .03 );
490 fhResDzDs = new TH1D( "resDzDs", "track DzDs resoltion ", 30, -.01, .01 );
6de2bc40 491 fhResPt = new TH1D( "resPt", "track relative Pt resoltion", 30, -.2, .2 );
fbb9b71b 492 fhPullY = new TH1D( "pullY", "track Y pull", 30, -10., 10. );
493 fhPullZ = new TH1D( "pullZ", "track Z pull", 30, -10., 10. );
494 fhPullSinPhi = new TH1D( "pullSinPhi", "track SinPhi pull", 30, -10., 10. );
495 fhPullDzDs = new TH1D( "pullDzDs", "track DzDs pull", 30, -10., 10. );
496 fhPullQPt = new TH1D( "pullQPt", "track Q/Pt pull", 30, -10., 10. );
497 fhPullYS = new TH1D( "pullYS", "track Y+SinPhi chi deviation", 100, 0., 30. );
498 fhPullZT = new TH1D( "pullZT", "track Z+DzDs chi deviation ", 100, 0., 30. );
499
500 gDirectory->cd( ".." );
501
502 fhEffVsP = new TProfile( "EffVsP", "Eff vs P", 100, 0., 5. );
503 fhGBEffVsP = new TProfile( "GBEffVsP", "Global tracker: Eff vs P", 100, 0., 5. );
504 fhGBEffVsPt = new TProfile( "GBEffVsPt", "Global tracker: Eff vs Pt", 100, 0.2, 5. );
505
506 gDirectory->mkdir( "Clusters" );
507 gDirectory->cd( "Clusters" );
508
4acc2401 509 fhHitShared = new TProfile( "fhHitSharedf", "fhHitShared vs row", 160, 0., 160. );
510
511 fhHitResY = new TH1D( "resHitY", "Y cluster resoltion [cm]", 100, -2., 2. );
512 fhHitResZ = new TH1D( "resHitZ", "Z cluster resoltion [cm]", 100, -2., 2. );
6de2bc40 513 fhHitPullY = new TH1D( "pullHitY", "Y cluster pull", 100, -10., 10. );
514 fhHitPullZ = new TH1D( "pullHitZ", "Z cluster pull", 100, -10., 10. );
4acc2401 515
516 fhHitResY1 = new TH1D( "resHitY1", "Y cluster resoltion [cm]", 100, -2., 2. );
517 fhHitResZ1 = new TH1D( "resHitZ1", "Z cluster resoltion [cm]", 100, -2., 2. );
6de2bc40 518 fhHitPullY1 = new TH1D( "pullHitY1", "Y cluster pull", 100, -10., 10. );
519 fhHitPullZ1 = new TH1D( "pullHitZ1", "Z cluster pull", 100, -10., 10. );
4acc2401 520
6de2bc40 521 fhHitErrY = new TH1D( "HitErrY", "Y cluster error [cm]", 100, 0., 3. );
522 fhHitErrZ = new TH1D( "HitErrZ", "Z cluster error [cm]", 100, 0., 3. );
d54804bf 523
fbb9b71b 524 gDirectory->cd( ".." );
525
526 gDirectory->mkdir( "Cells" );
527 gDirectory->cd( "Cells" );
528 fhCellPurity = new TH1D( "CellPurity", "Cell Purity", 100, -0.1, 1.1 );
529 fhCellNHits = new TH1D( "CellNHits", "Cell NHits", 40, 0., 40. );
530 fhCellPurityVsN = new TProfile( "CellPurityVsN", "Cell purity Vs N hits", 40, 2., 42. );
531 fhCellPurityVsPt = new TProfile( "CellPurityVsPt", "Cell purity Vs Pt", 100, 0., 5. );
532 gDirectory->cd( ".." );
533
534 curdir->cd();
d54804bf 535}
536
537void AliHLTTPCCAPerformance::WriteDir2Current( TObject *obj )
538{
539 //* recursive function to copy the directory 'obj' to the current one
fbb9b71b 540 if ( !obj->IsFolder() ) obj->Write();
541 else {
d54804bf 542 TDirectory *cur = gDirectory;
fbb9b71b 543 TDirectory *sub = cur->mkdir( obj->GetName() );
d54804bf 544 sub->cd();
fbb9b71b 545 TList *listSub = ( ( TDirectory* )obj )->GetList();
546 TIter it( listSub );
547 while ( TObject *obj1 = it() ) WriteDir2Current( obj1 );
d54804bf 548 cur->cd();
549 }
550}
551
552void AliHLTTPCCAPerformance::WriteHistos()
553{
554 //* write histograms to the file
555 TDirectory *curr = gDirectory;
556 // Open output file and write histograms
fbb9b71b 557 TFile* outfile = new TFile( "HLTTPCCATrackerPerformance.root", "RECREATE" );
d54804bf 558 outfile->cd();
fbb9b71b 559 WriteDir2Current( fHistoDir );
d54804bf 560 outfile->Close();
561 curr->cd();
562}
563
564
6de2bc40 565
566
567void AliHLTTPCCAPerformance::GetMCLabel( std::vector<int> &ClusterIDs, int &Label, float &Purity )
568{
569 // find MC label for the track
b8139972 570
6de2bc40 571 Label = -1;
572 Purity = 0;
573 int nClusters = ClusterIDs.size();
574 vector<int> labels;
575 for ( int i = 0; i < nClusters; i++ ) {
576 const AliHLTTPCCAHitLabel &l = fHitLabels[ClusterIDs[i]];
577 if ( l.fLab[0] >= 0 ) labels.push_back( l.fLab[0] );
578 if ( l.fLab[1] >= 0 ) labels.push_back( l.fLab[1] );
579 if ( l.fLab[2] >= 0 ) labels.push_back( l.fLab[2] );
580 }
581 sort( labels.begin(), labels.end() );
582 int nMax = 0, labCur = -1, nCur = 0;
b8139972 583
6de2bc40 584 for ( unsigned int i = 0; i < labels.size(); i++ ) {
585 if ( labels[i] != labCur ) {
586 if ( nMax < nCur ) {
b8139972 587 nMax = nCur;
588 Label = labCur;
6de2bc40 589 }
590 labCur = labels[i];
591 nCur = 0;
592 }
593 nCur++;
594 }
b8139972 595 if ( nMax < nCur ) Label = labCur;
6de2bc40 596
597 nMax = 0;
598 for ( int i = 0; i < nClusters; i++ ) {
599 const AliHLTTPCCAHitLabel &l = fHitLabels[ClusterIDs[i]];
600 if ( l.fLab[0] == Label || l.fLab[1] == Label || l.fLab[2] == Label ) nMax++;
601 }
b8139972 602 Purity = ( nClusters > 0 ) ? ( ( double ) nMax ) / nClusters : 0 ;
6de2bc40 603}
604
605
606void AliHLTTPCCAPerformance::LinkPerformance( int /*iSlice*/ )
fbb9b71b 607{
ce565086 608 // Efficiency and quality of the found neighbours
6de2bc40 609#ifdef XXX
fbb9b71b 610 std::cout << "Link performance..." << std::endl;
611 if ( !fTracker ) return;
4acc2401 612 const AliHLTTPCCATracker &slice = fTracker->Slice( iSlice );
ce565086 613
4acc2401 614 AliHLTResizableArray<int> mcType( fNMCTracks );
ce565086 615
fbb9b71b 616 for ( int imc = 0; imc < fNMCTracks; imc++ ) {
617 if ( fMCTracks[imc].P() < .2 ) { mcType[imc] = -1; continue; }
618 float x = fMCTracks[imc].Par()[0];
619 float y = fMCTracks[imc].Par()[1];
620 //float z = fMCTracks[imc].Par()[2];
621 if ( x*x + y*y < 100. ) {
622 if ( fMCTracks[imc].P() >= 1 ) mcType[imc] = 0;
ce565086 623 else mcType[imc] = 1;
624 } else {
fbb9b71b 625 if ( fMCTracks[imc].P() >= 1 ) mcType[imc] = 2;
ce565086 626 else mcType[imc] = 3;
627 }
628 }
629
fbb9b71b 630 struct AliHLTTPCCAMCHits {
631 int fNHits;
632 int fID[30];
633 };
ce565086 634 AliHLTTPCCAMCHits *mcGbHitsUp = new AliHLTTPCCAMCHits[fNMCTracks];
635 AliHLTTPCCAMCHits *mcGbHitsDn = new AliHLTTPCCAMCHits[fNMCTracks];
636
fbb9b71b 637 for ( int iRow = 2; iRow < slice.Param().NRows() - 2; iRow++ ) {
638
639 const AliHLTTPCCARow &row = slice.Row( iRow );
640 const AliHLTTPCCARow &rowUp = slice.Row( iRow + 2 );
641 const AliHLTTPCCARow &rowDn = slice.Row( iRow - 2 );
642
4acc2401 643 AliHLTResizableArray<int> gbHits ( row.NHits() );
644 AliHLTResizableArray<int> gbHitsUp( rowUp.NHits() );
645 AliHLTResizableArray<int> gbHitsDn( rowDn.NHits() );
fbb9b71b 646
4acc2401 647 for ( int ih = 0; ih < row.NHits() ; ih++ ) gbHits [ih] = fTracker->FirstSliceHit()[iSlice] + slice.HitInputID( row , ih );
648 for ( int ih = 0; ih < rowUp.NHits(); ih++ ) gbHitsUp[ih] = fTracker->FirstSliceHit()[iSlice] + slice.HitInputID( rowUp, ih );
649 for ( int ih = 0; ih < rowDn.NHits(); ih++ ) gbHitsDn[ih] = fTracker->FirstSliceHit()[iSlice] + slice.HitInputID( rowDn, ih );
fbb9b71b 650
651 for ( int imc = 0; imc < fNMCTracks; imc++ ) {
ce565086 652 mcGbHitsUp[imc].fNHits = 0;
653 mcGbHitsDn[imc].fNHits = 0;
654 }
fbb9b71b 655
656 for ( int ih = 0; ih < rowUp.NHits(); ih++ ) {
ce565086 657 AliHLTTPCCAHitLabel &l = fHitLabels[fTracker->Hits()[gbHitsUp[ih]].ID()];
fbb9b71b 658 for ( int il = 0; il < 3; il++ ) {
659 int imc = l.fLab[il];
660 if ( imc < 0 ) break;
661 int &nmc = mcGbHitsUp[imc].fNHits;
662 if ( nmc >= 30 ) continue;
663 mcGbHitsUp[imc].fID[nmc] = gbHitsUp[ih];
664 nmc++;
ce565086 665 }
666 }
667
fbb9b71b 668 for ( int ih = 0; ih < rowDn.NHits(); ih++ ) {
669 AliHLTTPCCAHitLabel &l = fHitLabels[fTracker->Hits()[gbHitsDn[ih]].ID()];
670 for ( int il = 0; il < 3; il++ ) {
671 int imc = l.fLab[il];
672 if ( imc < 0 ) break;
673 int &nmc = mcGbHitsDn[imc].fNHits;
674 if ( nmc >= 30 ) continue;
675 mcGbHitsDn[imc].fID[nmc] = gbHitsDn[ih];
676 nmc++;
ce565086 677 }
678 }
679
fbb9b71b 680 //float dxUp = rowUp.X() - row.X();
681 //float dxDn = row.X() - rowDn.X();
682 float tUp = rowUp.X() / row.X();
683 float tDn = rowDn.X() / row.X();
ce565086 684
fbb9b71b 685 for ( int ih = 0; ih < row.NHits(); ih++ ) {
686
4acc2401 687 int up = slice.HitLinkUpData( row, ih );
688 int dn = slice.HitLinkDownData( row, ih );
ce565086 689
4acc2401 690 const AliHLTTPCCAGBHit &h = fTracker->Hits()[gbHits[ih]];
fbb9b71b 691 AliHLTTPCCAHitLabel &l = fHitLabels[h.ID()];
692
693 int isMC = -1;
694 int mcFound = -1;
695
696 float yUp = h.Y() * tUp, zUp = h.Z() * tUp;
697 float yDn = h.Y() * tDn, zDn = h.Z() * tDn;
698
699 for ( int il = 0; il < 3; il++ ) {
700 int imc = l.fLab[il];
701 if ( imc < 0 ) break;
702
703 bool isMcUp = 0, isMcDn = 0;
704
705 float dyMin = 1.e8, dzMin = 1.e8;
706 for ( int i = 0; i < mcGbHitsUp[imc].fNHits; i++ ) {
4acc2401 707 const AliHLTTPCCAGBHit &h1 = fTracker->Hits()[mcGbHitsUp[imc].fID[i]];
fbb9b71b 708 float dy = TMath::Abs( h1.Y() - yUp );
709 float dz = TMath::Abs( h1.Z() - zUp );
710 if ( dy*dy + dz*dz < dyMin*dyMin + dzMin*dzMin ) {
711 dyMin = dy;
712 dzMin = dz;
713 }
714 }
715
716 if ( mcType[imc] >= 0 && mcGbHitsUp[imc].fNHits >= 0 ) {
717 fhLinkAreaY[mcType[imc]]->Fill( dyMin );
718 fhLinkAreaZ[mcType[imc]]->Fill( dzMin );
719 }
720 if ( dyMin*dyMin + dzMin*dzMin < 100. ) isMcUp = 1;
721
722 dyMin = 1.e8;
723 dzMin = 1.e8;
724 for ( int i = 0; i < mcGbHitsDn[imc].fNHits; i++ ) {
4acc2401 725 const AliHLTTPCCAGBHit &h1 = fTracker->Hits()[mcGbHitsDn[imc].fID[i]];
fbb9b71b 726 float dy = TMath::Abs( h1.Y() - yDn );
727 float dz = TMath::Abs( h1.Z() - zDn );
728 if ( dy*dy + dz*dz < dyMin*dyMin + dzMin*dzMin ) {
729 dyMin = dy;
730 dzMin = dz;
731 }
732 }
733
734 if ( mcType[imc] >= 0 && mcGbHitsDn[imc].fNHits >= 0 ) {
735 fhLinkAreaY[mcType[imc]]->Fill( dyMin );
736 fhLinkAreaZ[mcType[imc]]->Fill( dzMin );
737 }
738 if ( dyMin*dyMin + dzMin*dzMin < 100. ) isMcDn = 1;
739
740 if ( !isMcUp || !isMcDn ) continue;
741 isMC = imc;
742
743 bool found = 0;
744 if ( up >= 0 && dn >= 0 ) {
745 //std::cout<<"row, ih, mc, up, dn = "<<iRow<<" "<<ih<<" "<<imc<<" "<<up<<" "<<dn<<std::endl;
4acc2401 746 const AliHLTTPCCAGBHit &hUp = fTracker->Hits()[gbHitsUp[up]];
747 const AliHLTTPCCAGBHit &hDn = fTracker->Hits()[gbHitsDn[dn]];
fbb9b71b 748 AliHLTTPCCAHitLabel &lUp = fHitLabels[hUp.ID()];
749 AliHLTTPCCAHitLabel &lDn = fHitLabels[hDn.ID()];
750 bool foundUp = 0, foundDn = 0;
751 for ( int jl = 0; jl < 3; jl++ ) {
752 if ( lUp.fLab[jl] == imc ) foundUp = 1;
753 if ( lDn.fLab[jl] == imc ) foundDn = 1;
754 //std::cout<<"mc up, dn = "<<lUp.fLab[jl]<<" "<<lDn.fLab[jl]<<std::endl;
755 }
756 if ( foundUp && foundDn ) found = 1;
757 }
758 if ( found ) { mcFound = imc; break;}
ce565086 759 }
fbb9b71b 760
761 if ( mcFound >= 0 ) {
762 //std::cout<<" mc "<<mcFound<<" found"<<std::endl;
763 if ( mcType[mcFound] >= 0 ) fhLinkEff[mcType[mcFound]]->Fill( iRow, 1 );
764 } else if ( isMC >= 0 ) {
765 //std::cout<<" mc "<<isMC<<" not found"<<std::endl;
766 if ( mcType[isMC] >= 0 ) fhLinkEff[mcType[isMC]]->Fill( iRow, 0 );
ce565086 767 }
768
fbb9b71b 769 } // ih
ce565086 770 } // iRow
771 delete[] mcGbHitsUp;
772 delete[] mcGbHitsDn;
6de2bc40 773#endif
ce565086 774}
775
776
6de2bc40 777void AliHLTTPCCAPerformance::SliceTrackletPerformance( int /*iSlice*/, bool /*PrintFlag*/ )
fbb9b71b 778{
d54804bf 779 //* calculate slice tracker performance
6de2bc40 780#ifdef XXX
fbb9b71b 781 if ( !fTracker ) return;
782
783 int nRecTot = 0, nGhost = 0, nRecOut = 0;
784 int nMCAll = 0, nRecAll = 0, nClonesAll = 0;
785 int nMCRef = 0, nRecRef = 0, nClonesRef = 0;
4acc2401 786 const AliHLTTPCCATracker &slice = fTracker->Slice( iSlice );
d54804bf 787
fbb9b71b 788 int firstSliceHit = fTracker->FirstSliceHit()[iSlice];
789 int endSliceHit = fTracker->NHits();
790 if ( iSlice < fTracker->NSlices() - 1 ) endSliceHit = fTracker->FirstSliceHit()[iSlice+1];
d54804bf 791
ce565086 792 // Select reconstructable MC tracks
793
794 {
fbb9b71b 795 for ( int imc = 0; imc < fNMCTracks; imc++ ) fMCTracks[imc].SetNHits( 0 );
796
797 for ( int ih = firstSliceHit; ih < endSliceHit; ih++ ) {
798 int id = fTracker->Hits()[ih].ID();
799 if ( id < 0 || id >= fNHits ) break;
ce565086 800 AliHLTTPCCAHitLabel &l = fHitLabels[id];
fbb9b71b 801 if ( l.fLab[0] >= 0 ) fMCTracks[l.fLab[0]].SetNHits( fMCTracks[l.fLab[0]].NHits() + 1 );
802 if ( l.fLab[1] >= 0 ) fMCTracks[l.fLab[1]].SetNHits( fMCTracks[l.fLab[1]].NHits() + 1 );
803 if ( l.fLab[2] >= 0 ) fMCTracks[l.fLab[2]].SetNHits( fMCTracks[l.fLab[2]].NHits() + 1 );
ce565086 804 }
fbb9b71b 805
806 for ( int imc = 0; imc < fNMCTracks; imc++ ) {
ce565086 807 AliHLTTPCCAMCTrack &mc = fMCTracks[imc];
808 mc.SetSet( 0 );
809 mc.SetNReconstructed( 0 );
810 mc.SetNTurns( 1 );
fbb9b71b 811 if ( mc.NHits() >= 30 && mc.P() >= .05 ) {
812 mc.SetSet( 1 );
813 nMCAll++;
814 if ( mc.NHits() >= 30 && mc.P() >= 1. ) {
815 mc.SetSet( 2 );
816 nMCRef++;
817 }
00d07bcd 818 }
ce565086 819 }
820 }
00d07bcd 821
ce565086 822
4acc2401 823 int traN = slice.NTracklets();
fbb9b71b 824 int *traLabels = 0;
825 double *traPurity = 0;
ce565086 826
fbb9b71b 827 traLabels = new int[traN];
828 traPurity = new double[traN];
ce565086 829 {
fbb9b71b 830 for ( int itr = 0; itr < traN; itr++ ) {
831 traLabels[itr] = -1;
832 traPurity[itr] = 0;
833
834 int hits[1600];
835 int nHits = 0;
836
837 {
4acc2401 838 const AliHLTTPCCAHitId &id = slice.TrackletStartHit( itr );
839 int iRow = id.RowIndex();
840 int ih = id.HitIndex();
fbb9b71b 841
842 while ( ih >= 0 ) {
843 const AliHLTTPCCARow &row = slice.Row( iRow );
4acc2401 844 hits[nHits] = firstSliceHit + slice.HitInputID( row, ih );
fbb9b71b 845 nHits++;
4acc2401 846 ih = slice.HitLinkUpData( row, ih );
fbb9b71b 847 iRow++;
848 }
ce565086 849 }
850
fbb9b71b 851 if ( nHits < 5 ) continue;
852
853 int lb[1600*3];
854 int nla = 0;
ce565086 855
fbb9b71b 856 for ( int ih = 0; ih < nHits; ih++ ) {
857 AliHLTTPCCAHitLabel &l = fHitLabels[fTracker->Hits()[hits[ih]].ID()];
858 if ( l.fLab[0] >= 0 ) lb[nla++] = l.fLab[0];
859 if ( l.fLab[1] >= 0 ) lb[nla++] = l.fLab[1];
860 if ( l.fLab[2] >= 0 ) lb[nla++] = l.fLab[2];
ce565086 861 }
fbb9b71b 862
863 sort( lb, lb + nla );
864 int labmax = -1, labcur = -1, lmax = 0, lcurr = 0;
865 for ( int i = 0; i < nla; i++ ) {
866 if ( lb[i] != labcur ) {
867 if ( labcur >= 0 && lmax < lcurr ) {
868 lmax = lcurr;
869 labmax = labcur;
870 }
871 labcur = lb[i];
872 lcurr = 0;
873 }
874 lcurr++;
00d07bcd 875 }
fbb9b71b 876 if ( labcur >= 0 && lmax < lcurr ) {
877 lmax = lcurr;
878 labmax = labcur;
00d07bcd 879 }
ce565086 880 lmax = 0;
fbb9b71b 881 for ( int ih = 0; ih < nHits; ih++ ) {
882 AliHLTTPCCAHitLabel &l = fHitLabels[fTracker->Hits()[hits[ih]].ID()];
883 if ( l.fLab[0] == labmax || l.fLab[1] == labmax || l.fLab[2] == labmax
884 ) lmax++;
ce565086 885 }
886 traLabels[itr] = labmax;
fbb9b71b 887 traPurity[itr] = ( ( nHits > 0 ) ? double( lmax ) / double( nHits ) : 0 );
00d07bcd 888 }
ce565086 889 }
00d07bcd 890
fbb9b71b 891 nRecTot += traN;
892
893 for ( int itr = 0; itr < traN; itr++ ) {
894 if ( traPurity[itr] < .9 || traLabels[itr] < 0 || traLabels[itr] >= fNMCTracks ) {
ce565086 895 nGhost++;
896 continue;
897 }
fbb9b71b 898
899 AliHLTTPCCAMCTrack &mc = fMCTracks[traLabels[itr]];
900 mc.SetNReconstructed( mc.NReconstructed() + 1 );
901 if ( mc.Set() == 0 ) nRecOut++;
902 else {
903 if ( mc.NReconstructed() == 1 ) nRecAll++;
904 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesAll++;
905 if ( mc.Set() == 2 ) {
906 if ( mc.NReconstructed() == 1 ) nRecRef++;
907 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesRef++;
ce565086 908 }
fbb9b71b 909 }
ce565086 910 }
00d07bcd 911
fbb9b71b 912 for ( int ipart = 0; ipart < fNMCTracks; ipart++ ) {
ce565086 913 AliHLTTPCCAMCTrack &mc = fMCTracks[ipart];
fbb9b71b 914 if ( mc.Set() > 0 ) fhSeedEffVsP->Fill( mc.P(), ( mc.NReconstructed() > 0 ? 1 : 0 ) );
915 }
d54804bf 916
fbb9b71b 917 if ( traLabels ) delete[] traLabels;
918 if ( traPurity ) delete[] traPurity;
00d07bcd 919
ce565086 920 fStatSeedNRecTot += nRecTot;
921 fStatSeedNRecOut += nRecOut;
922 fStatSeedNGhost += nGhost;
923 fStatSeedNMCAll += nMCAll;
924 fStatSeedNRecAll += nRecAll;
925 fStatSeedNClonesAll += nClonesAll;
926 fStatSeedNMCRef += nMCRef;
927 fStatSeedNRecRef += nRecRef;
928 fStatSeedNClonesRef += nClonesRef;
929
fbb9b71b 930 if ( nMCAll == 0 ) return;
931
932 if ( PrintFlag ) {
933 cout << "Track seed performance for slice " << iSlice << " : " << endl;
934 cout << " N tracks : "
935 << nMCAll << " mc all, "
936 << nMCRef << " mc ref, "
937 << nRecTot << " rec total, "
938 << nRecAll << " rec all, "
939 << nClonesAll << " clones all, "
940 << nRecRef << " rec ref, "
941 << nClonesRef << " clones ref, "
942 << nRecOut << " out, "
943 << nGhost << " ghost" << endl;
944
945 int nRecExtr = nRecAll - nRecRef;
946 int nMCExtr = nMCAll - nMCRef;
947 int nClonesExtr = nClonesAll - nClonesRef;
948
949 double dRecTot = ( nRecTot > 0 ) ? nRecTot : 1;
950 double dMCAll = ( nMCAll > 0 ) ? nMCAll : 1;
951 double dMCRef = ( nMCRef > 0 ) ? nMCRef : 1;
952 double dMCExtr = ( nMCExtr > 0 ) ? nMCExtr : 1;
953 double dRecAll = ( nRecAll + nClonesAll > 0 ) ? nRecAll + nClonesAll : 1;
954 double dRecRef = ( nRecRef + nClonesRef > 0 ) ? nRecRef + nClonesRef : 1;
955 double dRecExtr = ( nRecExtr + nClonesExtr > 0 ) ? nRecExtr + nClonesExtr : 1;
956
957 cout << " EffRef = ";
958 if ( nMCRef > 0 ) cout << nRecRef / dMCRef; else cout << "_";
959 cout << ", CloneRef = ";
960 if ( nRecRef > 0 ) cout << nClonesRef / dRecRef; else cout << "_";
961 cout << endl;
962 cout << " EffExtra = ";
963 if ( nMCExtr > 0 ) cout << nRecExtr / dMCExtr; else cout << "_";
964 cout << ", CloneExtra = ";
965 if ( nRecExtr > 0 ) cout << nClonesExtr / dRecExtr; else cout << "_";
966 cout << endl;
967 cout << " EffAll = ";
968 if ( nMCAll > 0 ) cout << nRecAll / dMCAll; else cout << "_";
969 cout << ", CloneAll = ";
970 if ( nRecAll > 0 ) cout << nClonesAll / dRecAll; else cout << "_";
971 cout << endl;
972 cout << " Out = ";
973 if ( nRecTot > 0 ) cout << nRecOut / dRecTot; else cout << "_";
974 cout << ", Ghost = ";
975 if ( nRecTot > 0 ) cout << nGhost / dRecTot; else cout << "_";
976 cout << endl;
ce565086 977 }
6de2bc40 978#endif
ce565086 979}
980
981
982
983
6de2bc40 984void AliHLTTPCCAPerformance::SliceTrackCandPerformance( int /*iSlice*/, bool /*PrintFlag*/ )
fbb9b71b 985{
ce565086 986 //* calculate slice tracker performance
6de2bc40 987#ifdef XXX
fbb9b71b 988 if ( !fTracker ) return;
989
990 int nRecTot = 0, nGhost = 0, nRecOut = 0;
991 int nMCAll = 0, nRecAll = 0, nClonesAll = 0;
992 int nMCRef = 0, nRecRef = 0, nClonesRef = 0;
4acc2401 993 const AliHLTTPCCATracker &slice = fTracker->Slice( iSlice );
ce565086 994
fbb9b71b 995 int firstSliceHit = fTracker->FirstSliceHit()[iSlice];
996 int endSliceHit = fTracker->NHits();
997 if ( iSlice < fTracker->NSlices() - 1 ) endSliceHit = fTracker->FirstSliceHit()[iSlice+1];
ce565086 998
999 // Select reconstructable MC tracks
1000
1001 {
fbb9b71b 1002 for ( int imc = 0; imc < fNMCTracks; imc++ ) fMCTracks[imc].SetNHits( 0 );
1003
1004 for ( int ih = firstSliceHit; ih < endSliceHit; ih++ ) {
1005 int id = fTracker->Hits()[ih].ID();
1006 if ( id < 0 || id >= fNHits ) break;
ce565086 1007 AliHLTTPCCAHitLabel &l = fHitLabels[id];
fbb9b71b 1008 if ( l.fLab[0] >= 0 ) fMCTracks[l.fLab[0]].SetNHits( fMCTracks[l.fLab[0]].NHits() + 1 );
1009 if ( l.fLab[1] >= 0 ) fMCTracks[l.fLab[1]].SetNHits( fMCTracks[l.fLab[1]].NHits() + 1 );
1010 if ( l.fLab[2] >= 0 ) fMCTracks[l.fLab[2]].SetNHits( fMCTracks[l.fLab[2]].NHits() + 1 );
ce565086 1011 }
fbb9b71b 1012
1013 for ( int imc = 0; imc < fNMCTracks; imc++ ) {
ce565086 1014 AliHLTTPCCAMCTrack &mc = fMCTracks[imc];
1015 mc.SetSet( 0 );
1016 mc.SetNReconstructed( 0 );
1017 mc.SetNTurns( 1 );
fbb9b71b 1018 if ( mc.NHits() >= 30 && mc.P() >= .05 ) {
1019 mc.SetSet( 1 );
1020 nMCAll++;
1021 if ( mc.NHits() >= 30 && mc.P() >= 1. ) {
1022 mc.SetSet( 2 );
1023 nMCRef++;
1024 }
ce565086 1025 }
1026 }
1027 }
d54804bf 1028
4acc2401 1029 int traN = slice.NTracklets();
fbb9b71b 1030 int *traLabels = 0;
1031 double *traPurity = 0;
1032 traLabels = new int[traN];
1033 traPurity = new double[traN];
ce565086 1034 {
fbb9b71b 1035 for ( int itr = 0; itr < traN; itr++ ) {
1036 traLabels[itr] = -1;
1037 traPurity[itr] = 0;
ce565086 1038
4acc2401 1039 const AliHLTTPCCATracklet &t = slice.Tracklet( itr );
fbb9b71b 1040
1041 int nHits = t.NHits();
1042 if ( nHits < 10 ) continue;
1043 int firstRow = t.FirstRow();
1044 int lastRow = t.LastRow();
1045 nHits = 0;
1046
1047 int lb[1600*3];
1048 int nla = 0;
1049
1050 for ( int irow = firstRow; irow <= lastRow; irow++ ) {
b22af1bf 1051#ifdef EXTERN_ROW_HITS
1052 int ih = slice.TrackletRowHits[iRow * *slice.NTracklets() + itr];
1053#else
1054 int ih = t.RowHit( irow );
1055#endif
fbb9b71b 1056 if ( ih < 0 ) continue;
4acc2401 1057 int index = firstSliceHit + slice.HitInputID( slice.Row( irow ), ih );
fbb9b71b 1058 AliHLTTPCCAHitLabel &l = fHitLabels[fTracker->Hits()[index].ID()];
1059 if ( l.fLab[0] >= 0 ) lb[nla++] = l.fLab[0];
1060 if ( l.fLab[1] >= 0 ) lb[nla++] = l.fLab[1];
1061 if ( l.fLab[2] >= 0 ) lb[nla++] = l.fLab[2];
1062 nHits++;
ce565086 1063 }
fbb9b71b 1064 if ( nHits < 10 ) continue;
1065
1066 sort( lb, lb + nla );
1067 int labmax = -1, labcur = -1, lmax = 0, lcurr = 0;
1068 for ( int i = 0; i < nla; i++ ) {
1069 if ( lb[i] != labcur ) {
1070 if ( labcur >= 0 && lmax < lcurr ) {
1071 lmax = lcurr;
1072 labmax = labcur;
1073 }
1074 labcur = lb[i];
1075 lcurr = 0;
1076 }
1077 lcurr++;
ce565086 1078 }
fbb9b71b 1079 if ( labcur >= 0 && lmax < lcurr ) {
1080 lmax = lcurr;
1081 labmax = labcur;
ce565086 1082 }
1083 lmax = 0;
fbb9b71b 1084 for ( int irow = firstRow; irow <= lastRow; irow++ ) {
b22af1bf 1085#ifdef EXTERN_ROW_HITS
1086 int ih = slice.TrackletRowHits[iRow * *slice.NTracklets() + itr];
1087#else
1088 int ih = t.RowHit( irow );
1089#endif
fbb9b71b 1090 if ( ih < 0 ) continue;
4acc2401 1091 int index = firstSliceHit + slice.HitInputID( slice.Row( irow ), ih );
fbb9b71b 1092 AliHLTTPCCAHitLabel &l = fHitLabels[fTracker->Hits()[index].ID()];
1093 if ( l.fLab[0] == labmax || l.fLab[1] == labmax || l.fLab[2] == labmax
1094 ) lmax++;
d54804bf 1095 }
ce565086 1096 traLabels[itr] = labmax;
fbb9b71b 1097 traPurity[itr] = ( ( nHits > 0 ) ? double( lmax ) / double( nHits ) : 0 );
d54804bf 1098 }
1099 }
fbb9b71b 1100
1101 nRecTot += traN;
1102
1103 for ( int itr = 0; itr < traN; itr++ ) {
1104 if ( traPurity[itr] < .9 || traLabels[itr] < 0 || traLabels[itr] >= fNMCTracks ) {
ce565086 1105 nGhost++;
1106 continue;
1107 }
fbb9b71b 1108
1109 AliHLTTPCCAMCTrack &mc = fMCTracks[traLabels[itr]];
1110 mc.SetNReconstructed( mc.NReconstructed() + 1 );
1111 if ( mc.Set() == 0 ) nRecOut++;
1112 else {
1113 if ( mc.NReconstructed() == 1 ) nRecAll++;
1114 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesAll++;
1115 if ( mc.Set() == 2 ) {
1116 if ( mc.NReconstructed() == 1 ) nRecRef++;
1117 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesRef++;
ce565086 1118 }
fbb9b71b 1119 }
ce565086 1120 }
1121
fbb9b71b 1122 for ( int ipart = 0; ipart < fNMCTracks; ipart++ ) {
ce565086 1123 AliHLTTPCCAMCTrack &mc = fMCTracks[ipart];
fbb9b71b 1124 if ( mc.Set() > 0 ) fhCandEffVsP->Fill( mc.P(), ( mc.NReconstructed() > 0 ? 1 : 0 ) );
1125 }
ce565086 1126
fbb9b71b 1127 if ( traLabels ) delete[] traLabels;
1128 if ( traPurity ) delete[] traPurity;
ce565086 1129
1130 fStatCandNRecTot += nRecTot;
1131 fStatCandNRecOut += nRecOut;
1132 fStatCandNGhost += nGhost;
1133 fStatCandNMCAll += nMCAll;
1134 fStatCandNRecAll += nRecAll;
1135 fStatCandNClonesAll += nClonesAll;
1136 fStatCandNMCRef += nMCRef;
1137 fStatCandNRecRef += nRecRef;
1138 fStatCandNClonesRef += nClonesRef;
1139
fbb9b71b 1140 if ( nMCAll == 0 ) return;
1141
1142 if ( PrintFlag ) {
1143 cout << "Track candidate performance for slice " << iSlice << " : " << endl;
1144 cout << " N tracks : "
1145 << nMCAll << " mc all, "
1146 << nMCRef << " mc ref, "
1147 << nRecTot << " rec total, "
1148 << nRecAll << " rec all, "
1149 << nClonesAll << " clones all, "
1150 << nRecRef << " rec ref, "
1151 << nClonesRef << " clones ref, "
1152 << nRecOut << " out, "
1153 << nGhost << " ghost" << endl;
1154
1155 int nRecExtr = nRecAll - nRecRef;
1156 int nMCExtr = nMCAll - nMCRef;
1157 int nClonesExtr = nClonesAll - nClonesRef;
1158
1159 double dRecTot = ( nRecTot > 0 ) ? nRecTot : 1;
1160 double dMCAll = ( nMCAll > 0 ) ? nMCAll : 1;
1161 double dMCRef = ( nMCRef > 0 ) ? nMCRef : 1;
1162 double dMCExtr = ( nMCExtr > 0 ) ? nMCExtr : 1;
1163 double dRecAll = ( nRecAll + nClonesAll > 0 ) ? nRecAll + nClonesAll : 1;
1164 double dRecRef = ( nRecRef + nClonesRef > 0 ) ? nRecRef + nClonesRef : 1;
1165 double dRecExtr = ( nRecExtr + nClonesExtr > 0 ) ? nRecExtr + nClonesExtr : 1;
1166
1167 cout << " EffRef = ";
1168 if ( nMCRef > 0 ) cout << nRecRef / dMCRef; else cout << "_";
1169 cout << ", CloneRef = ";
1170 if ( nRecRef > 0 ) cout << nClonesRef / dRecRef; else cout << "_";
1171 cout << endl;
1172 cout << " EffExtra = ";
1173 if ( nMCExtr > 0 ) cout << nRecExtr / dMCExtr; else cout << "_";
1174 cout << ", CloneExtra = ";
1175 if ( nRecExtr > 0 ) cout << nClonesExtr / dRecExtr; else cout << "_";
1176 cout << endl;
1177 cout << " EffAll = ";
1178 if ( nMCAll > 0 ) cout << nRecAll / dMCAll; else cout << "_";
1179 cout << ", CloneAll = ";
1180 if ( nRecAll > 0 ) cout << nClonesAll / dRecAll; else cout << "_";
1181 cout << endl;
1182 cout << " Out = ";
1183 if ( nRecTot > 0 ) cout << nRecOut / dRecTot; else cout << "_";
1184 cout << ", Ghost = ";
1185 if ( nRecTot > 0 ) cout << nGhost / dRecTot; else cout << "_";
1186 cout << endl;
ce565086 1187 }
6de2bc40 1188#endif
ce565086 1189}
1190
1191
1192
6d869045 1193void AliHLTTPCCAPerformance::SlicePerformance( int /*iSlice*/, bool /*PrintFlag*/ )
fbb9b71b 1194{
ce565086 1195 //* calculate slice tracker performance
6d869045 1196#ifdef XXX
6de2bc40 1197 AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
fbb9b71b 1198
1199 int nRecTot = 0, nGhost = 0, nRecOut = 0;
1200 int nMCAll = 0, nRecAll = 0, nClonesAll = 0;
1201 int nMCRef = 0, nRecRef = 0, nClonesRef = 0;
b22af1bf 1202 //const AliHLTTPCCATracker &tracker = hlt.SliceTracker( iSlice );
1203 const AliHLTTPCCAClusterData &clusterdata = hlt.ClusterData(iSlice);
00d07bcd 1204
d54804bf 1205 // Select reconstructable MC tracks
1206
1207 {
fbb9b71b 1208 for ( int imc = 0; imc < fNMCTracks; imc++ ) fMCTracks[imc].SetNHits( 0 );
b8139972 1209
b22af1bf 1210 for ( int ih = 0; ih < clusterdata.NumberOfClusters(); ih++ ) {
1211 int id = clusterdata.Id( ih );
fbb9b71b 1212 if ( id < 0 || id > fNHits ) break;
4687b8fc 1213 AliHLTTPCCAHitLabel &l = fHitLabels[id];
fbb9b71b 1214 if ( l.fLab[0] >= 0 ) fMCTracks[l.fLab[0]].SetNHits( fMCTracks[l.fLab[0]].NHits() + 1 );
1215 if ( l.fLab[1] >= 0 ) fMCTracks[l.fLab[1]].SetNHits( fMCTracks[l.fLab[1]].NHits() + 1 );
1216 if ( l.fLab[2] >= 0 ) fMCTracks[l.fLab[2]].SetNHits( fMCTracks[l.fLab[2]].NHits() + 1 );
d54804bf 1217 }
fbb9b71b 1218
1219 for ( int imc = 0; imc < fNMCTracks; imc++ ) {
d54804bf 1220 AliHLTTPCCAMCTrack &mc = fMCTracks[imc];
ce565086 1221 mc.SetSet( 0 );
1222 mc.SetNReconstructed( 0 );
1223 mc.SetNTurns( 1 );
fbb9b71b 1224 if ( mc.NHits() >= 30 && mc.P() >= .05 ) {
1225 mc.SetSet( 1 );
1226 nMCAll++;
1227 if ( mc.NHits() >= 30 && mc.P() >= 1. ) {
1228 mc.SetSet( 2 );
1229 nMCRef++;
1230 }
d54804bf 1231 }
1232 }
1233 }
b8139972 1234
b22af1bf 1235 //if ( !tracker.Output() ) return;
d54804bf 1236
b22af1bf 1237 const AliHLTTPCCASliceOutput &output = hlt.Output(iSlice);
d54804bf 1238
6de2bc40 1239 int traN = output.NTracks();
eb30eb49 1240
6de2bc40 1241 nRecTot += traN;
b8139972 1242
0f1f07c3 1243 const AliHLTTPCCASliceOutTrack *tCA = output.GetFirstTrack();
6de2bc40 1244
0f1f07c3 1245 for ( int itr = 0; itr < traN; itr++ ) {
1246
6de2bc40 1247 std::vector<int> clusterIDs;
0f1f07c3 1248 for ( int i = 0; i < tCA->NClusters(); i++ ) {
1828ede1 1249 UInt_t id, row;
0f1f07c3 1250 float x,y,z;
1828ede1 1251 tCA->Cluster(i).Get(iSlice,id,row,x,y,z);
0f1f07c3 1252 clusterIDs.push_back( id );
b8139972 1253 }
0f1f07c3 1254 tCA = tCA->GetNextTrack();
6de2bc40 1255 int label;
1256 float purity;
1257 GetMCLabel( clusterIDs, label, purity );
1258
1259 if ( purity < .9 || label < 0 || label >= fNMCTracks ) {
d54804bf 1260 nGhost++;
1261 continue;
1262 }
b8139972 1263
6de2bc40 1264 AliHLTTPCCAMCTrack &mc = fMCTracks[label];
fbb9b71b 1265 mc.SetNReconstructed( mc.NReconstructed() + 1 );
1266 if ( mc.Set() == 0 ) nRecOut++;
1267 else {
1268 if ( mc.NReconstructed() == 1 ) nRecAll++;
1269 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesAll++;
1270 if ( mc.Set() == 2 ) {
1271 if ( mc.NReconstructed() == 1 ) nRecRef++;
1272 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesRef++;
d54804bf 1273 }
fbb9b71b 1274 }
6de2bc40 1275
d54804bf 1276 }
1277
6de2bc40 1278
fbb9b71b 1279 for ( int ipart = 0; ipart < fNMCTracks; ipart++ ) {
d54804bf 1280 AliHLTTPCCAMCTrack &mc = fMCTracks[ipart];
fbb9b71b 1281 if ( mc.Set() > 0 ) fhEffVsP->Fill( mc.P(), ( mc.NReconstructed() > 0 ? 1 : 0 ) );
1282 }
d54804bf 1283
d54804bf 1284
1285 fStatNRecTot += nRecTot;
1286 fStatNRecOut += nRecOut;
1287 fStatNGhost += nGhost;
1288 fStatNMCAll += nMCAll;
1289 fStatNRecAll += nRecAll;
1290 fStatNClonesAll += nClonesAll;
1291 fStatNMCRef += nMCRef;
1292 fStatNRecRef += nRecRef;
1293 fStatNClonesRef += nClonesRef;
1294
fbb9b71b 1295 if ( nMCAll == 0 ) return;
1296
1297 if ( PrintFlag ) {
1298 cout << "Performance for slice " << iSlice << " : " << endl;
1299 cout << " N tracks : "
1300 << nMCAll << " mc all, "
1301 << nMCRef << " mc ref, "
1302 << nRecTot << " rec total, "
1303 << nRecAll << " rec all, "
1304 << nClonesAll << " clones all, "
1305 << nRecRef << " rec ref, "
1306 << nClonesRef << " clones ref, "
1307 << nRecOut << " out, "
1308 << nGhost << " ghost" << endl;
1309
1310 int nRecExtr = nRecAll - nRecRef;
1311 int nMCExtr = nMCAll - nMCRef;
1312 int nClonesExtr = nClonesAll - nClonesRef;
1313
1314 double dRecTot = ( nRecTot > 0 ) ? nRecTot : 1;
1315 double dMCAll = ( nMCAll > 0 ) ? nMCAll : 1;
1316 double dMCRef = ( nMCRef > 0 ) ? nMCRef : 1;
1317 double dMCExtr = ( nMCExtr > 0 ) ? nMCExtr : 1;
1318 double dRecAll = ( nRecAll + nClonesAll > 0 ) ? nRecAll + nClonesAll : 1;
1319 double dRecRef = ( nRecRef + nClonesRef > 0 ) ? nRecRef + nClonesRef : 1;
1320 double dRecExtr = ( nRecExtr + nClonesExtr > 0 ) ? nRecExtr + nClonesExtr : 1;
1321
1322 cout << " EffRef = ";
1323 if ( nMCRef > 0 ) cout << nRecRef / dMCRef; else cout << "_";
1324 cout << ", CloneRef = ";
1325 if ( nRecRef > 0 ) cout << nClonesRef / dRecRef; else cout << "_";
1326 cout << endl;
1327 cout << " EffExtra = ";
1328 if ( nMCExtr > 0 ) cout << nRecExtr / dMCExtr; else cout << "_";
1329 cout << ", CloneExtra = ";
1330 if ( nRecExtr > 0 ) cout << nClonesExtr / dRecExtr; else cout << "_";
1331 cout << endl;
1332 cout << " EffAll = ";
1333 if ( nMCAll > 0 ) cout << nRecAll / dMCAll; else cout << "_";
1334 cout << ", CloneAll = ";
1335 if ( nRecAll > 0 ) cout << nClonesAll / dRecAll; else cout << "_";
1336 cout << endl;
1337 cout << " Out = ";
1338 if ( nRecTot > 0 ) cout << nRecOut / dRecTot; else cout << "_";
1339 cout << ", Ghost = ";
1340 if ( nRecTot > 0 ) cout << nGhost / dRecTot; else cout << "_";
1341 cout << endl;
d54804bf 1342 }
6d869045 1343#endif
d54804bf 1344}
1345
1346
6de2bc40 1347
1348void AliHLTTPCCAPerformance::MergerPerformance()
fbb9b71b 1349{
6de2bc40 1350 // performance calculation for merged tracks
6d869045 1351#ifdef XXX
6de2bc40 1352 int nRecTot = 0, nGhost = 0, nRecOut = 0;
1353 int nMCAll = 0, nRecAll = 0, nClonesAll = 0;
1354 int nMCRef = 0, nRecRef = 0, nClonesRef = 0;
b8139972 1355
6de2bc40 1356 // Select reconstructable MC tracks
00d07bcd 1357
eb30eb49 1358 {
6de2bc40 1359 for ( int imc = 0; imc < fNMCTracks; imc++ ) fMCTracks[imc].SetNHits( 0 );
eb30eb49 1360
6de2bc40 1361 for ( int ih = 0; ih < fNHits; ih++ ) {
1362 AliHLTTPCCAHitLabel &l = fHitLabels[ih];
1363 if ( l.fLab[0] >= 0 ) fMCTracks[l.fLab[0]].SetNHits( fMCTracks[l.fLab[0]].NHits() + 1 );
1364 if ( l.fLab[1] >= 0 ) fMCTracks[l.fLab[1]].SetNHits( fMCTracks[l.fLab[1]].NHits() + 1 );
1365 if ( l.fLab[2] >= 0 ) fMCTracks[l.fLab[2]].SetNHits( fMCTracks[l.fLab[2]].NHits() + 1 );
1366 }
eb30eb49 1367
6de2bc40 1368 for ( int imc = 0; imc < fNMCTracks; imc++ ) {
1369 AliHLTTPCCAMCTrack &mc = fMCTracks[imc];
1370 mc.SetSet( 0 );
1371 mc.SetNReconstructed( 0 );
1372 mc.SetNTurns( 1 );
1373 if ( mc.NHits() >= 50 && mc.P() >= .05 ) {
b8139972 1374 mc.SetSet( 1 );
1375 nMCAll++;
1376 if ( mc.P() >= 1. ) {
1377 mc.SetSet( 2 );
1378 nMCRef++;
1379 }
6de2bc40 1380 }
1381 }
1382 }
fbb9b71b 1383
6de2bc40 1384 AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
fbb9b71b 1385
b8139972 1386 if ( !hlt.Merger().Output() ) return;
eb30eb49 1387
b8139972 1388 const AliHLTTPCCAMergerOutput &output = *( hlt.Merger().Output() );
fbb9b71b 1389
6de2bc40 1390 int traN = output.NTracks();
eb30eb49 1391
6de2bc40 1392 nRecTot += traN;
b8139972 1393
6de2bc40 1394 for ( int itr = 0; itr < traN; itr++ ) {
fbb9b71b 1395
6de2bc40 1396 const AliHLTTPCCAMergedTrack &tCA = output.Track( itr );
1397 std::vector<int> clusterIDs;
1398 for ( int i = 0; i < tCA.NClusters(); i++ ) {
b8139972 1399 clusterIDs.push_back( output.ClusterId( tCA.FirstClusterRef() + i ) );
1400 }
6de2bc40 1401 int label;
1402 float purity;
1403 GetMCLabel( clusterIDs, label, purity );
eb30eb49 1404
6de2bc40 1405 if ( purity < .9 || label < 0 || label >= fNMCTracks ) {
1406 nGhost++;
1407 continue;
1408 }
b8139972 1409
6de2bc40 1410 AliHLTTPCCAMCTrack &mc = fMCTracks[label];
1411 mc.SetNReconstructed( mc.NReconstructed() + 1 );
1412 if ( mc.Set() == 0 ) nRecOut++;
1413 else {
1414 if ( mc.NReconstructed() == 1 ) nRecAll++;
1415 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesAll++;
fbb9b71b 1416 if ( mc.Set() == 2 ) {
6de2bc40 1417 if ( mc.NReconstructed() == 1 ) nRecRef++;
1418 else if ( mc.NReconstructed() > mc.NTurns() ) nClonesRef++;
b8139972 1419 fhTrackLengthRef->Fill( tCA.NClusters() / ( ( double ) mc.NHits() ) );
eb30eb49 1420 }
fbb9b71b 1421 }
b8139972 1422
6de2bc40 1423 // track resolutions
1424 while ( mc.Set() == 2 && TMath::Abs( mc.TPCPar()[0] ) + TMath::Abs( mc.TPCPar()[1] ) > 1 ) {
1425
1426 if ( purity < .90 ) break;
1427 AliHLTTPCCATrackParam p = tCA.InnerParam();
1428 double cosA = TMath::Cos( tCA.InnerAlpha() );
1429 double sinA = TMath::Sin( tCA.InnerAlpha() );
1430 double mcX = mc.TPCPar()[0] * cosA + mc.TPCPar()[1] * sinA;
1431 double mcY = -mc.TPCPar()[0] * sinA + mc.TPCPar()[1] * cosA;
1432 double mcZ = mc.TPCPar()[2];
1433 double mcEx = mc.TPCPar()[3] * cosA + mc.TPCPar()[4] * sinA;
1434 double mcEy = -mc.TPCPar()[3] * sinA + mc.TPCPar()[4] * cosA;
1435 double mcEz = mc.TPCPar()[5];
1436 double mcEt = TMath::Sqrt( mcEx * mcEx + mcEy * mcEy );
1437 if ( TMath::Abs( mcEt ) < 1.e-4 ) break;
1438 double mcSinPhi = mcEy / mcEt;
1439 double mcDzDs = mcEz / mcEt;
1440 double mcQPt = mc.TPCPar()[6] / mcEt;
1441 if ( TMath::Abs( mcQPt ) < 1.e-4 ) break;
1442 double mcPt = 1. / TMath::Abs( mcQPt );
1443
1444 if ( mcPt < 1. ) break;
1445
1446 if ( tCA.NClusters() < 50 ) break;
1447 if ( !p.TransportToXWithMaterial( mcX, hlt.Merger().SliceParam().GetBz( p ) ) ) break;
1448 if ( p.GetCosPhi()*mcEx < 0 ) { // change direction
b8139972 1449 mcSinPhi = -mcSinPhi;
1450 mcDzDs = -mcDzDs;
1451 mcQPt = -mcQPt;
6de2bc40 1452 }
b8139972 1453
6de2bc40 1454 double qPt = p.GetQPt();
1455 double pt = 100;
1456 if ( TMath::Abs( qPt ) > 1.e-4 ) pt = 1. / TMath::Abs( qPt );
b8139972 1457
6de2bc40 1458 fhResY->Fill( p.GetY() - mcY );
1459 fhResZ->Fill( p.GetZ() - mcZ );
1460 fhResSinPhi->Fill( p.GetSinPhi() - mcSinPhi );
1461 fhResDzDs->Fill( p.GetDzDs() - mcDzDs );
1462 fhResPt->Fill( ( pt - mcPt ) / mcPt );
1463
1464 if ( p.GetErr2Y() > 0 ) fhPullY->Fill( ( p.GetY() - mcY ) / TMath::Sqrt( p.GetErr2Y() ) );
1465 if ( p.GetErr2Z() > 0 ) fhPullZ->Fill( ( p.GetZ() - mcZ ) / TMath::Sqrt( p.GetErr2Z() ) );
b8139972 1466
6de2bc40 1467 if ( p.GetErr2SinPhi() > 0 ) fhPullSinPhi->Fill( ( p.GetSinPhi() - mcSinPhi ) / TMath::Sqrt( p.GetErr2SinPhi() ) );
1468 if ( p.GetErr2DzDs() > 0 ) fhPullDzDs->Fill( ( p.DzDs() - mcDzDs ) / TMath::Sqrt( p.GetErr2DzDs() ) );
b8139972 1469 if ( p.GetErr2QPt() > 0 ) fhPullQPt->Fill( ( qPt - mcQPt ) / TMath::Sqrt( p.GetErr2QPt() ) );
1470 fhPullYS->Fill( TMath::Sqrt( hlt.Merger().GetChi2( p.GetY(), p.GetSinPhi(), p.GetCov()[0], p.GetCov()[3], p.GetCov()[5], mcY, mcSinPhi, 0, 0, 0 ) ) );
1471 fhPullZT->Fill( TMath::Sqrt( hlt.Merger().GetChi2( p.GetZ(), p.GetDzDs(), p.GetCov()[2], p.GetCov()[7], p.GetCov()[9], mcZ, mcDzDs, 0, 0, 0 ) ) );
1472
6de2bc40 1473 break;
1474 } // end resolutions
1475
1476 }// end reco tracks
eb30eb49 1477
6de2bc40 1478
1479 for ( int ipart = 0; ipart < fNMCTracks; ipart++ ) {
1480 AliHLTTPCCAMCTrack &mc = fMCTracks[ipart];
1481 if ( mc.Set() > 0 ) fhGBEffVsP->Fill( mc.P(), ( mc.NReconstructed() > 0 ? 1 : 0 ) );
1482 if ( mc.Set() > 0 ) fhGBEffVsPt->Fill( mc.Pt(), ( mc.NReconstructed() > 0 ? 1 : 0 ) );
1483 if ( mc.Set() == 2 ) {
1484 const double *p = mc.TPCPar();
1485 double r = TMath::Sqrt( p[0] * p[0] + p[1] * p[1] );
1486 double cosA = p[0] / r;
1487 double sinA = p[1] / r;
1488
1489
1490 double phipos = TMath::Pi() + TMath::ATan2( -p[1], -p[0] );
1491 double alpha = TMath::Pi() * ( 20 * ( ( ( ( int )( phipos * 180 / TMath::Pi() ) ) / 20 ) ) + 10 ) / 180.;
1492 cosA = TMath::Cos( alpha );
1493 sinA = TMath::Sin( alpha );
b8139972 1494
6de2bc40 1495 double mcX = p[0] * cosA + p[1] * sinA;
1496 double mcY = -p[0] * sinA + p[1] * cosA;
1497 double mcZ = p[2];
1498 double mcEx = p[3] * cosA + p[4] * sinA;
1499 double mcEy = -p[3] * sinA + p[4] * cosA;
1500 double mcEz = p[5];
1501 //double mcEt = TMath::Sqrt(mcEx*mcEx + mcEy*mcEy);
1502 double angleY = TMath::ATan2( mcEy, mcEx ) * 180. / TMath::Pi();
1503 double angleZ = TMath::ATan2( mcEz, mcEx ) * 180. / TMath::Pi();
b8139972 1504
6de2bc40 1505 if ( mc.NReconstructed() > 0 ) {
b8139972 1506 fhRefRecoX->Fill( mcX );
1507 fhRefRecoY->Fill( mcY );
1508 fhRefRecoZ->Fill( mcZ );
1509 fhRefRecoP->Fill( mc.P() );
1510 fhRefRecoPt->Fill( mc.Pt() );
1511 fhRefRecoAngleY->Fill( angleY );
1512 fhRefRecoAngleZ->Fill( angleZ );
1513 fhRefRecoNHits->Fill( mc.NHits() );
6de2bc40 1514 } else {
b8139972 1515 fhRefNotRecoX->Fill( mcX );
1516 fhRefNotRecoY->Fill( mcY );
1517 fhRefNotRecoZ->Fill( mcZ );
1518 fhRefNotRecoP->Fill( mc.P() );
1519 fhRefNotRecoPt->Fill( mc.Pt() );
1520 fhRefNotRecoAngleY->Fill( angleY );
1521 fhRefNotRecoAngleZ->Fill( angleZ );
1522 fhRefNotRecoNHits->Fill( mc.NHits() );
6de2bc40 1523 }
1524 }
eb30eb49 1525 }
b8139972 1526
6de2bc40 1527 fStatGBNRecTot += nRecTot;
1528 fStatGBNRecOut += nRecOut;
1529 fStatGBNGhost += nGhost;
1530 fStatGBNMCAll += nMCAll;
1531 fStatGBNRecAll += nRecAll;
1532 fStatGBNClonesAll += nClonesAll;
1533 fStatGBNMCRef += nMCRef;
1534 fStatGBNRecRef += nRecRef;
1535 fStatGBNClonesRef += nClonesRef;
6d869045 1536#endif
6de2bc40 1537}
1538
eb30eb49 1539
fbb9b71b 1540
6de2bc40 1541void AliHLTTPCCAPerformance::ClusterPerformance()
1542{
1543 // performance calculation for input clusters
1544
1545 AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
b8139972 1546
d54804bf 1547 // distribution of cluster errors
1548
b8139972 1549 for ( int iSlice = 0; iSlice < hlt.NSlices(); iSlice++ ) {
6de2bc40 1550 const AliHLTTPCCAClusterData &data = hlt.ClusterData( iSlice );
b8139972 1551 for ( int i = 0; i < data.NumberOfClusters(); i++ ) {
1552 AliHLTTPCCAHitLabel &l = fHitLabels[data.Id( i )];
fbb9b71b 1553 int nmc = 0;
1554 for ( int il = 0; il < 3; il++ ) if ( l.fLab[il] >= 0 ) nmc++;
b8139972 1555 if ( nmc == 1 ) fhHitShared->Fill( data.RowNumber( i ), 0 );
1556 else if ( nmc > 1 ) fhHitShared->Fill( data.RowNumber( i ), 1 );
d54804bf 1557 }
1558 }
eb30eb49 1559
1560 // cluster pulls
1561
6de2bc40 1562 if ( !fDoClusterPulls || fNMCPoints <= 0 ) return;
eb30eb49 1563
6de2bc40 1564 // sort mc points
b8139972 1565 if ( 1 ) {
6de2bc40 1566 for ( int ipart = 0; ipart < fNMCTracks; ipart++ ) {
1567 AliHLTTPCCAMCTrack &mc = fMCTracks[ipart];
1568 mc.SetNMCPoints( 0 );
eb30eb49 1569 }
6de2bc40 1570 sort( fMCPoints, fMCPoints + fNMCPoints, AliHLTTPCCAMCPoint::Compare );
b8139972 1571
6de2bc40 1572 for ( int ip = 0; ip < fNMCPoints; ip++ ) {
1573 AliHLTTPCCAMCPoint &p = fMCPoints[ip];
1574 AliHLTTPCCAMCTrack &t = fMCTracks[p.TrackID()];
1575 if ( t.NMCPoints() == 0 ) t.SetFirstMCPointID( ip );
1576 t.SetNMCPoints( t.NMCPoints() + 1 );
1577 }
1578 }
b8139972 1579
1580 for ( int iSlice = 0; iSlice < hlt.NSlices(); iSlice++ ) {
1581
6de2bc40 1582 const AliHLTTPCCAClusterData &data = hlt.ClusterData( iSlice );
eb30eb49 1583
b8139972 1584 for ( int ic = 0; ic < data.NumberOfClusters(); ic++ ) {
eb30eb49 1585
b8139972 1586 const AliHLTTPCCAHitLabel &l = fHitLabels[data.Id( ic )];
eb30eb49 1587
fbb9b71b 1588 if ( l.fLab[0] < 0 || l.fLab[0] >= fNMCTracks
1589 || l.fLab[1] >= 0 || l.fLab[2] >= 0 ) continue;
eb30eb49 1590
fbb9b71b 1591 int lab = l.fLab[0];
b8139972 1592
6de2bc40 1593 AliHLTTPCCAMCTrack &mc = fMCTracks[lab];
eb30eb49 1594
b8139972 1595 double x0 = data.X( ic );
1596 double y0 = data.Y( ic );
1597 double z0 = data.Z( ic );
1598
1599 if ( fabs( x0 ) < 1.e-4 ) continue;
1600 if ( mc.Pt() < .05 ) continue;
6de2bc40 1601
fbb9b71b 1602 int ip1 = -1, ip2 = -1;
1603 double d1 = 1.e20, d2 = 1.e20;
6de2bc40 1604
b8139972 1605 AliHLTTPCCAMCPoint *pStart = lower_bound( fMCPoints + mc.FirstMCPointID(), fMCPoints + mc.FirstMCPointID() + mc.NMCPoints(), iSlice, AliHLTTPCCAMCPoint::CompareSlice );
1606
1607 pStart = lower_bound( pStart, fMCPoints + mc.FirstMCPointID() + mc.NMCPoints(), x0 - 2., AliHLTTPCCAMCPoint::CompareX );
6de2bc40 1608
b8139972 1609 for ( int ip = ( pStart - fMCPoints ) - mc.FirstMCPointID(); ip < mc.NMCPoints(); ip++ ) {
6de2bc40 1610 AliHLTTPCCAMCPoint &p = fMCPoints[mc.FirstMCPointID() + ip];
1611 if ( p.ISlice() != iSlice ) break;
1612 double dx = p.Sx() - x0;
1613 double dy = p.Sy() - y0;
1614 double dz = p.Sz() - z0;
b8139972 1615 double d = dx * dx + dy * dy + dz * dz;
1616 if ( d > 9. ) continue;
1617 if ( dx <= 0 && dx > -2. ) {
1618 if ( fabs( dx ) < d1 ) {
1619 d1 = fabs( dx );
fbb9b71b 1620 ip1 = ip;
1621 }
b8139972 1622 } else if ( dx > .2 ) {
1623 if ( dx >= 2. ) break;
1624 if ( fabs( dx ) < d2 ) {
1625 d2 = fabs( dx );
fbb9b71b 1626 ip2 = ip;
1627 }
1628 }
eb30eb49 1629 }
b8139972 1630
fbb9b71b 1631 if ( ip1 < 0 || ip2 < 0 ) continue;
b8139972 1632
6de2bc40 1633 AliHLTTPCCAMCPoint &p1 = fMCPoints[mc.FirstMCPointID() + ip1];
1634 AliHLTTPCCAMCPoint &p2 = fMCPoints[mc.FirstMCPointID() + ip2];
fbb9b71b 1635 double dx = p2.Sx() - p1.Sx();
1636 double dy = p2.Sy() - p1.Sy();
1637 double dz = p2.Sz() - p1.Sz();
6de2bc40 1638 double sx = x0;
1639 double sy = p1.Sy() + dy / dx * ( sx - p1.Sx() );
1640 double sz = p1.Sz() + dz / dx * ( sx - p1.Sx() );
1641
1642 float errY, errZ;
1643 {
b8139972 1644 AliHLTTPCCATrackParam t;
1645 double s = 1. / TMath::Sqrt( dx * dx + dy * dy );
1646 t.SetZ( sz );
1647 t.SetSinPhi( dy * s );
1648 t.SetSignCosPhi( dx );
1649 t.SetDzDs( dz * s );
b22af1bf 1650 //hlt.SliceTracker( 0 ).GetErrors2( data.RowNumber( ic ), t, errY, errZ );
1651 hlt.Param(0).GetClusterErrors2( data.RowNumber( ic ), t.GetZ(), t.SinPhi(), t.GetCosPhi(), t.DzDs(), errY, errZ );
b8139972 1652 errY = TMath::Sqrt( errY );
1653 errZ = TMath::Sqrt( errZ );
6de2bc40 1654 }
1655 fhHitErrY->Fill( errY );
1656 fhHitErrZ->Fill( errZ );
1657 fhHitResY->Fill( y0 - sy );
1658 fhHitResZ->Fill( z0 - sz );
b8139972 1659 fhHitPullY->Fill( ( y0 - sy ) / errY );
1660 fhHitPullZ->Fill( ( z0 - sz ) / errZ );
1661 if ( mc.Pt() >= 1. ) {
1662 fhHitResY1->Fill( y0 - sy );
1663 fhHitResZ1->Fill( z0 - sz );
1664 fhHitPullY1->Fill( ( y0 - sy ) / errY );
1665 fhHitPullZ1->Fill( ( z0 - sz ) / errZ );
1666 }
6de2bc40 1667 }
1668 }
1669}
1670
1671
1672void AliHLTTPCCAPerformance::SmearClustersMC()
1673{
1674 // smear clusters with gaussian using MC info
1675
1676 AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
b8139972 1677
6de2bc40 1678 // cluster pulls
1679
1680 if ( fNMCPoints <= 0 ) return;
1681
1682 // sort mc points
1683 {
1684 for ( int ipart = 0; ipart < fNMCTracks; ipart++ ) {
1685 AliHLTTPCCAMCTrack &mc = fMCTracks[ipart];
1686 mc.SetNMCPoints( 0 );
1687 }
1688 sort( fMCPoints, fMCPoints + fNMCPoints, AliHLTTPCCAMCPoint::Compare );
b8139972 1689
6de2bc40 1690 for ( int ip = 0; ip < fNMCPoints; ip++ ) {
1691 AliHLTTPCCAMCPoint &p = fMCPoints[ip];
1692 AliHLTTPCCAMCTrack &t = fMCTracks[p.TrackID()];
1693 if ( t.NMCPoints() == 0 ) t.SetFirstMCPointID( ip );
1694 t.SetNMCPoints( t.NMCPoints() + 1 );
1695 }
1696 }
b8139972 1697
1698 for ( int iSlice = 0; iSlice < hlt.NSlices(); iSlice++ ) {
1699
6de2bc40 1700 AliHLTTPCCAClusterData &data = hlt.ClusterData( iSlice );
1701
b8139972 1702 for ( int ic = 0; ic < data.NumberOfClusters(); ic++ ) {
6de2bc40 1703
b8139972 1704 double x0 = data.X( ic );
1705 double y0 = data.Y( ic );
1706 double z0 = data.Z( ic );
1707 int row0 = data.RowNumber( ic );
6de2bc40 1708
1709 AliHLTTPCCAClusterData::Data *cdata = data.GetClusterData( ic );
1710 cdata->fX = 0;
1711 cdata->fY = 0;
1712 cdata->fZ = 0;
1713
b8139972 1714 const AliHLTTPCCAHitLabel &l = fHitLabels[data.Id( ic )];
6de2bc40 1715
1716 if ( l.fLab[0] < 0 || l.fLab[0] >= fNMCTracks ) continue;
1717
1718 int lab = l.fLab[0];
b8139972 1719
6de2bc40 1720 AliHLTTPCCAMCTrack &mc = fMCTracks[lab];
b8139972 1721
6de2bc40 1722 int ip1 = -1, ip2 = -1;
1723 double d1 = 1.e20, d2 = 1.e20;
1724
b8139972 1725 AliHLTTPCCAMCPoint *pStart = lower_bound( fMCPoints + mc.FirstMCPointID(), fMCPoints + mc.FirstMCPointID() + mc.NMCPoints(), iSlice, AliHLTTPCCAMCPoint::CompareSlice );
1726
1727 pStart = lower_bound( pStart, fMCPoints + mc.FirstMCPointID() + mc.NMCPoints(), x0 - 2., AliHLTTPCCAMCPoint::CompareX );
6de2bc40 1728
b8139972 1729 for ( int ip = ( pStart - fMCPoints ) - mc.FirstMCPointID(); ip < mc.NMCPoints(); ip++ ) {
6de2bc40 1730 AliHLTTPCCAMCPoint &p = fMCPoints[mc.FirstMCPointID() + ip];
1731 if ( p.ISlice() != iSlice ) break;
1732 double dx = p.Sx() - x0;
1733 double dy = p.Sy() - y0;
1734 double dz = p.Sz() - z0;
b8139972 1735 double d = dx * dx + dy * dy + dz * dz;
1736 if ( d > 9. ) continue;
1737 if ( dx <= 0 && dx > -2. ) {
1738 if ( fabs( dx ) < d1 ) {
1739 d1 = fabs( dx );
6de2bc40 1740 ip1 = ip;
1741 }
b8139972 1742 } else if ( dx > .2 ) {
1743 if ( dx >= 2. ) break;
1744 if ( fabs( dx ) < d2 ) {
1745 d2 = fabs( dx );
6de2bc40 1746 ip2 = ip;
1747 }
fbb9b71b 1748 }
eb30eb49 1749 }
b8139972 1750
6de2bc40 1751 if ( ip1 < 0 || ip2 < 0 ) continue;
b8139972 1752
6de2bc40 1753 AliHLTTPCCAMCPoint &p1 = fMCPoints[mc.FirstMCPointID() + ip1];
1754 AliHLTTPCCAMCPoint &p2 = fMCPoints[mc.FirstMCPointID() + ip2];
1755 double dx = p2.Sx() - p1.Sx();
1756 double dy = p2.Sy() - p1.Sy();
1757 double dz = p2.Sz() - p1.Sz();
1758 double sx = x0;
1759 double sy = p1.Sy() + dy / dx * ( sx - p1.Sx() );
1760 double sz = p1.Sz() + dz / dx * ( sx - p1.Sx() );
1761
1762 float errY, errZ;
1763 {
b8139972 1764 AliHLTTPCCATrackParam t;
1765 double s = 1. / TMath::Sqrt( dx * dx + dy * dy );
1766 t.SetZ( sz );
1767 t.SetSinPhi( dy * s );
1768 t.SetSignCosPhi( dx );
1769 t.SetDzDs( dz * s );
b22af1bf 1770 //hlt.SliceTracker( 0 ).GetErrors2( row0, t, errY, errZ );
1771 hlt.Param(0).GetClusterErrors2( row0, t.GetZ(), t.SinPhi(), t.GetCosPhi(), t.DzDs(), errY, errZ );
b8139972 1772 errY = TMath::Sqrt( errY );
1773 errZ = TMath::Sqrt( errZ );
6de2bc40 1774 }
1775
1776 cdata->fX = x0;
1777 cdata->fY = gRandom->Gaus( sy, errY );
1778 cdata->fZ = gRandom->Gaus( sz, errZ );
fbb9b71b 1779 }
eb30eb49 1780 }
6de2bc40 1781}
1782
1783
1784void AliHLTTPCCAPerformance::Performance( fstream *StatFile )
1785{
1786 // main routine for performance calculation
1787
1788 AliHLTTPCCAStandaloneFramework &hlt = AliHLTTPCCAStandaloneFramework::Instance();
1789
1790 //SG!!!
1791 /*
1792 fStatNEvents=0;
1793 fStatNRecTot=0;
1794 fStatNRecOut=0;
1795 fStatNGhost=0;
1796 fStatNMCAll=0;
1797 fStatNRecAll=0;
1798 fStatNClonesAll=0;
1799 fStatNMCRef=0;
1800 fStatNRecRef=0;
1801 fStatNClonesRef=0;
1802 */
1803 fStatNEvents++;
1804 for ( int islice = 0; islice < hlt.NSlices(); islice++ ) {
b8139972 1805 SliceTrackletPerformance( islice, 0 );
6de2bc40 1806 SliceTrackCandPerformance( islice, 0 );
1807 SlicePerformance( islice, 0 );
1808 }
b8139972 1809
6de2bc40 1810 MergerPerformance();
1811 //ClusterPerformance();
eb30eb49 1812
ce565086 1813 {
fbb9b71b 1814 cout << "\nSlice Track Seed performance: \n" << endl;
1815 cout << " N tracks : "
1816 << fStatNMCAll / fStatNEvents << " mc all, "
1817 << fStatSeedNMCRef / fStatNEvents << " mc ref, "
1818 << fStatSeedNRecTot / fStatNEvents << " rec total, "
1819 << fStatSeedNRecAll / fStatNEvents << " rec all, "
1820 << fStatSeedNClonesAll / fStatNEvents << " clones all, "
1821 << fStatSeedNRecRef / fStatNEvents << " rec ref, "
1822 << fStatSeedNClonesRef / fStatNEvents << " clones ref, "
1823 << fStatSeedNRecOut / fStatNEvents << " out, "
1824 << fStatSeedNGhost / fStatNEvents << " ghost" << endl;
1825
1826 int nRecExtr = fStatSeedNRecAll - fStatSeedNRecRef;
1827 int nMCExtr = fStatNMCAll - fStatNMCRef;
1828 int nClonesExtr = fStatSeedNClonesAll - fStatSeedNClonesRef;
1829
1830 double dRecTot = ( fStatSeedNRecTot > 0 ) ? fStatSeedNRecTot : 1;
1831 double dMCAll = ( fStatNMCAll > 0 ) ? fStatNMCAll : 1;
1832 double dMCRef = ( fStatNMCRef > 0 ) ? fStatNMCRef : 1;
1833 double dMCExtr = ( nMCExtr > 0 ) ? nMCExtr : 1;
1834 double dRecAll = ( fStatSeedNRecAll + fStatSeedNClonesAll > 0 ) ? fStatSeedNRecAll + fStatSeedNClonesAll : 1;
1835 double dRecRef = ( fStatSeedNRecRef + fStatSeedNClonesRef > 0 ) ? fStatSeedNRecRef + fStatSeedNClonesRef : 1;
1836 double dRecExtr = ( nRecExtr + nClonesExtr > 0 ) ? nRecExtr + nClonesExtr : 1;
1837
1838 cout << " EffRef = " << fStatSeedNRecRef / dMCRef
1839 << ", CloneRef = " << fStatSeedNClonesRef / dRecRef << endl;
1840 cout << " EffExtra = " << nRecExtr / dMCExtr
1841 << ", CloneExtra = " << nClonesExtr / dRecExtr << endl;
1842 cout << " EffAll = " << fStatSeedNRecAll / dMCAll
1843 << ", CloneAll = " << fStatSeedNClonesAll / dRecAll << endl;
1844 cout << " Out = " << fStatSeedNRecOut / dRecTot
1845 << ", Ghost = " << fStatSeedNGhost / dRecTot << endl;
ce565086 1846 }
1847
1848 {
fbb9b71b 1849 cout << "\nSlice Track candidate performance: \n" << endl;
1850 cout << " N tracks : "
1851 << fStatNMCAll / fStatNEvents << " mc all, "
1852 << fStatCandNMCRef / fStatNEvents << " mc ref, "
1853 << fStatCandNRecTot / fStatNEvents << " rec total, "
1854 << fStatCandNRecAll / fStatNEvents << " rec all, "
1855 << fStatCandNClonesAll / fStatNEvents << " clones all, "
1856 << fStatCandNRecRef / fStatNEvents << " rec ref, "
1857 << fStatCandNClonesRef / fStatNEvents << " clones ref, "
1858 << fStatCandNRecOut / fStatNEvents << " out, "
1859 << fStatCandNGhost / fStatNEvents << " ghost" << endl;
1860
1861 int nRecExtr = fStatCandNRecAll - fStatCandNRecRef;
1862 int nMCExtr = fStatNMCAll - fStatNMCRef;
1863 int nClonesExtr = fStatCandNClonesAll - fStatCandNClonesRef;
1864
1865 double dRecTot = ( fStatCandNRecTot > 0 ) ? fStatCandNRecTot : 1;
1866 double dMCAll = ( fStatNMCAll > 0 ) ? fStatNMCAll : 1;
1867 double dMCRef = ( fStatNMCRef > 0 ) ? fStatNMCRef : 1;
1868 double dMCExtr = ( nMCExtr > 0 ) ? nMCExtr : 1;
1869 double dRecAll = ( fStatCandNRecAll + fStatCandNClonesAll > 0 ) ? fStatCandNRecAll + fStatCandNClonesAll : 1;
1870 double dRecRef = ( fStatCandNRecRef + fStatCandNClonesRef > 0 ) ? fStatCandNRecRef + fStatCandNClonesRef : 1;
1871 double dRecExtr = ( nRecExtr + nClonesExtr > 0 ) ? nRecExtr + nClonesExtr : 1;
1872
1873 cout << " EffRef = " << fStatCandNRecRef / dMCRef
1874 << ", CloneRef = " << fStatCandNClonesRef / dRecRef << endl;
1875 cout << " EffExtra = " << nRecExtr / dMCExtr
1876 << ", CloneExtra = " << nClonesExtr / dRecExtr << endl;
1877 cout << " EffAll = " << fStatCandNRecAll / dMCAll
1878 << ", CloneAll = " << fStatCandNClonesAll / dRecAll << endl;
1879 cout << " Out = " << fStatCandNRecOut / dRecTot
1880 << ", Ghost = " << fStatCandNGhost / dRecTot << endl;
ce565086 1881 }
1882
eb30eb49 1883 {
fbb9b71b 1884 cout << "\nSlice tracker performance: \n" << endl;
1885 cout << " N tracks : "
1886 << fStatNMCAll / fStatNEvents << " mc all, "
1887 << fStatNMCRef / fStatNEvents << " mc ref, "
1888 << fStatNRecTot / fStatNEvents << " rec total, "
1889 << fStatNRecAll / fStatNEvents << " rec all, "
1890 << fStatNClonesAll / fStatNEvents << " clones all, "
1891 << fStatNRecRef / fStatNEvents << " rec ref, "
1892 << fStatNClonesRef / fStatNEvents << " clones ref, "
1893 << fStatNRecOut / fStatNEvents << " out, "
1894 << fStatNGhost / fStatNEvents << " ghost" << endl;
1895
1896 int nRecExtr = fStatNRecAll - fStatNRecRef;
1897 int nMCExtr = fStatNMCAll - fStatNMCRef;
1898 int nClonesExtr = fStatNClonesAll - fStatNClonesRef;
1899
1900 double dRecTot = ( fStatNRecTot > 0 ) ? fStatNRecTot : 1;
1901 double dMCAll = ( fStatNMCAll > 0 ) ? fStatNMCAll : 1;
1902 double dMCRef = ( fStatNMCRef > 0 ) ? fStatNMCRef : 1;
1903 double dMCExtr = ( nMCExtr > 0 ) ? nMCExtr : 1;
1904 double dRecAll = ( fStatNRecAll + fStatNClonesAll > 0 ) ? fStatNRecAll + fStatNClonesAll : 1;
1905 double dRecRef = ( fStatNRecRef + fStatNClonesRef > 0 ) ? fStatNRecRef + fStatNClonesRef : 1;
1906 double dRecExtr = ( nRecExtr + nClonesExtr > 0 ) ? nRecExtr + nClonesExtr : 1;
1907
1908 cout << " EffRef = " << fStatNRecRef / dMCRef
1909 << ", CloneRef = " << fStatNClonesRef / dRecRef << endl;
1910 cout << " EffExtra = " << nRecExtr / dMCExtr
1911 << ", CloneExtra = " << nClonesExtr / dRecExtr << endl;
1912 cout << " EffAll = " << fStatNRecAll / dMCAll
1913 << ", CloneAll = " << fStatNClonesAll / dRecAll << endl;
1914 cout << " Out = " << fStatNRecOut / dRecTot
1915 << ", Ghost = " << fStatNGhost / dRecTot << endl;
6de2bc40 1916 cout << " Time = " << hlt.StatTime( 0 ) / hlt.StatNEvents()*1.e3 << " msec/event " << endl;
fbb9b71b 1917 cout << " Local timers = "
6de2bc40 1918 << hlt.StatTime( 1 ) / hlt.StatNEvents()*1.e3 << " "
1919 << hlt.StatTime( 2 ) / hlt.StatNEvents()*1.e3 << " "
1920 << hlt.StatTime( 3 ) / hlt.StatNEvents()*1.e3 << " "
1921 << hlt.StatTime( 4 ) / hlt.StatNEvents()*1.e3 << " "
1922 << hlt.StatTime( 5 ) / hlt.StatNEvents()*1.e3 << " "
1923 << hlt.StatTime( 6 ) / hlt.StatNEvents()*1.e3 << " "
1924 << hlt.StatTime( 7 ) / hlt.StatNEvents()*1.e3 << " "
1925 << hlt.StatTime( 8 ) / hlt.StatNEvents()*1.e3 << " "
fbb9b71b 1926 << " msec/event " << endl;
eb30eb49 1927 }
1928
ce565086 1929
eb30eb49 1930 {
fbb9b71b 1931 cout << "\nGlobal tracker performance for " << fStatNEvents << " events: \n" << endl;
1932 cout << " N tracks : "
1933 << fStatGBNMCAll << " mc all, "
1934 << fStatGBNMCRef << " mc ref, "
1935 << fStatGBNRecTot << " rec total, "
1936 << fStatGBNRecAll << " rec all, "
1937 << fStatGBNClonesAll << " clones all, "
1938 << fStatGBNRecRef << " rec ref, "
1939 << fStatGBNClonesRef << " clones ref, "
1940 << fStatGBNRecOut << " out, "
1941 << fStatGBNGhost << " ghost" << endl;
1942 cout << " N tracks average : "
1943 << fStatGBNMCAll / fStatNEvents << " mc all, "
1944 << fStatGBNMCRef / fStatNEvents << " mc ref, "
1945 << fStatGBNRecTot / fStatNEvents << " rec total, "
1946 << fStatGBNRecAll / fStatNEvents << " rec all, "
1947 << fStatGBNClonesAll / fStatNEvents << " clones all, "
1948 << fStatGBNRecRef / fStatNEvents << " rec ref, "
1949 << fStatGBNClonesRef / fStatNEvents << " clones ref, "
1950 << fStatGBNRecOut / fStatNEvents << " out, "
1951 << fStatGBNGhost / fStatNEvents << " ghost" << endl;
1952
1953 int nRecExtr = fStatGBNRecAll - fStatGBNRecRef;
1954 int nMCExtr = fStatGBNMCAll - fStatGBNMCRef;
1955 int nClonesExtr = fStatGBNClonesAll - fStatGBNClonesRef;
1956
1957 double dRecTot = ( fStatGBNRecTot > 0 ) ? fStatGBNRecTot : 1;
1958 double dMCAll = ( fStatGBNMCAll > 0 ) ? fStatGBNMCAll : 1;
1959 double dMCRef = ( fStatGBNMCRef > 0 ) ? fStatGBNMCRef : 1;
1960 double dMCExtr = ( nMCExtr > 0 ) ? nMCExtr : 1;
1961 double dRecAll = ( fStatGBNRecAll + fStatGBNClonesAll > 0 ) ? fStatGBNRecAll + fStatGBNClonesAll : 1;
1962 double dRecRef = ( fStatGBNRecRef + fStatGBNClonesRef > 0 ) ? fStatGBNRecRef + fStatGBNClonesRef : 1;
1963 double dRecExtr = ( nRecExtr + nClonesExtr > 0 ) ? nRecExtr + nClonesExtr : 1;
1964
1965 cout << " EffRef = " << fStatGBNRecRef / dMCRef
1966 << ", CloneRef = " << fStatGBNClonesRef / dRecRef << endl;
1967 cout << " EffExtra = " << nRecExtr / dMCExtr
1968 << ", CloneExtra = " << nClonesExtr / dRecExtr << endl;
1969 cout << " EffAll = " << fStatGBNRecAll / dMCAll
1970 << ", CloneAll = " << fStatGBNClonesAll / dRecAll << endl;
1971 cout << " Out = " << fStatGBNRecOut / dRecTot
1972 << ", Ghost = " << fStatGBNGhost / dRecTot << endl;
6de2bc40 1973 cout << " Time = " << ( hlt.StatTime( 0 ) + hlt.StatTime( 9 ) ) / hlt.StatNEvents()*1.e3 << " msec/event " << endl;
fbb9b71b 1974 cout << " Local timers: " << endl;
6de2bc40 1975 cout << " slice tracker " << hlt.StatTime( 0 ) / hlt.StatNEvents()*1.e3 << ": "
1976 << hlt.StatTime( 1 ) / hlt.StatNEvents()*1.e3 << " "
1977 << hlt.StatTime( 2 ) / hlt.StatNEvents()*1.e3 << " "
1978 << hlt.StatTime( 3 ) / hlt.StatNEvents()*1.e3 << " "
1979 << hlt.StatTime( 4 ) / hlt.StatNEvents()*1.e3 << " "
1980 << hlt.StatTime( 5 ) / hlt.StatNEvents()*1.e3 << "["
1981 << hlt.StatTime( 6 ) / hlt.StatNEvents()*1.e3 << "/"
1982 << hlt.StatTime( 7 ) / hlt.StatNEvents()*1.e3 << "] "
1983 << hlt.StatTime( 8 ) / hlt.StatNEvents()*1.e3
fbb9b71b 1984 << " msec/event " << endl;
6de2bc40 1985 cout << " GB merger " << hlt.StatTime( 9 ) / hlt.StatNEvents()*1.e3 << ": "
1986 << hlt.StatTime( 10 ) / hlt.StatNEvents()*1.e3 << ", "
1987 << hlt.StatTime( 11 ) / hlt.StatNEvents()*1.e3 << ", "
1988 << hlt.StatTime( 12 ) / hlt.StatNEvents()*1.e3 << " "
fbb9b71b 1989 << " msec/event " << endl;
1990
1991 if ( StatFile && StatFile->is_open() ) {
4687b8fc 1992 fstream &out = *StatFile;
1993
1994 //out<<"\nGlobal tracker performance for "<<fStatNEvents<<" events: \n"<<endl;
1995 //out<<" N tracks : "
1996 //<<fStatGBNMCAll/fStatNEvents<<" mc all, "
1997 //<<fStatGBNMCRef/fStatNEvents<<" mc ref, "
1998 // <<fStatGBNRecTot/fStatNEvents<<" rec total, "
1999 // <<fStatGBNRecAll/fStatNEvents<<" rec all, "
2000 // <<fStatGBNClonesAll/fStatNEvents<<" clones all, "
2001 // <<fStatGBNRecRef/fStatNEvents<<" rec ref, "
2002 // <<fStatGBNClonesRef/fStatNEvents<<" clones ref, "
2003 // <<fStatGBNRecOut/fStatNEvents<<" out, "
2004 // <<fStatGBNGhost/fStatNEvents<<" ghost"<<endl;
6de2bc40 2005 fStatTime += hlt.StatTime( 0 );
fbb9b71b 2006 double timeHz = 0;
2007 if ( fStatTime > 1.e-4 ) timeHz = 1. / fStatTime * fStatNEvents;
2008
2009 out << "<table border>" << endl;
2010 out << "<tr>" << endl;
2011 out << "<td> </td> <td align=center> RefSet </td> <td align=center> AllSet </td> <td align=center> ExtraSet </td>" << endl;
2012 out << "</tr>" << endl;
2013 out << "<tr>" << endl;
2014 out << "<td>Efficiency</td> <td align=center>" << fStatGBNRecRef / dMCRef
2015 << "</td> <td align=center>" << fStatGBNRecAll / dMCAll
2016 << "</td> <td align=center>" << nRecExtr / dMCExtr
2017 << "</td>" << endl;
2018 out << "</tr>" << endl;
2019 out << "<tr> " << endl;
2020 out << "<td>Clone</td> <td align=center>" << fStatGBNClonesRef / dRecRef
2021 << "</td> <td align=center>" << fStatGBNClonesAll / dRecAll
2022 << "</td> <td align=center>" << nClonesExtr / dRecExtr
2023 << "</td>" << endl;
2024 out << "</tr>" << endl;
2025 out << "<tr> " << endl;
2026 out << "<td>Ghost</td> <td colspan=3 align=center>" << fStatGBNGhost / dRecTot
2027 << "</td>" << endl;
2028 out << "</tr>" << endl;
2029 out << "<tr> " << endl;
2030 out << "<td>Time</td> <td colspan=3 align=center>" << timeHz
2031 << " ev/s</td>" << endl;
2032 out << "</tr>" << endl;
2033 out << "<tr> " << endl;
2034 out << "<td>N Events</td> <td colspan=3 align=center>" << fStatNEvents
2035 << "</td>" << endl;
2036 out << "</tr>" << endl;
2037 out << "</table>" << endl;
4687b8fc 2038 }
2039
eb30eb49 2040 }
2041
d54804bf 2042 WriteHistos();
2043}
eb30eb49 2044
6de2bc40 2045
00d07bcd 2046void AliHLTTPCCAPerformance::WriteMCEvent( ostream &out ) const
eb30eb49 2047{
00d07bcd 2048 // write MC information to the file
fbb9b71b 2049 out << fNMCTracks << endl;
2050 for ( int it = 0; it < fNMCTracks; it++ ) {
eb30eb49 2051 AliHLTTPCCAMCTrack &t = fMCTracks[it];
fbb9b71b 2052 out << it << " ";
2053 out << t.PDG() << endl;
2054 for ( int i = 0; i < 7; i++ ) out << t.Par()[i] << " ";
2055 out << endl << " ";
2056 for ( int i = 0; i < 7; i++ ) out << t.TPCPar()[i] << " ";
2057 out << endl << " ";
2058 out << t.P() << " ";
2059 out << t.Pt() << " ";
2060 out << t.NMCPoints() << " ";
2061 out << t.FirstMCPointID() << " ";
2062 out << t.NHits() << " ";
2063 out << t.NReconstructed() << " ";
2064 out << t.Set() << " ";
2065 out << t.NTurns() << endl;
eb30eb49 2066 }
2067
fbb9b71b 2068 out << fNHits << endl;
2069 for ( int ih = 0; ih < fNHits; ih++ ) {
eb30eb49 2070 AliHLTTPCCAHitLabel &l = fHitLabels[ih];
fbb9b71b 2071 out << l.fLab[0] << " " << l.fLab[1] << " " << l.fLab[2] << endl;
eb30eb49 2072 }
2073}
2074
00d07bcd 2075void AliHLTTPCCAPerformance::WriteMCPoints( ostream &out ) const
fbb9b71b 2076{
00d07bcd 2077 // write Mc points to the file
fbb9b71b 2078 out << fNMCPoints << endl;
2079 for ( int ip = 0; ip < fNMCPoints; ip++ ) {
eb30eb49 2080 AliHLTTPCCAMCPoint &p = fMCPoints[ip];
fbb9b71b 2081 out << p.X() << " ";
2082 out << p.Y() << " ";
2083 out << p.Z() << " ";
2084 out << p.Sx() << " ";
2085 out << p.Sy() << " ";
2086 out << p.Sz() << " ";
2087 out << p.Time() << " ";
2088 out << p.ISlice() << " ";
2089 out << p.TrackID() << endl;
eb30eb49 2090 }
2091}
2092
2093void AliHLTTPCCAPerformance::ReadMCEvent( istream &in )
2094{
00d07bcd 2095 // read mc info from the file
eb30eb49 2096 StartEvent();
fbb9b71b 2097 if ( fMCTracks ) delete[] fMCTracks;
eb30eb49 2098 fMCTracks = 0;
2099 fNMCTracks = 0;
fbb9b71b 2100 if ( fHitLabels ) delete[] fHitLabels;
eb30eb49 2101 fHitLabels = 0;
2102 fNHits = 0;
fbb9b71b 2103 if ( fMCPoints ) delete[] fMCPoints;
eb30eb49 2104 fMCPoints = 0;
2105 fNMCPoints = 0;
2106
fbb9b71b 2107 in >> fNMCTracks;
eb30eb49 2108 fMCTracks = new AliHLTTPCCAMCTrack[fNMCTracks];
fbb9b71b 2109 for ( int it = 0; it < fNMCTracks; it++ ) {
eb30eb49 2110 AliHLTTPCCAMCTrack &t = fMCTracks[it];
fbb9b71b 2111 int j;
2112 float f;
2113 in >> j;
2114 in >> j; t.SetPDG( j );
2115 for ( int i = 0; i < 7; i++ ) { in >> f; t.SetPar( i, f );}
2116 for ( int i = 0; i < 7; i++ ) { in >> f; t.SetTPCPar( i, f );}
2117 in >> f; t.SetP( f );
2118 in >> f; t.SetPt( f );
2119 in >> j; t.SetNHits( j );
2120 in >> j; t.SetNMCPoints( j );
2121 in >> j; t.SetFirstMCPointID( j );
2122 in >> j; t.SetNReconstructed( j );
2123 in >> j; t.SetSet( j );
2124 in >> j; t.SetNTurns( j );
eb30eb49 2125 }
fbb9b71b 2126
2127 in >> fNHits;
a986b6c6 2128 if( fNHits<0 || fNHits>10000000 ) fNHits = 0;
eb30eb49 2129 fHitLabels = new AliHLTTPCCAHitLabel[fNHits];
fbb9b71b 2130 for ( int ih = 0; ih < fNHits; ih++ ) {
eb30eb49 2131 AliHLTTPCCAHitLabel &l = fHitLabels[ih];
fbb9b71b 2132 in >> l.fLab[0] >> l.fLab[1] >> l.fLab[2];
eb30eb49 2133 }
2134}
2135
2136void AliHLTTPCCAPerformance::ReadMCPoints( istream &in )
2137{
00d07bcd 2138 // read mc points from the file
fbb9b71b 2139 if ( fMCPoints ) delete[] fMCPoints;
eb30eb49 2140 fMCPoints = 0;
2141 fNMCPoints = 0;
fbb9b71b 2142
2143 in >> fNMCPoints;
a986b6c6 2144
2145 if( fNMCPoints<0 || fNMCPoints>10000000 ){ fNMCPoints = 0; return; }
2146
eb30eb49 2147 fMCPoints = new AliHLTTPCCAMCPoint[fNMCPoints];
fbb9b71b 2148 for ( int ip = 0; ip < fNMCPoints; ip++ ) {
eb30eb49 2149 AliHLTTPCCAMCPoint &p = fMCPoints[ip];
fbb9b71b 2150 float f;
2151 int i;
2152 in >> f;
693d2443 2153 p.SetX( f );
2154 in >> f;
2155 p.SetY( f );
2156 in >> f;
2157 p.SetZ( f );
2158 in >> f;
2159 p.SetSx( f );
2160 in >> f;
2161 p.SetSy( f );
2162 in >> f;
2163 p.SetSz( f );
2164 in >> f;
2165 p.SetTime( f );
2166 in >> i;
2167 p.SetISlice( i );
2168 in >> i;
2169 p.SetTrackID( i );
eb30eb49 2170 }
2171}