removed warning
[u/mrichter/AliRoot.git] / CORRFW / AliCFTrackIsPrimaryCuts.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 AliCFTrackIsPrimaryCut is designed to select reconstructed tracks
17// with a small impact parameter and tracks which are (not) daughters of kink
18// decays and to provide corresponding QA histograms.
19// This class inherits from the Analysis' Framework abstract base class
20// AliAnalysisCuts and is a part of the Correction Framework.
21// This class acts on single, reconstructed tracks, it is applicable on
22// ESD and AOD data.
23// It mainly consists of a IsSelected function that returns a boolean.
24// This function checks whether the considered track passes a set of cuts:
89d7d478 25// - min. and max. distance to main vertex in transverse plane (xy)
26// - min. and max. longitudinal distance to main vertex (z)
27// - min. and max. distance to main vertex as ellpise in xy - z plane
28// - all above cuts on absolute values or in units of sigma (resolution)
29// - min. and max. distance to main vertex in units of sigma (resolution)
30// - max. transverse (xy) and longitudinal (z) impact parameter resolution
563113d0 31// - require that the dca calculation doesn't fail
32// - accept or not accept daughter tracks of kink decays
33//
c66800ea 34// By default, the distance to 'vertex calculated from tracks' is used.
c2c45ca4 35// Optionally the SPD (tracklet based) or TPC (TPC only tracks based) vertex
36// can be used.
37// Note: the distance to the TPC-vertex is already stored in the ESD,
38// the distance to the SPD-vertex has to be re-calculated by propagating each
39// track while executing this cut.
c66800ea 40//
563113d0 41// The cut values for these cuts are set with the corresponding set functions.
42// All cut classes provided by the correction framework are supposed to be
43// added in the Analysis Framwork's class AliAnalysisFilter and applied by
44// the filter via a loop.
45//
46// author: I. Kraus (Ingrid.Kraus@cern.ch)
47// idea taken form
48// AliESDtrackCuts writte by Jan Fiete Grosse-Oetringhaus and
49// AliRsnDaughterCut class written by A. Pulvirenti.
50
51#include <TCanvas.h>
52#include <TDirectory.h>
563113d0 53#include <TH2.h>
62037e79 54#include <TBits.h>
55
563113d0 56#include <AliESDtrack.h>
03f487b1 57#include <AliAODTrack.h>
8f7575ff 58#include <AliESDEvent.h>
03f487b1 59#include <AliAODEvent.h>
563113d0 60#include <AliLog.h>
61#include "AliCFTrackIsPrimaryCuts.h"
62
63ClassImp(AliCFTrackIsPrimaryCuts)
64
65//__________________________________________________________________________________
66AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts() :
67 AliCFCutBase(),
03f487b1 68 fEvt(0x0),
c2c45ca4 69 fUseSPDvertex(0),
c66800ea 70 fUseTPCvertex(0),
89d7d478 71 fMinDCAToVertexXY(0),
72 fMinDCAToVertexZ(0),
73 fMaxDCAToVertexXY(0),
74 fMaxDCAToVertexZ(0),
75 fDCAToVertex2D(0),
76 fAbsDCAToVertex(0),
77 fNSigmaToVertexMin(0),
563113d0 78 fNSigmaToVertexMax(0),
89d7d478 79 fSigmaDCAxy(0),
80 fSigmaDCAz(0),
563113d0 81 fRequireSigmaToVertex(0),
8edd0c2c 82 fAODType(AliAODTrack::kUndef),
563113d0 83 fAcceptKinkDaughters(0),
84 fhCutStatistics(0),
85 fhCutCorrelation(0),
86 fBitmap(0x0),
87 fhNBinsNSigma(0),
88 fhNBinsRequireSigma(0),
89 fhNBinsAcceptKink(0),
90 fhNBinsDcaXY(0),
91 fhNBinsDcaZ(0),
92 fhNBinsDcaXYnorm(0),
93 fhNBinsDcaZnorm(0),
89d7d478 94 fhNBinsSigmaDcaXY(0),
95 fhNBinsSigmaDcaZ(0),
563113d0 96 fhBinLimNSigma(0x0),
97 fhBinLimRequireSigma(0x0),
98 fhBinLimAcceptKink(0x0),
99 fhBinLimDcaXY(0x0),
100 fhBinLimDcaZ(0x0),
101 fhBinLimDcaXYnorm(0x0),
89d7d478 102 fhBinLimDcaZnorm(0x0),
103 fhBinLimSigmaDcaXY(0x0),
104 fhBinLimSigmaDcaZ(0x0)
563113d0 105{
106 //
107 // Default constructor
108 //
563113d0 109 Initialise();
110}
111//__________________________________________________________________________________
112AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts(Char_t* name, Char_t* title) :
113 AliCFCutBase(name,title),
03f487b1 114 fEvt(0x0),
c2c45ca4 115 fUseSPDvertex(0),
c66800ea 116 fUseTPCvertex(0),
89d7d478 117 fMinDCAToVertexXY(0),
118 fMinDCAToVertexZ(0),
119 fMaxDCAToVertexXY(0),
120 fMaxDCAToVertexZ(0),
121 fDCAToVertex2D(0),
122 fAbsDCAToVertex(0),
123 fNSigmaToVertexMin(0),
563113d0 124 fNSigmaToVertexMax(0),
89d7d478 125 fSigmaDCAxy(0),
126 fSigmaDCAz(0),
563113d0 127 fRequireSigmaToVertex(0),
8edd0c2c 128 fAODType(AliAODTrack::kUndef),
563113d0 129 fAcceptKinkDaughters(0),
130 fhCutStatistics(0),
131 fhCutCorrelation(0),
132 fBitmap(0x0),
133 fhNBinsNSigma(0),
134 fhNBinsRequireSigma(0),
135 fhNBinsAcceptKink(0),
136 fhNBinsDcaXY(0),
137 fhNBinsDcaZ(0),
138 fhNBinsDcaXYnorm(0),
139 fhNBinsDcaZnorm(0),
89d7d478 140 fhNBinsSigmaDcaXY(0),
141 fhNBinsSigmaDcaZ(0),
563113d0 142 fhBinLimNSigma(0x0),
143 fhBinLimRequireSigma(0x0),
144 fhBinLimAcceptKink(0x0),
145 fhBinLimDcaXY(0x0),
146 fhBinLimDcaZ(0x0),
147 fhBinLimDcaXYnorm(0x0),
89d7d478 148 fhBinLimDcaZnorm(0x0),
149 fhBinLimSigmaDcaXY(0x0),
150 fhBinLimSigmaDcaZ(0x0)
563113d0 151{
152 //
153 // Constructor
154 //
563113d0 155 Initialise();
156}
157//__________________________________________________________________________________
158AliCFTrackIsPrimaryCuts::AliCFTrackIsPrimaryCuts(const AliCFTrackIsPrimaryCuts& c) :
159 AliCFCutBase(c),
03f487b1 160 fEvt(c.fEvt),
c2c45ca4 161 fUseSPDvertex(c.fUseSPDvertex),
c66800ea 162 fUseTPCvertex(c.fUseTPCvertex),
89d7d478 163 fMinDCAToVertexXY(c.fMinDCAToVertexXY),
164 fMinDCAToVertexZ(c.fMinDCAToVertexZ),
165 fMaxDCAToVertexXY(c.fMaxDCAToVertexXY),
166 fMaxDCAToVertexZ(c.fMaxDCAToVertexZ),
167 fDCAToVertex2D(c.fDCAToVertex2D),
168 fAbsDCAToVertex(c.fAbsDCAToVertex),
169 fNSigmaToVertexMin(c.fNSigmaToVertexMin),
563113d0 170 fNSigmaToVertexMax(c.fNSigmaToVertexMax),
89d7d478 171 fSigmaDCAxy(c.fSigmaDCAxy),
172 fSigmaDCAz(c.fSigmaDCAz),
563113d0 173 fRequireSigmaToVertex(c.fRequireSigmaToVertex),
8edd0c2c 174 fAODType(c.fAODType),
563113d0 175 fAcceptKinkDaughters(c.fAcceptKinkDaughters),
176 fhCutStatistics(c.fhCutStatistics),
177 fhCutCorrelation(c.fhCutCorrelation),
178 fBitmap(c.fBitmap),
179 fhNBinsNSigma(c.fhNBinsNSigma),
180 fhNBinsRequireSigma(c.fhNBinsRequireSigma),
181 fhNBinsAcceptKink(c.fhNBinsAcceptKink),
182 fhNBinsDcaXY(c.fhNBinsDcaXY),
183 fhNBinsDcaZ(c.fhNBinsDcaZ),
184 fhNBinsDcaXYnorm(c.fhNBinsDcaXYnorm),
185 fhNBinsDcaZnorm(c.fhNBinsDcaZnorm),
89d7d478 186 fhNBinsSigmaDcaXY(c.fhNBinsSigmaDcaXY),
187 fhNBinsSigmaDcaZ(c.fhNBinsSigmaDcaZ),
563113d0 188 fhBinLimNSigma(c.fhBinLimNSigma),
189 fhBinLimRequireSigma(c.fhBinLimRequireSigma),
190 fhBinLimAcceptKink(c.fhBinLimAcceptKink),
191 fhBinLimDcaXY(c.fhBinLimDcaXY),
192 fhBinLimDcaZ(c.fhBinLimDcaZ),
193 fhBinLimDcaXYnorm(c.fhBinLimDcaXYnorm),
89d7d478 194 fhBinLimDcaZnorm(c.fhBinLimDcaZnorm),
195 fhBinLimSigmaDcaXY(c.fhBinLimSigmaDcaXY),
196 fhBinLimSigmaDcaZ(c.fhBinLimSigmaDcaZ)
563113d0 197{
198 //
199 // copy constructor
200 //
201 ((AliCFTrackIsPrimaryCuts &) c).Copy(*this);
202}
203//__________________________________________________________________________________
204AliCFTrackIsPrimaryCuts& AliCFTrackIsPrimaryCuts::operator=(const AliCFTrackIsPrimaryCuts& c)
205{
206 //
207 // Assignment operator
208 //
209 if (this != &c) {
210 AliCFCutBase::operator=(c) ;
03f487b1 211 fEvt = c.fEvt;
c2c45ca4 212 fUseSPDvertex = c.fUseSPDvertex;
c66800ea 213 fUseTPCvertex = c.fUseTPCvertex;
89d7d478 214 fMinDCAToVertexXY = c.fMinDCAToVertexXY;
215 fMinDCAToVertexZ = c.fMinDCAToVertexZ;
216 fMaxDCAToVertexXY = c.fMaxDCAToVertexXY;
217 fMaxDCAToVertexZ = c.fMaxDCAToVertexZ;
218 fDCAToVertex2D = c.fDCAToVertex2D;
219 fAbsDCAToVertex = c.fAbsDCAToVertex;
220 fNSigmaToVertexMin = c.fNSigmaToVertexMin ;
563113d0 221 fNSigmaToVertexMax = c.fNSigmaToVertexMax ;
89d7d478 222 fSigmaDCAxy = c.fSigmaDCAxy ;
223 fSigmaDCAz = c.fSigmaDCAz ;
563113d0 224 fRequireSigmaToVertex = c.fRequireSigmaToVertex ;
8edd0c2c 225 fAODType = c.fAODType ;
563113d0 226 fAcceptKinkDaughters = c.fAcceptKinkDaughters ;
227 fhCutStatistics = c.fhCutStatistics ;
228 fhCutCorrelation = c.fhCutCorrelation ;
229 fBitmap = c.fBitmap;
230 fhNBinsNSigma = c.fhNBinsNSigma;
231 fhNBinsRequireSigma = c.fhNBinsRequireSigma;
232 fhNBinsAcceptKink = c.fhNBinsAcceptKink;
233 fhNBinsDcaXY = c.fhNBinsDcaXY;
234 fhNBinsDcaZ = c.fhNBinsDcaZ;
235 fhNBinsDcaXYnorm = c.fhNBinsDcaXYnorm;
236 fhNBinsDcaZnorm = c.fhNBinsDcaZnorm;
89d7d478 237 fhNBinsSigmaDcaXY = c.fhNBinsSigmaDcaXY;
238 fhNBinsSigmaDcaZ = c.fhNBinsSigmaDcaZ;
563113d0 239 fhBinLimNSigma = c.fhBinLimNSigma;
240 fhBinLimRequireSigma = c.fhBinLimRequireSigma;
241 fhBinLimAcceptKink = c.fhBinLimAcceptKink;
242 fhBinLimDcaXY = c.fhBinLimDcaXY;
243 fhBinLimDcaZ = c.fhBinLimDcaZ;
244 fhBinLimDcaXYnorm = c.fhBinLimDcaXYnorm;
245 fhBinLimDcaZnorm = c.fhBinLimDcaZnorm;
89d7d478 246 fhBinLimSigmaDcaXY = c.fhBinLimSigmaDcaXY;
247 fhBinLimSigmaDcaZ = c.fhBinLimSigmaDcaZ;
62037e79 248
c66800ea 249 for (Int_t j=0; j<6; j++) fDCA[j] = c.fDCA[j];
8edd0c2c 250 for (Int_t j=0; j<c.kNStepQA; j++){
251 if(c.fhDcaXYvsDcaZ[j]) fhDcaXYvsDcaZ[j] = (TH2F*)c.fhDcaXYvsDcaZ[j]->Clone();
8edd0c2c 252 for (Int_t i=0; i<c.kNHist; i++){
563113d0 253 if(c.fhQA[i][j]) fhQA[i][j] = (TH1F*)c.fhQA[i][j]->Clone();
563113d0 254 }
255 }
563113d0 256 ((AliCFTrackIsPrimaryCuts &) c).Copy(*this);
257 }
258 return *this;
259}
260//__________________________________________________________________________________
261AliCFTrackIsPrimaryCuts::~AliCFTrackIsPrimaryCuts()
262{
263 //
264 // destructor
265 //
266 if (fhCutStatistics) delete fhCutStatistics;
267 if (fhCutCorrelation) delete fhCutCorrelation;
268
269 for (Int_t j=0; j<kNStepQA; j++){
62037e79 270 if(fhDcaXYvsDcaZ[j]) delete fhDcaXYvsDcaZ[j];
62037e79 271 for (Int_t i=0; i<kNHist; i++)
272 if(fhQA[i][j]) delete fhQA[i][j];
563113d0 273 }
03f487b1 274 if(fEvt) delete fEvt;
62037e79 275 if(fBitmap) delete fBitmap;
276 if(fhBinLimNSigma) delete fhBinLimNSigma;
277 if(fhBinLimRequireSigma) delete fhBinLimRequireSigma;
278 if(fhBinLimAcceptKink) delete fhBinLimAcceptKink;
279 if(fhBinLimDcaXY) delete fhBinLimDcaXY;
280 if(fhBinLimDcaZ) delete fhBinLimDcaZ;
281 if(fhBinLimDcaXYnorm) delete fhBinLimDcaXYnorm;
282 if(fhBinLimDcaZnorm) delete fhBinLimDcaZnorm;
89d7d478 283 if(fhBinLimSigmaDcaXY) delete fhBinLimSigmaDcaXY;
284 if(fhBinLimSigmaDcaZ) delete fhBinLimSigmaDcaZ;
563113d0 285}
286//__________________________________________________________________________________
287void AliCFTrackIsPrimaryCuts::Initialise()
288{
289 //
290 // sets everything to zero
291 //
c2c45ca4 292 fUseSPDvertex = 0;
c66800ea 293 fUseTPCvertex = 0;
89d7d478 294 fMinDCAToVertexXY = 0;
295 fMinDCAToVertexZ = 0;
296 fMaxDCAToVertexXY = 0;
297 fMaxDCAToVertexZ = 0;
298 fDCAToVertex2D = 0;
299 fAbsDCAToVertex = 0;
300 fNSigmaToVertexMin = 0;
563113d0 301 fNSigmaToVertexMax = 0;
89d7d478 302 fSigmaDCAxy = 0;
303 fSigmaDCAz = 0;
563113d0 304 fRequireSigmaToVertex = 0;
305 fAcceptKinkDaughters = 0;
8edd0c2c 306 fAODType = AliAODTrack::kUndef;
563113d0 307
89d7d478 308 SetMinDCAToVertexXY();
309 SetMinDCAToVertexZ();
310 SetMaxDCAToVertexXY();
311 SetMaxDCAToVertexZ();
312 SetDCAToVertex2D();
313 SetAbsDCAToVertex();
314 SetMinNSigmaToVertex();
563113d0 315 SetMaxNSigmaToVertex();
89d7d478 316 SetMaxSigmaDCAxy();
317 SetMaxSigmaDCAz();
563113d0 318 SetRequireSigmaToVertex();
cced7196 319 SetAcceptKinkDaughters();
8edd0c2c 320 SetAODType();
563113d0 321
c66800ea 322 for (Int_t j=0; j<6; j++) fDCA[j] = 0.;
563113d0 323 for (Int_t j=0; j<kNStepQA; j++) {
563113d0 324 fhDcaXYvsDcaZ[j] = 0x0;
62037e79 325 for (Int_t i=0; i<kNHist; i++)
326 fhQA[i][j] = 0x0;
563113d0 327 }
328 fhCutStatistics = 0;
329 fhCutCorrelation = 0;
62037e79 330 fBitmap=new TBits(0);
331
563113d0 332 //set default bining for QA histograms
c66800ea 333 SetHistogramBins(kCutNSigmaToVertex,100,0.,10.);
62037e79 334 SetHistogramBins(kCutRequireSigmaToVertex,5,-0.75,1.75);
335 SetHistogramBins(kCutAcceptKinkDaughters,5,-0.75,1.75);
336 SetHistogramBins(kDcaXY,500,-10.,10.);
337 SetHistogramBins(kDcaZ,500,-10.,10.);
338 SetHistogramBins(kDcaXYnorm,500,-10.,10.);
339 SetHistogramBins(kDcaZnorm,500,-10.,10.);
89d7d478 340 SetHistogramBins(kSigmaDcaXY,500,-0.1,0.9);
341 SetHistogramBins(kSigmaDcaZ,500,-0.1,0.9);
563113d0 342}
343//__________________________________________________________________________________
344void AliCFTrackIsPrimaryCuts::Copy(TObject &c) const
345{
346 //
347 // Copy function
348 //
349 AliCFTrackIsPrimaryCuts& target = (AliCFTrackIsPrimaryCuts &) c;
350
351 target.Initialise();
352
353 if (fhCutStatistics) target.fhCutStatistics = (TH1F*) fhCutStatistics->Clone();
354 if (fhCutCorrelation) target.fhCutCorrelation = (TH2F*) fhCutCorrelation->Clone();
355
c66800ea 356 for (Int_t j=0; j<6; j++) target.fDCA[j] = fDCA[j];
563113d0 357 for (Int_t j=0; j<kNStepQA; j++){
563113d0 358 if(fhDcaXYvsDcaZ[j]) target.fhDcaXYvsDcaZ[j] = (TH2F*)fhDcaXYvsDcaZ[j]->Clone();
62037e79 359 for (Int_t i=0; i<kNHist; i++)
360 if(fhQA[i][j]) target.fhQA[i][j] = (TH1F*)fhQA[i][j]->Clone();
563113d0 361 }
563113d0 362 TNamed::Copy(c);
363}
563113d0 364//__________________________________________________________________________________
03f487b1 365void AliCFTrackIsPrimaryCuts::SetRecEventInfo(const TObject* evt) {
c2c45ca4 366 //
03f487b1 367 // Sets pointer to event information (AliESDEvent or AliAODEvent)
c2c45ca4 368 //
03f487b1 369 if (!evt) {
370 AliError("Pointer to AliVEvent !");
c2c45ca4 371 return;
372 }
03f487b1 373 TString className(evt->ClassName());
374 if (! (className.CompareTo("AliESDEvent")==0 || className.CompareTo("AliAODEvent")==0)) {
375 AliError("argument must point to an AliESDEvent or AliAODEvent !");
c2c45ca4 376 return ;
377 }
03f487b1 378 fEvt = (AliVEvent*) evt;
c2c45ca4 379}
380//__________________________________________________________________________________
381void AliCFTrackIsPrimaryCuts::UseSPDvertex(Bool_t b) {
382 fUseSPDvertex = b;
84a7f48a 383 if(fUseTPCvertex && fUseSPDvertex) {
384 fUseSPDvertex = kFALSE;
385 AliError("SPD and TPC vertex chosen. TPC vertex is preferred.");
386 }
c2c45ca4 387}
388//__________________________________________________________________________________
389void AliCFTrackIsPrimaryCuts::UseTPCvertex(Bool_t b) {
390 fUseTPCvertex = b;
391 if(fUseTPCvertex) fUseSPDvertex = kFALSE;
392}
393//__________________________________________________________________________________
c66800ea 394void AliCFTrackIsPrimaryCuts::GetDCA(AliESDtrack* esdTrack)
395{
396 if (!esdTrack) return;
397
398 Float_t b[2] = {0.,0.};
399 Float_t bCov[3] = {0.,0.,0.};
c2c45ca4 400 if(!fUseSPDvertex && !fUseTPCvertex) esdTrack->GetImpactParameters(b,bCov);
401 if( fUseTPCvertex) esdTrack->GetImpactParametersTPC(b,bCov);
402
403 if( fUseSPDvertex) {
03f487b1 404 if (!fEvt) return;
405 AliESDEvent * evt = 0x0 ;
406 evt = dynamic_cast<AliESDEvent*>(fEvt);
b7ccf481 407 if (!evt) {
408 AliError("event not found");
409 return;
410 }
03f487b1 411 const AliESDVertex *vtx = evt->GetVertex();
412 const Double_t Bz = evt->GetMagneticField();
c2c45ca4 413 AliExternalTrackParam *cParam = 0;
414 Bool_t success = esdTrack->RelateToVertex(vtx, Bz, kVeryBig, cParam);
415 if (success) esdTrack->GetImpactParameters(b,bCov);
416 }
c66800ea 417
418 if (bCov[0]<=0 || bCov[2]<=0) {
419 bCov[0]=0; bCov[2]=0;
420 }
421 fDCA[0] = b[0]; // impact parameter xy
422 fDCA[1] = b[1]; // impact parameter z
423 fDCA[2] = TMath::Sqrt(bCov[0]); // resolution xy
424 fDCA[3] = TMath::Sqrt(bCov[2]); // resolution z
425
426 if (!fAbsDCAToVertex) {
427 if (fDCA[2] > 0) fDCA[0] = fDCA[0]/fDCA[2]; // normalised impact parameter xy
428 if (fDCA[3] > 0) fDCA[1] = fDCA[1]/fDCA[3]; // normalised impact parameter z
429 }
430
431 // get n_sigma
c2c45ca4 432 if(!fUseSPDvertex && !fUseTPCvertex)
c66800ea 433 fDCA[5] = AliESDtrackCuts::GetSigmaToVertex(esdTrack);
434
435 if(fUseTPCvertex) {
436 fDCA[5] = -1;
437 if (fDCA[2]==0 || fDCA[3]==0)
438 return;
439 fDCA[5] = 1000.;
440 Float_t d = TMath::Sqrt(TMath::Power(b[0]/fDCA[2],2) + TMath::Power(b[1]/fDCA[3],2));
441 if (TMath::Exp(-d * d / 2) < 1e-15)
442 return;
443 fDCA[5] = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
444 }
445 return;
446}
447//__________________________________________________________________________________
03f487b1 448void AliCFTrackIsPrimaryCuts::GetDCA(AliAODTrack* aodTrack)
449{
450 if (!aodTrack) return;
451
452 Double_t p[3] = {0.,0.,0.};
453 Double_t cov[21] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
454
455 aodTrack->XYZAtDCA(p); // position at DCA
456 aodTrack->GetCovarianceXYZPxPyPz(cov);
457
458
459 fDCA[5] = -1; // n_sigma
460 if (p[0]==-999. || p[1]==-999. || p[2]==-999.) {
461 AliError("dca info not available !");
462 fDCA[0] = -999.; // impact parameter xy
463 fDCA[1] = -999.; // impact parameter z
464 return;
465 }
466
03f487b1 467 AliAODEvent * evt = 0x0;
468 evt = dynamic_cast<AliAODEvent*>(fEvt);
b7ccf481 469 if (!evt) return;
470
03f487b1 471 // primary vertex is the "best": tracks, SPD or TPC vertex
472 AliAODVertex * primaryVertex = evt->GetVertex(0);
473 // dca = track postion - primary vertex position
474 p[0] = p[0] - primaryVertex->GetX();
475 p[1] = p[1] - primaryVertex->GetY();
476 p[2] = p[2] - primaryVertex->GetZ();
477 // calculate dca in transverse plane
478 Float_t b[2] = {0.,0.};
479 b[0] = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
480 b[1] = p[2];
481 // resolution
482 Double_t bCov[3] = {0.,0.,0.};
483 // how to calculate the resoultion in the transverse plane ?
484 bCov[0] = 0.; // to do: calculate cov in transverse plane
485 bCov[2] = 0.; // from cov in x and y, need to know correlation
486
487 if (bCov[0]<=0 || bCov[2]<=0) {
488 bCov[0]=0; bCov[2]=0;
489 }
490 fDCA[0] = b[0]; // impact parameter xy
491 fDCA[1] = b[1]; // impact parameter z
492 fDCA[2] = TMath::Sqrt(bCov[0]); // resolution xy
493 fDCA[3] = TMath::Sqrt(bCov[2]); // resolution z
494
495 if (!fAbsDCAToVertex) {
496 AliError("resolution of impact parameter not available, use absolute dca cut instead !");
497 if (fDCA[2] > 0) fDCA[0] = fDCA[0]/fDCA[2]; // normalised impact parameter xy
498 if (fDCA[3] > 0) fDCA[1] = fDCA[1]/fDCA[3]; // normalised impact parameter z
499 }
500
501 // get n_sigma
502 if (fDCA[2]==0 || fDCA[3]==0)
503 return;
504 fDCA[5] = 1000.;
505 Float_t d = TMath::Sqrt(TMath::Power(b[0]/fDCA[2],2) + TMath::Power(b[1]/fDCA[3],2));
506 if (TMath::Exp(-d * d / 2) < 1e-15)
507 return;
508 fDCA[5] = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
509
510 return;
511}
512//__________________________________________________________________________________
107a3100 513void AliCFTrackIsPrimaryCuts::SelectionBitMap(TObject* obj)
563113d0 514{
515 //
516 // test if the track passes the single cuts
517 // and store the information in a bitmap
518 //
519
520 // bitmap stores the decision of each single cut
521 for(Int_t i=0; i<kNCuts; i++)fBitmap->SetBitNumber(i,kFALSE);
522
107a3100 523 // check TObject and cast into ESDtrack
524 if (!obj) return;
8edd0c2c 525 if (!obj->InheritsFrom("AliVParticle")) {
526 AliError("object must derived from AliVParticle !");
527 return;
528 }
b7ccf481 529
93b9d5bd 530 AliESDtrack * esdTrack = dynamic_cast<AliESDtrack*>(obj);
531 AliAODTrack * aodTrack = dynamic_cast<AliAODTrack*>(obj);
8edd0c2c 532
93b9d5bd 533 if (!(esdTrack || aodTrack)) {
534 AliError("object must be an ESDtrack or an AODtrack !");
535 return;
536 }
537
538 Bool_t isESDTrack = kFALSE;
539 Bool_t isAODTrack = kFALSE;
540
541 if (esdTrack) isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ;
542 if (aodTrack) isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ;
563113d0 543
8edd0c2c 544 // get the track to vertex parameter for ESD track
c66800ea 545 if (isESDTrack) GetDCA(esdTrack);
03f487b1 546 if (isAODTrack) GetDCA(aodTrack);
547
548 // check whether dca info is filled
549 Bool_t dcaInfo = 0;
550 if (fDCA[0]>-990. && fDCA[1]>-990.) dcaInfo = 1;
89d7d478 551
c66800ea 552 Float_t bxy = 0, bz = 0;
03f487b1 553 bxy = TMath::Abs(fDCA[0]);
554 bz = TMath::Abs(fDCA[1]);
555
89d7d478 556 Float_t b2Dmin = 0, b2Dmax = 0;
03f487b1 557 if (fMinDCAToVertexXY>0 && fMinDCAToVertexZ>0)
558 b2Dmin = fDCA[0]*fDCA[0]/fMinDCAToVertexXY/fMinDCAToVertexXY + fDCA[1]*fDCA[1]/fMinDCAToVertexZ/fMinDCAToVertexZ;
559 if (fMaxDCAToVertexXY>0 && fMaxDCAToVertexZ>0)
560 b2Dmax = fDCA[0]*fDCA[0]/fMaxDCAToVertexXY/fMaxDCAToVertexXY + fDCA[1]*fDCA[1]/fMaxDCAToVertexZ/fMaxDCAToVertexZ;
561
563113d0 562
563 // fill the bitmap
564 Int_t iCutBit = 0;
8edd0c2c 565
03f487b1 566 if (!dcaInfo || fDCAToVertex2D || (!fDCAToVertex2D && bxy >= fMinDCAToVertexXY && bxy <= fMaxDCAToVertexXY))
567 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 568 iCutBit++;
569
03f487b1 570 if (!dcaInfo || fDCAToVertex2D || (!fDCAToVertex2D && bz >= fMinDCAToVertexZ && bz <= fMaxDCAToVertexZ))
571 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 572 iCutBit++;
573
03f487b1 574 if (!dcaInfo || !fDCAToVertex2D || (fDCAToVertex2D && TMath::Sqrt(b2Dmin) > 1 && TMath::Sqrt(b2Dmax) < 1))
8edd0c2c 575 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 576 iCutBit++;
8edd0c2c 577
3d266236 578 if (!dcaInfo || (fDCA[5] >= fNSigmaToVertexMin && fDCA[5] <= fNSigmaToVertexMax))
89d7d478 579 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 580 iCutBit++;
581
03f487b1 582 if (!dcaInfo || fDCA[2] < fSigmaDCAxy)
89d7d478 583 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 584 iCutBit++;
585
03f487b1 586 if (!dcaInfo || fDCA[3] < fSigmaDCAz)
89d7d478 587 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 588 iCutBit++;
589
03f487b1 590 if (!dcaInfo || !fRequireSigmaToVertex || (fDCA[5]>=0 && fRequireSigmaToVertex))
8edd0c2c 591 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 592 iCutBit++;
563113d0 593
03f487b1 594 if (!dcaInfo || fAcceptKinkDaughters || (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)<=0))
8edd0c2c 595 fBitmap->SetBitNumber(iCutBit,kTRUE);
8edd0c2c 596 iCutBit++;
03f487b1 597
8edd0c2c 598 if (isAODTrack) {
599 if (fAODType==AliAODTrack::kUndef || fAODType == aodTrack->GetType()) {
600 fBitmap->SetBitNumber(iCutBit,kTRUE);
601 }
602 }
603 else fBitmap->SetBitNumber(iCutBit,kTRUE);
03f487b1 604
107a3100 605 return;
563113d0 606}
607//__________________________________________________________________________________
9eeae5d5 608Bool_t AliCFTrackIsPrimaryCuts::IsSelected(TObject* obj) {
563113d0 609 //
610 // loops over decisions of single cuts and returns if the track is accepted
611 //
107a3100 612 SelectionBitMap(obj);
563113d0 613
107a3100 614 if (fIsQAOn) FillHistograms(obj,0);
563113d0 615 Bool_t isSelected = kTRUE;
616
107a3100 617 for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++) {
618 if(!fBitmap->TestBitNumber(icut)) {
619 isSelected = kFALSE;
620 break;
621 }
622 }
03f487b1 623
107a3100 624 if (!isSelected) return kFALSE ;
625 if (fIsQAOn) FillHistograms(obj,1);
626 return kTRUE;
563113d0 627}
628//__________________________________________________________________________________
629void AliCFTrackIsPrimaryCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
630{
631 //
632 // variable bin size
633 //
634 if(!fIsQAOn) return;
635
636 switch(index){
637 case kCutNSigmaToVertex:
db6722a5 638 fhNBinsNSigma=nbins+1;
563113d0 639 fhBinLimNSigma=new Double_t[nbins+1];
640 for(Int_t i=0;i<nbins+1;i++)fhBinLimNSigma[i]=bins[i];
641 break;
642
643 case kCutRequireSigmaToVertex:
db6722a5 644 fhNBinsRequireSigma=nbins+1;
563113d0 645 fhBinLimRequireSigma=new Double_t[nbins+1];
646 for(Int_t i=0;i<nbins+1;i++)fhBinLimRequireSigma[i]=bins[i];
647 break;
648
649 case kCutAcceptKinkDaughters:
db6722a5 650 fhNBinsAcceptKink=nbins+1;
563113d0 651 fhBinLimAcceptKink=new Double_t[nbins+1];
652 for(Int_t i=0;i<nbins+1;i++)fhBinLimAcceptKink[i]=bins[i];
653 break;
654
655 case kDcaXY:
db6722a5 656 fhNBinsDcaXY=nbins+1;
563113d0 657 fhBinLimDcaXY=new Double_t[nbins+1];
658 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXY[i]=bins[i];
659 break;
62037e79 660
563113d0 661 case kDcaZ:
db6722a5 662 fhNBinsDcaZ=nbins+1;
563113d0 663 fhBinLimDcaZ=new Double_t[nbins+1];
664 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZ[i]=bins[i];
665 break;
62037e79 666
563113d0 667 case kDcaXYnorm:
db6722a5 668 fhNBinsDcaXYnorm=nbins+1;
563113d0 669 fhBinLimDcaXYnorm=new Double_t[nbins+1];
670 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXYnorm[i]=bins[i];
671 break;
62037e79 672
563113d0 673 case kDcaZnorm:
db6722a5 674 fhNBinsDcaZnorm=nbins+1;
563113d0 675 fhBinLimDcaZnorm=new Double_t[nbins+1];
676 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZnorm[i]=bins[i];
677 break;
89d7d478 678
679 case kSigmaDcaXY:
680 fhNBinsSigmaDcaXY=nbins+1;
681 fhBinLimSigmaDcaXY=new Double_t[nbins+1];
682 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaXY[i]=bins[i];
683 break;
684
685 case kSigmaDcaZ:
686 fhNBinsSigmaDcaZ=nbins+1;
687 fhBinLimSigmaDcaZ=new Double_t[nbins+1];
688 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaZ[i]=bins[i];
689 break;
563113d0 690 }
691}
692//__________________________________________________________________________________
693void AliCFTrackIsPrimaryCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax)
694{
695 //
696 // fixed bin size
697 //
563113d0 698 switch(index){
699 case kCutNSigmaToVertex:
db6722a5 700 fhNBinsNSigma=nbins+1;
563113d0 701 fhBinLimNSigma=new Double_t[nbins+1];
702 for(Int_t i=0;i<nbins+1;i++)fhBinLimNSigma[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
703 break;
704
705 case kCutRequireSigmaToVertex:
db6722a5 706 fhNBinsRequireSigma=nbins+1;
563113d0 707 fhBinLimRequireSigma=new Double_t[nbins+1];
708 for(Int_t i=0;i<nbins+1;i++)fhBinLimRequireSigma[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
709 break;
710
711 case kCutAcceptKinkDaughters:
db6722a5 712 fhNBinsAcceptKink=nbins+1;
563113d0 713 fhBinLimAcceptKink=new Double_t[nbins+1];
714 for(Int_t i=0;i<nbins+1;i++)fhBinLimAcceptKink[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
715 break;
716
717 case kDcaXY:
db6722a5 718 fhNBinsDcaXY=nbins+1;
563113d0 719 fhBinLimDcaXY=new Double_t[nbins+1];
720 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXY[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
721 break;
62037e79 722
563113d0 723 case kDcaZ:
db6722a5 724 fhNBinsDcaZ=nbins+1;
563113d0 725 fhBinLimDcaZ=new Double_t[nbins+1];
726 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
727 break;
62037e79 728
563113d0 729 case kDcaXYnorm:
db6722a5 730 fhNBinsDcaXYnorm=nbins+1;
563113d0 731 fhBinLimDcaXYnorm=new Double_t[nbins+1];
732 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXYnorm[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
733 break;
62037e79 734
563113d0 735 case kDcaZnorm:
db6722a5 736 fhNBinsDcaZnorm=nbins+1;
563113d0 737 fhBinLimDcaZnorm=new Double_t[nbins+1];
738 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZnorm[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
739 break;
89d7d478 740
741 case kSigmaDcaXY:
742 fhNBinsSigmaDcaXY=nbins+1;
743 fhBinLimSigmaDcaXY=new Double_t[nbins+1];
744 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaXY[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
745 break;
746
747 case kSigmaDcaZ:
748 fhNBinsSigmaDcaZ=nbins+1;
749 fhBinLimSigmaDcaZ=new Double_t[nbins+1];
750 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
751 break;
563113d0 752 }
753}
754//__________________________________________________________________________________
755 void AliCFTrackIsPrimaryCuts::DefineHistograms() {
756 //
757 // histograms for cut variables, cut statistics and cut correlations
758 //
563113d0 759 Int_t color = 2;
760
761 // book cut statistics and cut correlation histograms
762 fhCutStatistics = new TH1F(Form("%s_cut_statistics",GetName()), Form("%s cut statistics",GetName()), kNCuts,0.5,kNCuts+0.5);
763 fhCutStatistics->SetLineWidth(2);
89d7d478 764 fhCutStatistics->GetXaxis()->SetBinLabel(1,"dca xy");
765 fhCutStatistics->GetXaxis()->SetBinLabel(2,"dca z");
766 fhCutStatistics->GetXaxis()->SetBinLabel(3,"dca ellipse");
767 fhCutStatistics->GetXaxis()->SetBinLabel(4,"n dca");
768 fhCutStatistics->GetXaxis()->SetBinLabel(5,"sigma dca xy");
769 fhCutStatistics->GetXaxis()->SetBinLabel(6,"sigma dca z");
770 fhCutStatistics->GetXaxis()->SetBinLabel(7,"require dca");
771 fhCutStatistics->GetXaxis()->SetBinLabel(8,"kink daughter");
772 fhCutStatistics->GetXaxis()->SetBinLabel(9,"AOD type");
563113d0 773
774 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);
775 fhCutCorrelation->SetLineWidth(2);
89d7d478 776 fhCutCorrelation->GetXaxis()->SetBinLabel(1,"dca xy");
777 fhCutCorrelation->GetXaxis()->SetBinLabel(2,"dca z");
778 fhCutCorrelation->GetXaxis()->SetBinLabel(3,"dca ellipse");
779 fhCutCorrelation->GetXaxis()->SetBinLabel(4,"n dca");
780 fhCutCorrelation->GetXaxis()->SetBinLabel(5,"sigma dca xy");
781 fhCutCorrelation->GetXaxis()->SetBinLabel(6,"sigma dca z");
782 fhCutCorrelation->GetXaxis()->SetBinLabel(7,"require dca");
783 fhCutCorrelation->GetXaxis()->SetBinLabel(8,"kink daughter");
784 fhCutCorrelation->GetXaxis()->SetBinLabel(9,"AOD type");
785
786 fhCutCorrelation->GetYaxis()->SetBinLabel(1,"dca xy");
787 fhCutCorrelation->GetYaxis()->SetBinLabel(2,"dca z");
788 fhCutCorrelation->GetYaxis()->SetBinLabel(3,"dca ellipse");
789 fhCutCorrelation->GetYaxis()->SetBinLabel(4,"n dca");
790 fhCutCorrelation->GetYaxis()->SetBinLabel(5,"sigma dca xy");
791 fhCutCorrelation->GetYaxis()->SetBinLabel(6,"sigma dca z");
792 fhCutCorrelation->GetYaxis()->SetBinLabel(7,"require dca");
793 fhCutCorrelation->GetYaxis()->SetBinLabel(8,"kink daughter");
794 fhCutCorrelation->GetYaxis()->SetBinLabel(9,"AOD type");
563113d0 795
796 // book QA histograms
ae8c412c 797 Char_t str[5];
563113d0 798 for (Int_t i=0; i<kNStepQA; i++) {
ae8c412c 799 if (i==0) snprintf(str,5," ");
800 else snprintf(str,5,"_cut");
62037e79 801
563113d0 802 fhDcaXYvsDcaZ[i] = new TH2F(Form("%s_dcaXYvsDcaZ%s",GetName(),str),"",200,-10,10,200,-10,10);
db6722a5 803 fhQA[kCutNSigmaToVertex][i] = new TH1F(Form("%s_nSigmaToVertex%s",GetName(),str),"",fhNBinsNSigma-1,fhBinLimNSigma);
804 fhQA[kCutRequireSigmaToVertex][i] = new TH1F(Form("%s_requireSigmaToVertex%s",GetName(),str),"",fhNBinsRequireSigma-1,fhBinLimRequireSigma);
805 fhQA[kCutAcceptKinkDaughters][i] = new TH1F(Form("%s_acceptKinkDaughters%s",GetName(),str),"",fhNBinsAcceptKink-1,fhBinLimAcceptKink);
806 fhQA[kDcaXY][i] = new TH1F(Form("%s_dcaXY%s",GetName(),str),"",fhNBinsDcaXY-1,fhBinLimDcaXY);
807 fhQA[kDcaZ][i] = new TH1F(Form("%s_dcaZ%s",GetName(),str),"",fhNBinsDcaZ-1,fhBinLimDcaZ);
808 fhQA[kDcaXYnorm][i] = new TH1F(Form("%s_dcaXYnorm%s",GetName(),str),"",fhNBinsDcaXYnorm-1,fhBinLimDcaXYnorm);
809 fhQA[kDcaZnorm][i] = new TH1F(Form("%s_dcaZnorm%s",GetName(),str),"",fhNBinsDcaZnorm-1,fhBinLimDcaZnorm);
89d7d478 810 fhQA[kSigmaDcaXY][i] = new TH1F(Form("%s_sigmaDcaXY%s",GetName(),str),"",fhNBinsSigmaDcaXY-1,fhBinLimSigmaDcaXY);
811 fhQA[kSigmaDcaZ][i] = new TH1F(Form("%s_sigmaDcaZ%s",GetName(),str),"",fhNBinsSigmaDcaZ-1,fhBinLimSigmaDcaZ);
563113d0 812
813 fhDcaXYvsDcaZ[i]->SetXTitle("impact par. d_{z}");
814 fhDcaXYvsDcaZ[i]->SetYTitle("impact par. d_{xy}");
563113d0 815
816 fhQA[kCutNSigmaToVertex][i]->SetXTitle("n #sigma to vertex");
817 fhQA[kCutRequireSigmaToVertex][i]->SetXTitle("require #sigma to vertex");
818 fhQA[kCutAcceptKinkDaughters][i]->SetXTitle("accept kink daughters");
819 fhQA[kDcaXY][i]->SetXTitle("impact par. d_{xy}");
820 fhQA[kDcaZ][i]->SetXTitle("impact par. d_{z}");
821 fhQA[kDcaXYnorm][i]->SetXTitle("norm. impact par. d_{xy} / #sigma_{xy}");
822 fhQA[kDcaZnorm][i]->SetXTitle("norm. impact par. d_{z} / #sigma_{z}");
89d7d478 823 fhQA[kSigmaDcaXY][i]->SetXTitle("impact par. resolution #sigma_{xy}");
824 fhQA[kSigmaDcaZ][i]->SetXTitle("impact par. resolution #sigma_{z}");
563113d0 825 }
563113d0 826 for(Int_t i=0; i<kNHist; i++) fhQA[i][1]->SetLineColor(color);
563113d0 827}
828//__________________________________________________________________________________
829void AliCFTrackIsPrimaryCuts::FillHistograms(TObject* obj, Bool_t f)
830{
831 //
832 // fill the QA histograms
833 //
563113d0 834
ae8c412c 835 if (!obj) return;
8edd0c2c 836 Bool_t isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ;
837 Bool_t isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ;
563113d0 838
8edd0c2c 839 AliESDtrack * esdTrack = 0x0 ;
840 AliAODTrack * aodTrack = 0x0 ;
841 if (isESDTrack) esdTrack = dynamic_cast<AliESDtrack*>(obj);
842 if (isAODTrack) aodTrack = dynamic_cast<AliAODTrack*>(obj);
563113d0 843
8edd0c2c 844 // f = 0: fill histograms before cuts
845 // f = 1: fill histograms after cuts
563113d0 846
89d7d478 847 // get the track to vertex parameter for ESD track
8edd0c2c 848 if (esdTrack) {
563113d0 849
c66800ea 850 fhQA[kDcaZ][f]->Fill(fDCA[1]);
851 fhQA[kDcaXY][f]->Fill(fDCA[0]);
852 fhDcaXYvsDcaZ[f]->Fill(fDCA[1],fDCA[0]);
853 fhQA[kSigmaDcaXY][f]->Fill(fDCA[2]);
854 fhQA[kSigmaDcaZ][f]->Fill(fDCA[3]);
855// // // // // // // delete histograms
856 fhQA[kDcaZnorm][f]->Fill(fDCA[1]);
857 fhQA[kDcaXYnorm][f]->Fill(fDCA[0]);
858
859 fhQA[kCutNSigmaToVertex][f]->Fill(fDCA[5]);
f5b77140 860 if (fDCA[5]<0 && fRequireSigmaToVertex)
861 fhQA[kCutRequireSigmaToVertex][f]->Fill(0.);
862 else
863 fhQA[kCutRequireSigmaToVertex][f]->Fill(1.);
864
865 if (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0)
866 fhQA[kCutAcceptKinkDaughters][f]->Fill(0.);
867 else
868 fhQA[kCutAcceptKinkDaughters][f]->Fill(1.);
8edd0c2c 869 }
c66800ea 870
563113d0 871 // fill cut statistics and cut correlation histograms with information from the bitmap
872 if (f) return;
873
874 // Get the bitmap of the single cuts
107a3100 875 SelectionBitMap(obj);
563113d0 876
877 // Number of single cuts in this class
107a3100 878 UInt_t ncuts = fBitmap->GetNbits();
563113d0 879 for(UInt_t bit=0; bit<ncuts;bit++) {
107a3100 880 if (!fBitmap->TestBitNumber(bit)) {
563113d0 881 fhCutStatistics->Fill(bit+1);
882 for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
107a3100 883 if (!fBitmap->TestBitNumber(bit2))
563113d0 884 fhCutCorrelation->Fill(bit+1,bit2+1);
885 }
886 }
887 }
888}
889//__________________________________________________________________________________
890void AliCFTrackIsPrimaryCuts::SaveHistograms(const Char_t* dir) {
891 //
892 // saves the histograms in a directory (dir)
893 //
894 if(!fIsQAOn) return;
895
896 if (!dir)
897 dir = GetName();
898
899 gDirectory->mkdir(dir);
900 gDirectory->cd(dir);
901
902 gDirectory->mkdir("before_cuts");
903 gDirectory->mkdir("after_cuts");
904
905 fhCutStatistics->Write();
906 fhCutCorrelation->Write();
907
908 for (Int_t j=0; j<kNStepQA; j++) {
909 if (j==0)
910 gDirectory->cd("before_cuts");
911 else
912 gDirectory->cd("after_cuts");
913
914 fhDcaXYvsDcaZ[j] ->Write();
563113d0 915
916 for(Int_t i=0; i<kNHist; i++) fhQA[i][j]->Write();
917
918 gDirectory->cd("../");
919 }
920 gDirectory->cd("../");
921}
922//__________________________________________________________________________________
923void AliCFTrackIsPrimaryCuts::DrawHistograms()
924{
925 //
926 // draws some histograms
927 //
928 if(!fIsQAOn) return;
929
930 // pad margins
931 Float_t right = 0.03;
932 Float_t left = 0.175;
933 Float_t top = 0.03;
934 Float_t bottom = 0.175;
935
936 TCanvas* canvas1 = new TCanvas("Track_QA_Primary_1", "Track QA Primary 1", 800, 500);
937 canvas1->Divide(2, 1);
938
939 canvas1->cd(1);
940 fhCutStatistics->SetStats(kFALSE);
941 fhCutStatistics->LabelsOption("v");
942 gPad->SetLeftMargin(left);
943 gPad->SetBottomMargin(0.25);
944 gPad->SetRightMargin(right);
945 gPad->SetTopMargin(0.1);
946 fhCutStatistics->Draw();
947
948 canvas1->cd(2);
949 fhCutCorrelation->SetStats(kFALSE);
950 fhCutCorrelation->LabelsOption("v");
951 gPad->SetLeftMargin(0.30);
952 gPad->SetRightMargin(bottom);
953 gPad->SetTopMargin(0.1);
954 gPad->SetBottomMargin(0.25);
955 fhCutCorrelation->Draw("COLZ");
956
957 canvas1->SaveAs(Form("%s.eps", canvas1->GetName()));
958 canvas1->SaveAs(Form("%s.ps", canvas1->GetName()));
959
960 // -----
961
962 TCanvas* canvas2 = new TCanvas("Track_QA_Primary_2", "Track QA Primary 2", 800, 800);
963 canvas2->Divide(2, 2);
964
965 canvas2->cd(1);
966 gPad->SetRightMargin(right);
967 gPad->SetLeftMargin(left);
968 gPad->SetTopMargin(top);
969 gPad->SetBottomMargin(bottom);
970 fhQA[kDcaXY][0]->SetStats(kFALSE);
971 fhQA[kDcaXY][0]->Draw();
972 fhQA[kDcaXY][1]->Draw("same");
973
974 canvas2->cd(2);
975 gPad->SetRightMargin(right);
976 gPad->SetLeftMargin(left);
977 gPad->SetTopMargin(top);
978 gPad->SetBottomMargin(bottom);
979 fhQA[kDcaZ][0]->SetStats(kFALSE);
980 fhQA[kDcaZ][0]->Draw();
981 fhQA[kDcaZ][1]->Draw("same");
982
983 canvas2->cd(3);
984// fhDXYvsDZ[0]->SetStats(kFALSE);
985 gPad->SetLogz();
986 gPad->SetLeftMargin(bottom);
987 gPad->SetTopMargin(0.1);
988 gPad->SetBottomMargin(bottom);
989 gPad->SetRightMargin(0.2);
990 fhDcaXYvsDcaZ[0]->Draw("COLZ");
991
992 canvas2->cd(4);
993// fhDXYvsDZ[1]->SetStats(kFALSE);
994 gPad->SetLogz();
995 gPad->SetLeftMargin(bottom);
996 gPad->SetTopMargin(0.1);
997 gPad->SetBottomMargin(bottom);
998 gPad->SetRightMargin(0.2);
999 fhDcaXYvsDcaZ[1]->Draw("COLZ");
1000
1001 canvas2->SaveAs(Form("%s.eps", canvas2->GetName()));
1002 canvas2->SaveAs(Form("%s.ps", canvas2->GetName()));
1003
1004 // -----
1005
c66800ea 1006 TCanvas* canvas3 = new TCanvas("Track_QA_Primary_3", "Track QA Primary 3", 800, 400);
1007 canvas3->Divide(2, 1);
563113d0 1008
1009 canvas3->cd(1);
1010 gPad->SetRightMargin(right);
1011 gPad->SetLeftMargin(left);
1012 gPad->SetTopMargin(top);
1013 gPad->SetBottomMargin(bottom);
1014 fhQA[kDcaXYnorm][0]->SetStats(kFALSE);
1015 fhQA[kDcaXYnorm][0]->Draw();
1016 fhQA[kDcaXYnorm][1]->Draw("same");
1017
1018 canvas3->cd(2);
1019 gPad->SetRightMargin(right);
1020 gPad->SetLeftMargin(left);
1021 gPad->SetTopMargin(top);
1022 gPad->SetBottomMargin(bottom);
1023 fhQA[kDcaZnorm][0]->SetStats(kFALSE);
1024 fhQA[kDcaZnorm][0]->Draw();
1025 fhQA[kDcaZnorm][1]->Draw("same");
1026
563113d0 1027 canvas3->SaveAs(Form("%s.eps", canvas3->GetName()));
1028 canvas3->SaveAs(Form("%s.ps", canvas3->GetName()));
1029
1030 // -----
1031
89d7d478 1032 TCanvas* canvas4 = new TCanvas("Track_QA_Primary_4", "Track QA Primary 4", 1200, 800);
1033 canvas4->Divide(3, 2);
563113d0 1034
1035 canvas4->cd(1);
1036 gPad->SetRightMargin(right);
1037 gPad->SetLeftMargin(left);
1038 gPad->SetTopMargin(top);
1039 gPad->SetBottomMargin(bottom);
89d7d478 1040 fhQA[kSigmaDcaXY][0]->SetStats(kFALSE);
1041 fhQA[kSigmaDcaXY][0]->Draw();
1042 fhQA[kSigmaDcaXY][1]->Draw("same");
1043
1044 canvas4->cd(2);
1045 gPad->SetRightMargin(right);
1046 gPad->SetLeftMargin(left);
1047 gPad->SetTopMargin(top);
1048 gPad->SetBottomMargin(bottom);
1049 fhQA[kSigmaDcaZ][0]->SetStats(kFALSE);
1050 fhQA[kSigmaDcaZ][0]->Draw();
1051 fhQA[kSigmaDcaZ][1]->Draw("same");
1052
1053 canvas4->cd(4);
1054 gPad->SetRightMargin(right);
1055 gPad->SetLeftMargin(left);
1056 gPad->SetTopMargin(top);
1057 gPad->SetBottomMargin(bottom);
563113d0 1058 fhQA[kCutNSigmaToVertex][0]->SetStats(kFALSE);
1059 fhQA[kCutNSigmaToVertex][0]->Draw();
1060 fhQA[kCutNSigmaToVertex][1]->Draw("same");
1061
89d7d478 1062 canvas4->cd(5);
563113d0 1063 gPad->SetRightMargin(right);
1064 gPad->SetLeftMargin(left);
1065 gPad->SetTopMargin(top);
1066 gPad->SetBottomMargin(bottom);
1067 fhQA[kCutRequireSigmaToVertex][0]->SetStats(kFALSE);
1068 fhQA[kCutRequireSigmaToVertex][0]->Draw();
1069 fhQA[kCutRequireSigmaToVertex][1]->Draw("same");
1070
89d7d478 1071 canvas4->cd(6);
563113d0 1072 gPad->SetRightMargin(right);
1073 gPad->SetLeftMargin(left);
1074 gPad->SetTopMargin(top);
1075 gPad->SetBottomMargin(bottom);
1076 fhQA[kCutAcceptKinkDaughters][0]->SetStats(kFALSE);
1077 fhQA[kCutAcceptKinkDaughters][0]->Draw();
1078 fhQA[kCutAcceptKinkDaughters][1]->Draw("same");
1079
1080 canvas4->SaveAs(Form("%s.eps", canvas4->GetName()));
1081 canvas4->SaveAs(Form("%s.ps", canvas4->GetName()));
1082}
1083//__________________________________________________________________________________
107a3100 1084void AliCFTrackIsPrimaryCuts::AddQAHistograms(TList *qaList) {
563113d0 1085 //
1086 // saves the histograms in a TList
1087 //
107a3100 1088 DefineHistograms();
563113d0 1089
1090 qaList->Add(fhCutStatistics);
1091 qaList->Add(fhCutCorrelation);
1092
1093 for (Int_t j=0; j<kNStepQA; j++) {
1094 qaList->Add(fhDcaXYvsDcaZ[j]);
563113d0 1095 for(Int_t i=0; i<kNHist; i++)
62037e79 1096 qaList->Add(fhQA[i][j]);
563113d0 1097 }
1098}