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