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