]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliHFEextraCuts.h
update of the package
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEextraCuts.h
1
2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 *                                                                        *
5 * Author: The ALICE Off-line Project.                                    *
6 * Contributors are mentioned in the code where appropriate.              *
7 *                                                                        *
8 * Permission to use, copy, modify and distribute this software and its   *
9 * documentation strictly for non-commercial purposes is hereby granted   *
10 * without fee, provided that the above copyright notice appears in all   *
11 * copies and that both the copyright notice and this permission notice   *
12 * appear in the supporting documentation. The authors make no claims     *
13 * about the suitability of this software for any purpose. It is          *
14 * provided "as is" without express or implied warranty.                  *
15 **************************************************************************/
16 //
17 // Extra Cuts from the ALICE HFE Group
18 // Container for cuts which are currently not implemented by
19 // the Correction Framework
20 //
21 #ifndef ALIHFEEXTRACUTS_H
22 #define ALIHFEEXTRACUTS_H
23
24 // #ifndef ALICFCUTBASE_H
25 #include "AliCFCutBase.h"
26 // #endif
27
28 class TList;
29
30 class AliVEvent;
31 class AliVParticle;
32 class AliVTrack;
33 class AliVVertex;
34 class AliAODVertex;
35 class AliAODEvent;
36 class AliESDEvent;
37
38 class AliHFEextraCuts: public AliCFCutBase{
39   public:
40     typedef enum{
41       kFirst = 0,
42       kSecond = 1,
43       kBoth = 2,
44       kNone = 3,
45       kAny = 4,
46       kExclusiveSecond = 5
47     } ITSPixel_t;
48     typedef enum{
49       kFirstD = 0  
50     } ITSDrift_t;
51     typedef enum{
52       kFound = 0,
53       kFoundIter1 = 1,
54       kCrossedRows = 2,
55       kFoundAll = 3
56     } ETPCclusterDef_t;
57     typedef enum{
58       kFoundOverFindable = 0,
59       kFoundOverFindableIter1 = 1,
60       kFoundOverCR = 2,
61       kCROverFindable = 3,
62       kFoundAllOverFindable = 4,
63     } ETPCclrDef_t;
64     AliHFEextraCuts(const Char_t *name, const Char_t *title);
65     AliHFEextraCuts(const AliHFEextraCuts &c);
66     AliHFEextraCuts &operator=(const AliHFEextraCuts &c);
67     virtual ~AliHFEextraCuts();
68     
69     virtual Bool_t IsSelected(TObject *o);
70     virtual Bool_t IsSelected(TList *) { return kTRUE; };
71     virtual void SetRecEventInfo(const TObject *event);
72
73     inline void SetClusterRatioTPC(Double_t ratio, ETPCclrDef_t def);
74     inline void SetRequireITSpixel(ITSPixel_t pixel);
75     inline void SetRequireITSdrift(ITSDrift_t drift);
76     inline void SetMinImpactParamR(Double_t impactParam);
77     inline void SetMaxImpactParamR(Double_t impactParam);
78     inline void SetMinImpactParamZ(Double_t impactParam);
79     inline void SetMaxImpactParamZ(Double_t impactParam);
80     inline void SetMinHFEImpactParamR(Float_t ipcutParam[4], Bool_t issigmacut, Bool_t isipcharge, Bool_t isopp);
81     inline void SetMinTrackletsTRD(Int_t minTracklets, Bool_t exact = kFALSE);
82     inline void SetMaxChi2TRD(Float_t maxchi2);
83     inline void SetMinNClustersTPC(Int_t minclusters, ETPCclusterDef_t def);
84     void SetMinNClustersTPCPID(Int_t minclusters) { SETBIT(fRequirements, kMinNClustersTPCPID); fMinNClustersTPCPID = minclusters; }
85     void SetTOFPID(Bool_t tofPid) { tofPid ? SETBIT(fRequirements, kTOFPID) : CLRBIT(fRequirements, kTOFPID); }
86     void SetTOFMISMATCH(Bool_t tofMismatch) { tofMismatch ? SETBIT(fRequirements, kTOFmismatch) : CLRBIT(fRequirements, kTOFmismatch); }
87     void SetTPCPIDCleanUp(Bool_t tpcPIDCleanUp) { tpcPIDCleanUp ? SETBIT(fRequirements, kTPCPIDCleanUp) : CLRBIT(fRequirements, kTPCPIDCleanUp); }
88     void SetMaxImpactParameterRpar(Bool_t maxImpactParameterRpar) { maxImpactParameterRpar ? SETBIT(fRequirements, kMaxImpactParameterRpar) : CLRBIT(fRequirements, kMaxImpactParameterRpar); }
89     void SetFractionOfTPCSharedClusters(Double_t fractionShared) { fFractionTPCShared= fractionShared; SETBIT(fRequirements, kTPCfractionShared); }
90     void SetMinNbITScls(UChar_t minNbITScls) { fMinNbITScls = minNbITScls; SETBIT(fRequirements, kMinNbITScls); }
91     void SetTOFsignalDxz(Double_t tofsignalDx,Double_t tofsignalDz) { fTOFsignalDx=tofsignalDx; fTOFsignalDz=tofsignalDz; SETBIT(fRequirements, kTOFsignalDxy); }
92     void SetRejectKinkDaughter() { SETBIT(fRequirements, kRejectKinkDaughter);}; 
93     void SetRejectKinkMother() { SETBIT(fRequirements, kRejectKinkMother);}; 
94     void SetAODFilterBit(Int_t bit) {fAODFilterBit = bit; SETBIT(fRequirements, kAODFilterBit);};
95     void SetCheckITSstatus(Bool_t check) { fCheck = check; };
96     void SetITSpatternCut() { SETBIT(fRequirements, kITSpattern); }
97     void SetDebugLevel(Int_t level) { fDebugLevel = level; };
98
99     Bool_t GetCheckITSstatus() const { return fCheck; };
100     Int_t GetDebugLevel() const { return fDebugLevel; };
101     void GetHFEImpactParameters(const AliVTrack * const track, Double_t &dcaxy, Double_t &dcansigmaxy); // temporary moved from protected to publich for IP QA 
102     void GetHFEImpactParameters(const AliVTrack * const track, Double_t dcaD[2], Double_t covD[3]);
103     void GetImpactParameters(AliVTrack *track, Float_t &radial, Float_t &z);
104     const AliVVertex* RemoveDaughtersFromPrimaryVtx(const AliESDEvent * const esdevent, const AliVTrack * const track);
105     AliAODVertex* RemoveDaughtersFromPrimaryVtx(const AliAODEvent * const aod, const AliVTrack * const track);
106     Int_t GetITSstatus(const AliVTrack * const track, Int_t layer) const;
107     Bool_t CheckITSstatus(Int_t itsStatus) const;
108     Bool_t CheckITSpattern(const AliVTrack *const track) const;
109     Bool_t IsKinkDaughter(AliVTrack *track);
110     Bool_t IsKinkMother(AliVTrack *track);
111
112
113     void UnSetRejectKinkDaughter() { CLRBIT(fRequirements, kRejectKinkDaughter);}; 
114     void UnSetRejectKinkMother() { CLRBIT(fRequirements, kRejectKinkMother);}; 
115
116     
117   protected:
118     virtual void AddQAHistograms(TList *qaList);
119     Bool_t CheckRecCuts(AliVTrack *track);
120     Bool_t CheckMCCuts(AliVParticle * /*track*/) const;
121     void FillQAhistosRec(AliVTrack *track, UInt_t when);
122     //void FillQAhistosMC(AliMCParticle *track, UInt_t when);
123     void FillCutCorrelation(ULong64_t survivedCut);
124     void PrintBitMap(Int_t bitmap);
125     
126     // Getter Functions for ESD/AOD compatible mode
127     UInt_t GetTPCncls(AliVTrack *track);
128     Bool_t GetTPCCountSharedMapBitsAboveThreshold(AliVTrack *track);
129     Double_t GetTPCclusterRatio(AliVTrack *track); 
130     //void GetHFEImpactParameters(AliVTrack *track, Double_t &dcaxy, Double_t &dcansigmaxy);
131     void GetHFEImpactParameterCuts(const AliVTrack * const track, Double_t &hfeimpactRcut, Double_t &hfeimpactnsigmaRcut);
132     void GetMaxImpactParameterCutR(const AliVTrack * const track, Double_t &maximpactRcut);
133     void GetTOFsignalDxDz(const AliVTrack * const track, Double_t &tofsignalDx, Double_t &tofsignalDz);
134     Float_t GetTPCsharedClustersRatio(AliVTrack *track);
135     Float_t GetTRDchi(AliVTrack *track);
136     Int_t GetITSNbOfcls(AliVTrack *track);
137
138   private:
139     typedef enum{
140       kMinImpactParamR = 0,
141       kMaxImpactParamR = 1,
142       kMinImpactParamZ = 2,
143       kMaxImpactParamZ = 3,
144       kClusterRatioTPC = 4,
145       kMinTrackletsTRD = 5,
146       kPixelITS = 6,
147       kMinHFEImpactParamR = 7,
148       kMinHFEImpactParamNsigmaR = 8,
149       kMinNClustersTPC = 9,
150       kMinNClustersTPCPID = 10,
151       kTPCfractionShared = 11,
152       kTOFPID = 12,
153       kTOFmismatch = 13,
154       kTPCPIDCleanUp = 14,
155       kEMCALmatch = 15,
156       kMaxImpactParameterRpar = 16,
157       kMinNbITScls = 17,
158       kRejectKinkDaughter = 18,
159       kRejectKinkMother = 19,
160       kDriftITS = 20,
161       kTOFsignalDxy = 21,
162       kMaxTRDChi2 = 22,
163       kITSpattern = 23,
164       kMinHFEImpactParamRcharge = 24,
165       kAODFilterBit=25,
166       kNcuts = 26
167     } Cut_t;
168     enum{
169       //
170       // Common Constants
171       //
172       kBeforeCuts =0,
173       kAfterCuts = 1
174     };
175     static const Int_t fgkNQAhistos;   // Number of QA histos
176     AliVEvent *fEvent;                //! working event
177     ULong64_t fCutCorrelation;        // Cut Correlation
178     ULong64_t fRequirements;          // Cut Requirements
179     Float_t fImpactParamCut[4];       // Impact Parmameter Cut
180     Float_t fIPcutParam[4];           // Parmameter of impact parameter cut parametrization
181     UInt_t fMinNClustersTPC;          // Minimum TPC clusters cut
182     UInt_t fMinNClustersTPCPID;       // Minimum TPC PID clusters cut
183     Float_t fClusterRatioTPC;         // Ratio of findable vs. found clusters in TPC
184     UChar_t fMinTrackletsTRD;         // Min. Number of Tracklets inside TRD
185     Float_t fMaxChi2TRD;              // Max chi2 TRD
186     UChar_t fMinNbITScls;             // Min. Number of ITS clusters
187     Bool_t  fTRDtrackletsExact;       // Require exact number of tracklets
188     UChar_t fPixelITS;                // Cut on ITS Pixels
189     UChar_t fDriftITS;                // Cut on ITS Drift
190     UChar_t fTPCclusterDef;           // TPC cluster definition Bitmap
191     UChar_t fTPCclusterRatioDef;      // TPC cluster ratio definition Bitmap
192     Double_t  fFractionTPCShared;     // Cut on fraction of shared clusters
193     Bool_t fOppSideIPcut;             // flag to use conversion peak side of ip*charge cut
194     Double_t fTOFsignalDx;            // TOF signal dx
195     Double_t fTOFsignalDz;            // TOF signal dz
196     Double_t fMagField;               // Magnetic field
197     Int_t    fAODFilterBit;           // Require AOD filter bit
198
199     Bool_t  fCheck;                     // check
200     TList *fQAlist;                     //! Directory for QA histograms
201     Int_t   fDebugLevel;                // Debug Level
202   
203     ClassDef(AliHFEextraCuts, 5)      // Additional cuts implemented by the ALICE HFE group
204 };
205
206 //__________________________________________________________
207 void AliHFEextraCuts::SetClusterRatioTPC(Double_t ratio, ETPCclrDef_t def) {
208   SETBIT(fRequirements, kClusterRatioTPC);
209   SETBIT(fTPCclusterRatioDef, def);
210   fClusterRatioTPC = ratio; 
211 }
212
213 //__________________________________________________________
214 void AliHFEextraCuts::SetRequireITSpixel(ITSPixel_t pixel) {
215   SETBIT(fRequirements, kPixelITS);
216   fPixelITS = pixel; 
217 }
218
219 //__________________________________________________________
220 void AliHFEextraCuts::SetRequireITSdrift(ITSDrift_t drift) {
221   SETBIT(fRequirements, kDriftITS);
222   fDriftITS = drift; 
223 }
224
225 //__________________________________________________________
226 void AliHFEextraCuts::SetMinImpactParamR(Double_t impactParam){
227   SETBIT(fRequirements, kMinImpactParamR);
228   fImpactParamCut[0] = impactParam;
229 }
230
231 //__________________________________________________________
232 void AliHFEextraCuts::SetMaxImpactParamR(Double_t impactParam){
233   SETBIT(fRequirements, kMaxImpactParamR);
234   fImpactParamCut[2] = impactParam;
235 }
236
237 //__________________________________________________________
238 void AliHFEextraCuts::SetMinImpactParamZ(Double_t impactParam){
239   SETBIT(fRequirements, kMinImpactParamZ);
240   fImpactParamCut[1] = impactParam;
241 }
242
243 //__________________________________________________________
244 void AliHFEextraCuts::SetMaxImpactParamZ(Double_t impactParam){
245   SETBIT(fRequirements, kMaxImpactParamZ);
246   fImpactParamCut[3] = impactParam;
247 }
248
249 //__________________________________________________________
250 void AliHFEextraCuts::SetMinHFEImpactParamR(Float_t ipcutParam[4], Bool_t isSigmacut, Bool_t isIPcharge, Bool_t isopp){
251   if(isSigmacut){ SETBIT(fRequirements, kMinHFEImpactParamNsigmaR);}
252   else{ 
253     if(isIPcharge){ SETBIT(fRequirements, kMinHFEImpactParamRcharge);}
254     else {SETBIT(fRequirements, kMinHFEImpactParamR);}
255     fIPcutParam[0]=ipcutParam[0];
256     fIPcutParam[1]=ipcutParam[1];
257     fIPcutParam[2]=ipcutParam[2];
258     fIPcutParam[3]=ipcutParam[3];
259     fOppSideIPcut = isopp;
260   }
261 }
262
263 //__________________________________________________________
264 void AliHFEextraCuts::SetMinTrackletsTRD(Int_t minTracklets, Bool_t exact){
265   SETBIT(fRequirements, kMinTrackletsTRD);
266   fMinTrackletsTRD = minTracklets;
267   fTRDtrackletsExact = exact;
268 }
269
270 //__________________________________________________________
271 void AliHFEextraCuts::SetMaxChi2TRD(Float_t maxchi2){
272   SETBIT(fRequirements, kMaxTRDChi2);
273   fMaxChi2TRD = maxchi2;
274 }
275
276
277 //__________________________________________________________
278 void AliHFEextraCuts::SetMinNClustersTPC(Int_t minClusters, ETPCclusterDef_t tpcdef){
279   SETBIT(fRequirements, kMinNClustersTPC);
280   SETBIT(fTPCclusterDef, tpcdef);
281   fMinNClustersTPC = minClusters;
282 }
283 #endif