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