Allow using SetUseMCchain() for chains made on galice.root
[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
8edd0c2c 530 Bool_t isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ;
531 Bool_t isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ;
532
533 AliESDtrack * esdTrack = 0x0 ;
534 AliAODTrack * aodTrack = 0x0 ;
535 if (isESDTrack) esdTrack = dynamic_cast<AliESDtrack*>(obj);
536 if (isAODTrack) aodTrack = dynamic_cast<AliAODTrack*>(obj);
563113d0 537
8edd0c2c 538 // get the track to vertex parameter for ESD track
c66800ea 539 if (isESDTrack) GetDCA(esdTrack);
03f487b1 540 if (isAODTrack) GetDCA(aodTrack);
541
542 // check whether dca info is filled
543 Bool_t dcaInfo = 0;
544 if (fDCA[0]>-990. && fDCA[1]>-990.) dcaInfo = 1;
89d7d478 545
c66800ea 546 Float_t bxy = 0, bz = 0;
03f487b1 547 bxy = TMath::Abs(fDCA[0]);
548 bz = TMath::Abs(fDCA[1]);
549
89d7d478 550 Float_t b2Dmin = 0, b2Dmax = 0;
03f487b1 551 if (fMinDCAToVertexXY>0 && fMinDCAToVertexZ>0)
552 b2Dmin = fDCA[0]*fDCA[0]/fMinDCAToVertexXY/fMinDCAToVertexXY + fDCA[1]*fDCA[1]/fMinDCAToVertexZ/fMinDCAToVertexZ;
553 if (fMaxDCAToVertexXY>0 && fMaxDCAToVertexZ>0)
554 b2Dmax = fDCA[0]*fDCA[0]/fMaxDCAToVertexXY/fMaxDCAToVertexXY + fDCA[1]*fDCA[1]/fMaxDCAToVertexZ/fMaxDCAToVertexZ;
555
563113d0 556
557 // fill the bitmap
558 Int_t iCutBit = 0;
8edd0c2c 559
03f487b1 560 if (!dcaInfo || fDCAToVertex2D || (!fDCAToVertex2D && bxy >= fMinDCAToVertexXY && bxy <= fMaxDCAToVertexXY))
561 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 562 iCutBit++;
563
03f487b1 564 if (!dcaInfo || fDCAToVertex2D || (!fDCAToVertex2D && bz >= fMinDCAToVertexZ && bz <= fMaxDCAToVertexZ))
565 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 566 iCutBit++;
567
03f487b1 568 if (!dcaInfo || !fDCAToVertex2D || (fDCAToVertex2D && TMath::Sqrt(b2Dmin) > 1 && TMath::Sqrt(b2Dmax) < 1))
8edd0c2c 569 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 570 iCutBit++;
8edd0c2c 571
3d266236 572 if (!dcaInfo || (fDCA[5] >= fNSigmaToVertexMin && fDCA[5] <= fNSigmaToVertexMax))
89d7d478 573 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 574 iCutBit++;
575
03f487b1 576 if (!dcaInfo || fDCA[2] < fSigmaDCAxy)
89d7d478 577 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 578 iCutBit++;
579
03f487b1 580 if (!dcaInfo || fDCA[3] < fSigmaDCAz)
89d7d478 581 fBitmap->SetBitNumber(iCutBit,kTRUE);
89d7d478 582 iCutBit++;
583
03f487b1 584 if (!dcaInfo || !fRequireSigmaToVertex || (fDCA[5]>=0 && fRequireSigmaToVertex))
8edd0c2c 585 fBitmap->SetBitNumber(iCutBit,kTRUE);
563113d0 586 iCutBit++;
563113d0 587
03f487b1 588 if (!dcaInfo || fAcceptKinkDaughters || (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)<=0))
8edd0c2c 589 fBitmap->SetBitNumber(iCutBit,kTRUE);
8edd0c2c 590 iCutBit++;
03f487b1 591
8edd0c2c 592 if (isAODTrack) {
593 if (fAODType==AliAODTrack::kUndef || fAODType == aodTrack->GetType()) {
594 fBitmap->SetBitNumber(iCutBit,kTRUE);
595 }
596 }
597 else fBitmap->SetBitNumber(iCutBit,kTRUE);
03f487b1 598
107a3100 599 return;
563113d0 600}
601//__________________________________________________________________________________
9eeae5d5 602Bool_t AliCFTrackIsPrimaryCuts::IsSelected(TObject* obj) {
563113d0 603 //
604 // loops over decisions of single cuts and returns if the track is accepted
605 //
107a3100 606 SelectionBitMap(obj);
563113d0 607
107a3100 608 if (fIsQAOn) FillHistograms(obj,0);
563113d0 609 Bool_t isSelected = kTRUE;
610
107a3100 611 for (UInt_t icut=0; icut<fBitmap->GetNbits();icut++) {
612 if(!fBitmap->TestBitNumber(icut)) {
613 isSelected = kFALSE;
614 break;
615 }
616 }
03f487b1 617
107a3100 618 if (!isSelected) return kFALSE ;
619 if (fIsQAOn) FillHistograms(obj,1);
620 return kTRUE;
563113d0 621}
622//__________________________________________________________________________________
623void AliCFTrackIsPrimaryCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
624{
625 //
626 // variable bin size
627 //
628 if(!fIsQAOn) return;
629
630 switch(index){
631 case kCutNSigmaToVertex:
db6722a5 632 fhNBinsNSigma=nbins+1;
563113d0 633 fhBinLimNSigma=new Double_t[nbins+1];
634 for(Int_t i=0;i<nbins+1;i++)fhBinLimNSigma[i]=bins[i];
635 break;
636
637 case kCutRequireSigmaToVertex:
db6722a5 638 fhNBinsRequireSigma=nbins+1;
563113d0 639 fhBinLimRequireSigma=new Double_t[nbins+1];
640 for(Int_t i=0;i<nbins+1;i++)fhBinLimRequireSigma[i]=bins[i];
641 break;
642
643 case kCutAcceptKinkDaughters:
db6722a5 644 fhNBinsAcceptKink=nbins+1;
563113d0 645 fhBinLimAcceptKink=new Double_t[nbins+1];
646 for(Int_t i=0;i<nbins+1;i++)fhBinLimAcceptKink[i]=bins[i];
647 break;
648
649 case kDcaXY:
db6722a5 650 fhNBinsDcaXY=nbins+1;
563113d0 651 fhBinLimDcaXY=new Double_t[nbins+1];
652 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXY[i]=bins[i];
653 break;
62037e79 654
563113d0 655 case kDcaZ:
db6722a5 656 fhNBinsDcaZ=nbins+1;
563113d0 657 fhBinLimDcaZ=new Double_t[nbins+1];
658 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZ[i]=bins[i];
659 break;
62037e79 660
563113d0 661 case kDcaXYnorm:
db6722a5 662 fhNBinsDcaXYnorm=nbins+1;
563113d0 663 fhBinLimDcaXYnorm=new Double_t[nbins+1];
664 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXYnorm[i]=bins[i];
665 break;
62037e79 666
563113d0 667 case kDcaZnorm:
db6722a5 668 fhNBinsDcaZnorm=nbins+1;
563113d0 669 fhBinLimDcaZnorm=new Double_t[nbins+1];
670 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZnorm[i]=bins[i];
671 break;
89d7d478 672
673 case kSigmaDcaXY:
674 fhNBinsSigmaDcaXY=nbins+1;
675 fhBinLimSigmaDcaXY=new Double_t[nbins+1];
676 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaXY[i]=bins[i];
677 break;
678
679 case kSigmaDcaZ:
680 fhNBinsSigmaDcaZ=nbins+1;
681 fhBinLimSigmaDcaZ=new Double_t[nbins+1];
682 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaZ[i]=bins[i];
683 break;
563113d0 684 }
685}
686//__________________________________________________________________________________
687void AliCFTrackIsPrimaryCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax)
688{
689 //
690 // fixed bin size
691 //
563113d0 692 switch(index){
693 case kCutNSigmaToVertex:
db6722a5 694 fhNBinsNSigma=nbins+1;
563113d0 695 fhBinLimNSigma=new Double_t[nbins+1];
696 for(Int_t i=0;i<nbins+1;i++)fhBinLimNSigma[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
697 break;
698
699 case kCutRequireSigmaToVertex:
db6722a5 700 fhNBinsRequireSigma=nbins+1;
563113d0 701 fhBinLimRequireSigma=new Double_t[nbins+1];
702 for(Int_t i=0;i<nbins+1;i++)fhBinLimRequireSigma[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
703 break;
704
705 case kCutAcceptKinkDaughters:
db6722a5 706 fhNBinsAcceptKink=nbins+1;
563113d0 707 fhBinLimAcceptKink=new Double_t[nbins+1];
708 for(Int_t i=0;i<nbins+1;i++)fhBinLimAcceptKink[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
709 break;
710
711 case kDcaXY:
db6722a5 712 fhNBinsDcaXY=nbins+1;
563113d0 713 fhBinLimDcaXY=new Double_t[nbins+1];
714 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXY[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
715 break;
62037e79 716
563113d0 717 case kDcaZ:
db6722a5 718 fhNBinsDcaZ=nbins+1;
563113d0 719 fhBinLimDcaZ=new Double_t[nbins+1];
720 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
721 break;
62037e79 722
563113d0 723 case kDcaXYnorm:
db6722a5 724 fhNBinsDcaXYnorm=nbins+1;
563113d0 725 fhBinLimDcaXYnorm=new Double_t[nbins+1];
726 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaXYnorm[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
727 break;
62037e79 728
563113d0 729 case kDcaZnorm:
db6722a5 730 fhNBinsDcaZnorm=nbins+1;
563113d0 731 fhBinLimDcaZnorm=new Double_t[nbins+1];
732 for(Int_t i=0;i<nbins+1;i++)fhBinLimDcaZnorm[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
733 break;
89d7d478 734
735 case kSigmaDcaXY:
736 fhNBinsSigmaDcaXY=nbins+1;
737 fhBinLimSigmaDcaXY=new Double_t[nbins+1];
738 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaXY[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
739 break;
740
741 case kSigmaDcaZ:
742 fhNBinsSigmaDcaZ=nbins+1;
743 fhBinLimSigmaDcaZ=new Double_t[nbins+1];
744 for(Int_t i=0;i<nbins+1;i++)fhBinLimSigmaDcaZ[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
745 break;
563113d0 746 }
747}
748//__________________________________________________________________________________
749 void AliCFTrackIsPrimaryCuts::DefineHistograms() {
750 //
751 // histograms for cut variables, cut statistics and cut correlations
752 //
563113d0 753 Int_t color = 2;
754
755 // book cut statistics and cut correlation histograms
756 fhCutStatistics = new TH1F(Form("%s_cut_statistics",GetName()), Form("%s cut statistics",GetName()), kNCuts,0.5,kNCuts+0.5);
757 fhCutStatistics->SetLineWidth(2);
89d7d478 758 fhCutStatistics->GetXaxis()->SetBinLabel(1,"dca xy");
759 fhCutStatistics->GetXaxis()->SetBinLabel(2,"dca z");
760 fhCutStatistics->GetXaxis()->SetBinLabel(3,"dca ellipse");
761 fhCutStatistics->GetXaxis()->SetBinLabel(4,"n dca");
762 fhCutStatistics->GetXaxis()->SetBinLabel(5,"sigma dca xy");
763 fhCutStatistics->GetXaxis()->SetBinLabel(6,"sigma dca z");
764 fhCutStatistics->GetXaxis()->SetBinLabel(7,"require dca");
765 fhCutStatistics->GetXaxis()->SetBinLabel(8,"kink daughter");
766 fhCutStatistics->GetXaxis()->SetBinLabel(9,"AOD type");
563113d0 767
768 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);
769 fhCutCorrelation->SetLineWidth(2);
89d7d478 770 fhCutCorrelation->GetXaxis()->SetBinLabel(1,"dca xy");
771 fhCutCorrelation->GetXaxis()->SetBinLabel(2,"dca z");
772 fhCutCorrelation->GetXaxis()->SetBinLabel(3,"dca ellipse");
773 fhCutCorrelation->GetXaxis()->SetBinLabel(4,"n dca");
774 fhCutCorrelation->GetXaxis()->SetBinLabel(5,"sigma dca xy");
775 fhCutCorrelation->GetXaxis()->SetBinLabel(6,"sigma dca z");
776 fhCutCorrelation->GetXaxis()->SetBinLabel(7,"require dca");
777 fhCutCorrelation->GetXaxis()->SetBinLabel(8,"kink daughter");
778 fhCutCorrelation->GetXaxis()->SetBinLabel(9,"AOD type");
779
780 fhCutCorrelation->GetYaxis()->SetBinLabel(1,"dca xy");
781 fhCutCorrelation->GetYaxis()->SetBinLabel(2,"dca z");
782 fhCutCorrelation->GetYaxis()->SetBinLabel(3,"dca ellipse");
783 fhCutCorrelation->GetYaxis()->SetBinLabel(4,"n dca");
784 fhCutCorrelation->GetYaxis()->SetBinLabel(5,"sigma dca xy");
785 fhCutCorrelation->GetYaxis()->SetBinLabel(6,"sigma dca z");
786 fhCutCorrelation->GetYaxis()->SetBinLabel(7,"require dca");
787 fhCutCorrelation->GetYaxis()->SetBinLabel(8,"kink daughter");
788 fhCutCorrelation->GetYaxis()->SetBinLabel(9,"AOD type");
563113d0 789
790 // book QA histograms
791 Char_t str[256];
792 for (Int_t i=0; i<kNStepQA; i++) {
793 if (i==0) sprintf(str," ");
794 else sprintf(str,"_cut");
62037e79 795
563113d0 796 fhDcaXYvsDcaZ[i] = new TH2F(Form("%s_dcaXYvsDcaZ%s",GetName(),str),"",200,-10,10,200,-10,10);
db6722a5 797 fhQA[kCutNSigmaToVertex][i] = new TH1F(Form("%s_nSigmaToVertex%s",GetName(),str),"",fhNBinsNSigma-1,fhBinLimNSigma);
798 fhQA[kCutRequireSigmaToVertex][i] = new TH1F(Form("%s_requireSigmaToVertex%s",GetName(),str),"",fhNBinsRequireSigma-1,fhBinLimRequireSigma);
799 fhQA[kCutAcceptKinkDaughters][i] = new TH1F(Form("%s_acceptKinkDaughters%s",GetName(),str),"",fhNBinsAcceptKink-1,fhBinLimAcceptKink);
800 fhQA[kDcaXY][i] = new TH1F(Form("%s_dcaXY%s",GetName(),str),"",fhNBinsDcaXY-1,fhBinLimDcaXY);
801 fhQA[kDcaZ][i] = new TH1F(Form("%s_dcaZ%s",GetName(),str),"",fhNBinsDcaZ-1,fhBinLimDcaZ);
802 fhQA[kDcaXYnorm][i] = new TH1F(Form("%s_dcaXYnorm%s",GetName(),str),"",fhNBinsDcaXYnorm-1,fhBinLimDcaXYnorm);
803 fhQA[kDcaZnorm][i] = new TH1F(Form("%s_dcaZnorm%s",GetName(),str),"",fhNBinsDcaZnorm-1,fhBinLimDcaZnorm);
89d7d478 804 fhQA[kSigmaDcaXY][i] = new TH1F(Form("%s_sigmaDcaXY%s",GetName(),str),"",fhNBinsSigmaDcaXY-1,fhBinLimSigmaDcaXY);
805 fhQA[kSigmaDcaZ][i] = new TH1F(Form("%s_sigmaDcaZ%s",GetName(),str),"",fhNBinsSigmaDcaZ-1,fhBinLimSigmaDcaZ);
563113d0 806
807 fhDcaXYvsDcaZ[i]->SetXTitle("impact par. d_{z}");
808 fhDcaXYvsDcaZ[i]->SetYTitle("impact par. d_{xy}");
563113d0 809
810 fhQA[kCutNSigmaToVertex][i]->SetXTitle("n #sigma to vertex");
811 fhQA[kCutRequireSigmaToVertex][i]->SetXTitle("require #sigma to vertex");
812 fhQA[kCutAcceptKinkDaughters][i]->SetXTitle("accept kink daughters");
813 fhQA[kDcaXY][i]->SetXTitle("impact par. d_{xy}");
814 fhQA[kDcaZ][i]->SetXTitle("impact par. d_{z}");
815 fhQA[kDcaXYnorm][i]->SetXTitle("norm. impact par. d_{xy} / #sigma_{xy}");
816 fhQA[kDcaZnorm][i]->SetXTitle("norm. impact par. d_{z} / #sigma_{z}");
89d7d478 817 fhQA[kSigmaDcaXY][i]->SetXTitle("impact par. resolution #sigma_{xy}");
818 fhQA[kSigmaDcaZ][i]->SetXTitle("impact par. resolution #sigma_{z}");
563113d0 819 }
563113d0 820 for(Int_t i=0; i<kNHist; i++) fhQA[i][1]->SetLineColor(color);
563113d0 821}
822//__________________________________________________________________________________
823void AliCFTrackIsPrimaryCuts::FillHistograms(TObject* obj, Bool_t f)
824{
825 //
826 // fill the QA histograms
827 //
563113d0 828
8edd0c2c 829 Bool_t isESDTrack = strcmp(obj->ClassName(),"AliESDtrack") == 0 ? kTRUE : kFALSE ;
830 Bool_t isAODTrack = strcmp(obj->ClassName(),"AliAODTrack") == 0 ? kTRUE : kFALSE ;
563113d0 831
8edd0c2c 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
8edd0c2c 837 // f = 0: fill histograms before cuts
838 // f = 1: fill histograms after cuts
563113d0 839
89d7d478 840 // get the track to vertex parameter for ESD track
8edd0c2c 841 if (esdTrack) {
563113d0 842
c66800ea 843 fhQA[kDcaZ][f]->Fill(fDCA[1]);
844 fhQA[kDcaXY][f]->Fill(fDCA[0]);
845 fhDcaXYvsDcaZ[f]->Fill(fDCA[1],fDCA[0]);
846 fhQA[kSigmaDcaXY][f]->Fill(fDCA[2]);
847 fhQA[kSigmaDcaZ][f]->Fill(fDCA[3]);
848// // // // // // // delete histograms
849 fhQA[kDcaZnorm][f]->Fill(fDCA[1]);
850 fhQA[kDcaXYnorm][f]->Fill(fDCA[0]);
851
852 fhQA[kCutNSigmaToVertex][f]->Fill(fDCA[5]);
f5b77140 853 if (fDCA[5]<0 && fRequireSigmaToVertex)
854 fhQA[kCutRequireSigmaToVertex][f]->Fill(0.);
855 else
856 fhQA[kCutRequireSigmaToVertex][f]->Fill(1.);
857
858 if (!fAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0)
859 fhQA[kCutAcceptKinkDaughters][f]->Fill(0.);
860 else
861 fhQA[kCutAcceptKinkDaughters][f]->Fill(1.);
8edd0c2c 862 }
c66800ea 863
563113d0 864 // fill cut statistics and cut correlation histograms with information from the bitmap
865 if (f) return;
866
867 // Get the bitmap of the single cuts
868 if ( !obj ) return;
107a3100 869 SelectionBitMap(obj);
563113d0 870
871 // Number of single cuts in this class
107a3100 872 UInt_t ncuts = fBitmap->GetNbits();
563113d0 873 for(UInt_t bit=0; bit<ncuts;bit++) {
107a3100 874 if (!fBitmap->TestBitNumber(bit)) {
563113d0 875 fhCutStatistics->Fill(bit+1);
876 for (UInt_t bit2=bit; bit2<ncuts;bit2++) {
107a3100 877 if (!fBitmap->TestBitNumber(bit2))
563113d0 878 fhCutCorrelation->Fill(bit+1,bit2+1);
879 }
880 }
881 }
882}
883//__________________________________________________________________________________
884void AliCFTrackIsPrimaryCuts::SaveHistograms(const Char_t* dir) {
885 //
886 // saves the histograms in a directory (dir)
887 //
888 if(!fIsQAOn) return;
889
890 if (!dir)
891 dir = GetName();
892
893 gDirectory->mkdir(dir);
894 gDirectory->cd(dir);
895
896 gDirectory->mkdir("before_cuts");
897 gDirectory->mkdir("after_cuts");
898
899 fhCutStatistics->Write();
900 fhCutCorrelation->Write();
901
902 for (Int_t j=0; j<kNStepQA; j++) {
903 if (j==0)
904 gDirectory->cd("before_cuts");
905 else
906 gDirectory->cd("after_cuts");
907
908 fhDcaXYvsDcaZ[j] ->Write();
563113d0 909
910 for(Int_t i=0; i<kNHist; i++) fhQA[i][j]->Write();
911
912 gDirectory->cd("../");
913 }
914 gDirectory->cd("../");
915}
916//__________________________________________________________________________________
917void AliCFTrackIsPrimaryCuts::DrawHistograms()
918{
919 //
920 // draws some histograms
921 //
922 if(!fIsQAOn) return;
923
924 // pad margins
925 Float_t right = 0.03;
926 Float_t left = 0.175;
927 Float_t top = 0.03;
928 Float_t bottom = 0.175;
929
930 TCanvas* canvas1 = new TCanvas("Track_QA_Primary_1", "Track QA Primary 1", 800, 500);
931 canvas1->Divide(2, 1);
932
933 canvas1->cd(1);
934 fhCutStatistics->SetStats(kFALSE);
935 fhCutStatistics->LabelsOption("v");
936 gPad->SetLeftMargin(left);
937 gPad->SetBottomMargin(0.25);
938 gPad->SetRightMargin(right);
939 gPad->SetTopMargin(0.1);
940 fhCutStatistics->Draw();
941
942 canvas1->cd(2);
943 fhCutCorrelation->SetStats(kFALSE);
944 fhCutCorrelation->LabelsOption("v");
945 gPad->SetLeftMargin(0.30);
946 gPad->SetRightMargin(bottom);
947 gPad->SetTopMargin(0.1);
948 gPad->SetBottomMargin(0.25);
949 fhCutCorrelation->Draw("COLZ");
950
951 canvas1->SaveAs(Form("%s.eps", canvas1->GetName()));
952 canvas1->SaveAs(Form("%s.ps", canvas1->GetName()));
953
954 // -----
955
956 TCanvas* canvas2 = new TCanvas("Track_QA_Primary_2", "Track QA Primary 2", 800, 800);
957 canvas2->Divide(2, 2);
958
959 canvas2->cd(1);
960 gPad->SetRightMargin(right);
961 gPad->SetLeftMargin(left);
962 gPad->SetTopMargin(top);
963 gPad->SetBottomMargin(bottom);
964 fhQA[kDcaXY][0]->SetStats(kFALSE);
965 fhQA[kDcaXY][0]->Draw();
966 fhQA[kDcaXY][1]->Draw("same");
967
968 canvas2->cd(2);
969 gPad->SetRightMargin(right);
970 gPad->SetLeftMargin(left);
971 gPad->SetTopMargin(top);
972 gPad->SetBottomMargin(bottom);
973 fhQA[kDcaZ][0]->SetStats(kFALSE);
974 fhQA[kDcaZ][0]->Draw();
975 fhQA[kDcaZ][1]->Draw("same");
976
977 canvas2->cd(3);
978// fhDXYvsDZ[0]->SetStats(kFALSE);
979 gPad->SetLogz();
980 gPad->SetLeftMargin(bottom);
981 gPad->SetTopMargin(0.1);
982 gPad->SetBottomMargin(bottom);
983 gPad->SetRightMargin(0.2);
984 fhDcaXYvsDcaZ[0]->Draw("COLZ");
985
986 canvas2->cd(4);
987// fhDXYvsDZ[1]->SetStats(kFALSE);
988 gPad->SetLogz();
989 gPad->SetLeftMargin(bottom);
990 gPad->SetTopMargin(0.1);
991 gPad->SetBottomMargin(bottom);
992 gPad->SetRightMargin(0.2);
993 fhDcaXYvsDcaZ[1]->Draw("COLZ");
994
995 canvas2->SaveAs(Form("%s.eps", canvas2->GetName()));
996 canvas2->SaveAs(Form("%s.ps", canvas2->GetName()));
997
998 // -----
999
c66800ea 1000 TCanvas* canvas3 = new TCanvas("Track_QA_Primary_3", "Track QA Primary 3", 800, 400);
1001 canvas3->Divide(2, 1);
563113d0 1002
1003 canvas3->cd(1);
1004 gPad->SetRightMargin(right);
1005 gPad->SetLeftMargin(left);
1006 gPad->SetTopMargin(top);
1007 gPad->SetBottomMargin(bottom);
1008 fhQA[kDcaXYnorm][0]->SetStats(kFALSE);
1009 fhQA[kDcaXYnorm][0]->Draw();
1010 fhQA[kDcaXYnorm][1]->Draw("same");
1011
1012 canvas3->cd(2);
1013 gPad->SetRightMargin(right);
1014 gPad->SetLeftMargin(left);
1015 gPad->SetTopMargin(top);
1016 gPad->SetBottomMargin(bottom);
1017 fhQA[kDcaZnorm][0]->SetStats(kFALSE);
1018 fhQA[kDcaZnorm][0]->Draw();
1019 fhQA[kDcaZnorm][1]->Draw("same");
1020
563113d0 1021 canvas3->SaveAs(Form("%s.eps", canvas3->GetName()));
1022 canvas3->SaveAs(Form("%s.ps", canvas3->GetName()));
1023
1024 // -----
1025
89d7d478 1026 TCanvas* canvas4 = new TCanvas("Track_QA_Primary_4", "Track QA Primary 4", 1200, 800);
1027 canvas4->Divide(3, 2);
563113d0 1028
1029 canvas4->cd(1);
1030 gPad->SetRightMargin(right);
1031 gPad->SetLeftMargin(left);
1032 gPad->SetTopMargin(top);
1033 gPad->SetBottomMargin(bottom);
89d7d478 1034 fhQA[kSigmaDcaXY][0]->SetStats(kFALSE);
1035 fhQA[kSigmaDcaXY][0]->Draw();
1036 fhQA[kSigmaDcaXY][1]->Draw("same");
1037
1038 canvas4->cd(2);
1039 gPad->SetRightMargin(right);
1040 gPad->SetLeftMargin(left);
1041 gPad->SetTopMargin(top);
1042 gPad->SetBottomMargin(bottom);
1043 fhQA[kSigmaDcaZ][0]->SetStats(kFALSE);
1044 fhQA[kSigmaDcaZ][0]->Draw();
1045 fhQA[kSigmaDcaZ][1]->Draw("same");
1046
1047 canvas4->cd(4);
1048 gPad->SetRightMargin(right);
1049 gPad->SetLeftMargin(left);
1050 gPad->SetTopMargin(top);
1051 gPad->SetBottomMargin(bottom);
563113d0 1052 fhQA[kCutNSigmaToVertex][0]->SetStats(kFALSE);
1053 fhQA[kCutNSigmaToVertex][0]->Draw();
1054 fhQA[kCutNSigmaToVertex][1]->Draw("same");
1055
89d7d478 1056 canvas4->cd(5);
563113d0 1057 gPad->SetRightMargin(right);
1058 gPad->SetLeftMargin(left);
1059 gPad->SetTopMargin(top);
1060 gPad->SetBottomMargin(bottom);
1061 fhQA[kCutRequireSigmaToVertex][0]->SetStats(kFALSE);
1062 fhQA[kCutRequireSigmaToVertex][0]->Draw();
1063 fhQA[kCutRequireSigmaToVertex][1]->Draw("same");
1064
89d7d478 1065 canvas4->cd(6);
563113d0 1066 gPad->SetRightMargin(right);
1067 gPad->SetLeftMargin(left);
1068 gPad->SetTopMargin(top);
1069 gPad->SetBottomMargin(bottom);
1070 fhQA[kCutAcceptKinkDaughters][0]->SetStats(kFALSE);
1071 fhQA[kCutAcceptKinkDaughters][0]->Draw();
1072 fhQA[kCutAcceptKinkDaughters][1]->Draw("same");
1073
1074 canvas4->SaveAs(Form("%s.eps", canvas4->GetName()));
1075 canvas4->SaveAs(Form("%s.ps", canvas4->GetName()));
1076}
1077//__________________________________________________________________________________
107a3100 1078void AliCFTrackIsPrimaryCuts::AddQAHistograms(TList *qaList) {
563113d0 1079 //
1080 // saves the histograms in a TList
1081 //
107a3100 1082 DefineHistograms();
563113d0 1083
1084 qaList->Add(fhCutStatistics);
1085 qaList->Add(fhCutCorrelation);
1086
1087 for (Int_t j=0; j<kNStepQA; j++) {
1088 qaList->Add(fhDcaXYvsDcaZ[j]);
563113d0 1089 for(Int_t i=0; i<kNHist; i++)
62037e79 1090 qaList->Add(fhQA[i][j]);
563113d0 1091 }
1092}