1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliESDtrackCuts.cxx 24534 2008-03-16 22:22:11Z fca $ */
18 #include "AliESDtrackCuts.h"
20 #include <AliESDtrack.h>
21 #include <AliESDVertex.h>
22 #include <AliESDEvent.h>
27 #include <TDirectory.h>
31 //____________________________________________________________________
32 ClassImp(AliESDtrackCuts)
35 const Char_t* AliESDtrackCuts::fgkCutNames[kNCuts] = {
37 "require TPC standalone",
41 "#Chi^{2}/cluster TPC",
42 "#Chi^{2}/cluster ITS",
58 "trk-to-vtx max dca 2D absolute",
59 "trk-to-vtx max dca xy absolute",
60 "trk-to-vtx max dca z absolute",
61 "trk-to-vtx min dca 2D absolute",
62 "trk-to-vtx min dca xy absolute",
63 "trk-to-vtx min dca z absolute",
64 "SPD cluster requirement",
65 "SDD cluster requirement",
66 "SSD cluster requirement",
67 "require ITS stand-alone",
68 "rel 1/pt uncertainty",
72 //____________________________________________________________________
73 AliESDtrackCuts::AliESDtrackCuts(const Char_t* name, const Char_t* title) : AliAnalysisCuts(name,title),
74 fCutMinNClusterTPC(0),
75 fCutMinNClusterITS(0),
76 fCutMaxChi2PerClusterTPC(0),
77 fCutMaxChi2PerClusterITS(0),
83 fCutMaxRel1PtUncertainty(0),
84 fCutAcceptKinkDaughters(0),
85 fCutAcceptSharedTPCClusters(0),
86 fCutMaxFractionSharedTPCClusters(0),
87 fCutRequireTPCRefit(0),
88 fCutRequireTPCStandAlone(0),
89 fCutRequireITSRefit(0),
91 fCutRequireITSStandAlone(0),
92 fCutRequireITSpureSA(0),
93 fCutNsigmaToVertex(0),
94 fCutSigmaToVertexRequired(0),
95 fCutMaxDCAToVertexXY(0),
96 fCutMaxDCAToVertexZ(0),
97 fCutMinDCAToVertexXY(0),
98 fCutMinDCAToVertexZ(0),
99 fCutMaxDCAToVertexXYPtDep(""),
100 fCutMaxDCAToVertexZPtDep(""),
101 fCutMinDCAToVertexXYPtDep(""),
102 fCutMinDCAToVertexZPtDep(""),
103 f1CutMaxDCAToVertexXYPtDep(0x0),
104 f1CutMaxDCAToVertexZPtDep(0x0),
105 f1CutMinDCAToVertexXYPtDep(0x0),
106 f1CutMinDCAToVertexZPtDep(0x0),
107 fCutDCAToVertex2D(0),
133 //##############################################################################
134 // setting default cuts
135 SetMinNClustersTPC();
136 SetMinNClustersITS();
137 SetMaxChi2PerClusterTPC();
138 SetMaxChi2PerClusterITS();
139 SetMaxCovDiagonalElements();
140 SetMaxRel1PtUncertainty();
141 SetRequireTPCRefit();
142 SetRequireTPCStandAlone();
143 SetRequireITSRefit();
144 SetRequireITSPid(kFALSE);
145 SetRequireITSStandAlone(kFALSE);
146 SetRequireITSPureStandAlone(kFALSE);
147 SetAcceptKinkDaughters();
148 SetMaxNsigmaToVertex();
149 SetMaxDCAToVertexXY();
150 SetMaxDCAToVertexZ();
152 SetMinDCAToVertexXY();
153 SetMinDCAToVertexZ();
161 SetClusterRequirementITS(kSPD);
162 SetClusterRequirementITS(kSDD);
163 SetClusterRequirementITS(kSSD);
168 //_____________________________________________________________________________
169 AliESDtrackCuts::AliESDtrackCuts(const AliESDtrackCuts &c) : AliAnalysisCuts(c),
170 fCutMinNClusterTPC(0),
171 fCutMinNClusterITS(0),
172 fCutMaxChi2PerClusterTPC(0),
173 fCutMaxChi2PerClusterITS(0),
179 fCutMaxRel1PtUncertainty(0),
180 fCutAcceptKinkDaughters(0),
181 fCutAcceptSharedTPCClusters(0),
182 fCutMaxFractionSharedTPCClusters(0),
183 fCutRequireTPCRefit(0),
184 fCutRequireTPCStandAlone(0),
185 fCutRequireITSRefit(0),
186 fCutRequireITSPid(0),
187 fCutRequireITSStandAlone(0),
188 fCutRequireITSpureSA(0),
189 fCutNsigmaToVertex(0),
190 fCutSigmaToVertexRequired(0),
191 fCutMaxDCAToVertexXY(0),
192 fCutMaxDCAToVertexZ(0),
193 fCutMinDCAToVertexXY(0),
194 fCutMinDCAToVertexZ(0),
195 fCutMaxDCAToVertexXYPtDep(""),
196 fCutMaxDCAToVertexZPtDep(""),
197 fCutMinDCAToVertexXYPtDep(""),
198 fCutMinDCAToVertexZPtDep(""),
199 f1CutMaxDCAToVertexXYPtDep(0x0),
200 f1CutMaxDCAToVertexZPtDep(0x0),
201 f1CutMinDCAToVertexXYPtDep(0x0),
202 f1CutMinDCAToVertexZPtDep(0x0),
203 fCutDCAToVertex2D(0),
227 ((AliESDtrackCuts &) c).Copy(*this);
230 AliESDtrackCuts::~AliESDtrackCuts()
236 for (Int_t i=0; i<2; i++) {
238 if (fhNClustersITS[i])
239 delete fhNClustersITS[i];
240 if (fhNClustersTPC[i])
241 delete fhNClustersTPC[i];
242 if (fhChi2PerClusterITS[i])
243 delete fhChi2PerClusterITS[i];
244 if (fhChi2PerClusterTPC[i])
245 delete fhChi2PerClusterTPC[i];
257 if (fhRel1PtUncertainty[i])
258 delete fhRel1PtUncertainty[i];
269 if (fhDXYNormalized[i])
270 delete fhDXYNormalized[i];
271 if (fhDZNormalized[i])
272 delete fhDZNormalized[i];
273 if (fhDXYvsDZNormalized[i])
274 delete fhDXYvsDZNormalized[i];
275 if (fhNSigmaToVertex[i])
276 delete fhNSigmaToVertex[i];
283 if(f1CutMaxDCAToVertexXYPtDep)delete f1CutMaxDCAToVertexXYPtDep;
284 f1CutMaxDCAToVertexXYPtDep = 0;
285 if( f1CutMaxDCAToVertexZPtDep) delete f1CutMaxDCAToVertexZPtDep;
286 f1CutMaxDCAToVertexZPtDep = 0;
287 if( f1CutMinDCAToVertexXYPtDep)delete f1CutMinDCAToVertexXYPtDep;
288 f1CutMinDCAToVertexXYPtDep = 0;
289 if(f1CutMinDCAToVertexZPtDep)delete f1CutMinDCAToVertexZPtDep;
290 f1CutMinDCAToVertexZPtDep = 0;
294 delete ffDTheoretical;
297 delete fhCutStatistics;
298 if (fhCutCorrelation)
299 delete fhCutCorrelation;
302 void AliESDtrackCuts::Init()
305 // sets everything to zero
308 fCutMinNClusterTPC = 0;
309 fCutMinNClusterITS = 0;
311 fCutMaxChi2PerClusterTPC = 0;
312 fCutMaxChi2PerClusterITS = 0;
314 for (Int_t i = 0; i < 3; i++)
315 fCutClusterRequirementITS[i] = kOff;
323 fCutMaxRel1PtUncertainty = 0;
325 fCutAcceptKinkDaughters = 0;
326 fCutAcceptSharedTPCClusters = 0;
327 fCutMaxFractionSharedTPCClusters = 0;
328 fCutRequireTPCRefit = 0;
329 fCutRequireTPCStandAlone = 0;
330 fCutRequireITSRefit = 0;
331 fCutRequireITSPid = 0;
332 fCutRequireITSStandAlone = 0;
333 fCutRequireITSpureSA = 0;
335 fCutNsigmaToVertex = 0;
336 fCutSigmaToVertexRequired = 0;
337 fCutMaxDCAToVertexXY = 0;
338 fCutMaxDCAToVertexZ = 0;
339 fCutDCAToVertex2D = 0;
340 fCutMinDCAToVertexXY = 0;
341 fCutMinDCAToVertexZ = 0;
342 fCutMaxDCAToVertexXYPtDep = "";
343 fCutMaxDCAToVertexZPtDep = "";
344 fCutMinDCAToVertexXYPtDep = "";
345 fCutMinDCAToVertexZPtDep = "";
347 if(f1CutMaxDCAToVertexXYPtDep)delete f1CutMaxDCAToVertexXYPtDep;
348 f1CutMaxDCAToVertexXYPtDep = 0;
349 if( f1CutMaxDCAToVertexXYPtDep) delete f1CutMaxDCAToVertexXYPtDep;
350 f1CutMaxDCAToVertexXYPtDep = 0;
351 if( f1CutMaxDCAToVertexZPtDep) delete f1CutMaxDCAToVertexZPtDep;
352 f1CutMaxDCAToVertexZPtDep = 0;
353 if( f1CutMinDCAToVertexXYPtDep)delete f1CutMinDCAToVertexXYPtDep;
354 f1CutMinDCAToVertexXYPtDep = 0;
355 if(f1CutMinDCAToVertexZPtDep)delete f1CutMinDCAToVertexZPtDep;
356 f1CutMinDCAToVertexZPtDep = 0;
374 fHistogramsOn = kFALSE;
376 for (Int_t i=0; i<2; ++i)
378 fhNClustersITS[i] = 0;
379 fhNClustersTPC[i] = 0;
381 fhChi2PerClusterITS[i] = 0;
382 fhChi2PerClusterTPC[i] = 0;
390 fhRel1PtUncertainty[i] = 0;
397 fhDXYNormalized[i] = 0;
398 fhDZNormalized[i] = 0;
399 fhDXYvsDZNormalized[i] = 0;
400 fhNSigmaToVertex[i] = 0;
408 fhCutCorrelation = 0;
411 //_____________________________________________________________________________
412 AliESDtrackCuts &AliESDtrackCuts::operator=(const AliESDtrackCuts &c)
415 // Assignment operator
418 if (this != &c) ((AliESDtrackCuts &) c).Copy(*this);
422 //_____________________________________________________________________________
423 void AliESDtrackCuts::Copy(TObject &c) const
429 AliESDtrackCuts& target = (AliESDtrackCuts &) c;
433 target.fCutMinNClusterTPC = fCutMinNClusterTPC;
434 target.fCutMinNClusterITS = fCutMinNClusterITS;
436 target.fCutMaxChi2PerClusterTPC = fCutMaxChi2PerClusterTPC;
437 target.fCutMaxChi2PerClusterITS = fCutMaxChi2PerClusterITS;
439 for (Int_t i = 0; i < 3; i++)
440 target.fCutClusterRequirementITS[i] = fCutClusterRequirementITS[i];
442 target.fCutMaxC11 = fCutMaxC11;
443 target.fCutMaxC22 = fCutMaxC22;
444 target.fCutMaxC33 = fCutMaxC33;
445 target.fCutMaxC44 = fCutMaxC44;
446 target.fCutMaxC55 = fCutMaxC55;
448 target.fCutMaxRel1PtUncertainty = fCutMaxRel1PtUncertainty;
450 target.fCutAcceptKinkDaughters = fCutAcceptKinkDaughters;
451 target.fCutAcceptSharedTPCClusters = fCutAcceptSharedTPCClusters;
452 target.fCutMaxFractionSharedTPCClusters = fCutMaxFractionSharedTPCClusters;
453 target.fCutRequireTPCRefit = fCutRequireTPCRefit;
454 target.fCutRequireTPCStandAlone = fCutRequireTPCStandAlone;
455 target.fCutRequireITSRefit = fCutRequireITSRefit;
456 target.fCutRequireITSPid = fCutRequireITSPid;
457 target.fCutRequireITSStandAlone = fCutRequireITSStandAlone;
458 target.fCutRequireITSpureSA = fCutRequireITSpureSA;
460 target.fCutNsigmaToVertex = fCutNsigmaToVertex;
461 target.fCutSigmaToVertexRequired = fCutSigmaToVertexRequired;
462 target.fCutMaxDCAToVertexXY = fCutMaxDCAToVertexXY;
463 target.fCutMaxDCAToVertexZ = fCutMaxDCAToVertexZ;
464 target.fCutDCAToVertex2D = fCutDCAToVertex2D;
465 target.fCutMinDCAToVertexXY = fCutMinDCAToVertexXY;
466 target.fCutMinDCAToVertexZ = fCutMinDCAToVertexZ;
468 target.fCutMaxDCAToVertexXYPtDep = fCutMaxDCAToVertexXYPtDep;
469 target.SetMaxDCAToVertexXYPtDep(fCutMaxDCAToVertexXYPtDep.Data());
471 target.fCutMaxDCAToVertexZPtDep = fCutMaxDCAToVertexZPtDep;
472 target.SetMaxDCAToVertexZPtDep(fCutMaxDCAToVertexZPtDep.Data());
474 target.fCutMinDCAToVertexXYPtDep = fCutMinDCAToVertexXYPtDep;
475 target.SetMinDCAToVertexXYPtDep(fCutMinDCAToVertexXYPtDep.Data());
477 target.fCutMinDCAToVertexZPtDep = fCutMinDCAToVertexZPtDep;
478 target.SetMinDCAToVertexZPtDep(fCutMinDCAToVertexZPtDep.Data());
480 target.fPMin = fPMin;
481 target.fPMax = fPMax;
482 target.fPtMin = fPtMin;
483 target.fPtMax = fPtMax;
484 target.fPxMin = fPxMin;
485 target.fPxMax = fPxMax;
486 target.fPyMin = fPyMin;
487 target.fPyMax = fPyMax;
488 target.fPzMin = fPzMin;
489 target.fPzMax = fPzMax;
490 target.fEtaMin = fEtaMin;
491 target.fEtaMax = fEtaMax;
492 target.fRapMin = fRapMin;
493 target.fRapMax = fRapMax;
495 target.fHistogramsOn = fHistogramsOn;
497 for (Int_t i=0; i<2; ++i)
499 if (fhNClustersITS[i]) target.fhNClustersITS[i] = (TH1F*) fhNClustersITS[i]->Clone();
500 if (fhNClustersTPC[i]) target.fhNClustersTPC[i] = (TH1F*) fhNClustersTPC[i]->Clone();
502 if (fhChi2PerClusterITS[i]) target.fhChi2PerClusterITS[i] = (TH1F*) fhChi2PerClusterITS[i]->Clone();
503 if (fhChi2PerClusterTPC[i]) target.fhChi2PerClusterTPC[i] = (TH1F*) fhChi2PerClusterTPC[i]->Clone();
505 if (fhC11[i]) target.fhC11[i] = (TH1F*) fhC11[i]->Clone();
506 if (fhC22[i]) target.fhC22[i] = (TH1F*) fhC22[i]->Clone();
507 if (fhC33[i]) target.fhC33[i] = (TH1F*) fhC33[i]->Clone();
508 if (fhC44[i]) target.fhC44[i] = (TH1F*) fhC44[i]->Clone();
509 if (fhC55[i]) target.fhC55[i] = (TH1F*) fhC55[i]->Clone();
511 if (fhRel1PtUncertainty[i]) target.fhRel1PtUncertainty[i] = (TH1F*) fhRel1PtUncertainty[i]->Clone();
513 if (fhDXY[i]) target.fhDXY[i] = (TH1F*) fhDXY[i]->Clone();
514 if (fhDZ[i]) target.fhDZ[i] = (TH1F*) fhDZ[i]->Clone();
515 if (fhDXYDZ[i]) target.fhDXYDZ[i] = (TH1F*) fhDXYDZ[i]->Clone();
516 if (fhDXYvsDZ[i]) target.fhDXYvsDZ[i] = (TH2F*) fhDXYvsDZ[i]->Clone();
518 if (fhDXYNormalized[i]) target.fhDXYNormalized[i] = (TH1F*) fhDXYNormalized[i]->Clone();
519 if (fhDZNormalized[i]) target.fhDZNormalized[i] = (TH1F*) fhDZNormalized[i]->Clone();
520 if (fhDXYvsDZNormalized[i]) target.fhDXYvsDZNormalized[i] = (TH2F*) fhDXYvsDZNormalized[i]->Clone();
521 if (fhNSigmaToVertex[i]) target.fhNSigmaToVertex[i] = (TH1F*) fhNSigmaToVertex[i]->Clone();
523 if (fhPt[i]) target.fhPt[i] = (TH1F*) fhPt[i]->Clone();
524 if (fhEta[i]) target.fhEta[i] = (TH1F*) fhEta[i]->Clone();
526 if (ffDTheoretical) target.ffDTheoretical = (TF1*) ffDTheoretical->Clone();
528 if (fhCutStatistics) target.fhCutStatistics = (TH1F*) fhCutStatistics->Clone();
529 if (fhCutCorrelation) target.fhCutCorrelation = (TH2F*) fhCutCorrelation->Clone();
534 //_____________________________________________________________________________
535 Long64_t AliESDtrackCuts::Merge(TCollection* list) {
536 // Merge a list of AliESDtrackCuts objects with this (needed for PROOF)
537 // Returns the number of merged objects (including this)
544 TIterator* iter = list->MakeIterator();
547 // collection of measured and generated histograms
549 while ((obj = iter->Next())) {
551 AliESDtrackCuts* entry = dynamic_cast<AliESDtrackCuts*>(obj);
555 if (!entry->fHistogramsOn)
558 for (Int_t i=0; i<2; i++) {
560 fhNClustersITS[i] ->Add(entry->fhNClustersITS[i] );
561 fhNClustersTPC[i] ->Add(entry->fhNClustersTPC[i] );
563 fhChi2PerClusterITS[i] ->Add(entry->fhChi2PerClusterITS[i]);
564 fhChi2PerClusterTPC[i] ->Add(entry->fhChi2PerClusterTPC[i]);
566 fhC11[i] ->Add(entry->fhC11[i] );
567 fhC22[i] ->Add(entry->fhC22[i] );
568 fhC33[i] ->Add(entry->fhC33[i] );
569 fhC44[i] ->Add(entry->fhC44[i] );
570 fhC55[i] ->Add(entry->fhC55[i] );
572 fhRel1PtUncertainty[i] ->Add(entry->fhRel1PtUncertainty[i]);
574 fhDXY[i] ->Add(entry->fhDXY[i] );
575 fhDZ[i] ->Add(entry->fhDZ[i] );
576 fhDXYDZ[i] ->Add(entry->fhDXYDZ[i] );
577 fhDXYvsDZ[i] ->Add(entry->fhDXYvsDZ[i] );
579 fhDXYNormalized[i] ->Add(entry->fhDXYNormalized[i] );
580 fhDZNormalized[i] ->Add(entry->fhDZNormalized[i] );
581 fhDXYvsDZNormalized[i] ->Add(entry->fhDXYvsDZNormalized[i]);
582 fhNSigmaToVertex[i] ->Add(entry->fhNSigmaToVertex[i]);
584 fhPt[i] ->Add(entry->fhPt[i]);
585 fhEta[i] ->Add(entry->fhEta[i]);
588 fhCutStatistics ->Add(entry->fhCutStatistics);
589 fhCutCorrelation ->Add(entry->fhCutCorrelation);
596 //____________________________________________________________________
597 AliESDtrackCuts* AliESDtrackCuts::GetStandardTPCOnlyTrackCuts()
599 // creates an AliESDtrackCuts object and fills it with standard (pre data-taking) values for TPC-only cuts
601 Printf("AliESDtrackCuts::GetStandardTPCOnlyTrackCuts: Creating track cuts for TPC-only.");
603 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
605 esdTrackCuts->SetMinNClustersTPC(50);
606 esdTrackCuts->SetMaxChi2PerClusterTPC(4);
607 esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
609 esdTrackCuts->SetMaxDCAToVertexZ(3.2);
610 esdTrackCuts->SetMaxDCAToVertexXY(2.4);
611 esdTrackCuts->SetDCAToVertex2D(kTRUE);
616 //____________________________________________________________________
617 AliESDtrackCuts* AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(Bool_t selPrimaries)
619 // creates an AliESDtrackCuts object and fills it with standard values for ITS-TPC cuts for pp 2009 data
621 Printf("AliESDtrackCuts::GetStandardITSTPCTrackCuts: Creating track cuts for ITS+TPC.");
623 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
626 esdTrackCuts->SetRequireTPCStandAlone(kTRUE); // to get chi2 and ncls of kTPCin
627 esdTrackCuts->SetMinNClustersTPC(70);
628 esdTrackCuts->SetMaxChi2PerClusterTPC(4);
629 esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
630 esdTrackCuts->SetRequireTPCRefit(kTRUE);
632 esdTrackCuts->SetRequireITSRefit(kTRUE);
633 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
634 AliESDtrackCuts::kAny);
636 // 7*(0.0050+0.0060/pt^0.9)
637 esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9");
639 esdTrackCuts->SetMaxDCAToVertexZ(1.e6);
640 esdTrackCuts->SetDCAToVertex2D(kFALSE);
641 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
642 //esdTrackCuts->SetEtaRange(-0.8,+0.8);
647 //____________________________________________________________________
648 AliESDtrackCuts* AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(Bool_t selPrimaries)
650 // creates an AliESDtrackCuts object and fills it with standard values for ITS-TPC cuts for pp 2010 data
652 Printf("AliESDtrackCuts::GetStandardITSTPCTrackCuts: Creating track cuts for ITS+TPC.");
654 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
657 esdTrackCuts->SetMinNClustersTPC(70);
658 esdTrackCuts->SetMaxChi2PerClusterTPC(4);
659 esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
660 esdTrackCuts->SetRequireTPCRefit(kTRUE);
662 esdTrackCuts->SetRequireITSRefit(kTRUE);
663 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
664 AliESDtrackCuts::kAny);
666 // 7*(0.0026+0.0050/pt^1.01)
667 esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
669 esdTrackCuts->SetMaxDCAToVertexZ(2);
670 esdTrackCuts->SetDCAToVertex2D(kFALSE);
671 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
676 //____________________________________________________________________
677 AliESDtrackCuts* AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(Bool_t selPrimaries, Bool_t useForPid)
679 // creates an AliESDtrackCuts object and fills it with standard values for ITS pure SA tracks
681 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
682 esdTrackCuts->SetRequireITSPureStandAlone(kTRUE);
683 esdTrackCuts->SetRequireITSRefit(kTRUE);
684 esdTrackCuts->SetMinNClustersITS(4);
685 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
686 AliESDtrackCuts::kAny);
687 esdTrackCuts->SetMaxChi2PerClusterITS(1.);
690 // 7*(0.0085+0.0026/pt^1.55)
691 esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55");
694 esdTrackCuts->SetRequireITSPid(kTRUE);
699 //____________________________________________________________________
700 AliESDtrackCuts* AliESDtrackCuts::GetStandardITSPureSATrackCuts2010(Bool_t selPrimaries, Bool_t useForPid)
702 // creates an AliESDtrackCuts object and fills it with standard values for ITS pure SA tracks - pp 2010
704 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
705 esdTrackCuts->SetRequireITSPureStandAlone(kTRUE);
706 esdTrackCuts->SetRequireITSRefit(kTRUE);
707 esdTrackCuts->SetMinNClustersITS(4);
708 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
709 AliESDtrackCuts::kAny);
710 esdTrackCuts->SetMaxChi2PerClusterITS(2.5);
713 // 7*(0.0033+0.0045/pt^1.3)
714 esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0231+0.0315/pt^1.3");
717 esdTrackCuts->SetRequireITSPid(kTRUE);
722 //____________________________________________________________________
723 AliESDtrackCuts* AliESDtrackCuts::GetStandardITSSATrackCuts2009(Bool_t selPrimaries, Bool_t useForPid)
725 // creates an AliESDtrackCuts object and fills it with standard values for ITS pure SA tracks
727 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
728 esdTrackCuts->SetRequireITSStandAlone(kTRUE);
729 esdTrackCuts->SetRequireITSPureStandAlone(kFALSE);
730 esdTrackCuts->SetRequireITSRefit(kTRUE);
731 esdTrackCuts->SetMinNClustersITS(4);
732 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
733 AliESDtrackCuts::kAny);
734 esdTrackCuts->SetMaxChi2PerClusterITS(1.);
737 // 7*(0.0085+0.0026/pt^1.55)
738 esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55");
741 esdTrackCuts->SetRequireITSPid(kTRUE);
746 //____________________________________________________________________
747 AliESDtrackCuts* AliESDtrackCuts::GetStandardITSSATrackCuts2010(Bool_t selPrimaries, Bool_t useForPid)
749 // creates an AliESDtrackCuts object and fills it with standard values for ITS pure SA tracks --pp 2010
751 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts;
752 esdTrackCuts->SetRequireITSStandAlone(kTRUE);
753 esdTrackCuts->SetRequireITSPureStandAlone(kFALSE);
754 esdTrackCuts->SetRequireITSRefit(kTRUE);
755 esdTrackCuts->SetMinNClustersITS(4);
756 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
757 AliESDtrackCuts::kAny);
758 esdTrackCuts->SetMaxChi2PerClusterITS(2.5);
761 // 7*(0.0033+0.0045/pt^1.3)
762 esdTrackCuts->SetMaxDCAToVertexXYPtDep("0.0231+0.0315/pt^1.3");
765 esdTrackCuts->SetRequireITSPid(kTRUE);
770 //____________________________________________________________________
771 Int_t AliESDtrackCuts::GetReferenceMultiplicity(AliESDEvent* esd, Bool_t tpcOnly)
773 // Gets reference multiplicity following the standard cuts and a defined fiducial volume
774 // tpcOnly = kTRUE -> consider TPC-only tracks
775 // = kFALSE -> consider global tracks
779 Printf("AliESDtrackCuts::GetReferenceMultiplicity: Not implemented for global tracks!");
783 static AliESDtrackCuts* esdTrackCuts = 0;
786 esdTrackCuts = GetStandardTPCOnlyTrackCuts();
787 esdTrackCuts->SetEtaRange(-0.8, 0.8);
788 esdTrackCuts->SetPtRange(0.15);
791 Int_t nTracks = esdTrackCuts->CountAcceptedTracks(esd);
796 //____________________________________________________________________
797 Float_t AliESDtrackCuts::GetSigmaToVertex(AliESDtrack* esdTrack)
799 // Calculates the number of sigma to the vertex.
804 esdTrack->GetImpactParameters(b,bCov);
806 if (bCov[0]<=0 || bCov[2]<=0) {
807 AliDebugClass(1, "Estimated b resolution lower or equal zero!");
808 bCov[0]=0; bCov[2]=0;
810 bRes[0] = TMath::Sqrt(bCov[0]);
811 bRes[1] = TMath::Sqrt(bCov[2]);
813 // -----------------------------------
814 // How to get to a n-sigma cut?
816 // The accumulated statistics from 0 to d is
818 // -> Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma)
819 // -> 1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma)
821 // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-d**2)/2)
822 // Can this be expressed in a different way?
824 if (bRes[0] == 0 || bRes[1] ==0)
827 Float_t d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
829 // work around precision problem
830 // if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
831 // 1e-15 corresponds to nsigma ~ 7.7
832 if (TMath::Exp(-d * d / 2) < 1e-15)
835 Float_t nSigma = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
839 void AliESDtrackCuts::EnableNeededBranches(TTree* tree)
841 // enables the branches needed by AcceptTrack, for a list see comment of AcceptTrack
843 tree->SetBranchStatus("fTracks.fFlags", 1);
844 tree->SetBranchStatus("fTracks.fITSncls", 1);
845 tree->SetBranchStatus("fTracks.fTPCncls", 1);
846 tree->SetBranchStatus("fTracks.fITSchi2", 1);
847 tree->SetBranchStatus("fTracks.fTPCchi2", 1);
848 tree->SetBranchStatus("fTracks.fC*", 1);
849 tree->SetBranchStatus("fTracks.fD", 1);
850 tree->SetBranchStatus("fTracks.fZ", 1);
851 tree->SetBranchStatus("fTracks.fCdd", 1);
852 tree->SetBranchStatus("fTracks.fCdz", 1);
853 tree->SetBranchStatus("fTracks.fCzz", 1);
854 tree->SetBranchStatus("fTracks.fP*", 1);
855 tree->SetBranchStatus("fTracks.fR*", 1);
856 tree->SetBranchStatus("fTracks.fKinkIndexes*", 1);
859 //____________________________________________________________________
860 Bool_t AliESDtrackCuts::AcceptTrack(AliESDtrack* esdTrack)
863 // figure out if the tracks survives all the track cuts defined
865 // the different quality parameter and kinematic values are first
866 // retrieved from the track. then it is found out what cuts the
867 // track did not survive and finally the cuts are imposed.
869 // this function needs the following branches:
875 // fTracks.fC //GetExternalCovariance
876 // fTracks.fD //GetImpactParameters
877 // fTracks.fZ //GetImpactParameters
878 // fTracks.fCdd //GetImpactParameters
879 // fTracks.fCdz //GetImpactParameters
880 // fTracks.fCzz //GetImpactParameters
881 // fTracks.fP //GetPxPyPz
882 // fTracks.fR //GetMass
883 // fTracks.fP //GetMass
884 // fTracks.fKinkIndexes
886 UInt_t status = esdTrack->GetStatus();
888 // getting quality parameters from the ESD track
889 Int_t nClustersITS = esdTrack->GetITSclusters(0);
890 Int_t nClustersTPC = -1;
891 if(fCutRequireTPCStandAlone) {
892 nClustersTPC = esdTrack->GetTPCNclsIter1();
895 nClustersTPC = esdTrack->GetTPCclusters(0);
898 Int_t nClustersTPCShared = esdTrack->GetTPCnclsS();
899 Float_t fracClustersTPCShared = -1.;
901 Float_t chi2PerClusterITS = -1;
902 Float_t chi2PerClusterTPC = -1;
904 chi2PerClusterITS = esdTrack->GetITSchi2()/Float_t(nClustersITS);
905 if (nClustersTPC!=0) {
906 if(fCutRequireTPCStandAlone) {
907 chi2PerClusterTPC = esdTrack->GetTPCchi2Iter1()/Float_t(nClustersTPC);
909 chi2PerClusterTPC = esdTrack->GetTPCchi2()/Float_t(nClustersTPC);
911 fracClustersTPCShared = Float_t(nClustersTPCShared)/Float_t(nClustersTPC);
915 esdTrack->GetExternalCovariance(extCov);
917 // getting the track to vertex parameters
918 Float_t nSigmaToVertex = GetSigmaToVertex(esdTrack);
922 esdTrack->GetImpactParameters(b,bCov);
923 if (bCov[0]<=0 || bCov[2]<=0) {
924 AliDebug(1, "Estimated b resolution lower or equal zero!");
925 bCov[0]=0; bCov[2]=0;
929 // set pt-dependent DCA cuts, if requested
930 SetPtDepDCACuts(esdTrack->Pt());
933 Float_t dcaToVertexXY = b[0];
934 Float_t dcaToVertexZ = b[1];
936 Float_t dcaToVertex = -1;
938 if (fCutDCAToVertex2D)
940 dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY/fCutMaxDCAToVertexXY/fCutMaxDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutMaxDCAToVertexZ/fCutMaxDCAToVertexZ);
943 dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY + dcaToVertexZ*dcaToVertexZ);
945 // getting the kinematic variables of the track
946 // (assuming the mass is known)
948 esdTrack->GetPxPyPz(p);
950 Float_t momentum = TMath::Sqrt(TMath::Power(p[0],2) + TMath::Power(p[1],2) + TMath::Power(p[2],2));
951 Float_t pt = TMath::Sqrt(TMath::Power(p[0],2) + TMath::Power(p[1],2));
952 Float_t energy = TMath::Sqrt(TMath::Power(esdTrack->GetMass(),2) + TMath::Power(momentum,2));
954 //y-eta related calculations
957 if((momentum != TMath::Abs(p[2]))&&(momentum != 0))
958 eta = 0.5*TMath::Log((momentum + p[2])/(momentum - p[2]));
959 if((energy != TMath::Abs(p[2]))&&(momentum != 0))
960 y = 0.5*TMath::Log((energy + p[2])/(energy - p[2]));
964 Printf("AliESDtrackCuts::AcceptTrack: WARNING: GetSigma1Pt2() returns negative value for external covariance matrix element fC[14]: %f. Corrupted track information, track will not be accepted!", extCov[14]);
967 Float_t relUncertainty1Pt = TMath::Sqrt(extCov[14])*pt;
969 //########################################################################
973 for (Int_t i=0; i<kNCuts; i++) cuts[i]=kFALSE;
975 // track quality cuts
976 if (fCutRequireTPCRefit && (status&AliESDtrack::kTPCrefit)==0)
978 if (fCutRequireTPCStandAlone && (status&AliESDtrack::kTPCin)==0)
980 if (fCutRequireITSRefit && (status&AliESDtrack::kITSrefit)==0)
982 if (nClustersTPC<fCutMinNClusterTPC)
984 if (nClustersITS<fCutMinNClusterITS)
986 if (chi2PerClusterTPC>fCutMaxChi2PerClusterTPC)
988 if (chi2PerClusterITS>fCutMaxChi2PerClusterITS)
990 if (extCov[0] > fCutMaxC11)
992 if (extCov[2] > fCutMaxC22)
994 if (extCov[5] > fCutMaxC33)
996 if (extCov[9] > fCutMaxC44)
998 if (extCov[14] > fCutMaxC55)
1000 if (nSigmaToVertex > fCutNsigmaToVertex && fCutSigmaToVertexRequired)
1002 // if n sigma could not be calculated
1003 if (nSigmaToVertex<0 && fCutSigmaToVertexRequired)
1005 if (!fCutAcceptKinkDaughters && esdTrack->GetKinkIndex(0)>0)
1007 // track kinematics cut
1008 if((momentum < fPMin) || (momentum > fPMax))
1010 if((pt < fPtMin) || (pt > fPtMax))
1012 if((p[0] < fPxMin) || (p[0] > fPxMax))
1014 if((p[1] < fPyMin) || (p[1] > fPyMax))
1016 if((p[2] < fPzMin) || (p[2] > fPzMax))
1018 if((eta < fEtaMin) || (eta > fEtaMax))
1020 if((y < fRapMin) || (y > fRapMax))
1022 if (fCutDCAToVertex2D && dcaToVertex > 1)
1024 if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexXY) > fCutMaxDCAToVertexXY)
1026 if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexZ) > fCutMaxDCAToVertexZ)
1028 if (fCutDCAToVertex2D && fCutMinDCAToVertexXY > 0 && fCutMinDCAToVertexZ > 0 && dcaToVertexXY*dcaToVertexXY/fCutMinDCAToVertexXY/fCutMinDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutMinDCAToVertexZ/fCutMinDCAToVertexZ < 1)
1030 if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexXY) < fCutMinDCAToVertexXY)
1032 if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexZ) < fCutMinDCAToVertexZ)
1035 for (Int_t i = 0; i < 3; i++)
1036 cuts[28+i] = !CheckITSClusterRequirement(fCutClusterRequirementITS[i], esdTrack->HasPointOnITSLayer(i*2), esdTrack->HasPointOnITSLayer(i*2+1));
1038 if(fCutRequireITSStandAlone || fCutRequireITSpureSA){
1039 if ((status & AliESDtrack::kITSin) == 0 || (status & AliESDtrack::kTPCin)){
1043 // ITS standalone tracks
1044 if(fCutRequireITSStandAlone && !fCutRequireITSpureSA){
1045 if(status & AliESDtrack::kITSpureSA) cuts[31] = kTRUE;
1046 }else if(fCutRequireITSpureSA){
1047 if(!(status & AliESDtrack::kITSpureSA)) cuts[31] = kTRUE;
1052 if (relUncertainty1Pt > fCutMaxRel1PtUncertainty)
1055 if (!fCutAcceptSharedTPCClusters && nClustersTPCShared!=0)
1058 if (fracClustersTPCShared > fCutMaxFractionSharedTPCClusters)
1061 if(fCutRequireITSPid){
1062 UChar_t clumap=esdTrack->GetITSClusterMap();
1063 Int_t nPointsForPid=0;
1064 for(Int_t i=2; i<6; i++){
1065 if(clumap&(1<<i)) ++nPointsForPid;
1067 if(nPointsForPid<3) cuts[35] = kTRUE;
1071 for (Int_t i=0; i<kNCuts; i++)
1072 if (cuts[i]) {cut = kTRUE;}
1075 //########################################################################
1076 // filling histograms
1077 if (fHistogramsOn) {
1078 fhCutStatistics->Fill(fhCutStatistics->GetBinCenter(fhCutStatistics->GetXaxis()->FindBin("n tracks")));
1080 fhCutStatistics->Fill(fhCutStatistics->GetBinCenter(fhCutStatistics->GetXaxis()->FindBin("n cut tracks")));
1082 for (Int_t i=0; i<kNCuts; i++) {
1084 fhCutStatistics->Fill(fhCutStatistics->GetBinCenter(fhCutStatistics->GetXaxis()->FindBin(fgkCutNames[i])));
1086 for (Int_t j=i; j<kNCuts; j++) {
1087 if (cuts[i] && cuts[j]) {
1088 Float_t xC = fhCutCorrelation->GetXaxis()->GetBinCenter(fhCutCorrelation->GetXaxis()->FindBin(fgkCutNames[i]));
1089 Float_t yC = fhCutCorrelation->GetYaxis()->GetBinCenter(fhCutCorrelation->GetYaxis()->FindBin(fgkCutNames[j]));
1090 fhCutCorrelation->Fill(xC, yC);
1096 // now we loop over the filling of the histograms twice: once "before" the cut, once "after"
1097 // the code is not in a function due to too many local variables that would need to be passed
1099 for (Int_t id = 0; id < 2; id++)
1101 // id = 0 --> before cut
1102 // id = 1 --> after cut
1106 fhNClustersITS[id]->Fill(nClustersITS);
1107 fhNClustersTPC[id]->Fill(nClustersTPC);
1108 fhChi2PerClusterITS[id]->Fill(chi2PerClusterITS);
1109 fhChi2PerClusterTPC[id]->Fill(chi2PerClusterTPC);
1111 fhC11[id]->Fill(extCov[0]);
1112 fhC22[id]->Fill(extCov[2]);
1113 fhC33[id]->Fill(extCov[5]);
1114 fhC44[id]->Fill(extCov[9]);
1115 fhC55[id]->Fill(extCov[14]);
1117 fhRel1PtUncertainty[id]->Fill(relUncertainty1Pt);
1120 fhEta[id]->Fill(eta);
1123 bRes[0] = TMath::Sqrt(bCov[0]);
1124 bRes[1] = TMath::Sqrt(bCov[2]);
1126 fhDZ[id]->Fill(b[1]);
1127 fhDXY[id]->Fill(b[0]);
1128 fhDXYDZ[id]->Fill(dcaToVertex);
1129 fhDXYvsDZ[id]->Fill(b[1],b[0]);
1131 if (bRes[0]!=0 && bRes[1]!=0) {
1132 fhDZNormalized[id]->Fill(b[1]/bRes[1]);
1133 fhDXYNormalized[id]->Fill(b[0]/bRes[0]);
1134 fhDXYvsDZNormalized[id]->Fill(b[1]/bRes[1], b[0]/bRes[0]);
1135 fhNSigmaToVertex[id]->Fill(nSigmaToVertex);
1147 //____________________________________________________________________
1148 Bool_t AliESDtrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2)
1150 // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
1154 case kOff: return kTRUE;
1155 case kNone: return !clusterL1 && !clusterL2;
1156 case kAny: return clusterL1 || clusterL2;
1157 case kFirst: return clusterL1;
1158 case kOnlyFirst: return clusterL1 && !clusterL2;
1159 case kSecond: return clusterL2;
1160 case kOnlySecond: return clusterL2 && !clusterL1;
1161 case kBoth: return clusterL1 && clusterL2;
1167 //____________________________________________________________________
1168 AliESDtrack* AliESDtrackCuts::GetTPCOnlyTrack(AliESDEvent* esd, Int_t iTrack)
1171 // Utility function to
1172 // create a TPC only track from the given esd track
1174 // IMPORTANT: The track has to be deleted by the user
1176 // NB. most of the functionality to get a TPC only track from an ESD track is in AliESDtrack, where it should be
1177 // there are only missing propagations here that are needed for old data
1178 // this function will therefore become obsolete
1180 // adapted from code provided by CKB
1182 if (!esd->GetPrimaryVertexTPC())
1183 return 0; // No TPC vertex no TPC tracks
1185 if(!esd->GetPrimaryVertexTPC()->GetStatus())
1186 return 0; // TPC Vertex is created by default in AliESDEvent, do not use in this case
1188 AliESDtrack* track = esd->GetTrack(iTrack);
1192 AliESDtrack *tpcTrack = new AliESDtrack();
1194 // only true if we have a tpc track
1195 if (!track->FillTPCOnlyTrack(*tpcTrack))
1201 // propagate to Vertex
1202 // not needed for normal reconstructed ESDs...
1203 // Double_t pTPC[2],covTPC[3];
1204 // tpcTrack->PropagateToDCA(esd->GetPrimaryVertexTPC(), esd->GetMagneticField(), 10000, pTPC, covTPC);
1209 //____________________________________________________________________
1210 TObjArray* AliESDtrackCuts::GetAcceptedTracks(AliESDEvent* esd,Bool_t bTPC)
1213 // returns an array of all tracks that pass the cuts
1214 // or an array of TPC only tracks (propagated to the TPC vertex during reco)
1215 // tracks that pass the cut
1217 TObjArray* acceptedTracks = new TObjArray();
1219 // loop over esd tracks
1220 for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {
1222 if(!esd->GetPrimaryVertexTPC())return acceptedTracks; // No TPC vertex no TPC tracks
1223 if(!esd->GetPrimaryVertexTPC()->GetStatus())return acceptedTracks; // No proper TPC vertex, only the default
1225 AliESDtrack *tpcTrack = GetTPCOnlyTrack(esd, iTrack);
1229 if (AcceptTrack(tpcTrack)) {
1230 acceptedTracks->Add(tpcTrack);
1237 AliESDtrack* track = esd->GetTrack(iTrack);
1238 if(AcceptTrack(track))
1239 acceptedTracks->Add(track);
1242 if(bTPC)acceptedTracks->SetOwner(kTRUE);
1243 return acceptedTracks;
1246 //____________________________________________________________________
1247 Int_t AliESDtrackCuts::CountAcceptedTracks(AliESDEvent* esd)
1250 // returns an the number of tracks that pass the cuts
1255 // loop over esd tracks
1256 for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {
1257 AliESDtrack* track = esd->GetTrack(iTrack);
1258 if (AcceptTrack(track))
1265 //____________________________________________________________________
1266 void AliESDtrackCuts::DefineHistograms(Int_t color) {
1268 // diagnostics histograms are defined
1271 fHistogramsOn=kTRUE;
1273 Bool_t oldStatus = TH1::AddDirectoryStatus();
1274 TH1::AddDirectory(kFALSE);
1276 //###################################################################################
1277 // defining histograms
1279 fhCutStatistics = new TH1F("cut_statistics","cut statistics",kNCuts+4,-0.5,kNCuts+3.5);
1281 fhCutStatistics->GetXaxis()->SetBinLabel(1,"n tracks");
1282 fhCutStatistics->GetXaxis()->SetBinLabel(2,"n cut tracks");
1284 fhCutCorrelation = new TH2F("cut_correlation","cut correlation",kNCuts,-0.5,kNCuts-0.5,kNCuts,-0.5,kNCuts-0.5);;
1286 for (Int_t i=0; i<kNCuts; i++) {
1287 fhCutStatistics->GetXaxis()->SetBinLabel(i+4,fgkCutNames[i]);
1288 fhCutCorrelation->GetXaxis()->SetBinLabel(i+1,fgkCutNames[i]);
1289 fhCutCorrelation->GetYaxis()->SetBinLabel(i+1,fgkCutNames[i]);
1292 fhCutStatistics ->SetLineColor(color);
1293 fhCutCorrelation ->SetLineColor(color);
1294 fhCutStatistics ->SetLineWidth(2);
1295 fhCutCorrelation ->SetLineWidth(2);
1297 for (Int_t i=0; i<2; i++) {
1298 fhNClustersITS[i] = new TH1F("nClustersITS" ,"",8,-0.5,7.5);
1299 fhNClustersTPC[i] = new TH1F("nClustersTPC" ,"",165,-0.5,164.5);
1300 fhChi2PerClusterITS[i] = new TH1F("chi2PerClusterITS","",500,0,10);
1301 fhChi2PerClusterTPC[i] = new TH1F("chi2PerClusterTPC","",500,0,10);
1303 fhC11[i] = new TH1F("covMatrixDiagonal11","",2000,0,20);
1304 fhC22[i] = new TH1F("covMatrixDiagonal22","",2000,0,20);
1305 fhC33[i] = new TH1F("covMatrixDiagonal33","",1000,0,0.1);
1306 fhC44[i] = new TH1F("covMatrixDiagonal44","",1000,0,0.1);
1307 fhC55[i] = new TH1F("covMatrixDiagonal55","",1000,0,5);
1309 fhRel1PtUncertainty[i] = new TH1F("rel1PtUncertainty","",1000,0,5);
1311 fhDXY[i] = new TH1F("dXY" ,"",500,-10,10);
1312 fhDZ[i] = new TH1F("dZ" ,"",500,-10,10);
1313 fhDXYDZ[i] = new TH1F("dXYDZ" ,"",500,0,10);
1314 fhDXYvsDZ[i] = new TH2F("dXYvsDZ","",200,-10,10,200,-10,10);
1316 fhDXYNormalized[i] = new TH1F("dXYNormalized" ,"",500,-10,10);
1317 fhDZNormalized[i] = new TH1F("dZNormalized" ,"",500,-10,10);
1318 fhDXYvsDZNormalized[i] = new TH2F("dXYvsDZNormalized","",200,-10,10,200,-10,10);
1320 fhNSigmaToVertex[i] = new TH1F("nSigmaToVertex","",500,0,10);
1322 fhPt[i] = new TH1F("pt" ,"p_{T} distribution;p_{T} (GeV/c)", 800, 0.0, 10.0);
1323 fhEta[i] = new TH1F("eta" ,"#eta distribution;#eta",40,-2.0,2.0);
1325 fhNClustersITS[i]->SetTitle("n ITS clusters");
1326 fhNClustersTPC[i]->SetTitle("n TPC clusters");
1327 fhChi2PerClusterITS[i]->SetTitle("#Chi^{2} per ITS cluster");
1328 fhChi2PerClusterTPC[i]->SetTitle("#Chi^{2} per TPC cluster");
1330 fhC11[i]->SetTitle("cov 11 : #sigma_{y}^{2} [cm^{2}]");
1331 fhC22[i]->SetTitle("cov 22 : #sigma_{z}^{2} [cm^{2}]");
1332 fhC33[i]->SetTitle("cov 33 : #sigma_{sin(#phi)}^{2}");
1333 fhC44[i]->SetTitle("cov 44 : #sigma_{tan(#theta_{dip})}^{2}");
1334 fhC55[i]->SetTitle("cov 55 : #sigma_{1/p_{T}}^{2} [(c/GeV)^2]");
1336 fhRel1PtUncertainty[i]->SetTitle("rel. uncertainty of 1/p_{T}");
1338 fhDXY[i]->SetXTitle("transverse impact parameter (cm)");
1339 fhDZ[i]->SetXTitle("longitudinal impact parameter (cm)");
1340 fhDXYDZ[i]->SetTitle("absolute impact parameter;sqrt(dXY**2 + dZ**2) (cm)");
1341 fhDXYvsDZ[i]->SetXTitle("longitudinal impact parameter (cm)");
1342 fhDXYvsDZ[i]->SetYTitle("transverse impact parameter (cm)");
1344 fhDXYNormalized[i]->SetTitle("normalized trans impact par (n#sigma)");
1345 fhDZNormalized[i]->SetTitle("normalized long impact par (n#sigma)");
1346 fhDXYvsDZNormalized[i]->SetTitle("normalized long impact par (n#sigma)");
1347 fhDXYvsDZNormalized[i]->SetYTitle("normalized trans impact par (n#sigma)");
1348 fhNSigmaToVertex[i]->SetTitle("n #sigma to vertex");
1350 fhNClustersITS[i]->SetLineColor(color); fhNClustersITS[i]->SetLineWidth(2);
1351 fhNClustersTPC[i]->SetLineColor(color); fhNClustersTPC[i]->SetLineWidth(2);
1352 fhChi2PerClusterITS[i]->SetLineColor(color); fhChi2PerClusterITS[i]->SetLineWidth(2);
1353 fhChi2PerClusterTPC[i]->SetLineColor(color); fhChi2PerClusterTPC[i]->SetLineWidth(2);
1355 fhC11[i]->SetLineColor(color); fhC11[i]->SetLineWidth(2);
1356 fhC22[i]->SetLineColor(color); fhC22[i]->SetLineWidth(2);
1357 fhC33[i]->SetLineColor(color); fhC33[i]->SetLineWidth(2);
1358 fhC44[i]->SetLineColor(color); fhC44[i]->SetLineWidth(2);
1359 fhC55[i]->SetLineColor(color); fhC55[i]->SetLineWidth(2);
1361 fhRel1PtUncertainty[i]->SetLineColor(color); fhRel1PtUncertainty[i]->SetLineWidth(2);
1363 fhDXY[i]->SetLineColor(color); fhDXY[i]->SetLineWidth(2);
1364 fhDZ[i]->SetLineColor(color); fhDZ[i]->SetLineWidth(2);
1365 fhDXYDZ[i]->SetLineColor(color); fhDXYDZ[i]->SetLineWidth(2);
1367 fhDXYNormalized[i]->SetLineColor(color); fhDXYNormalized[i]->SetLineWidth(2);
1368 fhDZNormalized[i]->SetLineColor(color); fhDZNormalized[i]->SetLineWidth(2);
1369 fhNSigmaToVertex[i]->SetLineColor(color); fhNSigmaToVertex[i]->SetLineWidth(2);
1372 // The number of sigmas to the vertex is per definition gaussian
1373 ffDTheoretical = new TF1("nSigmaToVertexTheoretical","([0]/2.506628274)*exp(-(x**2)/2)",0,50);
1374 ffDTheoretical->SetParameter(0,1);
1376 TH1::AddDirectory(oldStatus);
1379 //____________________________________________________________________
1380 Bool_t AliESDtrackCuts::LoadHistograms(const Char_t* dir)
1383 // loads the histograms from a file
1384 // if dir is empty a directory with the name of this object is taken (like in SaveHistogram)
1390 if (!gDirectory->cd(dir))
1393 ffDTheoretical = dynamic_cast<TF1*> (gDirectory->Get("nSigmaToVertexTheory"));
1395 fhCutStatistics = dynamic_cast<TH1F*> (gDirectory->Get("cut_statistics"));
1396 fhCutCorrelation = dynamic_cast<TH2F*> (gDirectory->Get("cut_correlation"));
1398 for (Int_t i=0; i<2; i++) {
1401 gDirectory->cd("before_cuts");
1404 gDirectory->cd("after_cuts");
1406 fhNClustersITS[i] = dynamic_cast<TH1F*> (gDirectory->Get("nClustersITS" ));
1407 fhNClustersTPC[i] = dynamic_cast<TH1F*> (gDirectory->Get("nClustersTPC" ));
1408 fhChi2PerClusterITS[i] = dynamic_cast<TH1F*> (gDirectory->Get("chi2PerClusterITS"));
1409 fhChi2PerClusterTPC[i] = dynamic_cast<TH1F*> (gDirectory->Get("chi2PerClusterTPC"));
1411 fhC11[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal11"));
1412 fhC22[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal22"));
1413 fhC33[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal33"));
1414 fhC44[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal44"));
1415 fhC55[i] = dynamic_cast<TH1F*> (gDirectory->Get("covMatrixDiagonal55"));
1417 fhRel1PtUncertainty[i] = dynamic_cast<TH1F*> (gDirectory->Get("rel1PtUncertainty"));
1419 fhDXY[i] = dynamic_cast<TH1F*> (gDirectory->Get("dXY" ));
1420 fhDZ[i] = dynamic_cast<TH1F*> (gDirectory->Get("dZ" ));
1421 fhDXYDZ[i] = dynamic_cast<TH1F*> (gDirectory->Get("dXYDZ"));
1422 fhDXYvsDZ[i] = dynamic_cast<TH2F*> (gDirectory->Get("dXYvsDZ"));
1424 fhDXYNormalized[i] = dynamic_cast<TH1F*> (gDirectory->Get("dXYNormalized" ));
1425 fhDZNormalized[i] = dynamic_cast<TH1F*> (gDirectory->Get("dZNormalized" ));
1426 fhDXYvsDZNormalized[i] = dynamic_cast<TH2F*> (gDirectory->Get("dXYvsDZNormalized"));
1427 fhNSigmaToVertex[i] = dynamic_cast<TH1F*> (gDirectory->Get("nSigmaToVertex"));
1429 fhPt[i] = dynamic_cast<TH1F*> (gDirectory->Get("pt"));
1430 fhEta[i] = dynamic_cast<TH1F*> (gDirectory->Get("eta"));
1432 gDirectory->cd("../");
1435 gDirectory->cd("..");
1440 //____________________________________________________________________
1441 void AliESDtrackCuts::SaveHistograms(const Char_t* dir) {
1443 // saves the histograms in a directory (dir)
1446 if (!fHistogramsOn) {
1447 AliDebug(0, "Histograms not on - cannot save histograms!!!");
1454 gDirectory->mkdir(dir);
1455 gDirectory->cd(dir);
1457 gDirectory->mkdir("before_cuts");
1458 gDirectory->mkdir("after_cuts");
1460 // a factor of 2 is needed since n sigma is positive
1461 ffDTheoretical->SetParameter(0,2*fhNSigmaToVertex[0]->Integral("width"));
1462 ffDTheoretical->Write("nSigmaToVertexTheory");
1464 fhCutStatistics->Write();
1465 fhCutCorrelation->Write();
1467 for (Int_t i=0; i<2; i++) {
1469 gDirectory->cd("before_cuts");
1471 gDirectory->cd("after_cuts");
1473 fhNClustersITS[i] ->Write();
1474 fhNClustersTPC[i] ->Write();
1475 fhChi2PerClusterITS[i] ->Write();
1476 fhChi2PerClusterTPC[i] ->Write();
1484 fhRel1PtUncertainty[i] ->Write();
1488 fhDXYDZ[i] ->Write();
1489 fhDXYvsDZ[i] ->Write();
1491 fhDXYNormalized[i] ->Write();
1492 fhDZNormalized[i] ->Write();
1493 fhDXYvsDZNormalized[i] ->Write();
1494 fhNSigmaToVertex[i] ->Write();
1499 gDirectory->cd("../");
1502 gDirectory->cd("../");
1505 //____________________________________________________________________
1506 void AliESDtrackCuts::DrawHistograms()
1508 // draws some histograms
1510 TCanvas* canvas1 = new TCanvas(Form("%s_1", GetName()), "Track Quality Results1", 800, 800);
1511 canvas1->Divide(2, 2);
1514 fhNClustersTPC[0]->SetStats(kFALSE);
1515 fhNClustersTPC[0]->Draw();
1518 fhChi2PerClusterTPC[0]->SetStats(kFALSE);
1519 fhChi2PerClusterTPC[0]->Draw();
1522 fhNSigmaToVertex[0]->SetStats(kFALSE);
1523 fhNSigmaToVertex[0]->GetXaxis()->SetRangeUser(0, 10);
1524 fhNSigmaToVertex[0]->Draw();
1526 canvas1->SaveAs(Form("%s_%s.gif", GetName(), canvas1->GetName()));
1528 TCanvas* canvas2 = new TCanvas(Form("%s_2", GetName()), "Track Quality Results2", 1200, 800);
1529 canvas2->Divide(3, 2);
1532 fhC11[0]->SetStats(kFALSE);
1537 fhC22[0]->SetStats(kFALSE);
1542 fhC33[0]->SetStats(kFALSE);
1547 fhC44[0]->SetStats(kFALSE);
1552 fhC55[0]->SetStats(kFALSE);
1557 fhRel1PtUncertainty[0]->SetStats(kFALSE);
1559 fhRel1PtUncertainty[0]->Draw();
1561 canvas2->SaveAs(Form("%s_%s.gif", GetName(), canvas2->GetName()));
1563 TCanvas* canvas3 = new TCanvas(Form("%s_3", GetName()), "Track Quality Results3", 1200, 800);
1564 canvas3->Divide(3, 2);
1567 fhDXY[0]->SetStats(kFALSE);
1572 fhDZ[0]->SetStats(kFALSE);
1577 fhDXYvsDZ[0]->SetStats(kFALSE);
1579 gPad->SetRightMargin(0.15);
1580 fhDXYvsDZ[0]->Draw("COLZ");
1583 fhDXYNormalized[0]->SetStats(kFALSE);
1585 fhDXYNormalized[0]->Draw();
1588 fhDZNormalized[0]->SetStats(kFALSE);
1590 fhDZNormalized[0]->Draw();
1593 fhDXYvsDZNormalized[0]->SetStats(kFALSE);
1595 gPad->SetRightMargin(0.15);
1596 fhDXYvsDZNormalized[0]->Draw("COLZ");
1598 canvas3->SaveAs(Form("%s_%s.gif", GetName(), canvas3->GetName()));
1600 TCanvas* canvas4 = new TCanvas(Form("%s_4", GetName()), "Track Quality Results4", 800, 500);
1601 canvas4->Divide(2, 1);
1604 fhCutStatistics->SetStats(kFALSE);
1605 fhCutStatistics->LabelsOption("v");
1606 gPad->SetBottomMargin(0.3);
1607 fhCutStatistics->Draw();
1610 fhCutCorrelation->SetStats(kFALSE);
1611 fhCutCorrelation->LabelsOption("v");
1612 gPad->SetBottomMargin(0.3);
1613 gPad->SetLeftMargin(0.3);
1614 fhCutCorrelation->Draw("COLZ");
1616 canvas4->SaveAs(Form("%s_%s.gif", GetName(), canvas4->GetName()));
1619 fhDXYvsDZNormalized[0]->SetStats(kFALSE);
1620 fhDXYvsDZNormalized[0]->DrawCopy("COLZ");
1623 fhNClustersTPC[0]->SetStats(kFALSE);
1624 fhNClustersTPC[0]->DrawCopy();
1627 fhChi2PerClusterITS[0]->SetStats(kFALSE);
1628 fhChi2PerClusterITS[0]->DrawCopy();
1629 fhChi2PerClusterITS[1]->SetLineColor(2);
1630 fhChi2PerClusterITS[1]->DrawCopy("SAME");
1633 fhChi2PerClusterTPC[0]->SetStats(kFALSE);
1634 fhChi2PerClusterTPC[0]->DrawCopy();
1635 fhChi2PerClusterTPC[1]->SetLineColor(2);
1636 fhChi2PerClusterTPC[1]->DrawCopy("SAME");*/
1638 //--------------------------------------------------------------------------
1639 void AliESDtrackCuts::SetPtDepDCACuts(Double_t pt) {
1641 // set the pt-dependent DCA cuts
1644 if(f1CutMaxDCAToVertexXYPtDep) {
1645 fCutMaxDCAToVertexXY=f1CutMaxDCAToVertexXYPtDep->Eval(pt);
1648 if(f1CutMaxDCAToVertexZPtDep) {
1649 fCutMaxDCAToVertexZ=f1CutMaxDCAToVertexZPtDep->Eval(pt);
1652 if(f1CutMinDCAToVertexXYPtDep) {
1653 fCutMinDCAToVertexXY=f1CutMinDCAToVertexXYPtDep->Eval(pt);
1656 if(f1CutMinDCAToVertexZPtDep) {
1657 fCutMinDCAToVertexZ=f1CutMinDCAToVertexZPtDep->Eval(pt);
1666 //--------------------------------------------------------------------------
1667 Bool_t AliESDtrackCuts::CheckPtDepDCA(TString dist,Bool_t print) const {
1669 // Check the correctness of the string syntax
1671 Bool_t retval=kTRUE;
1673 if(!dist.Contains("pt")) {
1674 if(print) printf("AliESDtrackCuts::CheckPtDepDCA(): string must contain \"pt\"\n");
1680 void AliESDtrackCuts::SetMaxDCAToVertexXYPtDep(const char *dist){
1682 if(f1CutMaxDCAToVertexXYPtDep){
1683 delete f1CutMaxDCAToVertexXYPtDep;
1685 f1CutMaxDCAToVertexXYPtDep = 0;
1686 fCutMaxDCAToVertexXYPtDep = "";
1688 if(!CheckPtDepDCA(dist,kTRUE)){
1691 fCutMaxDCAToVertexXYPtDep = dist;
1693 tmp.ReplaceAll("pt","x");
1694 f1CutMaxDCAToVertexXYPtDep = new TFormula("f1CutMaxDCAToVertexXYPtDep",tmp.Data());
1698 void AliESDtrackCuts::SetMaxDCAToVertexZPtDep(const char *dist){
1701 if(f1CutMaxDCAToVertexZPtDep){
1702 delete f1CutMaxDCAToVertexZPtDep;
1704 f1CutMaxDCAToVertexZPtDep = 0;
1705 fCutMaxDCAToVertexZPtDep = "";
1707 if(!CheckPtDepDCA(dist,kTRUE))return;
1709 fCutMaxDCAToVertexZPtDep = dist;
1711 tmp.ReplaceAll("pt","x");
1712 f1CutMaxDCAToVertexZPtDep = new TFormula("f1CutMaxDCAToVertexZPtDep",tmp.Data());
1718 void AliESDtrackCuts::SetMinDCAToVertexXYPtDep(const char *dist){
1721 if(f1CutMinDCAToVertexXYPtDep){
1722 delete f1CutMinDCAToVertexXYPtDep;
1724 f1CutMinDCAToVertexXYPtDep = 0;
1725 fCutMinDCAToVertexXYPtDep = "";
1727 if(!CheckPtDepDCA(dist,kTRUE))return;
1729 fCutMinDCAToVertexXYPtDep = dist;
1731 tmp.ReplaceAll("pt","x");
1732 f1CutMinDCAToVertexXYPtDep = new TFormula("f1CutMinDCAToVertexXYPtDep",tmp.Data());
1737 void AliESDtrackCuts::SetMinDCAToVertexZPtDep(const char *dist){
1741 if(f1CutMinDCAToVertexZPtDep){
1742 delete f1CutMinDCAToVertexZPtDep;
1744 f1CutMinDCAToVertexZPtDep = 0;
1745 fCutMinDCAToVertexZPtDep = "";
1747 if(!CheckPtDepDCA(dist,kTRUE))return;
1748 fCutMinDCAToVertexZPtDep = dist;
1750 tmp.ReplaceAll("pt","x");
1751 f1CutMinDCAToVertexZPtDep = new TFormula("f1CutMinDCAToVertexZPtDep",tmp.Data());