4 // Definition of a single value which can be computed
5 // from any of the defined input objects implemented
6 // in the resonance package.
9 #include "AliRsnEvent.h"
10 #include "AliRsnDaughter.h"
11 #include "AliRsnPairParticle.h"
12 #include "AliRsnPairDef.h"
14 #include "AliRsnValue.h"
18 //_____________________________________________________________________________
19 AliRsnValue::AliRsnValue(EAxisType type) : fType(type)
26 //_____________________________________________________________________________
27 const char* AliRsnValue::GetName() const
30 // Return the name of this object defined by the type
35 case kTrackPt: return "PT";
36 case kTrackEta: return "ETA";
37 case kTrack1P: return "P1";
38 case kTrack2P: return "P2";
39 case kTrack1Pt: return "PT1";
40 case kTrack2Pt: return "PT2";
41 case kPairInvMass: return "IM";
42 case kPairInvMassMC: return "IMMC";
43 case kPairInvMassRes: return "IMRES";
44 case kPairPt: return "PT";
45 case kPairEta: return "ETA";
46 case kPairMt: return "MT";
47 case kPairY: return "Y";
48 case kEventMult: return "MULT";
49 default: return "UNDEF";
53 //_____________________________________________________________________________
54 AliRsnValue::EAxisObject AliRsnValue::GetAxisObject() const
57 // Tells what kind of object must be evaluated for this axis
62 // values coming from single track
66 // values coming from pair
79 // values coming from event
87 //_____________________________________________________________________________
88 Double_t AliRsnValue::Eval(TObject * const obj, const AliRsnPairDef *pairDef) const
91 // Evaluation of the required value.
92 // Checks that the passed object is of the right type
93 // and if this check is successful, returns the required value.
94 // The output of the function tells if it was successful,
95 // and the values must be taken with GetValue().
99 AliRsnDaughter *track = dynamic_cast<AliRsnDaughter*>(obj);
100 AliRsnPairParticle *pair = dynamic_cast<AliRsnPairParticle*>(obj);
101 AliRsnEvent *event = dynamic_cast<AliRsnEvent*>(obj);
103 // check that the object type and required input match
104 EAxisObject requiredInput = GetAxisObject();
105 Double_t mass = pairDef->GetMotherMass();
106 if (requiredInput == kParticle && !track)
108 else if (requiredInput == kPair)
114 // if we are filling a pair, we need the pair def
116 mass = pairDef->GetMotherMass();
119 AliError("Cannot compute a 'pair' value if I don't have a vaild PairDef");
124 else if (requiredInput == kEvent && !event)
130 AliError(Form("Failed computation: expected type %d, passed a '%s'", (Int_t)requiredInput, obj->ClassName()));
141 return pair->GetDaughter(0)->P();
143 return pair->GetDaughter(1)->P();
145 return pair->GetDaughter(0)->Pt();
147 return pair->GetDaughter(1)->Pt();
149 return pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1));
151 return pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
152 case kPairInvMassRes:
155 value = pair->GetInvMass (pairDef->GetMass(0), pairDef->GetMass(1));
156 value -= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
157 value /= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
161 return pair->GetPt();
163 return pair->GetEta();
165 if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
166 return (TMath::Sqrt(pair->GetPt()*pair->GetPt() + mass*mass) - mass);
168 if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
169 return pair->GetY(mass);
171 return (Double_t)event->GetMultiplicity();
173 AliWarning("Invalid value type");