]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEcuts.h
c72ab563746b5c5d3cc049f213132fabb95f77ad
[u/mrichter/AliRoot.git] / PWGHF / 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 AliMCEvent;
34 class AliMCParticle;
35 class AliVEvent;
36
37 class TObjArray;
38 class TList;
39
40 class AliHFEcuts : public TNamed{
41   public:
42     typedef enum{
43       kStepRecNoCut = 0,
44       kStepRecKineITSTPC = 1,
45       kStepRecPrim = 2,
46       kStepHFEcutsITS = 3,
47       kStepHFEcutsTOF = 4,
48       kStepHFEcutsTPC = 5,
49       kStepHFEcutsTRD = 6,
50       kNcutStepsRecTrack = 7
51     } RecoCutStep_t;
52     typedef enum{
53       kStepHFEcutsDca = 0, 
54       kNcutStepsDETrack = 1
55     } DECutStep_t;
56     typedef enum{
57       kStepHFEcutsSecvtx = 0, 
58       kNcutStepsSecvtxTrack = 1
59     } SecvtxCutStep_t;
60     typedef enum{
61       kStepMCGenerated = 0,
62       kStepMCGeneratedZOutNoPileUpCentralityFine = 1,
63       kStepMCGeneratedEventCut = 2,
64       kStepMCInAcceptance = 3,
65       kNcutStepsMCTrack =  4
66     } MCCutStep_t;
67     typedef enum{
68       kEventStepGenerated = 0,
69       kEventStepRecNoCut = 1,
70       kEventStepRecNoPileUp = 2,
71       kEventStepRecCentralityOk = 3,
72       kEventStepZRange = 4,
73       kEventStepReconstructed = 5,
74       kNcutStepsEvent = 6
75     } EventCutStep_t;
76
77     AliHFEcuts();
78     AliHFEcuts(const Char_t *name, const Char_t *title);
79     AliHFEcuts(const AliHFEcuts &c);
80     AliHFEcuts &operator=(const AliHFEcuts &c);
81     void Copy(TObject &o) const;
82     Long64_t Merge(const TCollection *list);
83     ~AliHFEcuts();
84     
85     void Initialize(AliCFManager *cfm);
86     void Initialize();
87
88     Bool_t CheckParticleCuts(UInt_t step, TObject *o);
89     Bool_t CheckEventCuts(const char*namestep, TObject *o);
90     void SetRecEvent(const AliVEvent *ev);
91     void SetMCEvent(const AliMCEvent *ev);
92   
93     TList *GetQAhistograms() const { return fHistQA; }
94     
95     void SetQAOn() {SetBit(kDebugMode, kTRUE); };
96     void UnsetQA() {SetBit(kDebugMode, kFALSE); };
97     Bool_t IsQAOn() const { return TestBit(kDebugMode); };
98     void SetAOD() { SetBit(kAOD, kTRUE); }
99     void SetESD() { SetBit(kAOD, kFALSE); }
100     Bool_t IsAOD() const { return TestBit(kAOD); }
101     Bool_t IsESD() const { return !TestBit(kAOD); }
102
103     // Cut Names
104     static const Char_t *MCCutName(UInt_t step){
105       if(step >= kNcutStepsMCTrack) return fgkUndefined;
106       return fgkMCCutName[step];
107     };
108     static const Char_t *RecoCutName(UInt_t step){
109       if(step >= kNcutStepsRecTrack) return fgkUndefined;
110       return fgkRecoCutName[step];
111     }
112     static const Char_t *DECutName(UInt_t step){
113       if(step >= kNcutStepsDETrack) return fgkUndefined;
114       return fgkDECutName[step];
115     }
116     static const Char_t *SecvtxCutName(UInt_t step){
117       if(step >= kNcutStepsSecvtxTrack) return fgkUndefined;
118       return fgkSecvtxCutName[step];
119     }
120     static const Char_t *EventCutName(UInt_t step){
121       if(step >= kNcutStepsEvent) return fgkUndefined;
122       return fgkEventCutName[step];
123     }
124    
125     // Getters
126     Bool_t IsRequireITSpixel() const { return TESTBIT(fRequirements, kITSPixel); };
127     Bool_t IsRequireITSdrift() const { return TESTBIT(fRequirements, kITSDrift); };
128     Bool_t IsRequireMaxImpactParam() const { return TESTBIT(fRequirements, kMaxImpactParam); };
129     Bool_t IsRequirePrimary() const { return TESTBIT(fRequirements, kPrimary); };
130     Bool_t IsRequireProdVertex() const { return TESTBIT(fRequirements, kProductionVertex); };
131     Bool_t IsRequireSigmaToVertex() const { return TESTBIT(fRequirements, kSigmaToVertex); };
132     Bool_t IsRequireDCAToVertex() const {return TESTBIT(fRequirements, kDCAToVertex); };
133     Bool_t IsRequireKineMCCuts() const {return TESTBIT(fRequirements, kKineMCCuts); };
134     Double_t GetVertexRange() const {return fVertexRangeZ; };
135     Int_t GetMinTrackletsTRD() const { return fMinTrackletsTRD; }
136     
137     // Setters
138     inline void SetCutITSpixel(UChar_t cut);
139     inline void SetCutITSdrift(UChar_t cut);
140     void SetCheckITSLayerStatus(Bool_t checkITSLayerStatus) { fCheckITSLayerStatus = checkITSLayerStatus; }
141     void SetMinNClustersTPC(UChar_t minClustersTPC) { fMinClustersTPC = minClustersTPC; }
142     void SetMinNClustersTPCPID(UChar_t minClustersTPC) { fMinClustersTPCPID = minClustersTPC; }
143     void SetMinNClustersITS(UChar_t minClustersITS) { fMinClustersITS = minClustersITS; }
144     void SetMinNTrackletsTRD(UChar_t minNtrackletsTRD, Bool_t exact = kFALSE) { fMinTrackletsTRD = minNtrackletsTRD; fTRDtrackletsExact = exact; }
145     void SetMaxChi2perClusterITS(Double_t chi2) { fMaxChi2clusterITS = chi2; };
146     void SetMaxChi2perClusterTPC(Double_t chi2) { fMaxChi2clusterTPC = chi2; };
147     inline void SetMaxImpactParam(Double_t radial, Double_t z);
148     inline void SetIPcutParam(Float_t p0, Float_t p1, Float_t p2, Float_t p3, Bool_t isipsigma, Bool_t isabs);
149     void SetMinRatioTPCclusters(Double_t minRatioTPC) { fMinClusterRatioTPC = minRatioTPC; };
150     void SetPtRange(Double_t ptmin, Double_t ptmax){fPtRange[0] = ptmin; fPtRange[1] = ptmax;};
151     inline void SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax);
152     inline void SetSigmaToVertex(Double_t sig);
153     inline void SetSigmaToVertexXY(Double_t sig);
154     inline void SetSigmaToVertexZ(Double_t sig);
155     void SetTPCmodes(AliHFEextraCuts::ETPCclusterDef_t clusterDef, AliHFEextraCuts::ETPCclrDef_t ratioDef) {
156       fTPCclusterDef= clusterDef;
157       fTPCratioDef = ratioDef;
158     }
159     void SetVertexRange(Double_t zrange){fVertexRangeZ = zrange;};
160     void SetTOFPIDStep(Bool_t tofPidStep) {fTOFPIDStep = tofPidStep;};
161     void SetTOFMISMATCHStep(Bool_t tofMismatchStep) {fTOFMISMATCHStep = tofMismatchStep;};
162     void SetTPCPIDCleanUpStep(Bool_t tpcPIDCleanUpStep) {fTPCPIDCLEANUPStep = tpcPIDCleanUpStep;};
163     void SetUseMixedVertex(Bool_t useMixedVertex) {fUseMixedVertex = useMixedVertex;};    
164     void SetFractionOfSharedTPCClusters(Double_t fractionOfSharedTPCClusters) {fFractionOfSharedTPCClusters = fractionOfSharedTPCClusters;};
165     void SetMaxImpactParameterRpar(Bool_t maxImpactParameterRpar) { fMaxImpactParameterRpar = maxImpactParameterRpar; };
166     
167     inline void CreateStandardCuts();
168     
169     // Requirements
170     void SetAdditionalStatusRequirement(Long_t requirement) {fAdditionalStatusRequirement = requirement;}
171     void SetRequireDCAToVertex() { SETBIT(fRequirements, kDCAToVertex); CLRBIT(fRequirements, kSigmaToVertex); };
172     void SetRequireIsPrimary() { SETBIT(fRequirements, kPrimary); };
173     void SetRequireITSPixel() { SETBIT(fRequirements, kITSPixel); }
174     void SetRequireITSDrift() { SETBIT(fRequirements, kITSDrift); }
175     void UnsetRequireITSPixel() { CLRBIT(fRequirements, kITSPixel); }
176     void SetRequireProdVertex() { SETBIT(fRequirements, kProductionVertex); };
177     void SetRequireSigmaToVertex() { SETBIT(fRequirements, kSigmaToVertex); CLRBIT(fRequirements, kDCAToVertex); };
178     void UnsetVertexRequirement() { CLRBIT(fRequirements, kDCAToVertex); CLRBIT(fRequirements, kSigmaToVertex); }
179     void SetRequireKineMCCuts() { SETBIT(fRequirements, kKineMCCuts); };
180
181     void SetDebugLevel(Int_t level) { fDebugLevel = level; };
182     Int_t GetDebugLevel() const { return fDebugLevel; };
183
184   private:
185     enum{
186       kDebugMode = BIT(14),
187       kAOD = BIT(15)
188     };
189     typedef enum{
190       kPrimary = 0,
191       kProductionVertex = 1,
192       kSigmaToVertex = 2,
193       kDCAToVertex = 3,
194       kITSPixel = 4,
195       kMaxImpactParam = 5,
196       kKineMCCuts = 6,
197       kITSDrift = 7,
198     } Require_t;
199     void SetParticleGenCutList();
200     void SetAcceptanceCutList();
201     void SetRecKineITSTPCCutList();
202     void SetRecPrimaryCutList();
203     void SetHFElectronITSCuts();
204     void SetHFElectronTOFCuts();
205     void SetHFElectronTPCCuts();
206     void SetHFElectronTRDCuts();
207     void SetHFElectronDcaCuts();
208     void SetEventCutList(Int_t istep);
209
210     static const Char_t* fgkMCCutName[kNcutStepsMCTrack];     // Cut step names for MC single Track cuts
211     static const Char_t* fgkRecoCutName[kNcutStepsRecTrack];  // Cut step names for Rec single Track cuts
212     static const Char_t* fgkDECutName[kNcutStepsDETrack];     // Cut step names for impact parameter cuts
213     static const Char_t* fgkSecvtxCutName[kNcutStepsSecvtxTrack];     // Cut step names for secondary vertexing cuts
214     static const Char_t* fgkEventCutName[kNcutStepsEvent];    // Cut step names for Event cuts
215     static const Char_t* fgkUndefined;                        // Name for undefined (overflow)
216   
217     ULong64_t fRequirements;      // Bitmap for requirements
218     AliHFEextraCuts::ETPCclusterDef_t fTPCclusterDef;       // TPC cluster definition
219     AliHFEextraCuts::ETPCclrDef_t fTPCratioDef;             // TPC cluster ratio Definition
220     Double_t fDCAtoVtx[2];            // DCA to Vertex
221     Double_t fProdVtx[4];               // Production Vertex
222     Double_t fPtRange[2];               // pt range
223     UChar_t fMinClustersTPC;        // Min.Number of TPC clusters
224     UChar_t fMinClustersTPCPID;   // Min.Number of TPC clusters
225     UChar_t fMinClustersITS;        // Min.Number of TPC clusters
226     UChar_t fMinTrackletsTRD;       // Min. Number of TRD tracklets
227     UChar_t fCutITSPixel;               // Cut on ITS pixel
228     Bool_t  fCheckITSLayerStatus;       // Check ITS layer status
229     UChar_t fCutITSDrift;               // Cut on ITS drift
230     Double_t fMaxChi2clusterITS;        // Max Chi2 per ITS cluster
231     Double_t fMaxChi2clusterTPC;        // Max Chi2 per TPC cluster
232     Double_t fMinClusterRatioTPC;       // Min. Ratio findable / found TPC clusters
233     Double_t fSigmaToVtx[3];        // Sigma To Vertex
234     Double_t fVertexRangeZ;             // Vertex Range reconstructed
235     Bool_t   fTRDtrackletsExact;        // Require exact number of tracklets
236     Bool_t   fTOFPIDStep;               // TOF matching step efficiency
237     Bool_t   fTOFMISMATCHStep;        // TOF mismatch step
238     Bool_t   fTPCPIDCLEANUPStep;      // TPC PIC cleanup step
239     Bool_t   fUseMixedVertex;         // Use primary vertex from track only as before
240     Float_t  fIPCutParams[4];         // Parameters of impact parameter cut parametrization
241     Bool_t   fIsIPSigmacut;           // if IP cut or IP sigma cut 
242     Bool_t   fIsIPAbs;                // if abs IP sigma cut
243     Double_t fFractionOfSharedTPCClusters; // Fraction of shared TPC clusters
244     Bool_t   fMaxImpactParameterRpar;      // Max impact parameter
245     Long_t   fAdditionalStatusRequirement; // Additional status bit requirement 
246
247     
248     TList *fHistQA;                         //! QA Histograms
249     TObjArray *fCutList;                //! List of cut objects(Correction Framework Manager)
250
251     Int_t fDebugLevel;            // Debug Level
252     
253   ClassDef(AliHFEcuts, 2)         // Container for HFE cuts
254 };
255
256 //__________________________________________________________________
257 void AliHFEcuts::SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax){
258   // Set the production vertex constraint
259   SetRequireProdVertex();
260   fProdVtx[0] = xmin;
261   fProdVtx[1] = xmax;
262   fProdVtx[2] = ymin;
263   fProdVtx[3] = ymax;
264 }
265
266 //__________________________________________________________________
267 void AliHFEcuts::SetSigmaToVertex(Double_t sig){
268   SetRequireSigmaToVertex();
269   fSigmaToVtx[0] = sig;
270 }
271
272 //__________________________________________________________________
273 void AliHFEcuts::SetSigmaToVertexXY(Double_t sig){
274   SetRequireSigmaToVertex();
275   fSigmaToVtx[1] = sig;
276 }
277
278 //__________________________________________________________________
279 void AliHFEcuts::SetSigmaToVertexZ(Double_t sig){
280   SetRequireSigmaToVertex();
281   fSigmaToVtx[2] = sig;
282 }
283
284 //__________________________________________________________________
285 void AliHFEcuts::SetMaxImpactParam(Double_t radial, Double_t z){
286   SetRequireDCAToVertex();
287   fDCAtoVtx[0] = radial;
288   fDCAtoVtx[1] = z;
289 }
290
291 //__________________________________________________________________
292 void AliHFEcuts::SetIPcutParam(Float_t p0, Float_t p1, Float_t p2, Float_t p3, Bool_t isipsigma, Bool_t isabs){
293   // Set parameters for impact parameter cut parametrization
294   fIPCutParams[0] = p0;
295   fIPCutParams[1] = p1;
296   fIPCutParams[2] = p2;
297   fIPCutParams[3] = p3;
298   fIsIPSigmacut = isipsigma;
299   fIsIPAbs = isabs;
300 }
301
302 //__________________________________________________________________
303 void AliHFEcuts::SetCutITSpixel(UChar_t cut){
304   SetRequireITSPixel();
305   fCutITSPixel = cut;
306 }
307
308 //__________________________________________________________________
309 void AliHFEcuts::SetCutITSdrift(UChar_t cut){
310   SetRequireITSDrift();
311   fCutITSDrift = cut;
312 }
313
314 //__________________________________________________________________
315 void AliHFEcuts::CreateStandardCuts(){
316   //
317   // Standard Cuts defined by the HFE Group
318   //
319   SetRequireProdVertex();
320   fProdVtx[0] = 0;
321   fProdVtx[1] = 3;
322   fProdVtx[2] = 0;
323   fProdVtx[3] = 3;
324   //SetRequireDCAToVertex();
325   //fDCAtoVtx[0] = 0.5;
326   //fDCAtoVtx[1] = 1.5;
327   fMinClustersTPC = 80;
328   fMinClustersITS = 4;
329   fMinTrackletsTRD = 0;
330   SetRequireITSPixel();
331   fCutITSPixel = AliHFEextraCuts::kFirst;
332   fMaxChi2clusterITS = -1.;
333   fMaxChi2clusterTPC = 4.;
334   fMinClusterRatioTPC = 0.6;
335   fPtRange[0] = 0.1;
336   fPtRange[1] = 20.;
337   SetRequireKineMCCuts();
338 }
339 #endif