]>
Commit | Line | Data |
---|---|---|
659ef4f0 | 1 | // |
2 | // Class AliRsnCutPIDITS | |
3 | // | |
4 | // General implementation of a single cut strategy, which can be: | |
5 | // - a value contained in a given interval [--> IsBetween() ] | |
6 | // - a value equal to a given reference [--> MatchesValue()] | |
7 | // | |
8 | // In all cases, the reference value(s) is (are) given as data members | |
9 | // and each kind of cut requires a given value type (Int, UInt, Double), | |
10 | // but the cut check procedure is then automatized and chosen thanks to | |
11 | // an enumeration of the implemented cut types. | |
12 | // At the end, the user (or any other point which uses this object) has | |
13 | // to use the method IsSelected() to check if this cut has been passed. | |
14 | // | |
15 | // authors: Martin Vala (martin.vala@cern.ch) | |
16 | // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
17 | // | |
18 | ||
b63357a0 | 19 | #include "AliESDtrackCuts.h" |
20 | #include "AliAODpidUtil.h" | |
223b8750 | 21 | #include "AliAnalysisManager.h" |
22 | #include "AliESDInputHandler.h" | |
659ef4f0 | 23 | |
b63357a0 | 24 | #include "AliRsnDaughter.h" |
25 | ||
659ef4f0 | 26 | #include "AliRsnCutPIDITS.h" |
27 | ||
28 | ClassImp(AliRsnCutPIDITS) | |
29 | ||
30 | //_________________________________________________________________________________________________ | |
31 | AliRsnCutPIDITS::AliRsnCutPIDITS | |
80e49c8b | 32 | (const char *name, AliPID::EParticleType ref, Double_t min, Double_t max, Bool_t rejectOutside) : |
2a1c7696 | 33 | AliRsnCut(name, AliRsnCut::kDaughter, min, max), |
c865cb1d | 34 | fIsMC(kFALSE), |
2a1c7696 | 35 | fRejectOutside(rejectOutside), |
36 | fMomMin(0.0), | |
37 | fMomMax(1E+20), | |
38 | fRefType(ref), | |
39 | fESDpid(), | |
40 | fAODpid() | |
659ef4f0 | 41 | { |
42 | // | |
43 | // Main constructor. | |
44 | // | |
659ef4f0 | 45 | } |
46 | ||
47 | //_________________________________________________________________________________________________ | |
48 | AliRsnCutPIDITS::AliRsnCutPIDITS | |
61f275d1 | 49 | (const AliRsnCutPIDITS ©) : |
2a1c7696 | 50 | AliRsnCut(copy), |
c865cb1d | 51 | fIsMC(copy.fIsMC), |
2a1c7696 | 52 | fRejectOutside(copy.fRejectOutside), |
53 | fMomMin(copy.fMomMin), | |
54 | fMomMax(copy.fMomMax), | |
55 | fRefType(copy.fRefType), | |
56 | fESDpid(copy.fESDpid), | |
57 | fAODpid(copy.fAODpid) | |
659ef4f0 | 58 | { |
59 | // | |
60 | // Copy constructor. | |
61 | // | |
659ef4f0 | 62 | } |
63 | ||
64 | //_________________________________________________________________________________________________ | |
61f275d1 | 65 | AliRsnCutPIDITS &AliRsnCutPIDITS::operator=(const AliRsnCutPIDITS ©) |
659ef4f0 | 66 | { |
67 | // | |
68 | // Assignment operator | |
69 | // | |
70 | ||
2a1c7696 | 71 | AliRsnCut::operator=(copy); |
61f275d1 | 72 | if (this == ©) |
73 | return *this; | |
659ef4f0 | 74 | |
c865cb1d | 75 | fIsMC = copy.fIsMC; |
2a1c7696 | 76 | fRejectOutside = copy.fRejectOutside; |
77 | fMomMin = copy.fMomMin; | |
78 | fMomMax = copy.fMomMax; | |
79 | fRefType = copy.fRefType; | |
80 | fESDpid = copy.fESDpid; | |
81 | fAODpid = copy.fAODpid; | |
82 | ||
83 | return (*this); | |
659ef4f0 | 84 | } |
85 | ||
659ef4f0 | 86 | //_________________________________________________________________________________________________ |
87 | Bool_t AliRsnCutPIDITS::IsSelected(TObject *object) | |
88 | { | |
89 | // | |
90 | // Cut checker. | |
91 | // | |
92 | ||
2a1c7696 | 93 | // coherence check |
94 | if (!TargetOK(object)) return kFALSE; | |
95 | ||
96 | // reject not ITS tracks | |
97 | // status is checked in the same way for all tracks | |
f34f960b | 98 | AliVTrack *vtrack = fDaughter->Ref2Vtrack(); |
2a1c7696 | 99 | if (!vtrack) { |
100 | AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); | |
101 | return kFALSE; | |
102 | } | |
103 | ||
104 | // check status, to know it track is an ITS+TPC or ITS standalone | |
105 | // and reject it if it is of none of them | |
106 | Bool_t isSA = kFALSE; | |
107 | if (IsTPC(vtrack)) isSA = kFALSE; | |
108 | else if (IsSA(vtrack)) isSA = kTRUE; | |
109 | else { | |
110 | AliDebug(AliLog::kDebug + 2, "Status flags unmatched"); | |
111 | return kFALSE; | |
112 | } | |
113 | ||
114 | // common evaluation variables | |
115 | Int_t k, nITSpidLayers = 0; | |
116 | Double_t mom = vtrack->P(); | |
f34f960b | 117 | AliESDtrack *esdTrack = fDaughter->Ref2ESDtrack(); |
118 | AliAODTrack *aodTrack = fDaughter->Ref2AODtrack(); | |
2a1c7696 | 119 | |
2a1c7696 | 120 | // count number of PID layers... |
121 | if (esdTrack) { | |
122 | UChar_t itsCluMap = esdTrack->GetITSClusterMap(); | |
123 | for (k = 2; k < 6; k++) if (itsCluMap & (1 << k)) ++nITSpidLayers; | |
124 | } else if (aodTrack) { | |
125 | for (k = 2; k < 6; k++) if (TESTBIT(aodTrack->GetITSClusterMap(), k)) ++nITSpidLayers; | |
126 | } else { | |
127 | AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); | |
128 | return kFALSE; | |
129 | } | |
130 | // ...and reject tracks where it is smaller than 3 | |
131 | if (nITSpidLayers < 3) { | |
132 | AliDebug(AliLog::kDebug + 2, "Rejecting track with too few ITS pid layers"); | |
133 | return kFALSE; | |
134 | } | |
135 | ||
136 | // assign PID nsigmas to default cut check value | |
137 | // since bad object types are rejected before, here we have an ESD track or AOD track | |
c865cb1d | 138 | if (esdTrack) { |
139 | if (!fESDpid) fESDpid = new AliESDpid(fIsMC); | |
140 | fCutValueD = fESDpid->GetITSResponse().GetNumberOfSigmas(mom, esdTrack->GetITSsignal(), fRefType, nITSpidLayers, isSA); | |
141 | } else { | |
142 | if (!fAODpid) fAODpid = new AliAODpidUtil(fIsMC); | |
143 | fCutValueD = fAODpid->NumberOfSigmasITS(aodTrack, fRefType); | |
144 | } | |
2a1c7696 | 145 | |
2654b757 | 146 | // use AliRsnCut default method to check cut |
147 | Bool_t cutCheck = OkRangeD(); | |
148 | ||
149 | // now check the momentum: | |
150 | // -- if it stays inside the accepted range, track just checked | |
151 | // with respect to the nsigma band | |
152 | // -- if it stays outside the accepted range and 'fRejectOutside' is kTRUE, | |
153 | // track is always rejected, while if 'fRejectOutside' is kFALSE, | |
154 | // track is accepted if it stays inside the nsigma band | |
155 | if ((mom >= fMomMin && mom <= fMomMax)) | |
156 | return cutCheck; | |
157 | else { | |
158 | AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom)); | |
159 | return ((!fRejectOutside) && cutCheck); | |
160 | } | |
659ef4f0 | 161 | } |
162 | ||
163 | //_________________________________________________________________________________________________ | |
164 | void AliRsnCutPIDITS::Print(const Option_t *) const | |
165 | { | |
166 | // | |
167 | // Print information on this cut | |
168 | // | |
169 | ||
2a1c7696 | 170 | AliInfo(Form("Cut name : %s", GetName())); |
171 | AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD)); | |
172 | AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax)); | |
173 | AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted"))); | |
659ef4f0 | 174 | } |