]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/esdTrackCuts/AliESDtrackCuts.h
adding AliESDtrackCuts which provides the possibility to cut in quality parameters,
[u/mrichter/AliRoot.git] / PWG0 / esdTrackCuts / AliESDtrackCuts.h
1 #ifndef ALIESDTRACKCUTS_H
2 #define ALIESDTRACKCUTS_H
3
4 //**************************************************************** 
5 //
6 //  Class for handling of ESD track cuts
7 //
8 //  TODO: 
9 //  - add functionality to save and load cuts
10 //  - fix the n sigma cut so it is really a n sigma cut
11 //  - add different ways to make track to vertex cut
12 //  - add histograms for kinematic cut variables?
13 //  - upper and lower cuts for all (non-boolean) cuts
14 //  - update print method
15 //  - is there a smarter way to manage the cuts?
16 //
17
18 #ifndef ROOT_TObject
19 #include "TObject.h"
20 #endif
21 #ifndef ROOT_TTree
22 #include "TTree.h"
23 #endif
24 #ifndef ROOT_TH2
25 #include "TH2.h"
26 #endif
27
28 #include "AliESD.h"
29 #include "AliESDtrack.h"
30 #include "AliLog.h"
31
32 class AliESDtrackCuts : public TObject 
33 {
34 protected:
35
36   //######################################################
37   // esd track quality cuts
38   static const Int_t fNCuts = 21;
39   Char_t*            fCutNames[21];
40
41   Int_t   fCut_MinNClusterTPC;        // min number of tpc clusters
42   Int_t   fCut_MinNClusterITS;        // min number of its clusters  
43
44   Float_t fCut_MaxChi2PerClusterTPC;  // max tpc fit chi2 per tpc cluster
45   Float_t fCut_MaxChi2PerClusterITS;  // max its fit chi2 per its cluster
46
47   Float_t fCut_MaxC11;                // max resolutions of covariance matrix diag. elements
48   Float_t fCut_MaxC22;
49   Float_t fCut_MaxC33;
50   Float_t fCut_MaxC44;
51   Float_t fCut_MaxC55;
52  
53   Bool_t  fCut_AcceptKinkDaughters;   // accepting kink daughters?
54   Bool_t  fCut_RequireTPCRefit;       // require TPC refit
55   Bool_t  fCut_RequireITSRefit;       // require ITS refit
56   
57   // track to vertex cut
58   Float_t fCut_NsigmaToVertex;        // max number of estimated sigma from track-to-vertex
59   Bool_t  fCut_SigmaToVertexRequired; // cut track if sigma from track-to-vertex could not be calculated
60
61   // esd kinematics cuts
62   Float_t fPMin,   fPMax;             // definition of the range of the P
63   Float_t fPtMin,  fPtMax;            // definition of the range of the Pt
64   Float_t fPxMin,  fPxMax;            // definition of the range of the Px
65   Float_t fPyMin,  fPyMax;            // definition of the range of the Py
66   Float_t fPzMin,  fPzMax;            // definition of the range of the Pz
67   Float_t fEtaMin, fEtaMax;           // definition of the range of the eta
68   Float_t fRapMin, fRapMax;           // definition of the range of the y
69
70   //######################################################
71   // array of accepted ESD tracks
72
73   TObjArray* fAcceptedTracks; // List of accepted esd tracks after cuts
74
75
76   //######################################################
77   // diagnostics histograms
78   Bool_t fHistogramsOn;
79
80   TH1F** hNClustersITS;
81   TH1F** hNClustersTPC;
82   
83   TH1F** hChi2PerClusterITS;
84   TH1F** hChi2PerClusterTPC;
85
86   TH1F** hC11;
87   TH1F** hC22;
88   TH1F** hC33;
89   TH1F** hC44;
90   TH1F** hC55;
91
92   TH1F** hDXY;
93   TH1F** hDZ;
94   TH2F** hDXYvsDZ;
95
96   TH1F** hDXYNormalized;
97   TH1F** hDZNormalized;
98   TH2F** hDXYvsDZNormalized;
99
100   TH1F*  hCutStatistics;
101   TH2F*  hCutCorrelation;
102   
103
104   // dummy array
105   Int_t  fIdxInt[200];
106
107 public:
108   AliESDtrackCuts();
109   
110   Bool_t AcceptTrack(AliESDtrack* esdTrack);
111   Bool_t AcceptTrack(AliESDtrack* esdTrack, AliESDVertex* esdVtx, Double_t field);
112   Bool_t AcceptTrack(AliESDtrack* esdTrack, Double_t* vtx, Double_t* vtx_res, Double_t field);
113   Bool_t AcceptTrack(AliESDtrack* esdTrack, AliESDVertex* esdVtx, Float_t field)
114     {return AcceptTrack(esdTrack,esdVtx, Double_t(field));}
115
116   TObjArray* GetAcceptedTracks(AliESD* esd);
117
118   //######################################################
119   // track quality cut setters  
120   void SetMinNClustersTPC(Int_t min=-1)          {fCut_MinNClusterTPC=min;}
121   void SetMinNClustersITS(Int_t min=-1)          {fCut_MinNClusterITS=min;}
122   void SetMaxChi2PerClusterTPC(Float_t max=1e99) {fCut_MaxChi2PerClusterTPC=max;}
123   void SetMaxChi2PerClusterITS(Float_t max=1e99) {fCut_MaxChi2PerClusterITS=max;}
124   void SetRequireTPCRefit(Bool_t b=kFALSE)       {fCut_RequireTPCRefit=b;}
125   void SetRequireITSRefit(Bool_t b=kFALSE)       {fCut_RequireITSRefit=b;}
126   void SetAcceptKingDaughters(Bool_t b=kFALSE)   {fCut_AcceptKinkDaughters=b;}
127   void SetMaxCovDiagonalElements(Float_t c1=1e99, Float_t c2=1e99, Float_t c3=1e99, Float_t c4=1e99, Float_t c5=1e99) 
128     {fCut_MaxC11=c1; fCut_MaxC22=c2; fCut_MaxC33=c3; fCut_MaxC44=c4; fCut_MaxC55=c5;}
129   
130   // track to vertex cut setters
131   void SetMinNsigmaToVertex(Float_t sigma=1e99)       {fCut_NsigmaToVertex = sigma;}
132   void SetRequireSigmaToVertex(Bool_t b=kTRUE )       {fCut_SigmaToVertexRequired = b;}
133   
134   // track kinmatic cut setters  
135   void SetPRange(Float_t r1=0, Float_t r2=1e99)       {fPMin=r1;   fPMax=r2;}
136   void SetPtRange(Float_t r1=0, Float_t r2=1e99)      {fPtMin=r1;  fPtMax=r2;}
137   void SetPxRange(Float_t r1=-1e99, Float_t r2=1e99)  {fPxMin=r1;  fPxMax=r2;}
138   void SetPyRange(Float_t r1=-1e99, Float_t r2=1e99)  {fPyMin=r1;  fPyMax=r2;}
139   void SetPzRange(Float_t r1=-1e99, Float_t r2=1e99)  {fPzMin=r1;  fPzMax=r2;}
140   void SetEtaRange(Float_t r1=-1e99, Float_t r2=1e99) {fEtaMin=r1; fEtaMax=r2;}
141   void SetRapRange(Float_t r1=-1e99, Float_t r2=1e99) {fRapMin=r1; fRapMax=r2;}
142
143   //######################################################
144   void SetHistogramsOn(Bool_t b=kFALSE) {fHistogramsOn = b;}
145   void DefineHistograms(Int_t color=1);
146   void SaveHistograms(Char_t* dir="track_selection");
147   
148   void Print();
149
150   // void SaveQualityCuts(Char_t* file)
151   // void LoadQualityCuts(Char_t* file)
152
153   ClassDef(AliESDtrackCuts,0)
154 };
155
156
157 #endif