]>
Commit | Line | Data |
---|---|---|
2895972e | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //////////////////////////////////////////////////////////////////////////////// | |
17 | // | |
18 | // This class contains all code which is used to compute any of the values | |
19 | // which can be of interest within a resonance analysis. Besides the obvious | |
20 | // invariant mass, it allows to compute other utility values on all possible | |
21 | // targets, in order to allow a wide spectrum of binning and checks. | |
22 | // When needed, this object can also define a binning in the variable which | |
23 | // it is required to compute, which is used for initializing axes of output | |
24 | // histograms (see AliRsnFunction). | |
25 | // The value computation requires this object to be passed the object whose | |
26 | // informations will be used. This object can be of any allowed input type | |
27 | // (track, Daughter, event), then this class must inherit from AliRsnTarget. | |
28 | // Then, when value computation is attempted, a check on target type is done | |
29 | // and computation is successful only if expected target matches that of the | |
30 | // passed object. | |
31 | // In some cases, the value computation can require a support external object, | |
32 | // which must then be passed to this class. It can be of any type inheriting | |
33 | // from TObject. | |
34 | // | |
35 | // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
36 | // M. Vala (martin.vala@cern.ch) | |
37 | // | |
38 | //////////////////////////////////////////////////////////////////////////////// | |
39 | ||
b63357a0 | 40 | #include <Riostream.h> |
2895972e | 41 | #include "AliVVertex.h" |
42 | #include "AliMultiplicity.h" | |
43 | #include "AliESDtrackCuts.h" | |
44 | #include "AliESDpid.h" | |
45 | #include "AliAODPid.h" | |
46 | #include "AliCentrality.h" | |
47 | #include "AliESDUtils.h" | |
b63357a0 | 48 | #include "AliPIDResponse.h" |
2895972e | 49 | |
50 | #include "AliRsnEvent.h" | |
51 | #include "AliRsnDaughter.h" | |
52 | #include "AliRsnMother.h" | |
53 | #include "AliRsnDaughterDef.h" | |
54 | #include "AliRsnDaughterDef.h" | |
55 | ||
56 | #include "AliRsnValueDaughter.h" | |
57 | ||
58 | ClassImp(AliRsnValueDaughter) | |
59 | ||
60 | //_____________________________________________________________________________ | |
61 | AliRsnValueDaughter::AliRsnValueDaughter(const char *name, EType type) : | |
62 | AliRsnValue(name, AliRsnTarget::kDaughter), | |
63 | fType(type) | |
64 | { | |
65 | // | |
66 | // Constructor | |
67 | // | |
68 | } | |
69 | ||
70 | //_____________________________________________________________________________ | |
61f275d1 | 71 | AliRsnValueDaughter::AliRsnValueDaughter(const AliRsnValueDaughter ©) : |
2895972e | 72 | AliRsnValue(copy), |
73 | fType(copy.fType) | |
74 | { | |
75 | // | |
76 | // Copy constructor | |
77 | // | |
78 | } | |
79 | ||
80 | //_____________________________________________________________________________ | |
61f275d1 | 81 | AliRsnValueDaughter &AliRsnValueDaughter::operator=(const AliRsnValueDaughter ©) |
2895972e | 82 | { |
83 | // | |
84 | // Assignment operator. | |
85 | // Works like copy constructor. | |
86 | // | |
87 | ||
88 | AliRsnValue::operator=(copy); | |
e6f3a909 | 89 | if (this == ©) |
61f275d1 | 90 | return *this; |
2895972e | 91 | fType = copy.fType; |
61f275d1 | 92 | |
2895972e | 93 | return (*this); |
94 | } | |
95 | ||
96 | //_____________________________________________________________________________ | |
61f275d1 | 97 | const char *AliRsnValueDaughter::GetTypeName() const |
2895972e | 98 | { |
99 | // | |
100 | // This method returns a string to give a name to each possible | |
101 | // computation value. | |
102 | // | |
103 | ||
104 | switch (fType) { | |
b63357a0 | 105 | case kP: return "SingleTrackPtot"; |
106 | case kPt: return "SingleTrackPt"; | |
107 | case kPtpc: return "SingleTrackPtpc"; | |
108 | case kEta: return "SingleTrackEta"; | |
b154f736 | 109 | case kMass: return "SingleTrackMass"; |
b63357a0 | 110 | case kITSsignal: return "SingleTrackITSsignal"; |
111 | case kTPCsignal: return "SingleTrackTPCsignal"; | |
112 | case kTOFsignal: return "SingleTrackTOFsignal"; | |
52e6652d | 113 | case kTPCnsigmaPi: return "SingleTrackTPCnsigmaPion"; |
114 | case kTPCnsigmaK: return "SingleTrackTPCnsigmaKaon"; | |
115 | case kTPCnsigmaP: return "SingleTrackTPCnsigmaProton"; | |
b63357a0 | 116 | case kTOFnsigmaPi: return "SingleTrackTOFnsigmaPion"; |
117 | case kTOFnsigmaK: return "SingleTrackTOFnsigmaKaon"; | |
118 | case kTOFnsigmaP: return "SingleTrackTOFnsigmaProton"; | |
8ddd6d70 | 119 | case kCharge: return "SingleTrackCharge"; |
120 | case kPhi: return "SingleTrackPhi"; | |
121 | case kPhiOuterTPC: return "SingleTrackPhiOuterTPC"; | |
b63357a0 | 122 | default: return "Undefined"; |
2895972e | 123 | } |
124 | } | |
125 | ||
126 | //_____________________________________________________________________________ | |
127 | Bool_t AliRsnValueDaughter::Eval(TObject *object) | |
128 | { | |
129 | // | |
130 | // Evaluation of the required value. | |
131 | // Checks that the passed object is of the right type | |
132 | // and if this check is successful, computes the required value. | |
133 | // The output of the function tells if computing was successful, | |
134 | // and the values must be taken with GetValue(). | |
135 | // | |
61f275d1 | 136 | |
137 | // coherence check, which also casts object | |
2895972e | 138 | // to AliRsnTarget data members and returns kFALSE |
139 | // in case the object is NULL | |
140 | if (!TargetOK(object)) return kFALSE; | |
141 | ||
142 | // set a reference to the mother momentum | |
b63357a0 | 143 | AliVParticle *ref = fDaughter->GetRef(); |
144 | AliVParticle *refMC = fDaughter->GetRefMC(); | |
2895972e | 145 | AliVTrack *track = fDaughter->Ref2Vtrack(); |
b63357a0 | 146 | if (fUseMCInfo && !refMC) { |
147 | AliError("No MC"); | |
148 | return kFALSE; | |
149 | } | |
150 | if (!fUseMCInfo && !ref) { | |
151 | AliError("No DATA"); | |
152 | return kFALSE; | |
153 | } | |
61f275d1 | 154 | |
2895972e | 155 | // compute value depending on types in the enumeration |
156 | // if the type does not match any available choice, or if | |
157 | // the computation is not doable due to any problem | |
158 | // (not initialized support object, wrong values, risk of floating point errors) | |
159 | // the method returng kFALSE and sets the computed value to a meaningless number | |
160 | switch (fType) { | |
161 | case kP: | |
b63357a0 | 162 | fComputedValue = (fUseMCInfo ? refMC->P() : ref->P()); |
2895972e | 163 | return kTRUE; |
164 | case kPt: | |
b63357a0 | 165 | fComputedValue = (fUseMCInfo ? refMC->Pt() : ref->Pt()); |
2895972e | 166 | return kTRUE; |
167 | case kEta: | |
b63357a0 | 168 | fComputedValue = (fUseMCInfo ? refMC->Eta() : ref->Eta()); |
2895972e | 169 | return kTRUE; |
b154f736 | 170 | case kMass: |
e6952ec7 | 171 | fComputedValue = (fUseMCInfo ? refMC->M() : ref->M()); |
b154f736 | 172 | return kTRUE; |
2895972e | 173 | case kPtpc: |
174 | if (track) { | |
175 | fComputedValue = track->GetTPCmomentum(); | |
176 | return kTRUE; | |
177 | } else { | |
178 | AliWarning("Cannot get TPC momentum for non-track object"); | |
179 | fComputedValue = 0.0; | |
180 | return kFALSE; | |
181 | } | |
182 | case kITSsignal: | |
183 | if (track) { | |
184 | fComputedValue = track->GetITSsignal(); | |
185 | return kTRUE; | |
186 | } else { | |
187 | AliWarning("Cannot get ITS signal for non-track object"); | |
188 | fComputedValue = 0.0; | |
189 | return kFALSE; | |
190 | } | |
191 | case kTPCsignal: | |
192 | if (track) { | |
193 | fComputedValue = track->GetTPCsignal(); | |
194 | return kTRUE; | |
195 | } else { | |
196 | AliWarning("Cannot get TPC signal for non-track object"); | |
197 | fComputedValue = 0.0; | |
198 | return kFALSE; | |
199 | } | |
200 | case kTOFsignal: | |
201 | if (track) { | |
202 | fComputedValue = track->GetTOFsignal(); | |
203 | return kTRUE; | |
204 | } else { | |
205 | AliWarning("Cannot get TOF signal for non-track object"); | |
206 | fComputedValue = 0.0; | |
207 | return kFALSE; | |
208 | } | |
52e6652d | 209 | case kTPCnsigmaPi: |
210 | if (track) { | |
211 | AliPIDResponse *pid = fEvent->GetPIDResponse(); | |
212 | fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kPion); | |
213 | return kTRUE; | |
214 | } else { | |
215 | AliWarning("Cannot get TOF signal for non-track object"); | |
216 | fComputedValue = 0.0; | |
217 | return kFALSE; | |
218 | } | |
219 | case kTPCnsigmaK: | |
220 | if (track) { | |
221 | AliPIDResponse *pid = fEvent->GetPIDResponse(); | |
222 | fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kKaon); | |
223 | return kTRUE; | |
224 | } else { | |
225 | AliWarning("Cannot get TOF signal for non-track object"); | |
226 | fComputedValue = 0.0; | |
227 | return kFALSE; | |
228 | } | |
229 | case kTPCnsigmaP: | |
230 | if (track) { | |
231 | AliPIDResponse *pid = fEvent->GetPIDResponse(); | |
232 | fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kProton); | |
233 | return kTRUE; | |
234 | } else { | |
235 | AliWarning("Cannot get TOF signal for non-track object"); | |
236 | fComputedValue = 0.0; | |
237 | return kFALSE; | |
238 | } | |
b63357a0 | 239 | case kTOFnsigmaPi: |
240 | if (track) { | |
241 | AliPIDResponse *pid = fEvent->GetPIDResponse(); | |
242 | fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kPion); | |
243 | return kTRUE; | |
244 | } else { | |
245 | AliWarning("Cannot get TOF signal for non-track object"); | |
246 | fComputedValue = 0.0; | |
247 | return kFALSE; | |
248 | } | |
249 | case kTOFnsigmaK: | |
250 | if (track) { | |
251 | AliPIDResponse *pid = fEvent->GetPIDResponse(); | |
252 | fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kKaon); | |
253 | return kTRUE; | |
254 | } else { | |
255 | AliWarning("Cannot get TOF signal for non-track object"); | |
256 | fComputedValue = 0.0; | |
257 | return kFALSE; | |
258 | } | |
259 | case kTOFnsigmaP: | |
260 | if (track) { | |
261 | AliPIDResponse *pid = fEvent->GetPIDResponse(); | |
262 | fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kProton); | |
263 | return kTRUE; | |
264 | } else { | |
265 | AliWarning("Cannot get TOF signal for non-track object"); | |
266 | fComputedValue = 0.0; | |
267 | return kFALSE; | |
268 | } | |
a83bcf6e | 269 | case kNITSclusters: |
270 | if (track) { | |
e6952ec7 | 271 | AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track); |
272 | if (trackESD) { | |
273 | fComputedValue = trackESD->GetITSclusters(0); | |
274 | } else { | |
275 | fComputedValue = ((AliAODTrack *)track)->GetITSNcls(); | |
276 | } | |
a83bcf6e | 277 | return kTRUE; |
278 | } else { | |
279 | AliWarning("Cannot get n ITS clusters for non-track object"); | |
280 | fComputedValue = 0.0; | |
281 | return kFALSE; | |
282 | } | |
283 | case kNTPCclusters: | |
284 | if (track) { | |
e6952ec7 | 285 | AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track); |
286 | if (trackESD) { | |
287 | fComputedValue = trackESD->GetTPCclusters(0); | |
288 | } else { | |
289 | fComputedValue = ((AliAODTrack *)track)->GetTPCNcls(); | |
290 | } | |
a83bcf6e | 291 | return kTRUE; |
292 | } else { | |
293 | AliWarning("Cannot get n TPC clusters for non-track object"); | |
294 | fComputedValue = 0.0; | |
295 | return kFALSE; | |
296 | } | |
297 | case kITSchi2: | |
298 | if (track) { | |
e6952ec7 | 299 | AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track); |
300 | if (trackESD) { | |
301 | UShort_t nClustersITS = trackESD->GetITSclusters(0); | |
302 | fComputedValue = trackESD->GetITSchi2()/Float_t(nClustersITS); | |
303 | } else { | |
304 | fComputedValue = ((AliAODTrack *)track)->Chi2perNDF(); | |
305 | } | |
a83bcf6e | 306 | return kTRUE; |
307 | } else { | |
308 | AliWarning("Cannot get ITS chi^2 for non-track object"); | |
309 | fComputedValue = 0.0; | |
310 | return kFALSE; | |
311 | } | |
312 | case kTPCchi2: | |
313 | if (track) { | |
e6952ec7 | 314 | AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track); |
315 | if (trackESD) { | |
316 | UShort_t nClustersTPC = trackESD->GetTPCclusters(0); | |
317 | fComputedValue = trackESD->GetTPCchi2()/Float_t(nClustersTPC); | |
318 | } else { | |
319 | fComputedValue = ((AliAODTrack *)track)->Chi2perNDF(); | |
320 | } | |
a83bcf6e | 321 | return kTRUE; |
322 | } else { | |
323 | AliWarning("Cannot get TPC chi^2 for non-track object"); | |
324 | fComputedValue = 0.0; | |
325 | return kFALSE; | |
326 | } | |
3d0e1672 | 327 | case kDCAXY: |
328 | if (track) { | |
e6952ec7 | 329 | AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track); |
330 | if (trackESD) { | |
331 | Float_t b[2], bCov[3]; | |
332 | trackESD->GetImpactParameters(b, bCov); | |
333 | fComputedValue = b[0]; | |
334 | } else { | |
335 | Double_t b[2]= {-999,-999}, cov[3]; | |
336 | AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex(); | |
337 | if(vertex) { | |
338 | track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov); | |
339 | fComputedValue = b[0]; | |
340 | } else { | |
341 | fComputedValue = -999; | |
342 | } | |
343 | } | |
3d0e1672 | 344 | return kTRUE; |
345 | } else { | |
346 | AliWarning("Cannot get TPC chi^2 for non-track object"); | |
347 | fComputedValue = 0.0; | |
348 | return kFALSE; | |
349 | } | |
350 | case kDCAZ: | |
351 | if (track) { | |
e6952ec7 | 352 | AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track); |
353 | if (trackESD) { | |
354 | Float_t b[2], bCov[3]; | |
355 | trackESD->GetImpactParameters(b, bCov); | |
356 | fComputedValue = b[1]; | |
357 | } else { | |
358 | Double_t b[2]= {-999,-999}, cov[3]; | |
359 | AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex(); | |
360 | if(vertex) { | |
361 | track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov); | |
362 | fComputedValue = b[1]; | |
363 | } else { | |
364 | fComputedValue = -999; | |
365 | } | |
3d0e1672 | 366 | |
e6952ec7 | 367 | } |
3d0e1672 | 368 | return kTRUE; |
369 | } else { | |
370 | AliWarning("Cannot get TPC chi^2 for non-track object"); | |
371 | fComputedValue = 0.0; | |
372 | return kFALSE; | |
373 | } | |
8ddd6d70 | 374 | |
375 | case kCharge: | |
376 | fComputedValue = (fUseMCInfo ? refMC->Charge() : ref->Charge()); | |
377 | return kTRUE; | |
378 | ||
379 | case kPhi: | |
380 | fComputedValue = (fUseMCInfo ? (refMC->Phi()*TMath::RadToDeg()) : (ref->Phi()*TMath::RadToDeg())); | |
381 | return kTRUE; | |
382 | ||
383 | case kPhiOuterTPC: | |
384 | if (track) { | |
385 | Double_t pos[3]={0.,0.,0.}; | |
386 | Double_t phiOut = -999.0; | |
387 | Double_t radius = 278.;//TPC outer (vessel) = 278 cm, TOF radius (active surf.) = 378 cm; ref. PPR.1 | |
fcb14157 | 388 | AliExternalTrackParam etp; //thanks to Andrea and Cristina |
389 | etp.CopyFromVTrack(track); | |
390 | if(etp.GetXYZAt(radius, 5., pos)){ | |
8ddd6d70 | 391 | phiOut=TMath::ATan2(pos[1],pos[0])*TMath::RadToDeg(); |
392 | if (phiOut<0) phiOut+= (2*TMath::Pi()*TMath::RadToDeg()); | |
8ddd6d70 | 393 | } |
394 | fComputedValue = phiOut; | |
395 | } else { | |
396 | AliWarning("Cannot get phi at outer TPC radius for non-track object"); | |
fcb14157 | 397 | fComputedValue = -99.0; |
8ddd6d70 | 398 | return kFALSE; |
399 | } | |
400 | return kTRUE; | |
401 | ||
2895972e | 402 | default: |
403 | AliError(Form("[%s] Invalid value type for this computation", GetName())); | |
404 | return kFALSE; | |
405 | } | |
406 | } |