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