5 // Definition of a single value which can be computed
6 // from any of the defined input objects implemented
7 // in the resonance package.
10 #include "AliRsnEvent.h"
11 #include "AliRsnDaughter.h"
12 #include "AliRsnMother.h"
13 #include "AliRsnPairDef.h"
15 #include "AliRsnValue.h"
19 //_____________________________________________________________________________
20 AliRsnValue::AliRsnValue() :
29 // Main constructor (version 1)
30 // This can also be created without any argument.
34 //_____________________________________________________________________________
35 AliRsnValue::AliRsnValue
36 (const char *name, EValueType type, Int_t nbins, Double_t min, Double_t max) :
45 // Main constructor (version 1)
46 // This can also be created without any argument.
49 SetBins(nbins, min, max);
52 //_____________________________________________________________________________
53 AliRsnValue::AliRsnValue
54 (const char *name, EValueType type, Double_t min, Double_t max, Double_t step) :
63 // Main constructor (version 2)
66 SetBins(min, max, step);
70 //_____________________________________________________________________________
71 const char* AliRsnValue::GetName() const
74 // Return the name of this object defined by the type
79 case kTrack1P: return "P1";
80 case kTrack2P: return "P2";
81 case kTrack1Pt: return "PT1";
82 case kTrack2Pt: return "PT2";
83 case kPairInvMass: return "IM";
84 case kPairInvMassMC: return "IMMC";
85 case kPairInvMassRes: return "IMRES";
86 case kPairPt: return "PT";
87 case kPairEta: return "ETA";
88 case kPairMt: return "MT";
89 case kPairY: return "Y";
90 case kEventMult: return "MULT";
91 default: return "UNDEF";
96 //_____________________________________________________________________________
97 TArrayD AliRsnValue::GetArray() const
100 // Creates an array with all bin edges
103 TArrayD out(fNBins + 1);
106 Double_t step = (fMax - fMin) / (Double_t)fNBins;
108 for (i = 0; i <= fNBins; i++) out[i] = fMin + step * (Double_t)i;
113 //_____________________________________________________________________________
114 void AliRsnValue::SetBins(Int_t n, Double_t min, Double_t max)
117 // Set binning for histogram.
134 //_____________________________________________________________________________
135 void AliRsnValue::SetBins(Double_t min, Double_t max, Double_t step)
138 // Binning for histogram.
152 fNBins = (Int_t)((fMax - fMin) / (step)) + 1;
155 //_____________________________________________________________________________
156 Bool_t AliRsnValue::Eval(AliRsnMother * const mother, AliRsnPairDef * const pairDef, AliRsnEvent * const event)
159 // Evaluation of the required value.
160 // Checks that the passed object is of the right type
161 // and if this check is successful, returns the required value.
162 // The output of the function tells if it was successful,
163 // and the values must be taken with GetValue().
167 if (!mother) return kFALSE;
168 if (!pairDef) return kFALSE;
170 Double_t mass = pairDef->GetMotherMass();
175 fValue = mother->GetDaughter(0)->P().Mag();
178 fValue = mother->GetDaughter(1)->P().Mag();
181 fValue = mother->GetDaughter(0)->P().Perp();
184 fValue = mother->GetDaughter(1)->P().Perp();
187 fValue = mother->Sum().M();
190 fValue = mother->SumMC().M();
192 case kPairInvMassRes:
193 fValue = (mother->SumMC().M() - mother->Sum().M()) / mother->SumMC().M();
196 fValue = mother->Sum().Perp();
199 fValue = mother->Sum().Eta();
202 if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
203 fValue = (TMath::Sqrt(mother->Sum().Perp2() + mass*mass) - mass);
206 if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
207 mother->SetDefaultMass(mass);
208 fValue = mother->Ref().Rapidity();
210 case kPairCosThetaStar:
211 fValue = mother->CosThetaStar();
213 case kPairCosThetaStar1:
214 //fValue = TMath::Cos(mother->ThetaStar(kTRUE, kFALSE));
216 case kPairCosThetaStar2:
217 //fValue = TMath::Cos(mother->ThetaStar(kFALSE, kFALSE));
219 case kPairCosThetaStarMC1:
220 //fValue = TMath::Cos(mother->ThetaStar(kTRUE, kTRUE));
222 case kPairCosThetaStarMC2:
223 //fValue = TMath::Cos(mother->ThetaStar(kFALSE, kTRUE));
226 if (!event) fValue = 0.0;
227 fValue = (Double_t)event->GetMultiplicity();
230 AliWarning("Invalid value type");