]>
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 | // | |
11 | #include "TObject.h" | |
12 | ||
13 | #include "AliLog.h" | |
14 | ||
15 | #include "AliRsnEvent.h" | |
16 | #include "AliRsnPairParticle.h" | |
17 | #include "AliRsnPairDef.h" | |
18 | #include "AliRsnFunctionAxis.h" | |
19 | ||
20 | ClassImp(AliRsnFunctionAxis) | |
21 | ||
22 | //_____________________________________________________________________________ | |
23 | AliRsnFunctionAxis::AliRsnFunctionAxis() : | |
24 | fType(kAxisTypes), | |
25 | fNBins(0), | |
26 | fMin(0.0), | |
27 | fMax(0.0) | |
28 | { | |
29 | // | |
30 | // Default constructor | |
31 | // | |
32 | } | |
33 | ||
34 | //_____________________________________________________________________________ | |
35 | AliRsnFunctionAxis::AliRsnFunctionAxis | |
36 | (EAxisType type, Int_t nbins, Double_t min, Double_t max) : | |
37 | fType(type), | |
38 | fNBins(0), | |
39 | fMin(0.0), | |
40 | fMax(0.0) | |
41 | { | |
42 | // | |
43 | // Main constructor (version 1) | |
44 | // | |
45 | ||
46 | SetBins(nbins, min, max); | |
47 | } | |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | AliRsnFunctionAxis::AliRsnFunctionAxis | |
51 | (EAxisType type, Double_t min, Double_t max, Double_t step) : | |
52 | fType(type), | |
53 | fNBins(0), | |
54 | fMin(0.0), | |
55 | fMax(0.0) | |
56 | { | |
57 | // | |
58 | // Main constructor (version 2) | |
59 | // | |
60 | ||
61 | SetBins(min, max, step); | |
62 | } | |
63 | ||
64 | //_____________________________________________________________________________ | |
65 | const char* AliRsnFunctionAxis::GetName() const | |
66 | { | |
67 | // | |
68 | // Return the name of this object defined by the type | |
69 | // | |
70 | ||
71 | switch (fType) | |
72 | { | |
6f4a992c | 73 | case kTrack1P: return "P1"; |
74 | case kTrack2P: return "P2"; | |
75 | case kTrack1Pt: return "PT1"; | |
76 | case kTrack2Pt: return "PT2"; | |
b2028424 | 77 | case kPairInvMass: return "IM"; |
78 | case kPairInvMassMC: return "IMMC"; | |
79 | case kPairInvMassRes: return "IMRES"; | |
80 | case kPairPt: return "PT"; | |
81 | case kPairEta: return "ETA"; | |
82 | case kEventMult: return "MULT"; | |
83 | default: return "UNDEF"; | |
84 | } | |
85 | } | |
86 | ||
87 | //_____________________________________________________________________________ | |
88 | AliRsnFunctionAxis::EAxisObject AliRsnFunctionAxis::GetAxisObject() | |
89 | { | |
90 | // | |
91 | // Tells what kind of object must be evaluated for this axis | |
92 | // | |
93 | ||
94 | switch (fType) | |
95 | { | |
6f4a992c | 96 | case kTrack1P: |
97 | case kTrack2P: | |
98 | case kTrack1Pt: | |
99 | case kTrack2Pt: | |
b2028424 | 100 | case kPairInvMass: |
101 | case kPairInvMassMC: | |
102 | case kPairInvMassRes: | |
103 | case kPairPt: | |
104 | case kPairEta: | |
105 | return kPair; | |
106 | case kEventMult: | |
107 | return kEvent; | |
108 | default: | |
109 | return kNone; | |
110 | } | |
111 | } | |
112 | ||
113 | //_____________________________________________________________________________ | |
114 | void AliRsnFunctionAxis::SetBins(Int_t n, Double_t min, Double_t max) | |
115 | { | |
116 | // | |
117 | // Set binning for histogram. | |
118 | // | |
119 | ||
120 | fNBins = n; | |
121 | ||
122 | if (min < max) | |
123 | { | |
124 | fMin = min; | |
125 | fMax = max; | |
126 | } | |
127 | else | |
128 | { | |
129 | fMin = max; | |
130 | fMax = min; | |
131 | } | |
132 | } | |
133 | ||
134 | //_____________________________________________________________________________ | |
135 | void AliRsnFunctionAxis::SetBins(Double_t min, Double_t max, Double_t step) | |
136 | { | |
137 | // | |
138 | // Binning for histogram. | |
139 | // | |
140 | ||
141 | if (min < max) | |
142 | { | |
143 | fMin = min; | |
144 | fMax = max; | |
145 | } | |
146 | else | |
147 | { | |
148 | fMin = max; | |
149 | fMax = min; | |
150 | } | |
151 | ||
152 | fNBins = (Int_t)((fMax - fMin) / (step)) + 1; | |
153 | } | |
154 | ||
155 | //_____________________________________________________________________________ | |
c53de003 | 156 | Double_t AliRsnFunctionAxis::Eval(AliRsnDaughter* /*daughter*/) |
b2028424 | 157 | { |
158 | // | |
159 | // EValuation method for single tracks | |
160 | // (currently disabled) | |
161 | // | |
162 | ||
163 | return 0.0; | |
164 | } | |
165 | ||
166 | //_____________________________________________________________________________ | |
167 | Double_t AliRsnFunctionAxis::Eval(AliRsnPairParticle *pair, AliRsnPairDef *pairDef) | |
168 | { | |
169 | // | |
170 | // EValuation method for pairs. | |
171 | // Requires also the pair definitions, in order to retrieve mass. | |
172 | // | |
173 | ||
174 | switch (fType) | |
175 | { | |
6f4a992c | 176 | case kTrack1P: |
177 | return pair->GetDaughter(0)->P(); | |
178 | case kTrack2P: | |
179 | return pair->GetDaughter(1)->P(); | |
180 | case kTrack1Pt: | |
181 | return pair->GetDaughter(0)->Pt(); | |
182 | case kTrack2Pt: | |
183 | return pair->GetDaughter(1)->Pt(); | |
b2028424 | 184 | case kPairInvMass: |
185 | return pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1)); | |
186 | case kPairInvMassMC: | |
187 | return pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1)); | |
188 | case kPairInvMassRes: | |
189 | { | |
190 | Double_t value; | |
191 | value = pair->GetInvMass(pairDef->GetMass(0), pairDef->GetMass(1)); | |
192 | value -= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1)); | |
193 | value /= pair->GetInvMassMC(pairDef->GetMass(0), pairDef->GetMass(1)); | |
194 | return value; | |
195 | } | |
196 | case kPairPt: | |
197 | return pair->GetPt(); | |
198 | case kPairEta: | |
199 | return pair->GetEta(); | |
200 | default: | |
201 | AliWarning("This axis type cannot be applied to pairs"); | |
202 | return -999.0; | |
203 | } | |
204 | } | |
205 | ||
206 | //_____________________________________________________________________________ | |
207 | Double_t AliRsnFunctionAxis::Eval(AliRsnEvent *event) | |
208 | { | |
209 | // | |
210 | // EValuation method for events | |
211 | // | |
212 | ||
213 | switch (fType) | |
214 | { | |
215 | case kEventMult: | |
216 | return (Double_t)event->GetMultiplicity(); | |
217 | default: | |
218 | AliWarning("This axis type cannot be applied to events"); | |
219 | return 0.0; | |
220 | } | |
221 | } |