]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnCutPIDNSigma.h
3d9ac637d486bc7feefcac12fec3906e4d42178d
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPIDNSigma.h
1 #ifndef ALIRSNCUTPIDNSIGMA_H
2 #define ALIRSNCUTPIDNSIGMA_H
3
4 //
5 // Class for generalized n-sigma PID cuts with detectors
6 //
7
8 #include "AliPID.h"
9
10 #include "AliRsnCut.h"
11
12 class AliPIDResponse;
13
14 class AliRsnCutPIDNSigma : public AliRsnCut {
15 public:
16
17    enum EDetector {
18       kITS,
19       kTPC,
20       kTOF,
21       kDetectors
22    };
23
24    AliRsnCutPIDNSigma(const char *name = "cutPIDNsigma", AliPID::EParticleType species = AliPID::kUnknown, EDetector det = kDetectors, Double_t nsigma = 3.0);
25    AliRsnCutPIDNSigma(const AliRsnCutPIDNSigma& copy);
26    AliRsnCutPIDNSigma& operator=(const AliRsnCutPIDNSigma& copy);
27    virtual ~AliRsnCutPIDNSigma() { }
28
29    void             SetRejectOutside(Bool_t yn = kTRUE)           {fRejectOutside = yn;}
30    void             SetRejectUnmatched(Bool_t yn = kTRUE)         {fRejectUnmatched = yn;}
31    void             SetMomentumRange(Double_t min, Double_t max)  {fMomMin = min; fMomMax = max;}
32    void             SetNSigmaRange(Double_t min, Double_t max)    {AliRsnCut::SetRangeD(min, max);}
33    void             SetSpecies(AliPID::EParticleType type)        {fSpecies = type;}
34    
35    Bool_t           IsITS();
36    Bool_t           IsTPC();
37    Bool_t           IsTOF();
38    
39    virtual Bool_t   IsSelected(TObject *object);
40    virtual void     Print(const Option_t *option = "") const;
41
42 private:
43
44    AliPID::EParticleType   fSpecies;         //  particle species
45    EDetector               fDetector;        //  detector used for PID
46    Double_t                fMomMin;          //  momentum range (for ITS and TOF it is vertex momentum, for TPC it is inner wall)
47    Double_t                fMomMax;          //  momentum range (for ITS and TOF it is vertex momentum, for TPC it is inner wall)
48    Bool_t                  fRejectOutside;   //  tracks outside momentum range do pass the cut?
49    Bool_t                  fRejectUnmatched; //  tracks not matched to this detector do pass the cut?
50
51    ClassDef(AliRsnCutPIDNSigma, 1)
52 };
53
54 inline Bool_t AliRsnCutPIDNSigma::IsITS()
55 {
56 //
57 // Checks if the track has the status flags required for an ITS standalone track
58 //
59
60    AliVTrack *vtrack = fDaughter->GetRefVtrack();
61    
62    if (!vtrack) {
63       AliWarning("NULL argument: impossible to check status");
64       return kFALSE;
65    }
66
67    Bool_t isITSin  = ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0);
68    Bool_t isITSpid = ((vtrack->GetStatus() & AliESDtrack::kITSpid) != 0);
69
70    return (isITSin && isITSpid);
71 }
72
73 inline Bool_t AliRsnCutPIDNSigma::IsTPC()
74 {
75 //
76 // Checks if the track has the status flags required for a TPC track
77 //
78
79    AliVTrack *vtrack = fDaughter->GetRefVtrack();
80
81    if (!vtrack) {
82       AliWarning("NULL argument: impossible to check status");
83       return kFALSE;
84    }
85
86    return ((vtrack->GetStatus() & AliESDtrack::kTPCin) != 0);
87 }
88
89 inline Bool_t AliRsnCutPIDNSigma::IsTOF()
90 {
91 //
92 // Checks if the track has the status flags required for an ITS standalone track
93 //
94
95    AliVTrack *vtrack = fDaughter->GetRefVtrack();
96
97    if (!vtrack) {
98       AliWarning("NULL argument: impossible to check status");
99       return kFALSE;
100    }
101
102    Bool_t isTOFout = ((vtrack->GetStatus() & AliESDtrack::kTOFout) != 0);
103    Bool_t isTIME   = ((vtrack->GetStatus() & AliESDtrack::kTIME) != 0);
104
105    return (isTOFout && isTIME);
106 }
107
108 #endif