]>
Commit | Line | Data |
---|---|---|
2dab9030 | 1 | |
b9bbd271 | 2 | // |
3 | // Class AliRsnValue | |
4 | // | |
5 | // Definition of a single value which can be computed | |
6 | // from any of the defined input objects implemented | |
7 | // in the resonance package. | |
8 | // | |
9 | ||
d0282f3d | 10 | #include <Riostream.h> |
99261e24 | 11 | |
eaa44581 | 12 | #include "AliPID.h" |
32992791 | 13 | #include "AliESDtrackCuts.h" |
99261e24 | 14 | #include "AliESDpid.h" |
15 | #include "AliAODPid.h" | |
eaa44581 | 16 | #include "AliVEventHandler.h" |
17 | #include "AliInputEventHandler.h" | |
18 | #include "AliMultiInputEventHandler.h" | |
19 | #include "AliESDInputHandler.h" | |
20 | #include "AliAnalysisManager.h" | |
99261e24 | 21 | |
b9bbd271 | 22 | #include "AliRsnEvent.h" |
23 | #include "AliRsnDaughter.h" | |
2dab9030 | 24 | #include "AliRsnMother.h" |
b9bbd271 | 25 | #include "AliRsnPairDef.h" |
11ed73f6 | 26 | #include "AliRsnDaughterDef.h" |
b9bbd271 | 27 | |
28 | #include "AliRsnValue.h" | |
29 | ||
30 | ClassImp(AliRsnValue) | |
31 | ||
32 | //_____________________________________________________________________________ | |
2dab9030 | 33 | AliRsnValue::AliRsnValue() : |
2a1c7696 | 34 | AliRsnTarget(), |
35 | fComputedValue(0), | |
36 | fValueType(kValueTypes), | |
37 | fBinArray(0), | |
38 | fSupportObject(0x0) | |
2dab9030 | 39 | { |
40 | // | |
32992791 | 41 | // Default constructor without arguments. |
42 | // Initialize data members to meaningless values. | |
2a1c7696 | 43 | // This method is provided for ROOT streaming, |
32992791 | 44 | // but should never be used directly by a user. |
2dab9030 | 45 | // |
46 | } | |
47 | ||
48 | //_____________________________________________________________________________ | |
49 | AliRsnValue::AliRsnValue | |
0d73200d | 50 | (const char *name, EValueType type, Int_t nbins, Double_t min, Double_t max) : |
eaa44581 | 51 | AliRsnTarget(name, TargetType(type)), |
2a1c7696 | 52 | fComputedValue(0.0), |
53 | fValueType(type), | |
54 | fBinArray(0), | |
55 | fSupportObject(0x0) | |
b9bbd271 | 56 | { |
57 | // | |
32992791 | 58 | // Main constructor (version 1). |
59 | // This constructor defines in meaningful way all data members, | |
60 | // and defined a fixed binnings, subdividing the specified interval | |
61 | // into that many bins as specified in the integer argument. | |
62 | // --- | |
63 | // This method is also the entry point for all instances | |
64 | // of this class which don't need to do binning (e.g.: TNtuple inputs), | |
65 | // since arguments 3 to 5 have default values which don't create any | |
66 | // binning array, in order not to allocate memory when this is useless. | |
b9bbd271 | 67 | // |
2dab9030 | 68 | |
2a1c7696 | 69 | SetBins(nbins, min, max); |
2dab9030 | 70 | } |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | AliRsnValue::AliRsnValue | |
0d73200d | 74 | (const char *name, EValueType type, Double_t min, Double_t max, Double_t step) : |
eaa44581 | 75 | AliRsnTarget(name, TargetType(type)), |
2a1c7696 | 76 | fComputedValue(0.0), |
77 | fValueType(type), | |
78 | fBinArray(0), | |
79 | fSupportObject(0x0) | |
2dab9030 | 80 | { |
81 | // | |
32992791 | 82 | // Main constructor (version 2). |
83 | // This constructor defines in meaningful way all data members | |
84 | // and creates enough equal bins of the specified size to cover | |
85 | // the required interval. | |
2dab9030 | 86 | // |
87 | ||
2a1c7696 | 88 | SetBins(min, max, step); |
b9bbd271 | 89 | } |
90 | ||
91 | //_____________________________________________________________________________ | |
b2b08ca2 | 92 | AliRsnValue::AliRsnValue |
93 | (const char *name, EValueType type, Int_t nbins, Double_t *array) : | |
eaa44581 | 94 | AliRsnTarget(name, TargetType(type)), |
2a1c7696 | 95 | fComputedValue(0.0), |
96 | fValueType(type), | |
97 | fBinArray(0), | |
98 | fSupportObject(0x0) | |
b9bbd271 | 99 | { |
100 | // | |
32992791 | 101 | // Main constructor (version 3). |
102 | // This constructor defines in meaningful way all data members | |
103 | // and creates a set of variable bins delimited by the passed array. | |
b2b08ca2 | 104 | // |
105 | ||
2a1c7696 | 106 | SetBins(nbins, array); |
b9bbd271 | 107 | } |
108 | ||
109 | //_____________________________________________________________________________ | |
2a1c7696 | 110 | AliRsnValue::AliRsnValue(const AliRsnValue& copy) : |
111 | AliRsnTarget(copy), | |
112 | fComputedValue(copy.fComputedValue), | |
113 | fValueType(copy.fValueType), | |
114 | fBinArray(copy.fBinArray), | |
115 | fSupportObject(copy.fSupportObject) | |
52944696 | 116 | { |
117 | // | |
32992791 | 118 | // Copy constructor. |
119 | // Duplicates the binning array and copies all settings. | |
2a1c7696 | 120 | // Calls also the function that assigns properly the |
32992791 | 121 | // expected target, depending on the computation type. |
52944696 | 122 | // |
123 | } | |
124 | ||
125 | //_____________________________________________________________________________ | |
126 | AliRsnValue& AliRsnValue::operator=(const AliRsnValue& copy) | |
127 | { | |
128 | // | |
32992791 | 129 | // Assignment operator. |
130 | // Works like copy constructor. | |
52944696 | 131 | // |
132 | ||
2a1c7696 | 133 | AliRsnTarget::operator=(copy); |
134 | ||
135 | fComputedValue = copy.fComputedValue; | |
136 | fBinArray = copy.fBinArray; | |
137 | fSupportObject = copy.fSupportObject; | |
eaa44581 | 138 | fValueType = copy.fValueType; |
2a1c7696 | 139 | |
140 | return (*this); | |
52944696 | 141 | } |
142 | ||
143 | //_____________________________________________________________________________ | |
b2b08ca2 | 144 | void AliRsnValue::SetBins(Int_t nbins, Double_t min, Double_t max) |
b9bbd271 | 145 | { |
146 | // | |
b2b08ca2 | 147 | // Set binning for the axis in equally spaced bins |
148 | // where the number of bins, minimum and maximum are given. | |
149 | // | |
150 | ||
2a1c7696 | 151 | if (!nbins) { |
152 | fBinArray.Set(0); | |
153 | return; | |
154 | } | |
155 | ||
156 | fBinArray.Set(nbins + 1); | |
157 | ||
158 | Double_t mymax = TMath::Max(min, max); | |
159 | Double_t mymin = TMath::Min(min, max); | |
160 | ||
161 | Int_t k = 0; | |
162 | Double_t binSize = (mymax - mymin) / ((Double_t)nbins); | |
163 | ||
164 | fBinArray[0] = mymin; | |
165 | for (k = 1; k <= nbins; k++) fBinArray[k] = fBinArray[k - 1] + binSize; | |
2dab9030 | 166 | } |
167 | ||
168 | //_____________________________________________________________________________ | |
b2b08ca2 | 169 | void AliRsnValue::SetBins(Double_t min, Double_t max, Double_t step) |
2dab9030 | 170 | { |
171 | // | |
b2b08ca2 | 172 | // Set binning for the axis in equally spaced bins |
173 | // where the bin size, minimum and maximum are given. | |
2dab9030 | 174 | // |
175 | ||
2a1c7696 | 176 | Double_t dblNbins = TMath::Abs(max - min) / step; |
177 | Int_t intNbins = ((Int_t)dblNbins) + 1; | |
178 | ||
179 | SetBins(intNbins, min, max); | |
b9bbd271 | 180 | } |
181 | ||
182 | //_____________________________________________________________________________ | |
b2b08ca2 | 183 | void AliRsnValue::SetBins(Int_t nbins, Double_t *array) |
2dab9030 | 184 | { |
185 | // | |
b2b08ca2 | 186 | // Set binning for the axis in unequally spaced bins |
187 | // using the same way it is done in TAxis | |
2dab9030 | 188 | // |
189 | ||
2a1c7696 | 190 | if (!nbins) { |
191 | fBinArray.Set(0); | |
192 | return; | |
193 | } | |
194 | ||
195 | fBinArray.Adopt(nbins, array); | |
32992791 | 196 | } |
197 | ||
198 | //_____________________________________________________________________________ | |
199 | const char* AliRsnValue::GetValueTypeName() const | |
200 | { | |
201 | // | |
202 | // This method returns a string to give a name to each possible | |
203 | // computation value. | |
204 | // | |
2a1c7696 | 205 | |
206 | switch (fValueType) { | |
eaa44581 | 207 | case kTrackP: return "SingleTrackPtot"; |
208 | case kTrackPt: return "SingleTrackPt"; | |
209 | case kTrackEta: return "SingleTrackEta"; | |
210 | case kTrackY: return "SingleTrackRapidity"; | |
211 | case kTrackITSsignal: return "SingleTrackITSsignal"; | |
212 | case kTrackTPCsignal: return "SingleTrackTPCsignal"; | |
213 | case kTrackTOFsignal: return "SingleTrackTOFsignal"; | |
214 | case kTrackLength: return "SingleTrackLength"; | |
215 | case kPairP1: return "PairPtotDaughter1"; | |
216 | case kPairP2: return "PairPtotDaughter2"; | |
217 | case kPairP1t: return "PairPtDaughter1"; | |
218 | case kPairP2t: return "PairPtDaughter2"; | |
219 | case kPairP1z: return "PairPzDaughter1"; | |
220 | case kPairP2z: return "PairPzDaughter2"; | |
221 | case kPairInvMass: return "PairInvMass"; | |
222 | case kPairInvMassMC: return "PairInvMassMC"; | |
223 | case kPairInvMassRes: return "PairInvMassResolution"; | |
224 | case kPairPt: return "PairPt"; | |
225 | case kPairPz: return "PairPz"; | |
226 | case kPairEta: return "PairEta"; | |
227 | case kPairMt: return "PairMt"; | |
228 | case kPairY: return "PairY"; | |
229 | case kPairPhi: return "PairPhi"; | |
230 | case kPairPhiMC: return "PairPhiMC"; | |
231 | case kPairPtRatio: return "PairPtRatio"; | |
232 | case kPairDipAngle: return "PairDipAngle"; | |
233 | case kPairCosThetaStar: return "PairCosThetaStar"; | |
234 | case kPairQInv: return "PairQInv"; | |
235 | case kPairAngleToLeading: return "PairAngleToLeading"; | |
236 | case kEventLeadingPt: return "EventLeadingPt"; | |
237 | case kEventMult: return "EventMult"; | |
238 | case kEventMultESDCuts: return "EventMultESDCuts"; | |
239 | case kEventVz: return "EventVz"; | |
240 | default: return "Undefined"; | |
2a1c7696 | 241 | } |
32992791 | 242 | } |
243 | ||
2dab9030 | 244 | //_____________________________________________________________________________ |
32992791 | 245 | Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC) |
b9bbd271 | 246 | { |
247 | // | |
248 | // Evaluation of the required value. | |
249 | // Checks that the passed object is of the right type | |
32992791 | 250 | // and if this check is successful, computes the required value. |
251 | // The output of the function tells if computing was successful, | |
b9bbd271 | 252 | // and the values must be taken with GetValue(). |
253 | // | |
254 | ||
99261e24 | 255 | // coherence check |
256 | // (which also casts object to AliRsnTarget data members) | |
257 | if (!TargetOK(object)) return kFALSE; | |
258 | if (IsAllNull()) { | |
259 | AliError("TargetOK passed but all pointers are NULL"); | |
260 | return kFALSE; | |
261 | } | |
262 | ||
2a1c7696 | 263 | // cast the input to the allowed types |
99261e24 | 264 | AliRsnDaughter *daughter = fDaughter; |
265 | AliRsnMother *mother = fMother; | |
eaa44581 | 266 | AliRsnEvent *event = fgCurrentEvent; |
99261e24 | 267 | AliESDtrack *esdt = 0x0; |
268 | AliAODTrack *aodt = 0x0; | |
269 | ||
270 | // conditional initializations | |
271 | if (daughter) { | |
272 | esdt = daughter->GetRefESDtrack(); | |
273 | aodt = daughter->GetRefAODtrack(); | |
274 | } | |
2a1c7696 | 275 | |
276 | // common variables | |
277 | TLorentzVector pRec; // 4-momentum for single track or pair sum (reco) | |
278 | TLorentzVector pSim; // 4-momentum for single track or pair sum (MC) | |
279 | TLorentzVector pRec0; // 4-momentum of first daughter (reco) | |
280 | TLorentzVector pSim0; // 4-momentum of first daughter (MC) | |
281 | TLorentzVector pRec1; // 4-momentum of second daughter (reco) | |
282 | TLorentzVector pSim1; // 4-momentum of second daughter (MC) | |
283 | ||
284 | // check that the input object is the correct class type | |
285 | switch (fTargetType) { | |
286 | case AliRsnTarget::kDaughter: | |
99261e24 | 287 | pRec = daughter->Psim(); |
288 | pSim = daughter->Prec(); | |
2a1c7696 | 289 | break; |
290 | case AliRsnTarget::kMother: | |
99261e24 | 291 | pRec = mother->Sum(); |
292 | pSim = mother->SumMC(); | |
293 | pRec0 = mother->GetDaughter(0)->Prec(); | |
294 | pRec1 = mother->GetDaughter(1)->Prec(); | |
295 | pSim0 = mother->GetDaughter(0)->Psim(); | |
296 | pSim1 = mother->GetDaughter(1)->Psim(); | |
2a1c7696 | 297 | break; |
298 | case AliRsnTarget::kEvent: | |
eaa44581 | 299 | if (!event) { |
99261e24 | 300 | AliError(Form("[%s] current event not initialized", GetName())); |
2a1c7696 | 301 | return kFALSE; |
302 | } | |
303 | break; | |
304 | default: | |
305 | AliError(Form("[%s] Wrong type", GetName())); | |
306 | return kFALSE; | |
307 | } | |
308 | ||
309 | // cast the support object to the types which could be needed | |
99261e24 | 310 | AliESDtrackCuts *esdCuts = 0x0; |
311 | AliRsnPairDef *pairDef = 0x0; | |
312 | AliRsnDaughterDef *daughterDef = 0x0; | |
313 | AliESDpid *esdPID = 0x0; | |
314 | if (fSupportObject->InheritsFrom(AliESDtrackCuts ::Class())) esdCuts = static_cast<AliESDtrackCuts*>(fSupportObject); | |
315 | if (fSupportObject->InheritsFrom(AliRsnPairDef ::Class())) pairDef = static_cast<AliRsnPairDef*>(fSupportObject); | |
316 | if (fSupportObject->InheritsFrom(AliRsnDaughterDef::Class())) daughterDef = static_cast<AliRsnDaughterDef*>(fSupportObject); | |
eaa44581 | 317 | |
318 | // for retrieving the ESD pid it needs some more tricky operations | |
319 | // which consist in understanding if the default input event handler | |
320 | // is that which manages ESDs; if this is true take its ESDpid object | |
321 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
322 | AliVEventHandler *evh = mgr->GetInputEventHandler(); | |
323 | AliESDInputHandler *esdin = 0x0; | |
324 | if (evh->IsA() == AliMultiInputEventHandler::Class()) { | |
325 | AliMultiInputEventHandler *multh = static_cast<AliMultiInputEventHandler*>(evh); | |
326 | AliInputEventHandler *input = multh->GetFirstInputEventHandler(); | |
327 | if (input->IsA() == AliESDInputHandler::Class()) { | |
328 | esdin = static_cast<AliESDInputHandler*>(input); | |
329 | } | |
330 | } | |
331 | else if (evh->IsA() == AliESDInputHandler::Class()) { | |
332 | esdin = static_cast<AliESDInputHandler*>(evh); | |
333 | } | |
334 | // if it is initialized, get ESD pid | |
335 | if (esdin) { | |
336 | esdPID = esdin->GetESDpid(); | |
337 | } | |
338 | ||
2a1c7696 | 339 | // compute value depending on type |
340 | switch (fValueType) { | |
341 | case kTrackP: | |
342 | fComputedValue = useMC ? pSim.Mag() : pRec.Mag(); | |
343 | break; | |
344 | case kTrackPt: | |
345 | fComputedValue = useMC ? pSim.Perp() : pRec.Perp(); | |
346 | break; | |
347 | case kTrackEta: | |
348 | fComputedValue = useMC ? pSim.Eta() : pRec.Eta(); | |
349 | break; | |
11ed73f6 | 350 | case kTrackY: |
eaa44581 | 351 | // for this computation, an initialized daughterDef is required to get the mass hypothesis |
11ed73f6 | 352 | if (!daughterDef) { |
eaa44581 | 353 | AliError(Form("[%s] Required a correctly initialized AliRsnDaughterDef support object to compute this value", GetName())); |
354 | fComputedValue = fgkVeryBig; | |
11ed73f6 | 355 | return kFALSE; |
356 | } else { | |
357 | pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), daughterDef->GetMass()); | |
358 | pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), daughterDef->GetMass()); | |
359 | fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity(); | |
360 | } | |
361 | break; | |
99261e24 | 362 | case kTrackITSsignal: |
363 | if (esdt) { | |
364 | fComputedValue = esdt->GetITSsignal(); | |
365 | } | |
366 | else if (aodt) { | |
367 | AliAODPid *pidObj = aodt->GetDetPid(); | |
368 | if (pidObj) | |
369 | fComputedValue = pidObj->GetITSsignal(); | |
370 | else { | |
eaa44581 | 371 | fComputedValue = fgkVeryBig; |
99261e24 | 372 | return kFALSE; |
373 | } | |
374 | } | |
375 | else { | |
eaa44581 | 376 | fComputedValue = fgkVeryBig; |
99261e24 | 377 | return kFALSE; |
378 | } | |
379 | break; | |
380 | case kTrackTPCsignal: | |
381 | if (esdt) { | |
382 | fComputedValue = esdt->GetTPCsignal(); | |
383 | } | |
384 | else if (aodt) { | |
385 | AliAODPid *pidObj = aodt->GetDetPid(); | |
386 | if (pidObj) | |
387 | fComputedValue = pidObj->GetTPCsignal(); | |
388 | else { | |
eaa44581 | 389 | fComputedValue = fgkVeryBig; |
99261e24 | 390 | return kFALSE; |
391 | } | |
392 | } | |
393 | else { | |
eaa44581 | 394 | fComputedValue = fgkVeryBig; |
99261e24 | 395 | return kFALSE; |
396 | } | |
397 | break; | |
398 | case kTrackTOFsignal: | |
399 | if (esdt) { | |
400 | if (!esdPID) { | |
eaa44581 | 401 | AliError(Form("[%s] Required a correctly initialized AliESDpid support object to compute this value with ESDs", GetName())); |
402 | fComputedValue = fgkVeryBig; | |
99261e24 | 403 | return kFALSE; |
404 | } | |
405 | else | |
406 | fComputedValue = (esdt->GetTOFsignal() - esdPID->GetTOFResponse().GetStartTime(esdt->P())); | |
407 | } | |
408 | else if (aodt) { | |
409 | AliAODPid *pidObj = aodt->GetDetPid(); | |
410 | if (pidObj) | |
411 | fComputedValue = pidObj->GetTOFsignal(); | |
412 | else { | |
eaa44581 | 413 | fComputedValue = fgkVeryBig; |
99261e24 | 414 | return kFALSE; |
415 | } | |
416 | } | |
417 | else { | |
eaa44581 | 418 | fComputedValue = fgkVeryBig; |
99261e24 | 419 | return kFALSE; |
420 | } | |
421 | break; | |
422 | case kTrackLength: | |
423 | if (esdt) { | |
424 | fComputedValue = esdt->GetIntegratedLength(); | |
425 | } | |
426 | else { | |
427 | AliError(Form("[%s] Length information not available in AODs", GetName())); | |
eaa44581 | 428 | fComputedValue = fgkVeryBig; |
99261e24 | 429 | return kFALSE; |
430 | } | |
431 | break; | |
2a1c7696 | 432 | case kPairP1: |
433 | fComputedValue = useMC ? pSim0.Mag() : pRec0.Mag(); | |
434 | break; | |
435 | case kPairP2: | |
436 | fComputedValue = useMC ? pSim1.Mag() : pRec1.Mag(); | |
437 | break; | |
438 | case kPairP1t: | |
439 | fComputedValue = useMC ? pSim0.Perp() : pRec0.Perp(); | |
440 | break; | |
441 | case kPairP2t: | |
442 | fComputedValue = useMC ? pSim1.Perp() : pRec1.Perp(); | |
443 | break; | |
444 | case kPairP1z: | |
445 | fComputedValue = useMC ? pSim0.Z() : pRec0.Z(); | |
446 | break; | |
447 | case kPairP2z: | |
448 | fComputedValue = useMC ? pSim1.Z() : pRec1.Z(); | |
449 | break; | |
450 | case kPairInvMass: | |
451 | fComputedValue = useMC ? pSim.M() : pRec.M(); | |
452 | break; | |
453 | case kPairInvMassRes: | |
454 | fComputedValue = (pSim.M() - pRec.M()) / pSim.M(); | |
455 | break; | |
456 | case kPairPt: | |
457 | fComputedValue = useMC ? pSim.Perp() : pRec.Perp(); | |
458 | break; | |
459 | case kPairEta: | |
460 | fComputedValue = useMC ? pSim.Eta() : pRec.Eta(); | |
461 | break; | |
462 | case kPairMt: | |
eaa44581 | 463 | // for this computation, an initialized pairDef is required to get the mass |
2a1c7696 | 464 | if (!pairDef) { |
eaa44581 | 465 | AliError(Form("[%s] Required a correctly initialized AliRsnPairDef support object to compute this value", GetName())); |
466 | fComputedValue = fgkVeryBig; | |
2a1c7696 | 467 | return kFALSE; |
468 | } else { | |
469 | pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass()); | |
470 | pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass()); | |
471 | fComputedValue = useMC ? pSim.Mt() : pRec.Mt(); | |
472 | } | |
473 | break; | |
474 | case kPairY: | |
eaa44581 | 475 | // for this computation, an initialized pairDef is required to get the mass |
2a1c7696 | 476 | if (!pairDef) { |
eaa44581 | 477 | AliError(Form("[%s] Required a correctly initialized AliRsnPairDef support object to compute this value", GetName())); |
478 | fComputedValue = fgkVeryBig; | |
2a1c7696 | 479 | return kFALSE; |
480 | } else { | |
481 | pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass()); | |
482 | pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass()); | |
483 | fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity(); | |
484 | } | |
485 | break; | |
486 | case kPairPhi: | |
487 | fComputedValue = useMC ? pSim.Phi() : pRec.Phi(); | |
488 | break; | |
489 | case kPairPtRatio: | |
490 | if (useMC) { | |
491 | fComputedValue = TMath::Abs(pSim0.Perp() - pSim1.Perp()); | |
492 | fComputedValue /= TMath::Abs(pSim0.Perp() + pSim1.Perp()); | |
493 | } else { | |
494 | fComputedValue = TMath::Abs(pRec0.Perp() - pRec1.Perp()); | |
495 | fComputedValue /= TMath::Abs(pRec0.Perp() + pRec1.Perp()); | |
496 | } | |
497 | break; | |
498 | case kPairDipAngle: | |
eaa44581 | 499 | if (useMC) { |
500 | fComputedValue = pSim0.Perp() * pSim1.Perp() + pSim0.Z() * pSim1.Z(); | |
501 | fComputedValue /= pSim0.Mag() * pSim1.Mag(); | |
502 | } else { | |
503 | fComputedValue = pRec0.Perp() * pRec1.Perp() + pRec0.Z() * pRec1.Z(); | |
504 | fComputedValue /= pRec0.Mag() * pRec1.Mag(); | |
505 | } | |
506 | fComputedValue = TMath::Abs(TMath::ACos(fComputedValue)); | |
2a1c7696 | 507 | break; |
508 | case kPairCosThetaStar: | |
509 | fComputedValue = mother->CosThetaStar(useMC); | |
510 | break; | |
511 | case kPairQInv: | |
512 | pSim0 -= pSim1; | |
513 | pRec0 -= pRec1; | |
514 | fComputedValue = useMC ? pSim0.M() : pRec0.M(); | |
515 | break; | |
eaa44581 | 516 | case kPairAngleToLeading: |
517 | { | |
518 | int ID1 = (mother->GetDaughter(0))->GetID(); | |
519 | int ID2 = (mother->GetDaughter(1))->GetID(); | |
520 | //int leadingID = event->SelectLeadingParticle(0); | |
521 | Int_t leadingID = event->GetLeadingParticleID(); | |
522 | if (leadingID == ID1 || leadingID == ID2) { | |
523 | fComputedValue = -99.; | |
524 | return kFALSE; | |
525 | } | |
526 | AliRsnDaughter leadingPart = event->GetDaughter(leadingID); | |
527 | AliVParticle *ref = leadingPart.GetRef(); | |
528 | fComputedValue = ref->Phi() - mother->Sum().Phi(); | |
529 | //return angle w.r.t. leading particle in the range -pi/2, 3/2pi | |
530 | while (fComputedValue >= 1.5 * TMath::Pi()) fComputedValue -= 2 * TMath::Pi(); | |
531 | while (fComputedValue < -0.5 * TMath::Pi()) fComputedValue += 2 * TMath::Pi(); | |
9c4aeffd | 532 | } |
eaa44581 | 533 | break; |
2a1c7696 | 534 | case kEventMult: |
eaa44581 | 535 | fComputedValue = (Double_t)event->GetMultiplicity(0x0); |
2a1c7696 | 536 | break; |
537 | case kEventMultESDCuts: | |
538 | // this value requires an initialized ESDtrackCuts | |
539 | if (!esdCuts) { | |
eaa44581 | 540 | AliError(Form("[%s] Required a correctly initialized AliESDtrackCuts support object to compute this value", GetName())); |
541 | fComputedValue = fgkVeryBig; | |
2a1c7696 | 542 | return kFALSE; |
543 | } | |
eaa44581 | 544 | fComputedValue = (Double_t)event->GetMultiplicity(esdCuts); |
545 | break; | |
546 | case kEventLeadingPt: | |
547 | { | |
548 | int leadingID = event->GetLeadingParticleID(); //fEvent->SelectLeadingParticle(0); | |
549 | if (leadingID >= 0) { | |
550 | AliRsnDaughter leadingPart = event->GetDaughter(leadingID); | |
551 | AliVParticle *ref = leadingPart.GetRef(); | |
552 | fComputedValue = ref->Pt(); | |
553 | } else fComputedValue = 0; | |
554 | } | |
555 | break; | |
2a1c7696 | 556 | case kEventVz: |
eaa44581 | 557 | fComputedValue = event->GetRef()->GetPrimaryVertex()->GetZ(); |
2a1c7696 | 558 | break; |
559 | default: | |
560 | AliError(Form("[%s] Invalid value type for this computation", GetName())); | |
561 | return kFALSE; | |
562 | } | |
563 | ||
564 | return kTRUE; | |
b9bbd271 | 565 | } |
c18b1218 | 566 | |
69fbb331 | 567 | //_____________________________________________________________________________ |
32992791 | 568 | void AliRsnValue::Print(Option_t * /*option */) const |
69fbb331 | 569 | { |
570 | // | |
32992791 | 571 | // Print informations about this object |
69fbb331 | 572 | // |
573 | ||
2a1c7696 | 574 | AliInfo("=== VALUE INFO ================================================="); |
575 | AliInfo(Form(" Name : %s", GetName())); | |
576 | AliInfo(Form(" Type : %s", GetValueTypeName())); | |
577 | AliInfo(Form(" Current computed value: %f", fComputedValue)); | |
578 | Int_t i; | |
579 | for (i = 0; i < fBinArray.GetSize(); i++) { | |
580 | AliInfo(Form(" Bin limit #%d = %f", i, fBinArray[i])); | |
581 | } | |
582 | AliInfo(Form(" Support object : %s", (fSupportObject ? fSupportObject->ClassName() : " NO SUPPORT"))); | |
583 | AliInfo("=== END VALUE INFO ============================================="); | |
c18b1218 | 584 | } |
eaa44581 | 585 | |
586 | //_____________________________________________________________________________ | |
587 | RSNTARGET AliRsnValue::TargetType(EValueType type) | |
588 | { | |
589 | // | |
590 | // This method assigns the target to be expected by this object | |
591 | // in the computation, depending on its type chosen in the enum. | |
592 | // | |
593 | ||
594 | if (type < kTrackValues) | |
595 | return AliRsnTarget::kDaughter; | |
596 | else if (type < kPairValues) | |
597 | return AliRsnTarget::kMother; | |
598 | else | |
599 | return AliRsnTarget::kEvent; | |
600 | } |