]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliHFEcuts.h
Major update of the HFE package (comments inside the code
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEcuts.h
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 // Cut container class for the ALICE HFE group
17 // Serves also as interface to the correction Framework
18 // Provides a set of standard cuts
19 //
20 #ifndef ALIHFECUTS_H
21 #define ALIHFECUTS_H
22
23 #ifndef ROOT_TNamed
24 #include <TNamed.h>
25 #endif
26
27 #ifndef ALIHFEEXTRACUTS_H
28 #include "AliHFEextraCuts.h"
29 #endif
30
31 class AliCFManager;
32 class AliESDtrack;
33 class AliMCParticle;
34
35 class TObjArray;
36 class TList;
37
38 class AliHFEcuts : public TNamed{
39   public:
40     typedef enum{
41       kStepRecNoCut = 0,
42       kStepRecKineITSTPC = 1,
43       kStepRecPrim = 2,
44       kStepHFEcutsITS = 3,
45       kStepHFEcutsTRD = 4,
46       kNcutStepsRecTrack = 5
47     } RecoCutStep_t;
48     typedef enum{
49       kStepHFEcutsDca = 0, 
50       kNcutStepsDETrack = 1
51     } DECutStep_t;
52     typedef enum{
53       kStepMCGenerated = 0,
54       kStepMCGeneratedZOutNoPileUp = 1,
55       kStepMCGeneratedEventCut = 2,
56       kStepMCInAcceptance = 3,
57       kNcutStepsMCTrack =  4
58     } MCCutStep_t;
59     typedef enum{
60       kEventStepGenerated = 0,
61       kEventStepRecNoCut = 1,
62       kEventStepRecNoPileUp = 2,
63       kEventStepZRange = 3,
64       kEventStepReconstructed = 4,
65       kNcutStepsEvent = 5
66     } EventCutStep_t;
67
68     AliHFEcuts();
69     AliHFEcuts(const Char_t *name, const Char_t *title);
70     AliHFEcuts(const AliHFEcuts &c);
71     AliHFEcuts &operator=(const AliHFEcuts &c);
72     void Copy(TObject &o) const;
73     ~AliHFEcuts();
74     
75     void Initialize(AliCFManager *cfm);
76     void Initialize();
77
78     Bool_t CheckParticleCuts(UInt_t step, TObject *o);
79   
80     TList *GetQAhistograms() const { return fHistQA; }
81     
82     void SetQAOn() {SetBit(kDebugMode, kTRUE); };
83     void UnsetQA() {SetBit(kDebugMode, kFALSE); };
84     Bool_t IsQAOn() const { return TestBit(kDebugMode); };
85     void SetAOD() { SetBit(kAOD, kTRUE); }
86     void SetESD() { SetBit(kAOD, kFALSE); }
87     Bool_t IsAOD() const { return TestBit(kAOD); }
88     Bool_t IsESD() const { return !TestBit(kAOD); }
89
90     // Cut Names
91     static const Char_t *MCCutName(UInt_t step){
92       if(step >= kNcutStepsMCTrack) return fgkUndefined;
93       return fgkMCCutName[step];
94     };
95     static const Char_t *RecoCutName(UInt_t step){
96       if(step >= kNcutStepsRecTrack) return fgkUndefined;
97       return fgkRecoCutName[step];
98     }
99     static const Char_t *DECutName(UInt_t step){
100       if(step >= kNcutStepsDETrack) return fgkUndefined;
101       return fgkDECutName[step];
102     }
103     static const Char_t *EventCutName(UInt_t step){
104       if(step >= kNcutStepsEvent) return fgkUndefined;
105       return fgkEventCutName[step];
106     }
107    
108     // Getters
109     Bool_t IsRequireITSpixel() const { return TESTBIT(fRequirements, kITSPixel); };
110     Bool_t IsRequireMaxImpactParam() const { return TESTBIT(fRequirements, kMaxImpactParam); };
111     Bool_t IsRequirePrimary() const { return TESTBIT(fRequirements, kPrimary); };
112     Bool_t IsRequireProdVertex() const { return TESTBIT(fRequirements, kProductionVertex); };
113     Bool_t IsRequireSigmaToVertex() const { return TESTBIT(fRequirements, kSigmaToVertex); };
114     Bool_t IsRequireDCAToVertex() const {return TESTBIT(fRequirements, kDCAToVertex); };
115     Bool_t IsRequireKineMCCuts() const {return TESTBIT(fRequirements, kKineMCCuts); };
116     Double_t GetVertexRange() const {return fVertexRangeZ; };
117     
118     // Setters
119     inline void SetCutITSpixel(UChar_t cut);
120     void SetCheckITSLayerStatus(Bool_t checkITSLayerStatus) { fCheckITSLayerStatus = checkITSLayerStatus; }
121     void SetMinNClustersTPC(UChar_t minClustersTPC) { fMinClustersTPC = minClustersTPC; }
122     void SetMinNClustersITS(UChar_t minClustersITS) { fMinClustersITS = minClustersITS; }
123     void SetMinNTrackletsTRD(UChar_t minNtrackletsTRD) { fMinTrackletsTRD = minNtrackletsTRD; }
124     void SetMaxChi2perClusterTPC(Double_t chi2) { fMaxChi2clusterTPC = chi2; };
125     inline void SetMaxImpactParam(Double_t radial, Double_t z);
126     void SetMinRatioTPCclusters(Double_t minRatioTPC) { fMinClusterRatioTPC = minRatioTPC; };
127     void SetPtRange(Double_t ptmin, Double_t ptmax){fPtRange[0] = ptmin; fPtRange[1] = ptmax;};
128     inline void SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax);
129     inline void SetSigmaToVertex(Double_t sig);
130     void SetTPCiter1(Bool_t iter1) { fTPCiter1 = iter1; }
131     void SetVertexRange(Double_t zrange){fVertexRangeZ = zrange;};    
132     
133     inline void CreateStandardCuts();
134     
135     // Requirements
136     void SetRequireDCAToVertex() { SETBIT(fRequirements, kDCAToVertex); CLRBIT(fRequirements, kSigmaToVertex); };
137     void SetRequireIsPrimary() { SETBIT(fRequirements, kPrimary); };
138     void SetRequireITSPixel() { SETBIT(fRequirements, kITSPixel); }
139     void SetRequireProdVertex() { SETBIT(fRequirements, kProductionVertex); };
140     void SetRequireSigmaToVertex() { SETBIT(fRequirements, kSigmaToVertex); CLRBIT(fRequirements, kDCAToVertex); };
141     void UnsetVertexRequirement() { CLRBIT(fRequirements, kDCAToVertex); CLRBIT(fRequirements, kSigmaToVertex); }
142     void SetRequireKineMCCuts() { SETBIT(fRequirements, kKineMCCuts); };
143
144     void SetDebugLevel(Int_t level) { fDebugLevel = level; };
145     Int_t GetDebugLevel() const { return fDebugLevel; };
146
147   private:
148     enum{
149       kDebugMode = BIT(14),
150       kAOD = BIT(15)
151     };
152     typedef enum{
153       kPrimary = 0,
154       kProductionVertex = 1,
155       kSigmaToVertex = 2,
156       kDCAToVertex = 3,
157       kITSPixel = 4,
158       kMaxImpactParam = 5,
159       kKineMCCuts = 6
160     } Require_t;
161     void SetParticleGenCutList();
162     void SetAcceptanceCutList();
163     void SetRecKineITSTPCCutList();
164     void SetRecPrimaryCutList();
165     void SetHFElectronITSCuts();
166     void SetHFElectronTRDCuts();
167     void SetHFElectronDcaCuts();
168     void SetEventCutList(Int_t istep);
169
170     static const Char_t* fgkMCCutName[kNcutStepsMCTrack];     // Cut step names for MC single Track cuts
171     static const Char_t* fgkRecoCutName[kNcutStepsRecTrack];  // Cut step names for Rec single Track cuts
172     static const Char_t* fgkDECutName[kNcutStepsDETrack];     // Cut step names for impact parameter cuts
173     static const Char_t* fgkEventCutName[kNcutStepsEvent];    // Cut step names for Event cuts
174     static const Char_t* fgkUndefined;                        // Name for undefined (overflow)
175   
176     ULong64_t fRequirements;      // Bitmap for requirements
177     Bool_t fTPCiter1;             // TPC iter1
178     Double_t fDCAtoVtx[2];            // DCA to Vertex
179     Double_t fProdVtx[4];               // Production Vertex
180     Double_t fPtRange[2];               // pt range
181     UChar_t fMinClustersTPC;        // Min.Number of TPC clusters
182     UChar_t fMinClustersITS;        // Min.Number of TPC clusters
183     UChar_t fMinTrackletsTRD;       // Min. Number of TRD tracklets
184     UChar_t fCutITSPixel;               // Cut on ITS pixel
185     Bool_t  fCheckITSLayerStatus;       // Check ITS layer status
186     Double_t fMaxChi2clusterTPC;        // Max Chi2 per TPC cluster
187     Double_t fMinClusterRatioTPC;       // Min. Ratio findable / found TPC clusters
188     Double_t fSigmaToVtx;               // Sigma To Vertex
189     Double_t fVertexRangeZ;             // Vertex Range reconstructed
190
191     
192     TList *fHistQA;                         //! QA Histograms
193     TObjArray *fCutList;                //! List of cut objects(Correction Framework Manager)
194
195     Int_t fDebugLevel;            // Debug Level
196     
197   ClassDef(AliHFEcuts, 2)         // Container for HFE cuts
198 };
199
200 //__________________________________________________________________
201 void AliHFEcuts::SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax){
202   // Set the production vertex constraint
203   SetRequireProdVertex();
204   fProdVtx[0] = xmin;
205   fProdVtx[1] = xmax;
206   fProdVtx[2] = ymin;
207   fProdVtx[3] = ymax;
208 }
209
210 //__________________________________________________________________
211 void AliHFEcuts::SetSigmaToVertex(Double_t sig){
212   SetRequireSigmaToVertex();
213   fSigmaToVtx = sig;
214 }
215
216 //__________________________________________________________________
217 void AliHFEcuts::SetMaxImpactParam(Double_t radial, Double_t z){
218   SetRequireDCAToVertex();
219   fDCAtoVtx[0] = radial;
220   fDCAtoVtx[1] = z;
221 }
222
223 //__________________________________________________________________
224 void AliHFEcuts::SetCutITSpixel(UChar_t cut){
225   SetRequireITSPixel();
226   fCutITSPixel = cut;
227 }
228
229 //__________________________________________________________________
230 void AliHFEcuts::CreateStandardCuts(){
231   //
232   // Standard Cuts defined by the HFE Group
233   //
234   SetRequireProdVertex();
235   fProdVtx[0] = 0;
236   fProdVtx[1] = 3;
237   fProdVtx[2] = 0;
238   fProdVtx[3] = 3;
239   //SetRequireDCAToVertex();
240   //fDCAtoVtx[0] = 0.5;
241   //fDCAtoVtx[1] = 1.5;
242   fMinClustersTPC = 80;
243   fMinClustersITS = 4;
244   fMinTrackletsTRD = 0;
245   SetRequireITSPixel();
246   fCutITSPixel = AliHFEextraCuts::kFirst;
247   fMaxChi2clusterTPC = 4.;
248   fMinClusterRatioTPC = 0.6;
249   fPtRange[0] = 0.1;
250   fPtRange[1] = 20.;
251   SetRequireKineMCCuts();
252 }
253 #endif