1 #ifndef ALIRSNCUTPIDNSIGMA_H
2 #define ALIRSNCUTPIDNSIGMA_H
5 // Class for n-sigma PID cuts.
9 // 1) the used detector, chosen from an enumeration
10 // 2) the reference charged particle species, chosen from AliPID enumeration
11 // 3) a momentum range: outside it, the cut is never passed
15 #include <TClonesArray.h>
18 #include "AliESDtrack.h"
20 #include "AliRsnCut.h"
25 class AliRsnCutPIDNSigma : public AliRsnCut {
36 // This allows to define several intervals
38 class AliRsnPIDRange : public TObject {
41 AliRsnPIDRange(Double_t nsigma, Double_t pmin, Double_t pmax)
42 : fPMin(pmin), fPMax(pmax), fNSigmaCut(nsigma) { }
44 Double_t &PMin() {return fPMin;}
45 Double_t &PMax() {return fPMax;}
46 Double_t &NSigmaCut() {return fNSigmaCut;}
48 Bool_t IsInRange(Double_t mom) {return (mom >= fPMin && mom <= fPMax);}
49 Bool_t CutPass(Double_t nsigma) {return (nsigma <= fNSigmaCut);}
53 Double_t fPMin; // lower bound of momentum range
54 Double_t fPMax; // upper bound of momentum range
55 Double_t fNSigmaCut; // cut in number of sigmas
57 ClassDef(AliRsnCutPIDNSigma::AliRsnPIDRange,1)
61 AliRsnCutPIDNSigma(const char *name, AliPID::EParticleType species, EDetector det);
62 AliRsnCutPIDNSigma(const AliRsnCutPIDNSigma ©);
63 AliRsnCutPIDNSigma &operator=(const AliRsnCutPIDNSigma ©);
64 virtual ~AliRsnCutPIDNSigma() { }
66 void SetSpecies(AliPID::EParticleType type) {fSpecies = type;}
67 void SetDetector(EDetector det) {fDetector = det;}
68 void SetRejectUnmatched(Bool_t yn = kTRUE) {fRejectUnmatched = yn;}
70 AliPIDResponse *MyPID() {return fMyPID;}
71 void InitMyPID(Bool_t isMC, Bool_t isESD);
73 void SinglePIDRange(Double_t nsigma);
74 void AddPIDRange(Double_t nsigma, Double_t pmin = 0.0, Double_t pmax = 1E20);
76 Bool_t MatchITS(const AliVTrack *vtrack) const;
77 Bool_t MatchTPC(const AliVTrack *vtrack) const;
78 Bool_t MatchTOF(const AliVTrack *vtrack) const;
79 Bool_t MatchDetector(const AliVTrack *vtrack) const;
81 virtual Bool_t IsSelected(TObject *object);
82 virtual void Print(const Option_t *option = "") const;
86 AliPID::EParticleType fSpecies; // particle species
87 EDetector fDetector; // detector used for PID
88 Bool_t fRejectUnmatched; // tracks not matched to this detector do pass the cut?
89 Double_t fTrackNSigma; //! tmp track number of sigmas w.r. to chosen detector
90 Double_t fTrackMom; //! track reference momentum
91 AliPIDResponse *fMyPID; // PID response object to be configured manyally
92 TClonesArray fRanges; // collection of ranges
94 ClassDef(AliRsnCutPIDNSigma, 1)
97 inline Bool_t AliRsnCutPIDNSigma::MatchITS(const AliVTrack *vtrack) const
100 // Checks if the track has the status flags required for an ITS standalone track
103 if ((vtrack->GetStatus() & AliESDtrack::kITSin) == 0) return kFALSE;
104 if ((vtrack->GetStatus() & AliESDtrack::kITSpid) == 0) return kFALSE;
109 inline Bool_t AliRsnCutPIDNSigma::MatchTPC(const AliVTrack *vtrack) const
112 // Checks if the track has the status flags required for a TPC track
115 if ((vtrack->GetStatus() & AliESDtrack::kTPCin) == 0) return kFALSE;
120 inline Bool_t AliRsnCutPIDNSigma::MatchTOF(const AliVTrack *vtrack) const
123 // Checks if the track has the status flags required for an ITS standalone track
126 if ((vtrack->GetStatus() & AliESDtrack::kTOFout) == 0) return kFALSE;
127 if ((vtrack->GetStatus() & AliESDtrack::kTIME) == 0) return kFALSE;
132 inline Bool_t AliRsnCutPIDNSigma::MatchDetector(const AliVTrack *vtrack) const
135 // Checks if the track has matched the required detector.
136 // If no valid detector is specified, kFALSE is always returned.
140 case kITS: return MatchITS(vtrack);
141 case kTPC: return MatchTPC(vtrack);
142 case kTOF: return MatchTOF(vtrack);
143 default : return kFALSE;
147 inline void AliRsnCutPIDNSigma::AddPIDRange(Double_t nsigma, Double_t pmin, Double_t pmax)
150 // Add a new slot for checking PID
153 Int_t n = fRanges.GetEntries();
155 new (fRanges[n]) AliRsnPIDRange(nsigma, pmin, pmax);
158 inline void AliRsnCutPIDNSigma::SinglePIDRange(Double_t nsigma)
161 // Clear all slots and sets a unique one
166 new (fRanges[0]) AliRsnPIDRange(nsigma, 0.0, 1E20);