2 // Class AliRsnFunctionAxis
4 // Definition for a histogram type.
5 // Since one could do an analysis which is not an invariant mass
6 // the histogram definition should be more flexible, and it is stored
7 // separately in a new class.
8 // This class considers the possibility of a 1D or 2D histograms
9 // with its related binning, and can create a new histo from his definitions
14 #include "AliRsnEvent.h"
15 #include "AliRsnPairParticle.h"
16 #include "AliRsnPairDef.h"
17 #include "AliRsnFunctionAxis.h"
19 ClassImp(AliRsnFunctionAxis)
21 //_____________________________________________________________________________
22 AliRsnFunctionAxis::AliRsnFunctionAxis() :
29 // Default constructor
33 //_____________________________________________________________________________
34 AliRsnFunctionAxis::AliRsnFunctionAxis
35 (EAxisType type, Int_t nbins, Double_t min, Double_t max) :
42 // Main constructor (version 1)
45 SetBins(nbins, min, max);
48 //_____________________________________________________________________________
49 AliRsnFunctionAxis::AliRsnFunctionAxis
50 (EAxisType type, Double_t min, Double_t max, Double_t step) :
57 // Main constructor (version 2)
60 SetBins(min, max, step);
63 //_____________________________________________________________________________
64 const char* AliRsnFunctionAxis::GetName() const
67 // Return the name of this object defined by the type
72 case kTrackPt: return "PT";
73 case kTrackEta: return "ETA";
74 case kTrack1P: return "P1";
75 case kTrack2P: return "P2";
76 case kTrack1Pt: return "PT1";
77 case kTrack2Pt: return "PT2";
78 case kPairInvMass: return "IM";
79 case kPairInvMassMC: return "IMMC";
80 case kPairInvMassRes: return "IMRES";
81 case kPairPt: return "PT";
82 case kPairEta: return "ETA";
83 case kEventMult: return "MULT";
84 default: return "UNDEF";
88 //_____________________________________________________________________________
89 TArrayD AliRsnFunctionAxis::GetArray() const
92 // Creates an array with all bin edges
95 TArrayD out(fNBins + 1);
98 Double_t step = (fMax - fMin) / (Double_t)fNBins;
100 for (i = 0; i <= fNBins; i++) out[i] = fMin + step * (Double_t)i;
105 //_____________________________________________________________________________
106 AliRsnFunctionAxis::EAxisObject AliRsnFunctionAxis::GetAxisObject() const
109 // Tells what kind of object must be evaluated for this axis
123 case kPairInvMassRes:
134 //_____________________________________________________________________________
135 void AliRsnFunctionAxis::SetBins(Int_t n, Double_t min, Double_t max)
138 // Set binning for histogram.
152 //_____________________________________________________________________________
153 void AliRsnFunctionAxis::SetBins(Double_t min, Double_t max, Double_t step)
156 // Binning for histogram.
167 fNBins = (Int_t)((fMax - fMin) / (step)) + 1;
170 //_____________________________________________________________________________
171 Double_t AliRsnFunctionAxis::Eval(AliRsnDaughter* daughter) const
174 // EValuation method for single tracks
175 // (currently disabled)
181 return daughter->Pt();
183 return daughter->Eta();
185 AliWarning("This axis type cannot be applied to particles");
192 //_____________________________________________________________________________
193 Double_t AliRsnFunctionAxis::Eval(AliRsnPairParticle * const pair, AliRsnPairDef *const pairDef) const
196 // EValuation method for pairs.
197 // Requires also the pair definitions, in order to retrieve mass.
203 return pair->GetDaughter(0)->P();
205 return pair->GetDaughter(1)->P();
207 return pair->GetDaughter(0)->Pt();
209 return pair->GetDaughter(1)->Pt();
211 return pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1));
213 return pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
214 case kPairInvMassRes: {
216 value = pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1));
217 value -= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
218 value /= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1));
222 return pair->GetPt();
224 return pair->GetEta();
226 AliWarning("This axis type cannot be applied to pairs");
231 //_____________________________________________________________________________
232 Double_t AliRsnFunctionAxis::Eval(AliRsnEvent *const event) const
235 // EValuation method for events
241 return (Double_t)event->GetMultiplicity();
243 AliWarning("This axis type cannot be applied to events");