]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnCutPIDNSigma.h
Update in cuts for Sigma* and update for lego_train macros (M.Vala)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnCutPIDNSigma.h
CommitLineData
c865cb1d 1#ifndef ALIRSNCUTPIDNSIGMA_H
2#define ALIRSNCUTPIDNSIGMA_H
3
4//
64129b35 5// Class for n-sigma PID cuts.
6// ---
7// Requires:
c865cb1d 8//
64129b35 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
12//
13
14#include <TMath.h>
b6ab153d 15#include <TClonesArray.h>
c865cb1d 16
17#include "AliPID.h"
b6ab153d 18#include "AliESDtrack.h"
c865cb1d 19
20#include "AliRsnCut.h"
b63dbf69 21#include "AliRsnPIDRange.h"
c865cb1d 22
f34f960b 23class AliVTrack;
c865cb1d 24class AliPIDResponse;
25
26class AliRsnCutPIDNSigma : public AliRsnCut {
27public:
28
29 enum EDetector {
30 kITS,
31 kTPC,
32 kTOF,
33 kDetectors
34 };
64129b35 35 AliRsnCutPIDNSigma();
b6ab153d 36 AliRsnCutPIDNSigma(const char *name, AliPID::EParticleType species, EDetector det);
61f275d1 37 AliRsnCutPIDNSigma(const AliRsnCutPIDNSigma &copy);
38 AliRsnCutPIDNSigma &operator=(const AliRsnCutPIDNSigma &copy);
c865cb1d 39 virtual ~AliRsnCutPIDNSigma() { }
40
c865cb1d 41 void SetSpecies(AliPID::EParticleType type) {fSpecies = type;}
64129b35 42 void SetDetector(EDetector det) {fDetector = det;}
43 void SetRejectUnmatched(Bool_t yn = kTRUE) {fRejectUnmatched = yn;}
61f275d1 44
b6ab153d 45 AliPIDResponse *MyPID() {return fMyPID;}
46 void InitMyPID(Bool_t isMC, Bool_t isESD);
61f275d1 47
b6ab153d 48 void SinglePIDRange(Double_t nsigma);
49 void AddPIDRange(Double_t nsigma, Double_t pmin = 0.0, Double_t pmax = 1E20);
61f275d1 50
b6ab153d 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;
61f275d1 55
c865cb1d 56 virtual Bool_t IsSelected(TObject *object);
57 virtual void Print(const Option_t *option = "") const;
58
59private:
60
61 AliPID::EParticleType fSpecies; // particle species
62 EDetector fDetector; // detector used for PID
c865cb1d 63 Bool_t fRejectUnmatched; // tracks not matched to this detector do pass the cut?
b6ab153d 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
c865cb1d 68
69 ClassDef(AliRsnCutPIDNSigma, 1)
70};
71
b6ab153d 72inline Bool_t AliRsnCutPIDNSigma::MatchITS(const AliVTrack *vtrack) const
c865cb1d 73{
74//
75// Checks if the track has the status flags required for an ITS standalone track
76//
77
f34f960b 78 if ((vtrack->GetStatus() & AliESDtrack::kITSin) == 0) return kFALSE;
79 if ((vtrack->GetStatus() & AliESDtrack::kITSpid) == 0) return kFALSE;
c865cb1d 80
f34f960b 81 return kTRUE;
c865cb1d 82}
83
b6ab153d 84inline Bool_t AliRsnCutPIDNSigma::MatchTPC(const AliVTrack *vtrack) const
c865cb1d 85{
86//
87// Checks if the track has the status flags required for a TPC track
88//
89
f34f960b 90 if ((vtrack->GetStatus() & AliESDtrack::kTPCin) == 0) return kFALSE;
61f275d1 91
f34f960b 92 return kTRUE;
c865cb1d 93}
94
b6ab153d 95inline Bool_t AliRsnCutPIDNSigma::MatchTOF(const AliVTrack *vtrack) const
c865cb1d 96{
97//
98// Checks if the track has the status flags required for an ITS standalone track
99//
100
f34f960b 101 if ((vtrack->GetStatus() & AliESDtrack::kTOFout) == 0) return kFALSE;
102 if ((vtrack->GetStatus() & AliESDtrack::kTIME) == 0) return kFALSE;
c865cb1d 103
f34f960b 104 return kTRUE;
c865cb1d 105}
106
b6ab153d 107inline Bool_t AliRsnCutPIDNSigma::MatchDetector(const AliVTrack *vtrack) const
108{
109//
110// Checks if the track has matched the required detector.
111// If no valid detector is specified, kFALSE is always returned.
112//
113
114 switch (fDetector) {
115 case kITS: return MatchITS(vtrack);
116 case kTPC: return MatchTPC(vtrack);
117 case kTOF: return MatchTOF(vtrack);
118 default : return kFALSE;
119 }
120}
121
122inline void AliRsnCutPIDNSigma::AddPIDRange(Double_t nsigma, Double_t pmin, Double_t pmax)
123{
124//
125// Add a new slot for checking PID
126//
127
128 Int_t n = fRanges.GetEntries();
61f275d1 129
b6ab153d 130 new (fRanges[n]) AliRsnPIDRange(nsigma, pmin, pmax);
131}
132
133inline void AliRsnCutPIDNSigma::SinglePIDRange(Double_t nsigma)
134{
135//
136// Clear all slots and sets a unique one
137//
138
139 fRanges.Delete();
61f275d1 140
b6ab153d 141 new (fRanges[0]) AliRsnPIDRange(nsigma, 0.0, 1E20);
142}
143
c865cb1d 144#endif