]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEcuts.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[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 AliVEvent *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     Bool_t GetUseMixedVertex() const { return fUseMixedVertex;};   
137     
138     // Setters
139     inline void SetCutITSpixel(UChar_t cut);
140     inline void SetCutITSdrift(UChar_t cut);
141     void SetCheckITSLayerStatus(Bool_t checkITSLayerStatus) { fCheckITSLayerStatus = checkITSLayerStatus; }
142     void SetMinNClustersTPC(UChar_t minClustersTPC) { fMinClustersTPC = minClustersTPC; }
143     void SetMinNClustersTPCPID(UChar_t minClustersTPC) { fMinClustersTPCPID = minClustersTPC; }
144     void SetMinNClustersITS(UChar_t minClustersITS) { fMinClustersITS = minClustersITS; }
145     void SetMinNTrackletsTRD(UChar_t minNtrackletsTRD, Bool_t exact = kFALSE) { fMinTrackletsTRD = minNtrackletsTRD; fTRDtrackletsExact = exact; }
146     void SetMaxChi2perTrackletTRD(Float_t maxchi2trackletTRD) { fMaxChi2TRD = maxchi2trackletTRD; }
147     void SetMaxChi2perClusterITS(Double_t chi2) { fMaxChi2clusterITS = chi2; };
148     void SetMaxChi2perClusterTPC(Double_t chi2) { fMaxChi2clusterTPC = chi2; };
149     inline void SetMaxImpactParam(Double_t radial, Double_t z);
150     inline void SetIPcutParam(Float_t p0, Float_t p1, Float_t p2, Float_t p3, Bool_t isipsigma, Bool_t isIPcharge , Bool_t isopp);
151     void SetMinRatioTPCclusters(Double_t minRatioTPC) { fMinClusterRatioTPC = minRatioTPC; };
152     void SetPtRange(Double_t ptmin, Double_t ptmax){fPtRange[0] = ptmin; fPtRange[1] = ptmax;};
153     void SetTOFsignaldxz(Double_t tofsignaldx, Double_t tofsignaldz){fTOFsignaldx = tofsignaldx; fTOFsignaldz = tofsignaldz;};
154     void SetAODFilterBit(Int_t bit) { fAODFilterBit = bit; };
155     inline void SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax);
156     void SetProductionVertexZ(Double_t zmin, Double_t zmax) { fProdVtxZ[0] = zmin; fProdVtxZ[1] = zmax; }
157     inline void SetSigmaToVertex(Double_t sig);
158     inline void SetSigmaToVertexXY(Double_t sig);
159     inline void SetSigmaToVertexZ(Double_t sig);
160     void SetTPCmodes(UChar_t clusterDef, UChar_t ratioDef) {
161       fTPCclusterDef= clusterDef;
162       fTPCratioDef = ratioDef;
163     }
164     void SetEtaRange(Double_t etaRange){fEtaRange[0] = -etaRange; fEtaRange[1] = etaRange;};
165     void SetEtaRange(Double_t etamin, Double_t etamax){fEtaRange[0] = etamin; fEtaRange[1] = etamax;};
166     void SetPhiRange(Double_t phimin, Double_t phimax){fPhiRange[0] = phimin; fPhiRange[1] = phimax;};
167     void SetVertexRange(Double_t zrange){fVertexRangeZ = zrange;};
168     void SetTOFPIDStep(Bool_t tofPidStep) {fTOFPIDStep = tofPidStep;};
169     void SetTOFMISMATCHStep(Bool_t tofMismatchStep) {fTOFMISMATCHStep = tofMismatchStep;};
170     void SetMatchTOFLabel(Bool_t match) { fMatchTOFLabel = match; }
171     void SetTPCPIDCleanUpStep(Bool_t tpcPIDCleanUpStep) {fTPCPIDCLEANUPStep = tpcPIDCleanUpStep;};
172     void SetITSpatternCut() { fITSpatternCut = kTRUE; }
173     inline void SetUseMixedVertex(Bool_t useMixedVertex);    
174     inline void SetUseSPDVertex(Bool_t useSPDVertex);
175     void SetUseCorrelationVertex() { fUseCorrelationVertex = kTRUE;};
176     void SetSPDVtxResolutionCut() {fSPDVtxResolution = kTRUE;}
177     void SetpApileupCut() { fPApileupCut = kTRUE; }
178     void SetFractionOfSharedTPCClusters(Double_t fractionOfSharedTPCClusters) {fFractionOfSharedTPCClusters = fractionOfSharedTPCClusters;};
179     void SetMaxImpactParameterRpar(Bool_t maxImpactParameterRpar) { fMaxImpactParameterRpar = maxImpactParameterRpar; };
180     
181     inline void CreateStandardCuts();
182     
183     // Requirements
184     void SetAdditionalStatusRequirement(Long_t requirement) {fAdditionalStatusRequirement = requirement;}
185     void SetRequireDCAToVertex() { SETBIT(fRequirements, kDCAToVertex); CLRBIT(fRequirements, kSigmaToVertex); };
186     void SetRequireIsPrimary() { SETBIT(fRequirements, kPrimary); };
187     void SetRequireITSPixel() { SETBIT(fRequirements, kITSPixel); }
188     void SetRequireITSDrift() { SETBIT(fRequirements, kITSDrift); }
189     void UnsetRequireITSPixel() { CLRBIT(fRequirements, kITSPixel); }
190     void SetRequireProdVertex() { SETBIT(fRequirements, kProductionVertex); };
191     void SetRequireSigmaToVertex() { SETBIT(fRequirements, kSigmaToVertex); CLRBIT(fRequirements, kDCAToVertex); };
192     void UnsetVertexRequirement() { CLRBIT(fRequirements, kDCAToVertex); CLRBIT(fRequirements, kSigmaToVertex); }
193     void SetRequireKineMCCuts() { SETBIT(fRequirements, kKineMCCuts); };
194     void SetRejectKinkDaughters() { fRejectKinkDaughters = kTRUE; }
195     void SetAcceptKinkDaughters() { fRejectKinkDaughters = kFALSE; }
196     void SetRejectKinkMothers() { fRejectKinkMothers = kTRUE; }
197     void SetAcceptKinkMothers() { fRejectKinkMothers = kFALSE; }
198
199     void SetDebugLevel(Int_t level) { fDebugLevel = level; };
200     Int_t GetDebugLevel() const { return fDebugLevel; };
201
202   private:
203     enum{
204       kDebugMode = BIT(14),
205       kAOD = BIT(15)
206     };
207     typedef enum{
208       kPrimary = 0,
209       kProductionVertex = 1,
210       kSigmaToVertex = 2,
211       kDCAToVertex = 3,
212       kITSPixel = 4,
213       kMaxImpactParam = 5,
214       kKineMCCuts = 6,
215       kITSDrift = 7
216     } Require_t;
217     void SetParticleGenCutList();
218     void SetAcceptanceCutList();
219     void SetRecKineITSTPCCutList();
220     void SetRecPrimaryCutList();
221     void SetHFElectronITSCuts();
222     void SetHFElectronTOFCuts();
223     void SetHFElectronTPCCuts();
224     void SetHFElectronTRDCuts();
225     void SetHFElectronDcaCuts();
226     void SetEventCutList(Int_t istep);
227
228     static const Char_t* fgkMCCutName[kNcutStepsMCTrack];     // Cut step names for MC single Track cuts
229     static const Char_t* fgkRecoCutName[kNcutStepsRecTrack];  // Cut step names for Rec single Track cuts
230     static const Char_t* fgkDECutName[kNcutStepsDETrack];     // Cut step names for impact parameter cuts
231     static const Char_t* fgkSecvtxCutName[kNcutStepsSecvtxTrack];     // Cut step names for secondary vertexing cuts
232     static const Char_t* fgkEventCutName[kNcutStepsEvent];    // Cut step names for Event cuts
233     static const Char_t* fgkUndefined;                        // Name for undefined (overflow)
234   
235     ULong64_t fRequirements;                  // Bitmap for requirements
236     UChar_t   fTPCclusterDef;                 // TPC cluster definition
237     UChar_t   fTPCratioDef;                   // TPC cluster ratio Definition
238     Double_t fEtaRange[2];                    // Eta range
239     Double_t fPhiRange[2];                    // Phi range
240     Double_t fDCAtoVtx[2];                        // DCA to Vertex
241     Double_t fProdVtx[4];                           // Production Vertex
242     Double_t fProdVtxZ[2];                        // Production Vertex in Z direction
243     Double_t fPtRange[2];                           // pt range
244     UChar_t fMinClustersTPC;                    // Min.Number of TPC clusters
245     UChar_t fMinClustersTPCPID;               // Min.Number of TPC clusters
246     UChar_t fMinClustersITS;                    // Min.Number of TPC clusters
247     UChar_t fMinTrackletsTRD;                   // Min. Number of TRD tracklets
248     Float_t fMaxChi2TRD;                      // Max. Chi2 per TRD tracklet
249     UChar_t fCutITSPixel;                           // Cut on ITS pixel
250     Bool_t  fCheckITSLayerStatus;             // Check ITS layer status
251     UChar_t fCutITSDrift;                           // Cut on ITS drift
252     Double_t fMaxChi2clusterITS;                    // Max Chi2 per ITS cluster
253     Double_t fMaxChi2clusterTPC;                    // Max Chi2 per TPC cluster
254     Double_t fMinClusterRatioTPC;                   // Min. Ratio findable / found TPC clusters
255     Double_t fSigmaToVtx[3];                    // Sigma To Vertex
256     Double_t fVertexRangeZ;                   // Vertex Range reconstructed
257     Bool_t   fTRDtrackletsExact;              // Require exact number of tracklets
258     Bool_t   fTOFPIDStep;                     // TOF matching step efficiency
259     Bool_t   fMatchTOFLabel;                  // Check whether Track or TOF label are the same
260     Bool_t   fTOFMISMATCHStep;                // TOF mismatch step
261     Bool_t   fTPCPIDCLEANUPStep;              // TPC PIC cleanup step
262     Bool_t   fITSpatternCut;                  // Cut on ITS pattern
263     Bool_t   fUseMixedVertex;                 // Use primary vertex from track if there otherwise SPD vertex
264     Bool_t   fUseSPDVertex;                   // Use primary SPD vertex 
265     Bool_t   fUseCorrelationVertex;           // Use the correlation of the vertex in z
266     Bool_t   fSPDVtxResolution;               // Check resolution of the SPD vertex
267     Bool_t   fPApileupCut;                    // Apply pA pileup cut
268     Float_t  fIPCutParams[4];                 // Parameters of impact parameter cut parametrization
269     Bool_t   fIsIPSigmacut;                   // if IP cut or IP sigma cut 
270     Bool_t   fIsIPcharge;                     // if cut on IP * charge (cut using only positive side of distribution, to eliminate conversions)
271     Bool_t   fIsIPOpp;                        // if IP*charge cut on side of the photon peak
272     Double_t fFractionOfSharedTPCClusters;    // Fraction of shared TPC clusters
273     Bool_t   fMaxImpactParameterRpar;         // Max impact parameter
274     Long_t   fAdditionalStatusRequirement;    // Additional status bit requirement 
275     Double_t fTOFsignaldx;                    // TOF signal Dx
276     Double_t fTOFsignaldz;                    // TOF signal Dz
277     Int_t    fAODFilterBit;                   // AOD Filter Bit Number
278     Bool_t   fRejectKinkDaughters;            // Reject Kink Daughters
279     Bool_t   fRejectKinkMothers;              // Reject Kink Daughters
280     
281     TList *fHistQA;                                     //! QA Histograms
282     TObjArray *fCutList;                            //! List of cut objects(Correction Framework Manager)
283
284     Int_t fDebugLevel;                        // Debug Level
285     
286   ClassDef(AliHFEcuts, 6)                     // Container for HFE cuts
287 };
288
289 //__________________________________________________________________
290 void AliHFEcuts::SetProductionVertex(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax){
291   // Set the production vertex constraint
292   SetRequireProdVertex();
293   fProdVtx[0] = xmin;
294   fProdVtx[1] = xmax;
295   fProdVtx[2] = ymin;
296   fProdVtx[3] = ymax;
297 }
298
299 //__________________________________________________________________
300 void AliHFEcuts::SetSigmaToVertex(Double_t sig){
301   SetRequireSigmaToVertex();
302   fSigmaToVtx[0] = sig;
303 }
304
305 //__________________________________________________________________
306 void AliHFEcuts::SetSigmaToVertexXY(Double_t sig){
307   SetRequireSigmaToVertex();
308   fSigmaToVtx[1] = sig;
309 }
310
311 //__________________________________________________________________
312 void AliHFEcuts::SetSigmaToVertexZ(Double_t sig){
313   SetRequireSigmaToVertex();
314   fSigmaToVtx[2] = sig;
315 }
316
317 //__________________________________________________________________
318 void AliHFEcuts::SetMaxImpactParam(Double_t radial, Double_t z){
319   SetRequireDCAToVertex();
320   fDCAtoVtx[0] = radial;
321   fDCAtoVtx[1] = z;
322 }
323
324 //__________________________________________________________________
325 void AliHFEcuts::SetIPcutParam(Float_t p0, Float_t p1, Float_t p2, Float_t p3, Bool_t isipsigma, Bool_t isIPcharge, Bool_t isopp){
326   // Set parameters for impact parameter cut parametrization
327   fIPCutParams[0] = p0;
328   fIPCutParams[1] = p1;
329   fIPCutParams[2] = p2;
330   fIPCutParams[3] = p3;
331   fIsIPSigmacut = isipsigma;
332   fIsIPcharge = isIPcharge;
333   fIsIPOpp = isopp;
334 }
335
336 //__________________________________________________________________
337 void AliHFEcuts::SetCutITSpixel(UChar_t cut){
338   SetRequireITSPixel();
339   fCutITSPixel = cut;
340 }
341
342 //__________________________________________________________________
343 void AliHFEcuts::SetCutITSdrift(UChar_t cut){
344   SetRequireITSDrift();
345   fCutITSDrift = cut;
346 }
347 //__________________________________________________________________
348 void AliHFEcuts::SetUseMixedVertex(Bool_t useMixedVertex){
349   //
350   // Choice of a vertex
351   //
352   fUseMixedVertex = useMixedVertex;
353   if(useMixedVertex) fUseSPDVertex = kFALSE;
354 }
355 //__________________________________________________________________
356 void AliHFEcuts::SetUseSPDVertex(Bool_t useSPDVertex){
357   //
358   // Choice of a vertex
359   //
360   fUseSPDVertex = useSPDVertex;
361   if(useSPDVertex) fUseMixedVertex = kFALSE;
362 }
363
364 //__________________________________________________________________
365 void AliHFEcuts::CreateStandardCuts(){
366   //
367   // Standard Cuts defined by the HFE Group
368   //
369   SetRequireProdVertex();
370   fProdVtx[0] = 0;
371   fProdVtx[1] = 3;
372   fProdVtx[2] = 0;
373   fProdVtx[3] = 3;
374   fProdVtxZ[0] = -15;
375   fProdVtxZ[1] = 15;
376   //SetRequireDCAToVertex();
377   //fDCAtoVtx[0] = 0.5;
378   //fDCAtoVtx[1] = 1.5;
379   fMinClustersTPC = 80;
380   fMinClustersITS = 4;
381   fMinTrackletsTRD = 0;
382   SetRequireITSPixel();
383   fCutITSPixel = AliHFEextraCuts::kFirst;
384   fMaxChi2clusterITS = -1.;
385   fMaxChi2clusterTPC = 4.;
386   fMinClusterRatioTPC = 0.6;
387   fPtRange[0] = 0.1;
388   fPtRange[1] = 100.;
389   fRejectKinkDaughters = kTRUE;
390   fRejectKinkMothers = kTRUE;
391   SetRequireKineMCCuts();
392 }
393 #endif