]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCutTrackQuality.h
Some bug fixes, removal of some duplicates and clarified the logic of some pieces...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutTrackQuality.h
1 //
2 // Class AliRsnCutRange
3 //
4 // General implementation of cuts which check a value inside a range.
5 // This range can be defined by two integers or two doubles.
6 // A user-friendly enumeration allows to define what is checked.
7 //
8 // authors: Martin Vala (martin.vala@cern.ch)
9 //          Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
10 //
11
12 #ifndef ALIRSNCUTTRACKQUALITY_H
13 #define ALIRSNCUTTRACKQUALITY_H
14
15 #include <TMath.h>
16 #include <TString.h>
17
18 #include "AliRsnCut.h"
19
20 class AliESDtrack;
21 class AliAODTrack;
22
23 class AliRsnCutTrackQuality : public AliRsnCut {
24 public:
25
26    AliRsnCutTrackQuality(const char *name = "AliRsncutTrackQuality");
27    AliRsnCutTrackQuality(const AliRsnCutTrackQuality& copy);
28    AliRsnCutTrackQuality& operator=(const AliRsnCutTrackQuality& copy);
29    virtual ~AliRsnCutTrackQuality() { }
30
31    void      DisableAll();
32
33    void      AddStatusFlag(ULong_t f, Bool_t on)       {if (on) fFlagsOn = fFlagsOn | f; else fFlagsOff = fFlagsOff | f;}
34    void      SetStatusFlags(ULong_t f, Bool_t on)      {if (on) fFlagsOn = f; else fFlagsOff = f;}
35    void      SetPtRange(Double_t a, Double_t b)        {fPt[0] = TMath::Min(a, b); fPt[1] = TMath::Max(a, b);}
36    void      SetEtaRange(Double_t a, Double_t b)       {fEta[0] = TMath::Min(a, b); fEta[1] = TMath::Max(a, b);}
37
38    void      SetDCARPtFormula(const char *formula)     {fDCARptFormula = formula; fDCARfixed = kFALSE;}
39    void      SetDCARmax(Double_t value)                {fDCARmax = value; fDCARptFormula = ""; fDCARfixed = kTRUE;}
40    void      SetDCAZPtFormula(const char *formula)     {fDCAZptFormula = formula; fDCAZfixed = kFALSE;}
41    void      SetDCAZmax(Double_t value)                {fDCAZmax = value; fDCAZptFormula = ""; fDCAZfixed = kTRUE;}
42
43    void      SetSPDminNClusters(Int_t value)           {fSPDminNClusters = value;}
44    void      SetITSminNClusters(Int_t value)           {fITSminNClusters = value;}
45    void      SetITSmaxChi2(Double_t value)             {fITSmaxChi2 = value;}
46
47    void      SetTPCminNClusters(Int_t value)           {fTPCminNClusters = value;}
48    void      SetTPCmaxChi2(Double_t value)             {fTPCmaxChi2 = value;}
49
50    void      SetRejectKinkDaughters(Bool_t yn = kTRUE) {fRejectKinkDaughters = yn;}
51    
52    void      SetAODTestFilterBit(Int_t value)          {fAODTestFilterBit = value;}
53
54    virtual Bool_t IsSelected(TObject *obj);
55    virtual void   Print(const Option_t *option = "") const;
56
57 protected:
58
59    Bool_t      CheckESD(AliESDtrack *track);
60    Bool_t      CheckAOD(AliAODTrack *track);
61    const char* Binary(UInt_t number);
62
63    ULong_t    fFlagsOn;                // status flags which must be ON (used AliESDtrack ones, connected with '|')
64    ULong_t    fFlagsOff;               // status flags which must be OFF (used AliESDtrack ones, connected with '|')
65    Double_t   fPt[2];                  // pt range
66    Double_t   fEta[2];                 // eta range
67    Bool_t     fRejectKinkDaughters;    // switch to kTRUE if daughters of kinks must be rejected
68
69    Bool_t     fDCARfixed;              // flag to switch between fixed and pt-dependent DCA cut
70    TString    fDCARptFormula;          // expression to compute transverse DCA sigma w.r. to pt
71    Double_t   fDCARmax;                // maximum value for transverse DCA
72
73    Bool_t     fDCAZfixed;              // flag to switch between fixed and pt-dependent DCA cut
74    TString    fDCAZptFormula;          // expression to compute longitudinal DCA sigma w.r. to pt
75    Double_t   fDCAZmax;                // maximum value for longitudinal DCA
76
77    Int_t      fSPDminNClusters;        // minimum number of required clusters in SPD
78    Int_t      fITSminNClusters;        // minimum number of required clusters in ITS
79    Double_t   fITSmaxChi2;             // maximum chi2 / number of clusters in ITS
80
81    Int_t      fTPCminNClusters;        // minimum number of required clusters in TPC
82    Double_t   fTPCmaxChi2;             // maximum chi2 / number of clusters in TPC
83    Int_t      fAODTestFilterBit;       // test filter bit for AOD tracks
84
85    ClassDef(AliRsnCutTrackQuality, 1)
86 };
87
88 //__________________________________________________________________________________________________
89 inline const char * AliRsnCutTrackQuality::Binary(UInt_t number)
90 {
91 //
92 // Convert an integer in binary
93 //
94
95     static char b[15];
96     b[0] = '\0';
97
98     UInt_t z;
99     for (z = 512; z > 0; z >>= 1)
100         strcat(b, ((number & z) == z) ? "1" : "0");
101
102     return b;
103 }
104
105 #endif