]>
Commit | Line | Data |
---|---|---|
659ef4f0 | 1 | // |
2 | // Class AliRsnCutPIDTPC | |
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 "AliPID.h" |
223b8750 | 20 | #include "AliAnalysisManager.h" |
21 | #include "AliESDInputHandler.h" | |
c865cb1d | 22 | #include "AliESDpid.h" |
23 | #include "AliAODpidUtil.h" | |
24 | ||
659ef4f0 | 25 | #include "AliRsnCutPIDTPC.h" |
26 | ||
27 | ClassImp(AliRsnCutPIDTPC) | |
28 | ||
29 | //_________________________________________________________________________________________________ | |
30 | AliRsnCutPIDTPC::AliRsnCutPIDTPC | |
80e49c8b | 31 | (const char *name, AliPID::EParticleType type, Double_t min, Double_t max, Bool_t rejectOutside) : |
2a1c7696 | 32 | AliRsnCut(name, AliRsnCut::kDaughter, min, max), |
2a1c7696 | 33 | fRejectOutside(rejectOutside), |
34 | fMomMin(0.0), | |
35 | fMomMax(1E+20), | |
36 | fRefType(type), | |
c865cb1d | 37 | fESDpid(0x0), |
38 | fAODpid(0x0) | |
659ef4f0 | 39 | { |
40 | // | |
41 | // Main constructor. | |
42 | // | |
e187bd70 | 43 | |
44 | fBB[0] = fBB[1] = fBB[2] = fBB[3] = fBB[4] = 0.0; | |
659ef4f0 | 45 | } |
46 | ||
47 | //_________________________________________________________________________________________________ | |
48 | AliRsnCutPIDTPC::AliRsnCutPIDTPC | |
61f275d1 | 49 | (const AliRsnCutPIDTPC ©) : |
2a1c7696 | 50 | AliRsnCut(copy), |
2a1c7696 | 51 | fRejectOutside(copy.fRejectOutside), |
52 | fMomMin(copy.fMomMin), | |
53 | fMomMax(copy.fMomMax), | |
54 | fRefType(copy.fRefType), | |
55 | fESDpid(copy.fESDpid), | |
56 | fAODpid(copy.fAODpid) | |
659ef4f0 | 57 | { |
58 | // | |
59 | // Copy constructor. | |
60 | // | |
e187bd70 | 61 | |
62 | Int_t i; | |
63 | for (i = 0; i < 5; i++) fBB[i] = copy.fBB[i]; | |
659ef4f0 | 64 | } |
65 | ||
66 | //_________________________________________________________________________________________________ | |
61f275d1 | 67 | AliRsnCutPIDTPC &AliRsnCutPIDTPC::operator=(const AliRsnCutPIDTPC ©) |
659ef4f0 | 68 | { |
69 | // | |
70 | // Assignment operator | |
71 | // | |
72 | ||
2a1c7696 | 73 | AliRsnCut::operator=(copy); |
e6f3a909 | 74 | if (this == ©) |
61f275d1 | 75 | return *this; |
659ef4f0 | 76 | |
2a1c7696 | 77 | fRejectOutside = copy.fRejectOutside; |
78 | fMomMin = copy.fMomMin; | |
79 | fMomMax = copy.fMomMax; | |
80 | fRefType = copy.fRefType; | |
81 | fESDpid = copy.fESDpid; | |
82 | fAODpid = copy.fAODpid; | |
61f275d1 | 83 | |
e187bd70 | 84 | Int_t i; |
85 | for (i = 0; i < 5; i++) fBB[i] = copy.fBB[i]; | |
2a1c7696 | 86 | |
87 | return (*this); | |
659ef4f0 | 88 | } |
89 | ||
90 | //_________________________________________________________________________________________________ | |
91 | void AliRsnCutPIDTPC::SetBBParam(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) | |
92 | { | |
93 | // | |
94 | // Properly set the Bethe-Bloch parameters in all places where it is needed. | |
95 | // | |
96 | ||
c865cb1d | 97 | fBB[0] = p0; |
98 | fBB[1] = p1; | |
99 | fBB[2] = p2; | |
100 | fBB[3] = p3; | |
101 | fBB[4] = p4; | |
659ef4f0 | 102 | } |
103 | ||
104 | //_________________________________________________________________________________________________ | |
105 | Bool_t AliRsnCutPIDTPC::IsSelected(TObject *object) | |
106 | { | |
107 | // | |
108 | // Cut checker. | |
109 | // | |
110 | ||
2a1c7696 | 111 | // coherence check |
112 | if (!TargetOK(object)) return kFALSE; | |
113 | ||
2a1c7696 | 114 | // common evaluation variables |
115 | Double_t mom; | |
f34f960b | 116 | AliESDtrack *esdTrack = fDaughter->Ref2ESDtrack(); |
117 | AliAODTrack *aodTrack = fDaughter->Ref2AODtrack(); | |
2a1c7696 | 118 | |
2654b757 | 119 | // get inner momentum, needed for BB computation |
c865cb1d | 120 | if (esdTrack) { |
121 | if (!esdTrack->GetInnerParam()) { | |
122 | AliDebug(AliLog::kDebug + 2, "No inner param"); | |
123 | return kFALSE; | |
124 | } | |
2a1c7696 | 125 | mom = esdTrack->GetInnerParam()->P(); |
c865cb1d | 126 | } else if (aodTrack) { |
127 | if (!aodTrack->GetDetPid()) { | |
128 | AliDebug(AliLog::kDebug + 2, "No def-pid object"); | |
129 | return kFALSE; | |
130 | } | |
2a1c7696 | 131 | mom = aodTrack->GetDetPid()->GetTPCmomentum(); |
c865cb1d | 132 | if (mom < 1E-6) return kFALSE; |
133 | } else { | |
2a1c7696 | 134 | AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); |
135 | return kFALSE; | |
136 | } | |
2a1c7696 | 137 | |
138 | // assign PID nsigmas to default cut check value | |
139 | // since bad object types are rejected before, here we have an ESD track or AOD track | |
c865cb1d | 140 | if (esdTrack) { |
141 | if (!fESDpid) { | |
142 | fESDpid = new AliESDpid; | |
143 | fESDpid->GetTPCResponse().SetBetheBlochParameters(fBB[0], fBB[1], fBB[2], fBB[3], fBB[4]); | |
144 | } | |
145 | fCutValueD = fESDpid->GetTPCResponse().GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fRefType); | |
146 | } else { | |
147 | if (!fAODpid) { | |
148 | fAODpid = new AliAODpidUtil; | |
149 | fAODpid->GetTPCResponse().SetBetheBlochParameters(fBB[0], fBB[1], fBB[2], fBB[3], fBB[4]); | |
150 | } | |
151 | if (aodTrack->GetTPCsignalN() == 0) aodTrack->GetDetPid()->SetTPCsignalN(aodTrack->GetTPCNcls()); | |
152 | fCutValueD = fAODpid->NumberOfSigmasTPC(aodTrack, fRefType); | |
153 | } | |
2a1c7696 | 154 | |
155 | // use AliRsnCut default method to check cut | |
2654b757 | 156 | Bool_t cutCheck = OkRangeD(); |
157 | ||
158 | // now check the momentum: | |
159 | // -- if it stays inside the accepted range, track just checked | |
160 | // with respect to the nsigma band | |
161 | // -- if it stays outside the accepted range and 'fRejectOutside' is kTRUE, | |
162 | // track is always rejected, while if 'fRejectOutside' is kFALSE, | |
163 | // track is accepted if it stays inside the nsigma band | |
164 | if ((mom >= fMomMin && mom <= fMomMax)) | |
165 | return cutCheck; | |
166 | else { | |
167 | AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom)); | |
168 | return ((!fRejectOutside) && cutCheck); | |
169 | } | |
659ef4f0 | 170 | } |
171 | ||
172 | //_________________________________________________________________________________________________ | |
173 | void AliRsnCutPIDTPC::Print(const Option_t *) const | |
174 | { | |
175 | // | |
176 | // Print information on this cut | |
177 | // | |
178 | ||
2a1c7696 | 179 | AliInfo(Form("Cut name : %s", GetName())); |
180 | AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD)); | |
181 | AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax)); | |
182 | AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted"))); | |
659ef4f0 | 183 | } |