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"
21 #include "AliRsnPIDRange.h"
26 class AliRsnCutPIDNSigma : public AliRsnCut {
36 AliRsnCutPIDNSigma(const char *name, AliPID::EParticleType species, EDetector det);
37 AliRsnCutPIDNSigma(const AliRsnCutPIDNSigma ©);
38 AliRsnCutPIDNSigma &operator=(const AliRsnCutPIDNSigma ©);
39 virtual ~AliRsnCutPIDNSigma() { }
41 void SetSpecies(AliPID::EParticleType type) {fSpecies = type;}
42 void SetDetector(EDetector det) {fDetector = det;}
43 void SetRejectUnmatched(Bool_t yn = kTRUE) {fRejectUnmatched = yn;}
45 AliPIDResponse *MyPID() {return fMyPID;}
46 void InitMyPID(Bool_t isMC, Bool_t isESD);
48 void SinglePIDRange(Double_t nsigma);
49 void AddPIDRange(Double_t nsigma, Double_t pmin = 0.0, Double_t pmax = 1E20);
51 Bool_t MatchITS(const AliVTrack *vtrack) const;
52 Bool_t MatchTPC(const AliVTrack *vtrack) const;
53 Bool_t MatchTOF(const AliVTrack *vtrack) const;
54 Bool_t MatchDetector(const AliVTrack *vtrack) const;
56 virtual Bool_t IsSelected(TObject *object);
57 virtual void Print(const Option_t *option = "") const;
61 AliPID::EParticleType fSpecies; // particle species
62 EDetector fDetector; // detector used for PID
63 Bool_t fRejectUnmatched; // tracks not matched to this detector do pass the cut?
64 Double_t fTrackNSigma; //! tmp track number of sigmas w.r. to chosen detector
65 Double_t fTrackMom; //! track reference momentum
66 AliPIDResponse *fMyPID; // PID response object to be configured manyally
67 TClonesArray fRanges; // collection of ranges
69 ClassDef(AliRsnCutPIDNSigma, 1)
72 inline Bool_t AliRsnCutPIDNSigma::MatchITS(const AliVTrack *vtrack) const
75 // Checks if the track has the status flags required for an ITS standalone track
78 if ((vtrack->GetStatus() & AliESDtrack::kITSin) == 0) return kFALSE;
79 if ((vtrack->GetStatus() & AliESDtrack::kITSpid) == 0) return kFALSE;
84 inline Bool_t AliRsnCutPIDNSigma::MatchTPC(const AliVTrack *vtrack) const
87 // Checks if the track has the status flags required for a TPC track
90 if ((vtrack->GetStatus() & AliESDtrack::kTPCin) == 0) return kFALSE;
95 inline Bool_t AliRsnCutPIDNSigma::MatchTOF(const AliVTrack *vtrack) const
98 // Checks if the track has the status flags required for an ITS standalone track
101 if ((vtrack->GetStatus() & AliESDtrack::kTOFout) == 0) return kFALSE;
102 if ((vtrack->GetStatus() & AliESDtrack::kTIME) == 0) return kFALSE;
107 inline Bool_t AliRsnCutPIDNSigma::MatchDetector(const AliVTrack *vtrack) const
110 // Checks if the track has matched the required detector.
111 // If no valid detector is specified, kFALSE is always returned.
115 case kITS: return MatchITS(vtrack);
116 case kTPC: return MatchTPC(vtrack);
117 case kTOF: return MatchTOF(vtrack);
118 default : return kFALSE;
122 inline void AliRsnCutPIDNSigma::AddPIDRange(Double_t nsigma, Double_t pmin, Double_t pmax)
125 // Add a new slot for checking PID
128 Int_t n = fRanges.GetEntries();
130 new (fRanges[n]) AliRsnPIDRange(nsigma, pmin, pmax);
133 inline void AliRsnCutPIDNSigma::SinglePIDRange(Double_t nsigma)
136 // Clear all slots and sets a unique one
141 new (fRanges[0]) AliRsnPIDRange(nsigma, 0.0, 1E20);