technical changes:
[u/mrichter/AliRoot.git] / CORRFW / AliCFTrackQualityCuts.cxx
CommitLineData
563113d0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// The class AliCFTrackQualityCuts is designed to select reconstructed tracks
17// of high quality and to provide corresponding QA histograms.
18// This class inherits from the Analysis' Framework abstract base class
19// AliAnalysisCuts and is a part of the Correction Framework.
20// This class acts on single, reconstructed tracks, it is applicable on
21// ESD and AOD data.
22// It mainly consists of a IsSelected function that returns a boolean.
23// This function checks whether the considered track passes a set of cuts:
563113d0 24// - number of clusters in the ITS
65e7777d 25// - number of clusters in the TPC
18274103 26// - number of clusters in the TRD
65e7777d 27// - ratio of found / finable number of clusters in the TPC
28// - number of tracklets in the TRD
29// - number TRD tracklets used for pid
563113d0 30// - chi2 / cluster in the ITS
65e7777d 31// - chi2 / cluster in the TPC
32// - chi2 / tracklet in the TRD
563113d0 33// - successful TPC refit
34// - successful ITS refit
35// - covariance matrix diagonal elements
36//
37// The cut values for these cuts are set with the corresponding set functions.
38// All cut classes provided by the correction framework are supposed to be
39// added in the Analysis Framwork's class AliAnalysisFilter and applied by
40// the filter via a loop.
41//
42// author: I. Kraus (Ingrid.Kraus@cern.ch)
43// idea taken form
44// AliESDtrackCuts writte by Jan Fiete Grosse-Oetringhaus and
45// AliRsnDaughterCut class written by A. Pulvirenti.
46
47
48#include <TCanvas.h>
49#include <TDirectory.h>
563113d0 50#include <TH2.h>
6cb5e116 51#include <TBits.h>
563113d0 52
53#include <AliESDtrack.h>
54#include <AliLog.h>
55#include "AliCFTrackQualityCuts.h"
8edd0c2c 56#include "AliAODTrack.h"
563113d0 57
58ClassImp(AliCFTrackQualityCuts)
59
60//__________________________________________________________________________________
61AliCFTrackQualityCuts::AliCFTrackQualityCuts() :
62 AliCFCutBase(),
63 fMinNClusterTPC(0),
64 fMinNClusterITS(0),
18274103 65 fMinNClusterTRD(0),
65e7777d 66 fMinFoundClusterTPC(0),
67 fMinNTrackletTRD(0),
68 fMinNTrackletTRDpid(0),
563113d0 69 fMaxChi2PerClusterTPC(0),
70 fMaxChi2PerClusterITS(0),
65e7777d 71 fMaxChi2PerTrackletTRD(0),
563113d0 72 fCovariance11Max(0),
73 fCovariance22Max(0),
74 fCovariance33Max(0),
75 fCovariance44Max(0),
76 fCovariance55Max(0),
8edd0c2c 77 fStatus(0),
563113d0 78 fhCutStatistics(0),
79 fhCutCorrelation(0),
80 fBitmap(0x0),
81 fhNBinsClusterTPC(0),
82 fhNBinsClusterITS(0),
18274103 83 fhNBinsClusterTRD(0),
65e7777d 84 fhNBinsFoundClusterTPC(0),
85 fhNBinsTrackletTRD(0),
86 fhNBinsTrackletTRDpid(0),
563113d0 87 fhNBinsChi2TPC(0),
88 fhNBinsChi2ITS(0),
18274103 89 fhNBinsChi2TRD(0),
563113d0 90 fhNBinsCovariance11(0),
91 fhNBinsCovariance22(0),
92 fhNBinsCovariance33(0),
93 fhNBinsCovariance44(0),
94 fhNBinsCovariance55(0),
95 fhBinLimClusterTPC(0x0),
96 fhBinLimClusterITS(0x0),
18274103 97 fhBinLimClusterTRD(0x0),
65e7777d 98 fhBinLimFoundClusterTPC(0x0),
99 fhBinLimTrackletTRD(0x0),
100 fhBinLimTrackletTRDpid(0x0),
563113d0 101 fhBinLimChi2TPC(0x0),
102 fhBinLimChi2ITS(0x0),
18274103 103 fhBinLimChi2TRD(0x0),
563113d0 104 fhBinLimCovariance11(0x0),
105 fhBinLimCovariance22(0x0),
106 fhBinLimCovariance33(0x0),
107 fhBinLimCovariance44(0x0),
108 fhBinLimCovariance55(0x0)
6cb5e116 109{
563113d0 110 //
111 // Default constructor
112 //
563113d0 113 Initialise();
114}
115//__________________________________________________________________________________
116AliCFTrackQualityCuts::AliCFTrackQualityCuts(Char_t* name, Char_t* title) :
117 AliCFCutBase(name,title),
118 fMinNClusterTPC(0),
119 fMinNClusterITS(0),
18274103 120 fMinNClusterTRD(0),
65e7777d 121 fMinFoundClusterTPC(0),
122 fMinNTrackletTRD(0),
123 fMinNTrackletTRDpid(0),
563113d0 124 fMaxChi2PerClusterTPC(0),
125 fMaxChi2PerClusterITS(0),
65e7777d 126 fMaxChi2PerTrackletTRD(0),
563113d0 127 fCovariance11Max(0),
128 fCovariance22Max(0),
129 fCovariance33Max(0),
130 fCovariance44Max(0),
131 fCovariance55Max(0),
8edd0c2c 132 fStatus(0),
563113d0 133 fhCutStatistics(0),
134 fhCutCorrelation(0),
135 fBitmap(0x0),
136 fhNBinsClusterTPC(0),
137 fhNBinsClusterITS(0),
18274103 138 fhNBinsClusterTRD(0),
65e7777d 139 fhNBinsFoundClusterTPC(0),
140 fhNBinsTrackletTRD(0),
141 fhNBinsTrackletTRDpid(0),
563113d0 142 fhNBinsChi2TPC(0),
143 fhNBinsChi2ITS(0),
18274103 144 fhNBinsChi2TRD(0),
563113d0 145 fhNBinsCovariance11(0),
146 fhNBinsCovariance22(0),
147 fhNBinsCovariance33(0),
148 fhNBinsCovariance44(0),
149 fhNBinsCovariance55(0),
150 fhBinLimClusterTPC(0x0),
151 fhBinLimClusterITS(0x0),
18274103 152 fhBinLimClusterTRD(0x0),
65e7777d 153 fhBinLimFoundClusterTPC(0x0),
154 fhBinLimTrackletTRD(0x0),
155 fhBinLimTrackletTRDpid(0x0),
563113d0 156 fhBinLimChi2TPC(0x0),
157 fhBinLimChi2ITS(0x0),
18274103 158 fhBinLimChi2TRD(0x0),
563113d0 159 fhBinLimCovariance11(0x0),
160 fhBinLimCovariance22(0x0),
161 fhBinLimCovariance33(0x0),
162 fhBinLimCovariance44(0x0),
163 fhBinLimCovariance55(0x0)
563113d0 164{
165 //
166 // Constructor
167 //
563113d0 168 Initialise();
169}
170//__________________________________________________________________________________
171AliCFTrackQualityCuts::AliCFTrackQualityCuts(const AliCFTrackQualityCuts& c) :
172 AliCFCutBase(c),
173 fMinNClusterTPC(c.fMinNClusterTPC),
174 fMinNClusterITS(c.fMinNClusterITS),
18274103 175 fMinNClusterTRD(c.fMinNClusterTRD),
65e7777d 176 fMinFoundClusterTPC(c.fMinFoundClusterTPC),
177 fMinNTrackletTRD(c.fMinNTrackletTRD),
178 fMinNTrackletTRDpid(c.fMinNTrackletTRDpid),
563113d0 179 fMaxChi2PerClusterTPC(c.fMaxChi2PerClusterTPC),
180 fMaxChi2PerClusterITS(c.fMaxChi2PerClusterITS),
65e7777d 181 fMaxChi2PerTrackletTRD(c.fMaxChi2PerTrackletTRD),
563113d0 182 fCovariance11Max(c.fCovariance11Max),
183 fCovariance22Max(c.fCovariance22Max),
184 fCovariance33Max(c.fCovariance33Max),
185 fCovariance44Max(c.fCovariance44Max),
186 fCovariance55Max(c.fCovariance55Max),
8edd0c2c 187 fStatus(c.fStatus),
563113d0 188 fhCutStatistics(c.fhCutStatistics),
189 fhCutCorrelation(c.fhCutCorrelation),
190 fBitmap(c.fBitmap),
191 fhNBinsClusterTPC(c.fhNBinsClusterTPC),
192 fhNBinsClusterITS(c.fhNBinsClusterITS),
18274103 193 fhNBinsClusterTRD(c.fhNBinsClusterTRD),
65e7777d 194 fhNBinsFoundClusterTPC(c.fhNBinsFoundClusterTPC),
195 fhNBinsTrackletTRD(c.fhNBinsTrackletTRD),
196 fhNBinsTrackletTRDpid(c.fhNBinsTrackletTRDpid),
563113d0 197 fhNBinsChi2TPC(c.fhNBinsChi2TPC),
198 fhNBinsChi2ITS(c.fhNBinsChi2ITS),
18274103 199 fhNBinsChi2TRD(c.fhNBinsChi2TRD),
563113d0 200 fhNBinsCovariance11(c.fhNBinsCovariance11),
201 fhNBinsCovariance22(c.fhNBinsCovariance22),
202 fhNBinsCovariance33(c.fhNBinsCovariance33),
203 fhNBinsCovariance44(c.fhNBinsCovariance44),
204 fhNBinsCovariance55(c.fhNBinsCovariance55),
205 fhBinLimClusterTPC(c.fhBinLimClusterTPC),
206 fhBinLimClusterITS(c.fhBinLimClusterITS),
18274103 207 fhBinLimClusterTRD(c.fhBinLimClusterTRD),
65e7777d 208 fhBinLimFoundClusterTPC(c.fhBinLimFoundClusterTPC),
209 fhBinLimTrackletTRD(c.fhBinLimTrackletTRD),
210 fhBinLimTrackletTRDpid(c.fhBinLimTrackletTRDpid),
563113d0 211 fhBinLimChi2TPC(c.fhBinLimChi2TPC),
212 fhBinLimChi2ITS(c.fhBinLimChi2ITS),
18274103 213 fhBinLimChi2TRD(c.fhBinLimChi2TRD),
563113d0 214 fhBinLimCovariance11(c.fhBinLimCovariance11),
215 fhBinLimCovariance22(c.fhBinLimCovariance22),
216 fhBinLimCovariance33(c.fhBinLimCovariance33),
217 fhBinLimCovariance44(c.fhBinLimCovariance44),
218 fhBinLimCovariance55(c.fhBinLimCovariance55)
219{
220 //
221 // copy constructor
222 //
223 ((AliCFTrackQualityCuts &) c).Copy(*this);
224}
225//__________________________________________________________________________________
226AliCFTrackQualityCuts& AliCFTrackQualityCuts::operator=(const AliCFTrackQualityCuts& c)
227{
228 //
229 // Assignment operator
230 //
231 if (this != &c) {
232 AliCFCutBase::operator=(c) ;
233 fMinNClusterTPC = c.fMinNClusterTPC ;
234 fMinNClusterITS = c.fMinNClusterITS ;
18274103 235 fMinNClusterTRD = c.fMinNClusterTRD ;
65e7777d 236 fMinFoundClusterTPC = c.fMinFoundClusterTPC ;
237 fMinNTrackletTRD = c.fMinNTrackletTRD ;
238 fMinNTrackletTRDpid = c.fMinNTrackletTRDpid ;
563113d0 239 fMaxChi2PerClusterTPC = c.fMaxChi2PerClusterTPC ;
240 fMaxChi2PerClusterITS = c.fMaxChi2PerClusterITS ;
65e7777d 241 fMaxChi2PerTrackletTRD = c.fMaxChi2PerTrackletTRD ;
563113d0 242 fCovariance11Max = c.fCovariance11Max ;
243 fCovariance22Max = c.fCovariance22Max ;
244 fCovariance33Max = c.fCovariance33Max ;
245 fCovariance44Max = c.fCovariance44Max ;
246 fCovariance55Max = c.fCovariance55Max ;
8edd0c2c 247 fStatus = c.fStatus ;
563113d0 248 fhCutStatistics = c.fhCutStatistics ;
249 fhCutCorrelation = c.fhCutCorrelation ;
250 fBitmap = c.fBitmap ;
563113d0 251 fhNBinsClusterTPC = c.fhNBinsClusterTPC ;
252 fhNBinsClusterITS = c.fhNBinsClusterITS ;
18274103 253 fhNBinsClusterTRD = c.fhNBinsClusterTRD ;
65e7777d 254 fhNBinsFoundClusterTPC = c.fhNBinsFoundClusterTPC ;
255 fhNBinsTrackletTRD = c.fhNBinsTrackletTRD ;
256 fhNBinsTrackletTRDpid = c.fhNBinsTrackletTRDpid ;
563113d0 257 fhNBinsChi2TPC = c.fhNBinsChi2TPC ;
258 fhNBinsChi2ITS = c.fhNBinsChi2ITS ;
18274103 259 fhNBinsChi2TRD = c.fhNBinsChi2TRD ;
563113d0 260 fhNBinsCovariance11 = c.fhNBinsCovariance11 ;
261 fhNBinsCovariance22 = c.fhNBinsCovariance22 ;
262 fhNBinsCovariance33 = c.fhNBinsCovariance33 ;
263 fhNBinsCovariance44 = c.fhNBinsCovariance44 ;
264 fhNBinsCovariance55 = c.fhNBinsCovariance55 ;
265 fhBinLimClusterTPC = c.fhBinLimClusterTPC ;
266 fhBinLimClusterITS = c.fhBinLimClusterITS ;
18274103 267 fhBinLimClusterTRD = c.fhBinLimClusterTRD ;
65e7777d 268 fhBinLimFoundClusterTPC = c.fhBinLimFoundClusterTPC ;
269 fhBinLimTrackletTRD = c.fhBinLimTrackletTRD ;
270 fhBinLimTrackletTRDpid = c.fhBinLimTrackletTRDpid ;
563113d0 271 fhBinLimChi2TPC = c.fhBinLimChi2TPC ;
272 fhBinLimChi2ITS = c.fhBinLimChi2ITS ;
18274103 273 fhBinLimChi2TRD = c.fhBinLimChi2TRD ;
563113d0 274 fhBinLimCovariance11 = c.fhBinLimCovariance11 ;
275 fhBinLimCovariance22 = c.fhBinLimCovariance22 ;
276 fhBinLimCovariance33 = c.fhBinLimCovariance33 ;
277 fhBinLimCovariance44 = c.fhBinLimCovariance44 ;
278 fhBinLimCovariance55 = c.fhBinLimCovariance55 ;
6cb5e116 279
563113d0 280 for (Int_t i=0; i<c.kNHist; i++){
281 for (Int_t j=0; j<c.kNStepQA; j++){
282 if(c.fhQA[i][j]) fhQA[i][j] = (TH1F*)c.fhQA[i][j]->Clone();
283 }
284 }
563113d0 285 ((AliCFTrackQualityCuts &) c).Copy(*this);
6cb5e116 286 }
563113d0 287 return *this;
288}
289//__________________________________________________________________________________
290AliCFTrackQualityCuts::~AliCFTrackQualityCuts()
291{
292 //
293 // destructor
294 //
8edd0c2c 295 if (fhCutStatistics) delete fhCutStatistics;
296 if (fhCutCorrelation) delete fhCutCorrelation;
563113d0 297
298 for (Int_t i=0; i<kNHist; i++){
299 for (Int_t j=0; j<kNStepQA; j++){
300 if(fhQA[i][j]) delete fhQA[i][j];
301 }
302 }
6cb5e116 303 if(fBitmap) delete fBitmap;
563113d0 304 if(fhBinLimClusterTPC) delete fhBinLimClusterTPC;
305 if(fhBinLimClusterITS) delete fhBinLimClusterITS;
18274103 306 if(fhBinLimClusterTRD) delete fhBinLimClusterTRD;
65e7777d 307 if(fhBinLimFoundClusterTPC) delete fhBinLimFoundClusterTPC;
308 if(fhBinLimTrackletTRD) delete fhBinLimTrackletTRD;
309 if(fhBinLimTrackletTRDpid) delete fhBinLimTrackletTRDpid;
563113d0 310 if(fhBinLimChi2TPC) delete fhBinLimChi2TPC;
311 if(fhBinLimChi2ITS) delete fhBinLimChi2ITS;
18274103 312 if(fhBinLimChi2TRD) delete fhBinLimChi2TRD;
563113d0 313 if(fhBinLimCovariance11) delete fhBinLimCovariance11;
314 if(fhBinLimCovariance22) delete fhBinLimCovariance22;
315 if(fhBinLimCovariance33) delete fhBinLimCovariance33;
316 if(fhBinLimCovariance44) delete fhBinLimCovariance44;
317 if(fhBinLimCovariance55) delete fhBinLimCovariance55;
563113d0 318}
319//__________________________________________________________________________________
320void AliCFTrackQualityCuts::Initialise()
321{
322 //
323 // sets everything to zero
324 //
325 fMinNClusterTPC = 0;
326 fMinNClusterITS = 0;
18274103 327 fMinNClusterTRD = 0;
65e7777d 328 fMinFoundClusterTPC = 0;
329 fMinNTrackletTRD = 0;
330 fMinNTrackletTRDpid = 0;
563113d0 331 fMaxChi2PerClusterTPC = 0;
332 fMaxChi2PerClusterITS = 0;
65e7777d 333 fMaxChi2PerTrackletTRD = 0;
563113d0 334 fCovariance11Max = 0;
335 fCovariance22Max = 0;
336 fCovariance33Max = 0;
337 fCovariance44Max = 0;
338 fCovariance55Max = 0;
8edd0c2c 339 fStatus = 0;
563113d0 340
341 SetMinNClusterTPC();
342 SetMinNClusterITS();
18274103 343 SetMinNClusterTRD();
65e7777d 344 SetMinFoundClusterTPC();
345 SetMinNTrackletTRD();
346 SetMinNTrackletTRDpid();
563113d0 347 SetMaxChi2PerClusterTPC();
348 SetMaxChi2PerClusterITS();
65e7777d 349 SetMaxChi2PerTrackletTRD();
563113d0 350 SetMaxCovDiagonalElements();
8edd0c2c 351 SetStatus();
563113d0 352
353 for (Int_t i=0; i<kNHist; i++){
6cb5e116 354 for (Int_t j=0; j<kNStepQA; j++)
563113d0 355 fhQA[i][j] = 0x0;
563113d0 356 }
357 fhCutStatistics = 0;
358 fhCutCorrelation = 0;
6cb5e116 359 fBitmap=new TBits(0);
563113d0 360
6cb5e116 361 //set default bining for QA histograms
563113d0 362 SetHistogramBins(kCutClusterTPC,165,-0.5,164.5);
363 SetHistogramBins(kCutClusterITS,8,-0.5,7.5);
65e7777d 364 SetHistogramBins(kCutClusterTRD,120,-0.5,119.5);
365 SetHistogramBins(kCutMinFoundClusterTPC,110,-0.05,1.05);
366 SetHistogramBins(kCutTrackletTRD,7,-0.5,6.5);
367 SetHistogramBins(kCutTrackletTRDpid,7,-0.5,6.5);
6cb5e116 368 SetHistogramBins(kCutChi2TPC,500,0.,10.);
369 SetHistogramBins(kCutChi2ITS,500,0.,10.);
18274103 370 SetHistogramBins(kCutChi2TRD,500,0.,10.);
6cb5e116 371 SetHistogramBins(kCutCovElement11,200,0.,20.);
372 SetHistogramBins(kCutCovElement22,200,0.,20.);
373 SetHistogramBins(kCutCovElement33,100,0.,1.);
374 SetHistogramBins(kCutCovElement44,100,0.,5.);
375 SetHistogramBins(kCutCovElement55,100,0.,5.);
563113d0 376}
377//__________________________________________________________________________________
378void AliCFTrackQualityCuts::Copy(TObject &c) const
379{
380 //
381 // Copy function
382 //
383 AliCFTrackQualityCuts& target = (AliCFTrackQualityCuts &) c;
384
385 target.Initialise();
386
387 if (fhCutStatistics) target.fhCutStatistics = (TH1F*) fhCutStatistics->Clone();
388 if (fhCutCorrelation) target.fhCutCorrelation = (TH2F*) fhCutCorrelation->Clone();
389
390 for (Int_t i=0; i<kNHist; i++){
391 for (Int_t j=0; j<kNStepQA; j++){
392 if(fhQA[i][j]) target.fhQA[i][j] = (TH1F*)fhQA[i][j]->Clone();
393 }
394 }
563113d0 395 TNamed::Copy(c);
396}
397//__________________________________________________________________________________
107a3100 398void AliCFTrackQualityCuts::SelectionBitMap(TObject* obj)
563113d0 399{
400 //
401 // test if the track passes the single cuts
402 // and store the information in a bitmap
403 //
404
405 // bitmap stores the decision of each single cut
406 for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kFALSE);
407
8edd0c2c 408 if (!obj) return;
409 if (!obj->InheritsFrom("AliVParticle")) {
410 AliError("object must derived from AliVParticle !");
411 return;
412 }
563113d0 413
8edd0c2c 414 Bool_t isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ;
415 Bool_t isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ;
563113d0 416
8edd0c2c 417 AliESDtrack * esdTrack = 0x0 ;
418 AliAODTrack * aodTrack = 0x0 ;
419 if (isESDTrack) esdTrack = dynamic_cast<AliESDtrack*>(obj);
420 if (isAODTrack) aodTrack = dynamic_cast<AliAODTrack*>(obj);
563113d0 421
8edd0c2c 422 // get cut quantities
8edd0c2c 423 Int_t nClustersTPC = 0;
424 Int_t nClustersITS = 0 ;
18274103 425 Int_t nClustersTRD = 0 ;
65e7777d 426 Int_t nTrackletsTRD = 0 ;
8edd0c2c 427 Float_t chi2PerClusterTPC = 0 ;
428 Float_t chi2PerClusterITS = 0 ;
65e7777d 429 Float_t chi2PerTrackletTRD = 0 ;
8edd0c2c 430 Double_t extCov[15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
65e7777d 431 Float_t fractionFoundClustersTPC = 0;
432
8edd0c2c 433 if (isESDTrack) {
65e7777d 434 nClustersTPC = esdTrack->GetTPCclusters(0x0);
435 nClustersITS = esdTrack->GetITSclusters(0x0);
436 nClustersTRD = esdTrack->GetTRDncls();
437 nTrackletsTRD = esdTrack->GetTRDntracklets();
8edd0c2c 438 if (nClustersTPC != 0) chi2PerClusterTPC = esdTrack->GetTPCchi2() / Float_t(nClustersTPC);
439 if (nClustersITS != 0) chi2PerClusterITS = esdTrack->GetITSchi2() / Float_t(nClustersITS);
65e7777d 440 if (nTrackletsTRD != 0) chi2PerTrackletTRD = esdTrack->GetTRDchi2() / Float_t(nTrackletsTRD);
8edd0c2c 441 esdTrack->GetExternalCovariance(extCov);
65e7777d 442 if (esdTrack->GetTPCNclsF() != 0) fractionFoundClustersTPC = float(nClustersTPC) / float(esdTrack->GetTPCNclsF());
8edd0c2c 443 }
563113d0 444
563113d0 445 // fill the bitmap
446 Int_t iCutBit = 0;
447
107a3100 448 if (nClustersTPC >= fMinNClusterTPC)
8edd0c2c 449 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 450 iCutBit++;
107a3100 451 if (nClustersITS >= fMinNClusterITS)
8edd0c2c 452 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 453 iCutBit++;
18274103 454 if (nClustersTRD >= fMinNClusterTRD)
455 fBitmap->SetBitNumber(iCutBit,kTRUE);
456 iCutBit++;
65e7777d 457 if ((fMinFoundClusterTPC <= 0) || (nClustersTPC > 0 && (fractionFoundClustersTPC >= fMinFoundClusterTPC)))
458 fBitmap->SetBitNumber(iCutBit,kTRUE);
459 iCutBit++;
460 if (nTrackletsTRD >= fMinNTrackletTRD)
461 fBitmap->SetBitNumber(iCutBit,kTRUE);
462 iCutBit++;
463 if (esdTrack->GetTRDntrackletsPID() >= fMinNTrackletTRDpid)
464 fBitmap->SetBitNumber(iCutBit,kTRUE);
465 iCutBit++;
107a3100 466 if (chi2PerClusterTPC <= fMaxChi2PerClusterTPC)
8edd0c2c 467 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 468 iCutBit++;
107a3100 469 if (chi2PerClusterITS <= fMaxChi2PerClusterITS)
8edd0c2c 470 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 471 iCutBit++;
65e7777d 472 if (chi2PerTrackletTRD <= fMaxChi2PerTrackletTRD)
18274103 473 fBitmap->SetBitNumber(iCutBit,kTRUE);
474 iCutBit++;
107a3100 475 if (extCov[0] <= fCovariance11Max)
8edd0c2c 476 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 477 iCutBit++;
107a3100 478 if (extCov[2] <= fCovariance22Max)
8edd0c2c 479 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 480 iCutBit++;
107a3100 481 if (extCov[5] <= fCovariance33Max)
8edd0c2c 482 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 483 iCutBit++;
107a3100 484 if (extCov[9] <= fCovariance44Max)
8edd0c2c 485 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 486 iCutBit++;
107a3100 487 if (extCov[14] <= fCovariance55Max)
8edd0c2c 488 fBitmap->SetBitNumber(iCutBit,kTRUE);
489 iCutBit++;
490
491 if (isESDTrack) {
492 if ( (esdTrack->GetStatus() & fStatus) == fStatus ) fBitmap->SetBitNumber(iCutBit,kTRUE);
493 }
494 else {
495 if ( (aodTrack->GetStatus() & fStatus) == fStatus ) fBitmap->SetBitNumber(iCutBit,kTRUE);
496 }
563113d0 497
107a3100 498 return;
563113d0 499}
500//__________________________________________________________________________________
501Bool_t AliCFTrackQualityCuts::IsSelected(TObject* obj) {
502 //
503 // loops over decisions of single cuts and returns if the track is accepted
504 //
107a3100 505 SelectionBitMap(obj);
563113d0 506
107a3100 507 if (fIsQAOn) FillHistograms(obj,0);
563113d0 508 Bool_t isSelected = kTRUE;
509
107a3100 510 for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++) {
511 if(!fBitmap->TestBitNumber(icut)) {
512 isSelected = kFALSE;
513 break;
514 }
515 }
516 if (!isSelected) return kFALSE ;
517 if (fIsQAOn) FillHistograms(obj,1);
518 return kTRUE;
563113d0 519}
520//__________________________________________________________________________________
521void AliCFTrackQualityCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
522{
523 //
524 // variable bin size
525 //
526 if(!fIsQAOn) return;
527
8edd0c2c 528 if (index<0 || index>=kNHist) {
529 Error("SetHistogramBins","could not determine histogram from index %d",index);
530 return;
531 }
532
563113d0 533 switch(index){
534 case kCutClusterTPC:
db6722a5 535 fhNBinsClusterTPC=nbins+1;
563113d0 536 fhBinLimClusterTPC=new Double_t[nbins+1];
537 for(Int_t i=0;i<nbins+1;i++)fhBinLimClusterTPC[i]=bins[i];
538 break;
6cb5e116 539
563113d0 540 case kCutClusterITS:
db6722a5 541 fhNBinsClusterITS=nbins+1;
563113d0 542 fhBinLimClusterITS=new Double_t[nbins+1];
543 for(Int_t i=0;i<nbins+1;i++)fhBinLimClusterITS[i]=bins[i];
544 break;
6cb5e116 545
18274103 546 case kCutClusterTRD:
547 fhNBinsClusterTRD=nbins+1;
548 fhBinLimClusterTRD=new Double_t[nbins+1];
549 for(Int_t i=0;i<nbins+1;i++)fhBinLimClusterTRD[i]=bins[i];
550 break;
551
65e7777d 552 case kCutMinFoundClusterTPC:
553 fhNBinsFoundClusterTPC=nbins+1;
554 fhBinLimFoundClusterTPC=new Double_t[nbins+1];
555 for(Int_t i=0;i<nbins+1;i++)fhBinLimFoundClusterTPC[i]=bins[i];
556 break;
557
558 case kCutTrackletTRD:
559 fhNBinsTrackletTRD=nbins+1;
560 fhBinLimTrackletTRD=new Double_t[nbins+1];
561 for(Int_t i=0;i<nbins+1;i++)fhBinLimTrackletTRD[i]=bins[i];
562 break;
563
564 case kCutTrackletTRDpid:
565 fhNBinsTrackletTRDpid=nbins+1;
566 fhBinLimTrackletTRDpid=new Double_t[nbins+1];
567 for(Int_t i=0;i<nbins+1;i++)fhBinLimTrackletTRDpid[i]=bins[i];
568 break;
569
563113d0 570 case kCutChi2TPC:
db6722a5 571 fhNBinsChi2TPC=nbins+1;
563113d0 572 fhBinLimChi2TPC=new Double_t[nbins+1];
573 for(Int_t i=0;i<nbins+1;i++)fhBinLimChi2TPC[i]=bins[i];
574 break;
6cb5e116 575
563113d0 576 case kCutChi2ITS:
db6722a5 577 fhNBinsChi2ITS=nbins+1;
563113d0 578 fhBinLimChi2ITS=new Double_t[nbins+1];
579 for(Int_t i=0;i<nbins+1;i++)fhBinLimChi2ITS[i]=bins[i];
580 break;
6cb5e116 581
18274103 582 case kCutChi2TRD:
583 fhNBinsChi2TRD=nbins+1;
584 fhBinLimChi2TRD=new Double_t[nbins+1];
585 for(Int_t i=0;i<nbins+1;i++)fhBinLimChi2TRD[i]=bins[i];
586 break;
587
563113d0 588 case kCutCovElement11:
db6722a5 589 fhNBinsCovariance11=nbins+1;
563113d0 590 fhBinLimCovariance11=new Double_t[nbins+1];
591 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance11[i]=bins[i];
592 break;
6cb5e116 593
563113d0 594 case kCutCovElement22:
db6722a5 595 fhNBinsCovariance22=nbins+1;
563113d0 596 fhBinLimCovariance22=new Double_t[nbins+1];
597 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance22[i]=bins[i];
598 break;
6cb5e116 599
563113d0 600 case kCutCovElement33:
db6722a5 601 fhNBinsCovariance33=nbins+1;
563113d0 602 fhBinLimCovariance33=new Double_t[nbins+1];
603 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance33[i]=bins[i];
604 break;
6cb5e116 605
563113d0 606 case kCutCovElement44:
db6722a5 607 fhNBinsCovariance44=nbins+1;
563113d0 608 fhBinLimCovariance44=new Double_t[nbins+1];
609 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance44[i]=bins[i];
610 break;
6cb5e116 611
563113d0 612 case kCutCovElement55:
db6722a5 613 fhNBinsCovariance55=nbins+1;
563113d0 614 fhBinLimCovariance55=new Double_t[nbins+1];
615 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance55[i]=bins[i];
616 break;
617 }
618}
619//__________________________________________________________________________________
620void AliCFTrackQualityCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax)
621{
622 //
623 // fixed bin size
624 //
8edd0c2c 625 if (index<0 || index>=kNHist) {
626 Error("SetHistogramBins","could not determine histogram from index %d",index);
627 return;
628 }
629
563113d0 630 switch(index){
631 case kCutClusterTPC:
db6722a5 632 fhNBinsClusterTPC=nbins+1;
563113d0 633 fhBinLimClusterTPC=new Double_t[nbins+1];
634 for(Int_t i=0;i<nbins+1;i++)fhBinLimClusterTPC[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
635 break;
6cb5e116 636
563113d0 637 case kCutClusterITS:
db6722a5 638 fhNBinsClusterITS=nbins+1;
563113d0 639 fhBinLimClusterITS=new Double_t[nbins+1];
640 for(Int_t i=0;i<nbins+1;i++)fhBinLimClusterITS[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
641 break;
6cb5e116 642
18274103 643 case kCutClusterTRD:
644 fhNBinsClusterTRD=nbins+1;
645 fhBinLimClusterTRD=new Double_t[nbins+1];
646 for(Int_t i=0;i<nbins+1;i++)fhBinLimClusterTRD[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
647 break;
648
65e7777d 649 case kCutMinFoundClusterTPC:
650 fhNBinsFoundClusterTPC=nbins+1;
651 fhBinLimFoundClusterTPC=new Double_t[nbins+1];
652 for(Int_t i=0;i<nbins+1;i++)fhBinLimFoundClusterTPC[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
653 break;
654
655 case kCutTrackletTRD:
656 fhNBinsTrackletTRD=nbins+1;
657 fhBinLimTrackletTRD=new Double_t[nbins+1];
658 for(Int_t i=0;i<nbins+1;i++)fhBinLimTrackletTRD[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
659 break;
660
661 case kCutTrackletTRDpid:
662 fhNBinsTrackletTRDpid=nbins+1;
663 fhBinLimTrackletTRDpid=new Double_t[nbins+1];
664 for(Int_t i=0;i<nbins+1;i++)fhBinLimTrackletTRDpid[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
665 break;
666
563113d0 667 case kCutChi2TPC:
db6722a5 668 fhNBinsChi2TPC=nbins+1;
563113d0 669 fhBinLimChi2TPC=new Double_t[nbins+1];
670 for(Int_t i=0;i<nbins+1;i++)fhBinLimChi2TPC[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
671 break;
6cb5e116 672
563113d0 673 case kCutChi2ITS:
db6722a5 674 fhNBinsChi2ITS=nbins+1;
563113d0 675 fhBinLimChi2ITS=new Double_t[nbins+1];
676 for(Int_t i=0;i<nbins+1;i++)fhBinLimChi2ITS[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
677 break;
6cb5e116 678
18274103 679 case kCutChi2TRD:
680 fhNBinsChi2TRD=nbins+1;
681 fhBinLimChi2TRD=new Double_t[nbins+1];
682 for(Int_t i=0;i<nbins+1;i++)fhBinLimChi2TRD[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
683 break;
684
563113d0 685 case kCutCovElement11:
db6722a5 686 fhNBinsCovariance11=nbins+1;
563113d0 687 fhBinLimCovariance11=new Double_t[nbins+1];
688 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance11[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
689 break;
6cb5e116 690
563113d0 691 case kCutCovElement22:
db6722a5 692 fhNBinsCovariance22=nbins+1;
563113d0 693 fhBinLimCovariance22=new Double_t[nbins+1];
694 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance22[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
695 break;
6cb5e116 696
563113d0 697 case kCutCovElement33:
db6722a5 698 fhNBinsCovariance33=nbins+1;
563113d0 699 fhBinLimCovariance33=new Double_t[nbins+1];
700 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance33[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
701 break;
6cb5e116 702
563113d0 703 case kCutCovElement44:
db6722a5 704 fhNBinsCovariance44=nbins+1;
563113d0 705 fhBinLimCovariance44=new Double_t[nbins+1];
706 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance44[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
707 break;
6cb5e116 708
563113d0 709 case kCutCovElement55:
db6722a5 710 fhNBinsCovariance55=nbins+1;
563113d0 711 fhBinLimCovariance55=new Double_t[nbins+1];
712 for(Int_t i=0;i<nbins+1;i++)fhBinLimCovariance55[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
713 break;
714 }
715}
716//__________________________________________________________________________________
717 void AliCFTrackQualityCuts::DefineHistograms() {
718 //
719 // histograms for cut variables, cut statistics and cut correlations
720 //
563113d0 721 Int_t color = 2;
722
723 // book cut statistics and cut correlation histograms
724 fhCutStatistics = new TH1F(Form("%s_cut_statistics",GetName()), Form("%s cut statistics",GetName()), kNCuts,0.5,kNCuts+0.5);
725 fhCutStatistics->SetLineWidth(2);
18274103 726 fhCutStatistics->GetXaxis()->SetBinLabel(1, "nClustersTPC");
727 fhCutStatistics->GetXaxis()->SetBinLabel(2, "nClustersITS");
65e7777d 728 fhCutStatistics->GetXaxis()->SetBinLabel(3, "nClustersTRD");
729 fhCutStatistics->GetXaxis()->SetBinLabel(4, "fractionClustersTPC");
730 fhCutStatistics->GetXaxis()->SetBinLabel(5, "ntrackletsTRD");
731 fhCutStatistics->GetXaxis()->SetBinLabel(6, "ntrackletsTRDpid");
732 fhCutStatistics->GetXaxis()->SetBinLabel(7, "chi2PerClusterTPC");
733 fhCutStatistics->GetXaxis()->SetBinLabel(8, "chi2PerClusterITS");
734 fhCutStatistics->GetXaxis()->SetBinLabel(9, "chi2PerTrackletTRD");
735 fhCutStatistics->GetXaxis()->SetBinLabel(10, "covElement11");
736 fhCutStatistics->GetXaxis()->SetBinLabel(11, "covElement22");
737 fhCutStatistics->GetXaxis()->SetBinLabel(12, "covElement33");
738 fhCutStatistics->GetXaxis()->SetBinLabel(13, "covElement44");
739 fhCutStatistics->GetXaxis()->SetBinLabel(14, "covElement55");
740 fhCutStatistics->GetXaxis()->SetBinLabel(15, "status");
563113d0 741
742 fhCutCorrelation = new TH2F(Form("%s_cut_correlation",GetName()), Form("%s cut correlation",GetName()), kNCuts,0.5,kNCuts+0.5,kNCuts,0.5,kNCuts+0.5);
743 fhCutCorrelation->SetLineWidth(2);
18274103 744 fhCutCorrelation->GetXaxis()->SetBinLabel(1, "nClustersTPC");
745 fhCutCorrelation->GetXaxis()->SetBinLabel(2, "nClustersITS");
746 fhCutCorrelation->GetXaxis()->SetBinLabel(3, "nClustersTRD");
65e7777d 747 fhCutCorrelation->GetXaxis()->SetBinLabel(4, "fractionClustersTPC");
748 fhCutCorrelation->GetXaxis()->SetBinLabel(5, "ntrackletsTRD");
749 fhCutCorrelation->GetXaxis()->SetBinLabel(6, "ntrackletsTRDpid");
750 fhCutCorrelation->GetXaxis()->SetBinLabel(7, "chi2PerClusterTPC");
751 fhCutCorrelation->GetXaxis()->SetBinLabel(8, "chi2PerClusterITS");
752 fhCutCorrelation->GetXaxis()->SetBinLabel(9, "chi2PerTrackletTRD");
753 fhCutCorrelation->GetXaxis()->SetBinLabel(10, "covElement11");
754 fhCutCorrelation->GetXaxis()->SetBinLabel(11, "covElement22");
755 fhCutCorrelation->GetXaxis()->SetBinLabel(12, "covElement33");
756 fhCutCorrelation->GetXaxis()->SetBinLabel(13, "covElement44");
757 fhCutCorrelation->GetXaxis()->SetBinLabel(14, "covElement55");
758 fhCutStatistics->GetXaxis()->SetBinLabel(15, "status");
18274103 759
760 fhCutCorrelation->GetYaxis()->SetBinLabel(1, "nClustersTPC");
761 fhCutCorrelation->GetYaxis()->SetBinLabel(2, "nClustersITS");
762 fhCutCorrelation->GetYaxis()->SetBinLabel(3, "nClustersTRD");
65e7777d 763 fhCutCorrelation->GetYaxis()->SetBinLabel(4, "fractionClustersTPC");
764 fhCutCorrelation->GetYaxis()->SetBinLabel(5, "ntrackletsTRD");
765 fhCutCorrelation->GetYaxis()->SetBinLabel(6, "ntrackletsTRDpid");
766 fhCutCorrelation->GetYaxis()->SetBinLabel(7, "chi2PerClusterTPC");
767 fhCutCorrelation->GetYaxis()->SetBinLabel(8, "chi2PerClusterITS");
768 fhCutCorrelation->GetYaxis()->SetBinLabel(9, "chi2PerTrackletTRD");
769 fhCutCorrelation->GetYaxis()->SetBinLabel(10, "covElement11");
770 fhCutCorrelation->GetYaxis()->SetBinLabel(11, "covElement22");
771 fhCutCorrelation->GetYaxis()->SetBinLabel(12, "covElement33");
772 fhCutCorrelation->GetYaxis()->SetBinLabel(13, "covElement44");
773 fhCutCorrelation->GetYaxis()->SetBinLabel(14, "covElement55");
774 fhCutCorrelation->GetYaxis()->SetBinLabel(15, "status");
563113d0 775
776
777 // book QA histograms
778 Char_t str[256];
779 for (Int_t i=0; i<kNStepQA; i++) {
780 if (i==0) sprintf(str," ");
781 else sprintf(str,"_cut");
6cb5e116 782
db6722a5 783 fhQA[kCutClusterTPC][i] = new TH1F(Form("%s_nClustersTPC%s",GetName(),str) ,"",fhNBinsClusterTPC-1,fhBinLimClusterTPC);
784 fhQA[kCutClusterITS][i] = new TH1F(Form("%s_nClustersITS%s",GetName(),str) ,"",fhNBinsClusterITS-1,fhBinLimClusterITS);
18274103 785 fhQA[kCutClusterTRD][i] = new TH1F(Form("%s_nClustersTRD%s",GetName(),str) ,"",fhNBinsClusterTRD-1,fhBinLimClusterTRD);
65e7777d 786 fhQA[kCutMinFoundClusterTPC][i] = new TH1F(Form("%s_fractionClustersTPC%s",GetName(),str) ,"",fhNBinsFoundClusterTPC-1,fhBinLimFoundClusterTPC);
787 fhQA[kCutTrackletTRD][i] = new TH1F(Form("%s_ntrackletsTRD%s",GetName(),str) ,"",fhNBinsTrackletTRD-1,fhBinLimTrackletTRD);
788 fhQA[kCutTrackletTRDpid][i] = new TH1F(Form("%s_ntrackletsTRDpid%s",GetName(),str) ,"",fhNBinsTrackletTRDpid-1,fhBinLimTrackletTRDpid);
db6722a5 789 fhQA[kCutChi2TPC][i] = new TH1F(Form("%s_chi2PerClusterTPC%s",GetName(),str),"",fhNBinsChi2TPC-1,fhBinLimChi2TPC);
790 fhQA[kCutChi2ITS][i] = new TH1F(Form("%s_chi2PerClusterITS%s",GetName(),str),"",fhNBinsChi2ITS-1,fhBinLimChi2ITS);
65e7777d 791 fhQA[kCutChi2TRD][i] = new TH1F(Form("%s_chi2PerTrackletTRD%s",GetName(),str),"",fhNBinsChi2TRD-1,fhBinLimChi2TRD);
db6722a5 792 fhQA[kCutCovElement11][i] = new TH1F(Form("%s_covMatrixDiagonal11%s",GetName(),str),"",fhNBinsCovariance11-1,fhBinLimCovariance11);
793 fhQA[kCutCovElement22][i] = new TH1F(Form("%s_covMatrixDiagonal22%s",GetName(),str),"",fhNBinsCovariance22-1,fhBinLimCovariance22);
794 fhQA[kCutCovElement33][i] = new TH1F(Form("%s_covMatrixDiagonal33%s",GetName(),str),"",fhNBinsCovariance33-1,fhBinLimCovariance33);
795 fhQA[kCutCovElement44][i] = new TH1F(Form("%s_covMatrixDiagonal44%s",GetName(),str),"",fhNBinsCovariance44-1,fhBinLimCovariance44);
796 fhQA[kCutCovElement55][i] = new TH1F(Form("%s_covMatrixDiagonal55%s",GetName(),str),"",fhNBinsCovariance55-1,fhBinLimCovariance55);
563113d0 797
798 fhQA[kCutClusterTPC][i] ->SetXTitle("n TPC clusters");
799 fhQA[kCutClusterITS][i] ->SetXTitle("n ITS clusters");
18274103 800 fhQA[kCutClusterTRD][i] ->SetXTitle("n TRD clusters");
65e7777d 801 fhQA[kCutMinFoundClusterTPC][i]->SetXTitle("fraction TPC clusters");
802 fhQA[kCutTrackletTRD][i] ->SetXTitle("n tracklets TRD");
803 fhQA[kCutTrackletTRDpid][i]->SetXTitle("n tracklets TRD pid");
563113d0 804 fhQA[kCutChi2TPC][i] ->SetXTitle("#chi^{2} per TPC cluster");
805 fhQA[kCutChi2ITS][i] ->SetXTitle("#chi^{2} per ITS cluster");
65e7777d 806 fhQA[kCutChi2TRD][i] ->SetXTitle("#chi^{2} per TRD tracklet");
563113d0 807 fhQA[kCutCovElement11][i] ->SetXTitle("cov 11 : #sigma_{y}^{2} (cm^{2})");
808 fhQA[kCutCovElement22][i] ->SetXTitle("cov 22 : #sigma_{z}^{2} (cm^{2})");
809 fhQA[kCutCovElement33][i] ->SetXTitle("cov 33 : #sigma_{sin(#phi)}^{2}");
810 fhQA[kCutCovElement44][i] ->SetXTitle("cov 44 : #sigma_{tan(#theta_{dip})}^{2}");
6cb5e116 811 fhQA[kCutCovElement55][i] ->SetXTitle("cov 55 : #sigma_{1/p_{T}}^{2} ((c/GeV)^{2})");
563113d0 812 }
813
814 for(Int_t i=0; i<kNHist; i++) fhQA[i][1]->SetLineColor(color);
563113d0 815}
816//__________________________________________________________________________________
817void AliCFTrackQualityCuts::FillHistograms(TObject* obj, Bool_t b)
818{
819 //
820 // fill the QA histograms
821 //
563113d0 822
107a3100 823 if (!obj) return;
8edd0c2c 824 if (!obj->InheritsFrom("AliVParticle")) {
825 AliError("object must derived from AliVParticle !");
826 return;
827 }
828
829 Bool_t isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ;
830 Bool_t isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ;
831
832 AliESDtrack * esdTrack = 0x0 ;
833 AliAODTrack * aodTrack = 0x0 ;
834 if (isESDTrack) esdTrack = dynamic_cast<AliESDtrack*>(obj);
835 if (isAODTrack) aodTrack = dynamic_cast<AliAODTrack*>(obj);
563113d0 836
107a3100 837 // b = 0: fill histograms before cuts
838 // b = 1: fill histograms after cuts
563113d0 839
8edd0c2c 840 Int_t nClustersTPC = 0;
841 Int_t nClustersITS = 0 ;
18274103 842 Int_t nClustersTRD = 0 ;
65e7777d 843 Int_t nTrackletsTRD = 0 ;
8edd0c2c 844 Float_t chi2PerClusterTPC = 0 ;
845 Float_t chi2PerClusterITS = 0 ;
65e7777d 846 Float_t chi2PerTrackletTRD = 0 ;
8edd0c2c 847 Double_t extCov[15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
65e7777d 848 Float_t fractionFoundClustersTPC = 0;
849
8edd0c2c 850 if (isESDTrack) {
65e7777d 851 nClustersTPC = esdTrack->GetTPCclusters(0x0);
852 nClustersITS = esdTrack->GetITSclusters(0x0);
853 nClustersTRD = esdTrack->GetTRDncls();
854 nTrackletsTRD = esdTrack->GetTRDntracklets();
8edd0c2c 855 if (nClustersTPC != 0) chi2PerClusterTPC = esdTrack->GetTPCchi2() / Float_t(nClustersTPC);
18274103 856 if (nClustersITS != 0) chi2PerClusterITS = esdTrack->GetITSchi2() / Float_t(nClustersITS);
65e7777d 857 if (nTrackletsTRD != 0) chi2PerTrackletTRD = esdTrack->GetTRDchi2() / Float_t(nTrackletsTRD);
8edd0c2c 858 esdTrack->GetExternalCovariance(extCov);
65e7777d 859 if (esdTrack->GetTPCNclsF() != 0) fractionFoundClustersTPC = float(nClustersTPC) / float(esdTrack->GetTPCNclsF());
860 }
107a3100 861 fhQA[kCutClusterTPC][b]->Fill((float)nClustersTPC);
107a3100 862 fhQA[kCutChi2TPC][b]->Fill(chi2PerClusterTPC);
107a3100 863 fhQA[kCutClusterITS][b]->Fill((float)nClustersITS);
107a3100 864 fhQA[kCutChi2ITS][b]->Fill(chi2PerClusterITS);
18274103 865 fhQA[kCutClusterTRD][b]->Fill((float)nClustersTRD);
65e7777d 866 fhQA[kCutChi2TRD][b]->Fill(chi2PerTrackletTRD);
867 if (b==0 || (b==1 && nClustersTPC>0)) fhQA[kCutMinFoundClusterTPC][b]->Fill((float)fractionFoundClustersTPC);
868 fhQA[kCutTrackletTRD][b]->Fill((float)nTrackletsTRD);
869 fhQA[kCutTrackletTRDpid][b]->Fill((float)esdTrack->GetTRDntrackletsPID());
107a3100 870 fhQA[kCutCovElement11][b]->Fill(extCov[0]);
871 fhQA[kCutCovElement22][b]->Fill(extCov[2]);
872 fhQA[kCutCovElement33][b]->Fill(extCov[5]);
873 fhQA[kCutCovElement44][b]->Fill(extCov[9]);
874 fhQA[kCutCovElement55][b]->Fill(extCov[14]);
6cb5e116 875
563113d0 876 // fill cut statistics and cut correlation histograms with information from the bitmap
877 if (b) return;
878
879 // Get the bitmap of the single cuts
880 if ( !obj ) return;
107a3100 881 SelectionBitMap(obj);
563113d0 882
883 // Number of single cuts in this class
107a3100 884 UInt_t ncuts = fBitmap->GetNbits();
563113d0 885 for(UInt_t bit=0; bit<ncuts;bit++) {
107a3100 886 if (!fBitmap->TestBitNumber(bit)) {
563113d0 887 fhCutStatistics->Fill(bit+1);
888 for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
107a3100 889 if (!fBitmap->TestBitNumber(bit2))
563113d0 890 fhCutCorrelation->Fill(bit+1,bit2+1);
891 }
892 }
893 }
894}
895//__________________________________________________________________________________
896void AliCFTrackQualityCuts::SaveHistograms(const Char_t* dir) {
897 //
898 // saves the histograms in a directory (dir)
899 //
900 if(!fIsQAOn) return;
901
902 if (!dir)
903 dir = GetName();
904
905 gDirectory->mkdir(dir);
906 gDirectory->cd(dir);
907
908 gDirectory->mkdir("before_cuts");
909 gDirectory->mkdir("after_cuts");
910
911 fhCutStatistics->Write();
912 fhCutCorrelation->Write();
913
914 for (Int_t j=0; j<kNStepQA; j++) {
915 if (j==0)
916 gDirectory->cd("before_cuts");
917 else
918 gDirectory->cd("after_cuts");
919
920 for(Int_t i=0; i<kNHist; i++) fhQA[i][j]->Write();
921
922 gDirectory->cd("../");
923 }
924 gDirectory->cd("../");
925}
926//__________________________________________________________________________________
927void AliCFTrackQualityCuts::DrawHistograms(Bool_t drawLogScale)
928{
929 //
930 // draws some histograms
931 //
932 if(!fIsQAOn) return;
933
934 // pad margins
935 Float_t right = 0.03;
936 Float_t left = 0.175;
937 Float_t top = 0.03;
938 Float_t bottom = 0.175;
939
940 TCanvas* canvas1 = new TCanvas("Track_QA_Quality_1", "Track QA Quality 1", 800, 500);
941 canvas1->Divide(2, 1);
942
943 canvas1->cd(1);
944 fhCutStatistics->SetStats(kFALSE);
945 fhCutStatistics->LabelsOption("v");
946 gPad->SetLeftMargin(left);
947 gPad->SetBottomMargin(0.25);
948 gPad->SetRightMargin(right);
949 gPad->SetTopMargin(0.1);
950 fhCutStatistics->Draw();
951
952 canvas1->cd(2);
953 fhCutCorrelation->SetStats(kFALSE);
954 fhCutCorrelation->LabelsOption("v");
955 gPad->SetLeftMargin(0.30);
956 gPad->SetRightMargin(bottom);
957 gPad->SetTopMargin(0.1);
958 gPad->SetBottomMargin(0.25);
959 fhCutCorrelation->Draw("COLZ");
960
961 canvas1->SaveAs(Form("%s.eps", canvas1->GetName()));
962 canvas1->SaveAs(Form("%s.ps", canvas1->GetName()));
963
964 // -----
965
966 TCanvas* canvas2 = new TCanvas("Track_QA_Quality_2", "Track QA Quality 2", 1200, 800);
8edd0c2c 967 canvas2->Divide(2, 2);
563113d0 968
969 canvas2->cd(1);
970 gPad->SetRightMargin(right);
971 gPad->SetLeftMargin(left);
972 gPad->SetTopMargin(top);
973 gPad->SetBottomMargin(bottom);
974 fhQA[kCutClusterTPC][0]->SetStats(kFALSE);
975 fhQA[kCutClusterTPC][0]->Draw();
976 fhQA[kCutClusterTPC][1]->Draw("same");
977
978 canvas2->cd(2);
979 gPad->SetRightMargin(right);
980 gPad->SetLeftMargin(left);
981 gPad->SetTopMargin(top);
982 gPad->SetBottomMargin(bottom);
983 fhQA[kCutChi2TPC][0]->SetStats(kFALSE);
984 fhQA[kCutChi2TPC][0]->Draw();
985 fhQA[kCutChi2TPC][1]->Draw("same");
986
987 canvas2->cd(3);
988 gPad->SetRightMargin(right);
989 gPad->SetLeftMargin(left);
990 gPad->SetTopMargin(top);
991 gPad->SetBottomMargin(bottom);
563113d0 992 fhQA[kCutClusterITS][0]->SetStats(kFALSE);
993 fhQA[kCutClusterITS][0]->Draw();
994 fhQA[kCutClusterITS][1]->Draw("same");
995
8edd0c2c 996 canvas2->cd(4);
563113d0 997 gPad->SetRightMargin(right);
998 gPad->SetLeftMargin(left);
999 gPad->SetTopMargin(top);
1000 gPad->SetBottomMargin(bottom);
1001 fhQA[kCutChi2ITS][0]->SetStats(kFALSE);
1002 fhQA[kCutChi2ITS][0]->Draw();
1003 fhQA[kCutChi2ITS][1]->Draw("same");
1004
563113d0 1005 canvas2->SaveAs(Form("%s.eps", canvas2->GetName()));
1006 canvas2->SaveAs(Form("%s.ps", canvas2->GetName()));
1007
1008 // -----
1009
1010 TCanvas* canvas3 = new TCanvas("Track_QA_Quality_3", "Track QA Quality 3", 1200, 800);
1011 canvas3->Divide(3, 2);
1012
1013 canvas3->cd(1);
1014 if(drawLogScale) gPad->SetLogy();
1015 gPad->SetRightMargin(right);
1016 gPad->SetLeftMargin(left);
1017 gPad->SetTopMargin(top);
1018 gPad->SetBottomMargin(bottom);
1019 fhQA[kCutCovElement11][0]->SetStats(kFALSE);
1020 fhQA[kCutCovElement11][0]->Draw();
1021 fhQA[kCutCovElement11][1]->Draw("same");
1022
1023 canvas3->cd(2);
1024 if(drawLogScale) gPad->SetLogy();
1025 gPad->SetRightMargin(right);
1026 gPad->SetLeftMargin(left);
1027 gPad->SetTopMargin(top);
1028 gPad->SetBottomMargin(bottom);
1029 fhQA[kCutCovElement22][0]->SetStats(kFALSE);
1030 fhQA[kCutCovElement22][0]->Draw();
1031 fhQA[kCutCovElement22][1]->Draw("same");
1032
1033 canvas3->cd(3);
1034 if(drawLogScale) gPad->SetLogy();
1035 gPad->SetRightMargin(right);
1036 gPad->SetLeftMargin(left);
1037 gPad->SetTopMargin(top);
1038 gPad->SetBottomMargin(bottom);
1039 fhQA[kCutCovElement33][0]->SetStats(kFALSE);
1040 fhQA[kCutCovElement33][0]->Draw();
1041 fhQA[kCutCovElement33][1]->Draw("same");
1042
1043 canvas3->cd(4);
1044 if(drawLogScale) gPad->SetLogy();
1045 gPad->SetRightMargin(right);
1046 gPad->SetLeftMargin(left);
1047 gPad->SetTopMargin(top);
1048 gPad->SetBottomMargin(bottom);
1049 fhQA[kCutCovElement44][0]->SetStats(kFALSE);
1050 fhQA[kCutCovElement44][0]->Draw();
1051 fhQA[kCutCovElement44][1]->Draw("same");
1052
1053 canvas3->cd(5);
1054 if(drawLogScale) gPad->SetLogy();
1055 gPad->SetRightMargin(right);
1056 gPad->SetLeftMargin(left);
1057 gPad->SetTopMargin(top);
1058 gPad->SetBottomMargin(bottom);
1059 fhQA[kCutCovElement55][0]->SetStats(kFALSE);
1060 fhQA[kCutCovElement55][0]->Draw();
1061 fhQA[kCutCovElement55][1]->Draw("same");
1062
1063 canvas3->SaveAs(Form("%s.eps", canvas3->GetName()));
1064 canvas3->SaveAs(Form("%s.ps", canvas3->GetName()));
1065}
1066//__________________________________________________________________________________
107a3100 1067void AliCFTrackQualityCuts::AddQAHistograms(TList *qaList) {
563113d0 1068 //
1069 // saves the histograms in a TList
1070 //
107a3100 1071 DefineHistograms();
563113d0 1072
1073 qaList->Add(fhCutStatistics);
1074 qaList->Add(fhCutCorrelation);
1075
1076 for (Int_t j=0; j<kNStepQA; j++) {
1077 for(Int_t i=0; i<kNHist; i++)
1078 qaList->Add(fhQA[i][j]);
1079 }
1080}