]>
Commit | Line | Data |
---|---|---|
b2028424 | 1 | // |
2 | // Class AliRsnFunctionAxis | |
3 | // | |
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 | |
10 | // | |
b2028424 | 11 | |
4fbb2459 | 12 | #include <TArrayD.h> |
b2028424 | 13 | |
14 | #include "AliRsnEvent.h" | |
15 | #include "AliRsnPairParticle.h" | |
16 | #include "AliRsnPairDef.h" | |
17 | #include "AliRsnFunctionAxis.h" | |
18 | ||
19 | ClassImp(AliRsnFunctionAxis) | |
20 | ||
21 | //_____________________________________________________________________________ | |
22 | AliRsnFunctionAxis::AliRsnFunctionAxis() : | |
4fbb2459 | 23 | fType(kAxisTypes), |
24 | fNBins(0), | |
25 | fMin(0.0), | |
bd6bf3ee | 26 | fMax(0.0), |
27 | fMass(0.0) | |
b2028424 | 28 | { |
29 | // | |
30 | // Default constructor | |
31 | // | |
32 | } | |
33 | ||
34 | //_____________________________________________________________________________ | |
35 | AliRsnFunctionAxis::AliRsnFunctionAxis | |
36 | (EAxisType type, Int_t nbins, Double_t min, Double_t max) : | |
4fbb2459 | 37 | fType(type), |
38 | fNBins(0), | |
39 | fMin(0.0), | |
bd6bf3ee | 40 | fMax(0.0), |
41 | fMass(0.0) | |
b2028424 | 42 | { |
43 | // | |
44 | // Main constructor (version 1) | |
45 | // | |
46 | ||
47 | SetBins(nbins, min, max); | |
48 | } | |
49 | ||
50 | //_____________________________________________________________________________ | |
51 | AliRsnFunctionAxis::AliRsnFunctionAxis | |
52 | (EAxisType type, Double_t min, Double_t max, Double_t step) : | |
4fbb2459 | 53 | fType(type), |
54 | fNBins(0), | |
55 | fMin(0.0), | |
bd6bf3ee | 56 | fMax(0.0), |
57 | fMass(0.0) | |
b2028424 | 58 | { |
59 | // | |
60 | // Main constructor (version 2) | |
61 | // | |
62 | ||
63 | SetBins(min, max, step); | |
64 | } | |
65 | ||
66 | //_____________________________________________________________________________ | |
67 | const char* AliRsnFunctionAxis::GetName() const | |
68 | { | |
69 | // | |
70 | // Return the name of this object defined by the type | |
71 | // | |
72 | ||
eca224a3 | 73 | switch (fType) |
74 | { | |
75 | case kTrackPt: return "PT"; | |
76 | case kTrackEta: return "ETA"; | |
77 | case kTrack1P: return "P1"; | |
78 | case kTrack2P: return "P2"; | |
79 | case kTrack1Pt: return "PT1"; | |
80 | case kTrack2Pt: return "PT2"; | |
81 | case kPairInvMass: return "IM"; | |
82 | case kPairInvMassMC: return "IMMC"; | |
83 | case kPairInvMassRes: return "IMRES"; | |
84 | case kPairPt: return "PT"; | |
85 | case kPairEta: return "ETA"; | |
bd6bf3ee | 86 | case kPairMt: return "MT"; |
87 | case kPairY: return "Y"; | |
eca224a3 | 88 | case kEventMult: return "MULT"; |
89 | default: return "UNDEF"; | |
b2028424 | 90 | } |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
4fbb2459 | 94 | TArrayD AliRsnFunctionAxis::GetArray() const |
95 | { | |
96 | // | |
97 | // Creates an array with all bin edges | |
98 | // | |
99 | ||
100 | TArrayD out(fNBins + 1); | |
101 | ||
102 | Int_t i; | |
103 | Double_t step = (fMax - fMin) / (Double_t)fNBins; | |
104 | ||
105 | for (i = 0; i <= fNBins; i++) out[i] = fMin + step * (Double_t)i; | |
106 | ||
107 | return out; | |
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | AliRsnFunctionAxis::EAxisObject AliRsnFunctionAxis::GetAxisObject() const | |
b2028424 | 112 | { |
113 | // | |
114 | // Tells what kind of object must be evaluated for this axis | |
115 | // | |
116 | ||
eca224a3 | 117 | switch (fType) |
118 | { | |
119 | case kTrackPt: | |
120 | case kTrackEta: | |
121 | return kParticle; | |
122 | case kTrack1P: | |
123 | case kTrack2P: | |
124 | case kTrack1Pt: | |
125 | case kTrack2Pt: | |
126 | case kPairInvMass: | |
127 | case kPairInvMassMC: | |
128 | case kPairInvMassRes: | |
129 | case kPairPt: | |
130 | case kPairEta: | |
bd6bf3ee | 131 | case kPairMt: |
132 | case kPairY: | |
eca224a3 | 133 | return kPair; |
134 | case kEventMult: | |
135 | return kEvent; | |
136 | default: | |
137 | return kNone; | |
b2028424 | 138 | } |
139 | } | |
140 | ||
141 | //_____________________________________________________________________________ | |
142 | void AliRsnFunctionAxis::SetBins(Int_t n, Double_t min, Double_t max) | |
143 | { | |
144 | // | |
145 | // Set binning for histogram. | |
146 | // | |
147 | ||
148 | fNBins = n; | |
149 | ||
4fbb2459 | 150 | if (min < max) { |
b2028424 | 151 | fMin = min; |
152 | fMax = max; | |
4fbb2459 | 153 | } else { |
b2028424 | 154 | fMin = max; |
155 | fMax = min; | |
156 | } | |
157 | } | |
158 | ||
159 | //_____________________________________________________________________________ | |
160 | void AliRsnFunctionAxis::SetBins(Double_t min, Double_t max, Double_t step) | |
161 | { | |
162 | // | |
163 | // Binning for histogram. | |
164 | // | |
165 | ||
4fbb2459 | 166 | if (min < max) { |
b2028424 | 167 | fMin = min; |
168 | fMax = max; | |
4fbb2459 | 169 | } else { |
b2028424 | 170 | fMin = max; |
171 | fMax = min; | |
172 | } | |
173 | ||
174 | fNBins = (Int_t)((fMax - fMin) / (step)) + 1; | |
175 | } | |
176 | ||
177 | //_____________________________________________________________________________ | |
9477aa42 | 178 | Double_t AliRsnFunctionAxis::Eval(AliRsnDaughter*const daughter) const |
b2028424 | 179 | { |
180 | // | |
181 | // EValuation method for single tracks | |
182 | // (currently disabled) | |
183 | // | |
184 | ||
eca224a3 | 185 | switch (fType) |
186 | { | |
187 | case kTrackPt: | |
188 | return daughter->Pt(); | |
189 | case kTrackEta: | |
190 | return daughter->Eta(); | |
191 | default: | |
192 | AliWarning("This axis type cannot be applied to particles"); | |
193 | return -999.0; | |
194 | } | |
195 | ||
b2028424 | 196 | return 0.0; |
197 | } | |
198 | ||
199 | //_____________________________________________________________________________ | |
4fbb2459 | 200 | Double_t AliRsnFunctionAxis::Eval(AliRsnPairParticle * const pair, AliRsnPairDef *const pairDef) const |
b2028424 | 201 | { |
202 | // | |
203 | // EValuation method for pairs. | |
204 | // Requires also the pair definitions, in order to retrieve mass. | |
205 | // | |
206 | ||
39a3e819 | 207 | Double_t mass = pairDef->GetMotherMass(); |
208 | ||
eca224a3 | 209 | switch (fType) |
210 | { | |
211 | case kTrack1P: | |
212 | return pair->GetDaughter(0)->P(); | |
213 | case kTrack2P: | |
214 | return pair->GetDaughter(1)->P(); | |
215 | case kTrack1Pt: | |
216 | return pair->GetDaughter(0)->Pt(); | |
217 | case kTrack2Pt: | |
218 | return pair->GetDaughter(1)->Pt(); | |
219 | case kPairInvMass: | |
220 | return pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1)); | |
221 | case kPairInvMassMC: | |
222 | return pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1)); | |
223 | case kPairInvMassRes: { | |
224 | Double_t value; | |
225 | value = pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1)); | |
226 | value -= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1)); | |
227 | value /= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1)); | |
228 | return value; | |
229 | } | |
230 | case kPairPt: | |
231 | return pair->GetPt(); | |
232 | case kPairEta: | |
233 | return pair->GetEta(); | |
bd6bf3ee | 234 | case kPairMt: |
39a3e819 | 235 | //if (TMath::Abs(fMass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", fMass)); |
236 | //return TMath::Sqrt(pair->GetPt()*pair->GetPt() + fMass*fMass); | |
237 | if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass)); | |
238 | return (TMath::Sqrt(pair->GetPt()*pair->GetPt() + mass*mass) - mass); | |
bd6bf3ee | 239 | case kPairY: |
39a3e819 | 240 | //if (TMath::Abs(fMass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", fMass)); |
241 | //return pair->GetY(fMass); | |
242 | if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass)); | |
243 | return pair->GetY(mass); | |
eca224a3 | 244 | default: |
245 | AliWarning("This axis type cannot be applied to pairs"); | |
246 | return -999.0; | |
b2028424 | 247 | } |
248 | } | |
249 | ||
250 | //_____________________________________________________________________________ | |
4fbb2459 | 251 | Double_t AliRsnFunctionAxis::Eval(AliRsnEvent *const event) const |
b2028424 | 252 | { |
253 | // | |
254 | // EValuation method for events | |
255 | // | |
256 | ||
eca224a3 | 257 | switch (fType) |
258 | { | |
259 | case kEventMult: | |
260 | return (Double_t)event->GetMultiplicity(); | |
261 | default: | |
262 | AliWarning("This axis type cannot be applied to events"); | |
263 | return 0.0; | |
b2028424 | 264 | } |
265 | } |