]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/AliRsnValueStd.cxx
edit to output container arg list from Claude
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnValueStd.cxx
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, pair, 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
40 #include "AliESDtrackCuts.h"
41 #include "AliESDpid.h"
42 #include "AliAODPid.h"
43 #include "AliCentrality.h"
44
45 #include "AliRsnEvent.h"
46 #include "AliRsnDaughter.h"
47 #include "AliRsnMother.h"
48 #include "AliRsnPairDef.h"
49 #include "AliRsnDaughterDef.h"
50
51 #include "AliRsnValueStd.h"
52
53 ClassImp(AliRsnValueStd)
54
55 //_____________________________________________________________________________
56 AliRsnValueStd::AliRsnValueStd() :
57    AliRsnValue(),
58    fValueType(kValueTypes),
59    fSupportObject(0x0)
60 {
61 //
62 // Default constructor without arguments.
63 // Initialize data members to meaningless values.
64 // This method is provided for ROOT streaming,
65 // but should never be used directly by a user.
66 //
67 }
68
69 //_____________________________________________________________________________
70 AliRsnValueStd::AliRsnValueStd
71 (const char *name, EValueType type, Int_t nbins, Double_t min, Double_t max) :
72    AliRsnValue(name),
73    fValueType(type),
74    fSupportObject(0x0)
75 {
76 //
77 // Main constructor (version 1).
78 // This constructor defines in meaningful way all data members,
79 // and defined a fixed binnings, subdividing the specified interval
80 // into that many bins as specified in the integer argument.
81 // ---
82 // This method is also the entry point for all instances
83 // of this class which don't need to do binning (e.g.: TNtuple inputs),
84 // since arguments 3 to 5 have default values which don't create any
85 // binning array, in order not to allocate memory when this is useless.
86 //
87
88    SetTargetType(TargetType(type));
89    SetBins(nbins, min, max);
90 }
91
92 //_____________________________________________________________________________
93 AliRsnValueStd::AliRsnValueStd
94 (const char *name, EValueType type, Double_t min, Double_t max, Double_t step) :
95    AliRsnValue(name),
96    fValueType(type),
97    fSupportObject(0x0)
98 {
99 //
100 // Main constructor (version 2).
101 // This constructor defines in meaningful way all data members
102 // and creates enough equal bins of the specified size to cover
103 // the required interval.
104 //
105
106    SetTargetType(TargetType(type));
107    SetBins(min, max, step);
108 }
109
110 //_____________________________________________________________________________
111 AliRsnValueStd::AliRsnValueStd
112 (const char *name, EValueType type, Int_t nbins, Double_t *array) :
113    AliRsnValue(name),
114    fValueType(type),
115    fSupportObject(0x0)
116 {
117 //
118 // Main constructor (version 3).
119 // This constructor defines in meaningful way all data members
120 // and creates a set of variable bins delimited by the passed array.
121 //
122
123    SetTargetType(TargetType(type));
124    SetBins(nbins, array);
125 }
126
127 //_____________________________________________________________________________
128 AliRsnValueStd::AliRsnValueStd(const AliRsnValueStd &copy) :
129    AliRsnValue(copy),
130    fValueType(copy.fValueType),
131    fSupportObject(copy.fSupportObject)
132 {
133 //
134 // Copy constructor.
135 // Duplicates the binning array and copies all settings.
136 //
137 }
138
139 //_____________________________________________________________________________
140 AliRsnValueStd &AliRsnValueStd::operator=(const AliRsnValueStd &copy)
141 {
142 //
143 // Assignment operator.
144 // Works like copy constructor.
145 //
146
147    AliRsnValue::operator=(copy);
148    if (this == &copy)
149       return *this;
150    fSupportObject = copy.fSupportObject;
151    fValueType = copy.fValueType;
152
153    return (*this);
154 }
155
156 //_____________________________________________________________________________
157 const char *AliRsnValueStd::GetValueTypeName() const
158 {
159 //
160 // This method returns a string to give a name to each possible
161 // computation value.
162 //
163
164    switch (fValueType) {
165       case kTrackP:               return "SingleTrackPtot";
166       case kTrackPt:              return "SingleTrackPt";
167       case kTrackPtpc:            return "SingleTrackPtpc";
168       case kTrackEta:             return "SingleTrackEta";
169       case kTrackY:               return "SingleTrackRapidity";
170       case kTrackITSsignal:       return "SingleTrackITSsignal";
171       case kTrackTPCsignal:       return "SingleTrackTPCsignal";
172       case kTrackTOFsignal:       return "SingleTrackTOFsignal";
173       case kTrackTOFbeta:         return "SingleTrackTOFbeta";
174       case kTrackLength:          return "SingleTrackLength";
175
176       case kPairP1:               return "PairPtotDaughter1";
177       case kPairP2:               return "PairPtotDaughter2";
178       case kPairP1t:              return "PairPtDaughter1";
179       case kPairP2t:              return "PairPtDaughter2";
180       case kPairP1z:              return "PairPzDaughter1";
181       case kPairP2z:              return "PairPzDaughter2";
182       case kPairInvMass:          return "PairInvMass";
183       case kPairInvMassMC:        return "PairInvMassMC";
184       case kPairInvMassRes:       return "PairInvMassResolution";
185       case kPairPt:               return "PairPt";
186       case kPairPz:               return "PairPz";
187       case kPairEta:              return "PairEta";
188       case kPairMt:               return "PairMt";
189       case kPairY:                return "PairY";
190       case kPairPhi:              return "PairPhi";
191       case kPairPhiMC:            return "PairPhiMC";
192       case kPairPtRatio:          return "PairPtRatio";
193       case kPairDipAngle:         return "PairDipAngle";
194       case kPairCosThetaStar:     return "PairCosThetaStar";
195       case kPairQInv:             return "PairQInv";
196       case kPairAngleToLeading:   return "PairAngleToLeading";
197
198       case kEventLeadingPt:       return "EventLeadingPt";
199       case kEventMult:            return "EventMult";
200       case kEventMultMC:          return "EventMultMC";
201       case kEventMultESDCuts:     return "EventMultESDCuts";
202       case kEventMultSPD:         return "EventMultSPD";
203       case kEventVz:              return "EventVz";
204       case kEventCentralityV0:    return "EventCentralityV0";
205       case kEventCentralityTrack: return "EventCentralityTrack";
206       case kEventCentralityCL1:   return "EventCentralityCL1";
207       default:                    return "Undefined";
208    }
209 }
210
211 //_____________________________________________________________________________
212 Bool_t AliRsnValueStd::Eval(TObject *object, Bool_t useMC)
213 {
214 //
215 // Evaluation of the required value.
216 // Checks that the passed object is of the right type
217 // and if this check is successful, computes the required value.
218 // The output of the function tells if computing was successful,
219 // and the values must be taken with GetValue().
220 //
221
222    // utility variables
223    Bool_t         success;
224    const Double_t fgkVeryBig = 1E20;
225    Double_t       time;
226    Int_t          leadingID = -1;
227    ULong_t        status = 0x0;
228
229    // coherence check, which also casts object
230    // to AliRsnTarget data members and returns kFALSE
231    // in case the object is NULL
232    if (!TargetOK(object)) return kFALSE;
233
234    // these variables are initialized
235    // from the target object, once it
236    // is casted to one of the expected
237    // types (daughter/mother/event)
238    // -- not all are initialized always
239    TLorentzVector pRec;          // 4-momentum for single track or pair sum (reco)
240    TLorentzVector pSim;          // 4-momentum for single track or pair sum (MC)
241    TLorentzVector pRec0;         // 4-momentum of first daughter (reco)
242    TLorentzVector pSim0;         // 4-momentum of first daughter (MC)
243    TLorentzVector pRec1;         // 4-momentum of second daughter (reco)
244    TLorentzVector pSim1;         // 4-momentum of second daughter (MC)
245    AliESDEvent   *esdev  = 0x0;  // reference ESD event
246    AliAODEvent   *aodev  = 0x0;  // reference AOD event
247    AliESDtrack   *esdt   = 0x0;  // reference ESD track
248    AliAODTrack   *aodt   = 0x0;  // reference AOD track
249    AliAODPid     *pidObj = 0x0;  // reference AOD PID object
250
251    // initialize the above 4-vectors according to the
252    // expected target type (which has been checked above)
253    // in particular, the 'fEvent' data member of base AliRsnTarget
254    // will be *always* well initialized if the TargetOK() returns kTRUE
255    switch (fTargetType) {
256       case AliRsnTarget::kDaughter:
257          pRec = fDaughter->Prec();
258          pSim = fDaughter->Psim();
259          esdt = fDaughter->GetRefESDtrack();
260          aodt = fDaughter->GetRefAODtrack();
261          if (aodt) pidObj = aodt->GetDetPid();
262          break;
263       case AliRsnTarget::kMother:
264          pRec  = fMother->Sum();
265          pSim  = fMother->SumMC();
266          pRec0 = fMother->GetDaughter(0)->Prec();
267          pRec1 = fMother->GetDaughter(1)->Prec();
268          pSim0 = fMother->GetDaughter(0)->Psim();
269          pSim1 = fMother->GetDaughter(1)->Psim();
270          break;
271       case AliRsnTarget::kEvent:
272          break;
273       default:
274          AliError(Form("[%s] Wrong type", GetName()));
275          return kFALSE;
276    }
277    leadingID = fEvent->GetLeadingParticleID();
278    esdev = fEvent->GetRefESD();
279    aodev = fEvent->GetRefAOD();
280
281    // if leading index is negative, assume that leading particle was not searched
282    // and then searches for it
283    if (leadingID < 0) {
284       fEvent->SelectLeadingParticle();
285       leadingID = fEvent->GetLeadingParticleID();
286    }
287
288    if (esdt) status = esdt->GetStatus();
289    if (aodt) status = aodt->GetStatus();
290
291    // these objects are all types of supports
292    // which could be needed for some values
293    AliRsnPairDef     *pairDef     = 0x0;
294    AliRsnDaughterDef *daughterDef = 0x0;
295    AliESDpid         *esdPID      = 0x0;
296    if (fSupportObject) {
297       if (fSupportObject->InheritsFrom(AliRsnPairDef    ::Class())) pairDef     = static_cast<AliRsnPairDef *>(fSupportObject);
298       if (fSupportObject->InheritsFrom(AliRsnDaughterDef::Class())) daughterDef = static_cast<AliRsnDaughterDef *>(fSupportObject);
299       if (fSupportObject->InheritsFrom(AliESDpid        ::Class())) esdPID      = static_cast<AliESDpid *>(fSupportObject);
300    }
301
302    // compute value depending on types in the enumeration
303    // if the type does not match any available choice, or if
304    // the computation is not doable due to any problem
305    // (not initialized support object, wrong values, risk of floating point errors)
306    // the method returng kFALSE and sets the computed value to a meaningless number
307    switch (fValueType) {
308       case kTrackP:
309          // single track:
310          // total momentum
311          fComputedValue = useMC ? pSim.Vect().Mag() : pRec.Vect().Mag();
312          return kTRUE;
313       case kTrackPt:
314          // single track:
315          // transverse momentum
316          fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
317          return kTRUE;
318       case kTrackPtpc:
319          // single track:
320          // transverse momentum
321          if (esdt) {
322             if (esdt->GetInnerParam()) {
323                fComputedValue = esdt->GetInnerParam()->P();
324                return kTRUE;
325             } else {
326                AliError(Form("[%s] TPC inner param is not initialized", GetName()));
327                return kFALSE;
328             }
329          }
330          else if (aodt && pidObj) {
331             fComputedValue = pidObj->GetTPCmomentum();
332             return kTRUE;
333          } else {
334             AliError(Form("[%s] Cannot retrieve TPC momentum", GetName()));
335             return kFALSE;
336          }
337       case kTrackEta:
338          // single track:
339          // pseudo-rapidity
340          fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
341          return kTRUE;
342       case kTrackY:
343          // single track:
344          // rapidity (requires an AliRsnDaughterDef support)
345          if (daughterDef) {
346             pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), daughterDef->GetMass());
347             pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), daughterDef->GetMass());
348             fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity();
349             return kTRUE;
350          }
351          else {
352             AliError(Form("[%s] Required a correctly initialized AliRsnDaughterDef support object to compute this value", GetName()));
353             fComputedValue = fgkVeryBig;
354             return kFALSE;
355          }
356       case kTrackITSsignal:
357          // single track:
358          // ITS signal (successful only for tracks)
359          // works only if the status is OK
360          if ((status & AliESDtrack::kITSin) == 0) {
361             AliDebug(AliLog::kDebug + 2, "Rejecting non-ITS track");
362             return kFALSE;
363          }
364          if (esdt) {
365             fComputedValue = esdt->GetITSsignal();
366             return kTRUE;
367          }
368          else if (aodt && pidObj) {
369             fComputedValue = pidObj->GetITSsignal();
370             return kTRUE;
371          }
372          else {
373             AliError(Form("[%s] Detector signals can be computed only on reconstructed tracks", GetName()));
374             fComputedValue = fgkVeryBig;
375             return kFALSE;
376          }
377       case kTrackTPCsignal:
378          // single track:
379          // TPC signal (successful only for tracks)
380          // works only if the status is OK
381          if ((status & AliESDtrack::kTPCin) == 0) {
382             AliDebug(AliLog::kDebug + 2, "Rejecting non-TPC track");
383             return kFALSE;
384          }
385          if (esdt) {
386             fComputedValue = esdt->GetTPCsignal();
387             return kTRUE;
388          }
389          else if (aodt && pidObj) {
390             fComputedValue = pidObj->GetTPCsignal();
391             return kTRUE;
392          }
393          else {
394             AliError(Form("[%s] Detector signals can be computed only on reconstructed tracks", GetName()));
395             fComputedValue = fgkVeryBig;
396             return kFALSE;
397          }
398       case kTrackTOFsignal:
399          // single track:
400          // TOF signal (successful only for tracks, for ESD requires an AliESDpid support)
401          // works only if the status is OK
402          if ((status & AliESDtrack::kTOFout) == 0 || (status & AliESDtrack::kTIME) == 0) {
403             AliDebug(AliLog::kDebug + 2, "Rejecting non-TOF track");
404             return kFALSE;
405          }
406          if (esdt) {
407             if (!esdPID || !esdev) {
408                AliError(Form("[%s] Required a correctly initialized AliRsnEvent and AliESDpid support object to compute this value with ESDs", GetName()));
409                fComputedValue = fgkVeryBig;
410                return kFALSE;
411             }
412             else {
413                esdPID->SetTOFResponse(esdev, AliESDpid::kTOF_T0);
414                fComputedValue = (esdt->GetTOFsignal() - esdPID->GetTOFResponse().GetStartTime(esdt->P()));
415                return kTRUE;
416             }
417          }
418          else if (aodt && pidObj) {
419             fComputedValue = pidObj->GetTOFsignal();
420             return kTRUE;
421          }
422          else {
423             AliError(Form("[%s] Detector signals can be computed only on reconstructed tracks", GetName()));
424             fComputedValue = fgkVeryBig;
425             return kFALSE;
426          }
427       case kTrackTOFbeta:
428          // single track:
429          // TOF beta (successful only for tracks, for ESD requires an AliESDpid support)
430          if (esdt) {
431             if (!esdPID) {
432                AliError(Form("[%s] Required a correctly initialized AliESDpid support object to compute this value with ESDs", GetName()));
433                fComputedValue = fgkVeryBig;
434                return kFALSE;
435             }
436             else if (!esdev) {
437                AliError(Form("[%s] Required a correctly initialized AliESDEvent to compute this value with ESDs", GetName()));
438                fComputedValue = fgkVeryBig;
439                return kFALSE;
440             }
441             else {
442                esdPID->SetTOFResponse(esdev, AliESDpid::kTOF_T0);
443                fComputedValue = esdt->GetIntegratedLength();
444                time = (esdt->GetTOFsignal() - esdPID->GetTOFResponse().GetStartTime(esdt->P()));
445                if (time > 0.0) {
446                   fComputedValue /= time;
447                   fComputedValue /= 2.99792458E-2;
448                   return kTRUE;
449                } else {
450                   fComputedValue = fgkVeryBig;
451                   return kFALSE;
452                }
453             }
454          }
455          else {
456             AliError(Form("[%s] Length information not available in AODs", GetName()));
457             fComputedValue = fgkVeryBig;
458             return kFALSE;
459          }
460       case kTrackLength:
461          // single tracks:
462          // integrated length (computed only on ESDs)
463          if (esdt) {
464             fComputedValue = esdt->GetIntegratedLength();
465             return kTRUE;
466          }
467          else {
468             AliError(Form("[%s] Length information not available in AODs", GetName()));
469             fComputedValue = fgkVeryBig;
470             return kFALSE;
471          }
472          //---------------------------------------------------------------------------------------------------------------------
473       case kPairP1:
474          // pair:
475          // momentum of first daughter (which matches definition #1 in pairDef)
476          fComputedValue = useMC ? pSim0.Mag() : pRec0.Mag();
477          return kTRUE;
478       case kPairP2:
479          // pair:
480          // momentum of second daughter (which matches definition #2 in pairDef)
481          fComputedValue = useMC ? pSim1.Mag() : pRec1.Mag();
482          return kTRUE;
483       case kPairP1t:
484          // pair:
485          // transverse momentum of first daughter
486          fComputedValue = useMC ? pSim0.Perp() : pRec0.Perp();
487          return kTRUE;
488       case kPairP2t:
489          // pair:
490          // transverse momentum of second daughter
491          fComputedValue = useMC ? pSim1.Perp() : pRec1.Perp();
492          return kTRUE;
493       case kPairP1z:
494          // pair:
495          // longitudinal momentum of first daughter
496          fComputedValue = useMC ? pSim0.Z() : pRec0.Z();
497          return kTRUE;
498       case kPairP2z:
499          // pair:
500          // longitudinal momentum of second daughter
501          fComputedValue = useMC ? pSim1.Z() : pRec1.Z();
502          return kTRUE;
503       case kPairInvMass:
504          // pair:
505          // invariant mass
506          fComputedValue = useMC ? pSim.M() : pRec.M();
507          return kTRUE;
508       case kPairInvMassRes:
509          // pair:
510          // invariant mass resolution (requires MC)
511          if (TMath::Abs(pSim.M()) > 0.0) {
512             fComputedValue = (pSim.M() - pRec.M()) / pSim.M();
513             return kTRUE;
514          }
515          else {
516             AliError(Form("[%s] Caught a null MC mass", GetName()));
517             return kFALSE;
518          }
519       case kPairPt:
520          // pair:
521          // total transverse momentum
522          fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
523          return kTRUE;
524       case kPairEta:
525          // pair:
526          // pseudo-rapidiry
527          fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
528          return kTRUE;
529       case kPairMt:
530          // pair:
531          // transverse mass (requires an AliRsnPairDef to get mass hypothesis)
532          if (pairDef) {
533             pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
534             pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
535             fComputedValue = useMC ? pSim.Mt() : pRec.Mt();
536             return kTRUE;
537          }
538          else {
539             AliError(Form("[%s] Required a correctly initialized AliRsnPairDef support object to compute this value", GetName()));
540             fComputedValue = fgkVeryBig;
541             return kFALSE;
542          }
543       case kPairY:
544          // pair:
545          // rapidity (requires an AliRsnPairDef to get mass hypothesis)
546          if (pairDef) {
547             pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
548             pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
549             fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity();
550             return kTRUE;
551          }
552          else {
553             AliError(Form("[%s] Required a correctly initialized AliRsnPairDef support object to compute this value", GetName()));
554             fComputedValue = fgkVeryBig;
555             return kFALSE;
556          }
557       case kPairPhi:
558          // pair:
559          // phi angle of total momentum
560          fComputedValue = useMC ? pSim.Phi() : pRec.Phi();
561          return kTRUE;
562       case kPairPtRatio:
563          // pair:
564          // ratio of relative sum and difference of daughter transverse momenta
565          if (useMC) {
566             fComputedValue  = TMath::Abs(pSim0.Perp() - pSim1.Perp());
567             fComputedValue /= TMath::Abs(pSim0.Perp() + pSim1.Perp());
568          } else {
569             fComputedValue  = TMath::Abs(pRec0.Perp() - pRec1.Perp());
570             fComputedValue /= TMath::Abs(pRec0.Perp() + pRec1.Perp());
571          }
572          return kTRUE;
573       case kPairDipAngle:
574          // pair:
575          // dip-angle in the transverse-Z plane
576          // (used to check conversion electrons)
577          if (useMC) {
578             fComputedValue  = pSim0.Perp() * pSim1.Perp() + pSim0.Z() * pSim1.Z();
579             fComputedValue /= pSim0.Mag() * pSim1.Mag();
580          } else {
581             fComputedValue  = pRec0.Perp() * pRec1.Perp() + pRec0.Z() * pRec1.Z();
582             fComputedValue /= pRec0.Mag() * pRec1.Mag();
583          }
584          fComputedValue = TMath::Abs(TMath::ACos(fComputedValue));
585          return kTRUE;
586       case kPairCosThetaStar:
587          // pair:
588          // cosine of theta star angle
589          // (= angle of first daughter to the total momentum, in resonance rest frame)
590          fComputedValue = fMother->CosThetaStar(useMC);
591          return kTRUE;
592       case kPairQInv:
593          // pair:
594          // Q-invariant
595          pSim0 -= pSim1;
596          pRec0 -= pRec1;
597          fComputedValue = useMC ? pSim0.M() : pRec0.M();
598          return kTRUE;
599       case kPairAngleToLeading:
600          // pair:
601          // angle w.r. to leading particle (if any)
602          fComputedValue = fMother->AngleToLeading(success);
603          return success;
604          //---------------------------------------------------------------------------------------------------------------------
605       case kEventMult:
606          // event:
607          // multiplicity of tracks
608          fComputedValue = (Double_t)fEvent->GetMultiplicityFromTracks();
609          return (fComputedValue >= 0);
610       case kEventMultMC:
611          // event:
612          // multiplicity of MC tracks
613          fComputedValue = (Double_t)fEvent->GetMultiplicityFromMC();
614          return (fComputedValue >= 0);
615       case kEventMultESDCuts:
616          // event:
617          // multiplicity of good quality tracks
618          fComputedValue = fEvent->GetMultiplicityFromESDCuts();
619          return (fComputedValue >= 0);
620       case kEventMultSPD:
621          // event:
622          // multiplicity of good quality tracks
623          fComputedValue = fEvent->GetMultiplicityFromSPD();
624          return (fComputedValue >= 0);
625       case kEventLeadingPt:
626          // event:
627          // transverse momentum of leading particle
628          if (leadingID >= 0) {
629             AliRsnDaughter leadingPart = fEvent->GetDaughter(leadingID);
630             AliVParticle *ref = leadingPart.GetRef();
631             fComputedValue = ref->Pt();
632             return kTRUE;
633          } else {
634             AliError(Form("[%s] Leading ID has bad value (%d)", GetName(), leadingID));
635             return kFALSE;
636          }
637       case kEventVz:
638          // event:
639          // Z position of primary vertex
640          fComputedValue = fEvent->GetRef()->GetPrimaryVertex()->GetZ();
641          return kTRUE;
642       case kEventCentralityV0:
643          // event:
644          // centrality using V0 method
645          if (esdev) {
646             AliCentrality *centrality = esdev->GetCentrality();
647             fComputedValue = centrality->GetCentralityPercentile("V0M");
648             return kTRUE;
649          } else if (aodev) {
650             AliCentrality *centrality = aodev->GetCentrality();
651             fComputedValue = centrality->GetCentralityPercentile("V0M");
652             return kTRUE;
653          } else {
654             AliError(Form("[%s] Neither the ESD nor the AOD events are initialized", GetName()));
655             return kFALSE;
656          }
657       case kEventCentralityTrack:
658          // event:
659          // centrality using tracks method
660          if (esdev) {
661             AliCentrality *centrality = esdev->GetCentrality();
662             fComputedValue = centrality->GetCentralityPercentile("TRK");
663             return kTRUE;
664          } else if (aodev) {
665             AliCentrality *centrality = aodev->GetCentrality();
666             fComputedValue = centrality->GetCentralityPercentile("TRK");
667             return kTRUE;
668          } else {
669             AliError(Form("[%s] Neither the ESD nor the AOD events are initialized", GetName()));
670             return kFALSE;
671          }
672       case kEventCentralityCL1:
673          // event:
674          // centrality using CL1 method
675          if (esdev) {
676             AliCentrality *centrality = esdev->GetCentrality();
677             fComputedValue = centrality->GetCentralityPercentile("CL1");
678             return kTRUE;
679          } else if (aodev) {
680             AliCentrality *centrality = aodev->GetCentrality();
681             fComputedValue = centrality->GetCentralityPercentile("CL1");
682             return kTRUE;
683          } else {
684             AliError(Form("[%s] Neither the ESD nor the AOD events are initialized", GetName()));
685             return kFALSE;
686          }
687       default:
688          AliError(Form("[%s] Invalid value type for this computation", GetName()));
689          return kFALSE;
690    }
691 }
692
693 //_____________________________________________________________________________
694 void AliRsnValueStd::Print(Option_t *option) const
695 {
696 //
697 // Print informations about this object
698 //
699
700    AliInfo("=== VALUE INFO =================================================");
701    AliInfo(Form(" Name                  : %s", GetName()));
702    AliInfo(Form(" Type                  : %s", GetValueTypeName()));
703    AliInfo(Form(" Current computed value: %f", fComputedValue));
704    if (!strcmp(option, "BINS")) {
705       Int_t i;
706       for (i = 0; i < fBinArray.GetSize(); i++) {
707          AliInfo(Form(" Bin limit #%03d        = %f", i, fBinArray[i]));
708       }
709    }
710    AliInfo(Form(" Support object        : %s", (fSupportObject ? fSupportObject->ClassName() : " NO SUPPORT")));
711    AliInfo("=== END VALUE INFO =============================================");
712 }
713
714 //_____________________________________________________________________________
715 RSNTARGET AliRsnValueStd::TargetType(EValueType type)
716 {
717 //
718 // This method assigns the target to be expected by this object
719 // in the computation, depending on its type chosen in the enum.
720 //
721
722    if (type < kTrackValues)
723       return AliRsnTarget::kDaughter;
724    else if (type < kPairValues)
725       return AliRsnTarget::kMother;
726    else
727       return AliRsnTarget::kEvent;
728 }