]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // Utilities used in the forward multiplcity analysis | |
3 | // | |
4 | // | |
5 | #ifndef ALIFORWARDUTIL_H | |
6 | #define ALIFORWARDUTIL_H | |
ffca499d | 7 | /** |
8 | * @file AliForwardUtil.h | |
9 | * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk> | |
10 | * @date Wed Mar 23 14:06:54 2011 | |
11 | * | |
12 | * @brief | |
13 | * | |
14 | * | |
bd6f5206 | 15 | * @ingroup pwglf_forward |
ffca499d | 16 | */ |
7e4038b5 | 17 | #include <TObject.h> |
9d99b0dd | 18 | #include <TString.h> |
7f759bb7 | 19 | #include <TObjArray.h> |
7e4038b5 | 20 | class TH2D; |
9d99b0dd | 21 | class TH1I; |
22 | class TH1; | |
7f759bb7 | 23 | class TF1; |
7e4038b5 | 24 | class TAxis; |
9d99b0dd | 25 | class AliESDEvent; |
290052e7 | 26 | class AliAODEvent; |
27 | class AliAnalysisTaskSE; | |
7e4038b5 | 28 | |
29 | /** | |
30 | * Utilities used in the forward multiplcity analysis | |
31 | * | |
bd6f5206 | 32 | * @ingroup pwglf_forward |
7e4038b5 | 33 | */ |
34 | class AliForwardUtil : public TObject | |
35 | { | |
9d99b0dd | 36 | public: |
ffca499d | 37 | /** |
38 | * Get the standard color for a ring | |
39 | * | |
40 | * @param d Detector | |
41 | * @param r Ring | |
42 | * | |
43 | * @return | |
44 | */ | |
cc83fca2 | 45 | static Color_t RingColor(UShort_t d, Char_t r) |
46 | { | |
47 | return ((d == 1 ? kRed : (d == 2 ? kGreen : kBlue)) | |
5bb5d1f6 | 48 | + ((r == 'I' || r == 'i') ? 2 : -3)); |
cc83fca2 | 49 | } |
0bd4b00f | 50 | //================================================================== |
51 | /** | |
52 | * @{ | |
7c1a1f1d | 53 | * @name Collision/run parameters |
0bd4b00f | 54 | */ |
55 | /** | |
56 | * Defined collision types | |
57 | */ | |
58 | enum ECollisionSystem { | |
59 | kUnknown, | |
60 | kPP, | |
0151a6c6 | 61 | kPbPb, |
62 | kPPb | |
0bd4b00f | 63 | }; |
64 | //__________________________________________________________________ | |
38229ecd | 65 | /** |
66 | * Calculate the beam rapidity. | |
67 | * | |
68 | * @b Note: The beam energy is given in GeV/charge | |
69 | * | |
70 | * @param beam Beam energy in GeV/charge | |
71 | * @param z Charge number of projectile | |
72 | * @param a Mass number of projectile | |
73 | * | |
74 | * @return The rapidity of the beam | |
75 | */ | |
76 | static Float_t BeamRapidity(Float_t beam, UShort_t z, UShort_t a); | |
77 | /** | |
78 | * Calculate the center of mass energy from the beam energy per | |
79 | * charge and the nucleus numbers. | |
80 | * | |
81 | * @param beam Beam energy in GeV/charge | |
82 | * @param z1 Charge number of projectile | |
83 | * @param a1 Mass number of projectile | |
84 | * @param z2 Charge number of projectile | |
85 | * @param a2 Mass number of projectile | |
86 | * | |
87 | * @return The center of mass energy in GeV/nucleon | |
88 | */ | |
89 | static Float_t CenterOfMassEnergy(Float_t beam, UShort_t z1, UShort_t a1, | |
90 | Short_t z2=-1, Short_t a2=-1); | |
91 | /** | |
92 | * Calculate the center of mass rapidity (shift) | |
93 | * | |
94 | * @param z1 Charge number of projectile | |
95 | * @param a1 Mass number of projectile | |
96 | * @param z2 Charge number of projectile | |
97 | * @param a2 Mass number of projectile | |
98 | * x | |
99 | * @return Rapidity of the center of mass | |
100 | */ | |
101 | static Float_t CenterOfMassRapidity(UShort_t z1, UShort_t a1, | |
102 | Short_t z2=-1, Short_t a2=-1); | |
0bd4b00f | 103 | /** |
104 | * Parse a collision system spec given in a string. Known values are | |
105 | * | |
106 | * - "pp", "p-p" which returns kPP | |
0151a6c6 | 107 | * - "PbPb", "Pb-Pb", "A-A", which returns kPbPb |
108 | * - "pPb", "p-Pb", "pA", p-A" which returns kPPb | |
0bd4b00f | 109 | * - Everything else gives kUnknown |
110 | * | |
111 | * @param sys Collision system spec | |
112 | * | |
113 | * @return Collision system id | |
114 | */ | |
115 | static UShort_t ParseCollisionSystem(const char* sys); | |
116 | /** | |
117 | * Get a string representation of the collision system | |
118 | * | |
119 | * @param sys Collision system | |
120 | * - kPP -> "pp" | |
121 | * - kPbPb -> "PbPb" | |
0151a6c6 | 122 | * - kPPb -> "pPb" |
0bd4b00f | 123 | * - anything else gives "unknown" |
124 | * | |
125 | * @return String representation of the collision system | |
126 | */ | |
127 | static const char* CollisionSystemString(UShort_t sys); | |
128 | //__________________________________________________________________ | |
129 | /** | |
130 | * Parse the center of mass energy given as a float and return known | |
131 | * values as a unsigned integer | |
132 | * | |
133 | * @param sys Collision system (needed for AA) | |
134 | * @param cms Center of mass energy * total charge | |
135 | * | |
136 | * @return Center of mass energy per nucleon | |
137 | */ | |
138 | static UShort_t ParseCenterOfMassEnergy(UShort_t sys, Float_t cms); | |
139 | /** | |
140 | * Get a string representation of the center of mass energy per nuclean | |
141 | * | |
7c1a1f1d | 142 | * @param cms Center of mass energy per nucleon |
0bd4b00f | 143 | * |
144 | * @return String representation of the center of mass energy per nuclean | |
145 | */ | |
146 | static const char* CenterOfMassEnergyString(UShort_t cms); | |
147 | //__________________________________________________________________ | |
148 | /** | |
149 | * Parse the magnetic field (in kG) as given by a floating point number | |
150 | * | |
151 | * @param field Magnetic field in kG | |
152 | * | |
153 | * @return Short integer value of magnetic field in kG | |
154 | */ | |
155 | static Short_t ParseMagneticField(Float_t field); | |
6f4a5c0d | 156 | /** |
157 | * Get eta from strip | |
158 | * | |
159 | * @param det, ring, sec, strip, zvtx | |
160 | * | |
161 | * @return eta | |
162 | */ | |
163 | static Double_t GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Double_t zvtx) ; | |
0bd4b00f | 164 | /** |
165 | * Get a string representation of the magnetic field | |
166 | * | |
167 | * @param field Magnetic field in kG | |
168 | * | |
169 | * @return String representation of the magnetic field | |
170 | */ | |
6f4a5c0d | 171 | static const char* MagneticFieldString(Short_t field); |
0bd4b00f | 172 | /* @} */ |
173 | ||
290052e7 | 174 | //__________________________________________________________________ |
175 | /** | |
176 | * Get the AOD event - either from the input (AOD analysis) or the | |
177 | * output (ESD analysis) | |
178 | * | |
179 | * @param task Task to do the investigation for | |
180 | * | |
181 | * @return Found AOD event or null | |
182 | */ | |
183 | static AliAODEvent* GetAODEvent(AliAnalysisTaskSE* task); | |
184 | /** | |
185 | * Check if we have something that will provide and AOD event | |
186 | * | |
187 | * @return 0 if there's nothing that provide an AOD event, 1 if it | |
188 | * is provided on the input (AOD analysis) or 2 if it is provided on | |
189 | * the output (ESD analysis) | |
190 | */ | |
191 | static UShort_t CheckForAOD(); | |
192 | /** | |
193 | * Check if we have a particular (kind) of task in our train | |
194 | * | |
195 | * @param clsOrName Class name or name of task | |
196 | * @param cls If true, look for a task of a particular class - | |
197 | * otherwise search for a speficially name task | |
198 | * | |
199 | * @return true if the needed task was found | |
200 | */ | |
201 | static Bool_t CheckForTask(const char* clsOrName, Bool_t cls=true); | |
202 | ||
241cca4d | 203 | //__________________________________________________________________ |
204 | /** | |
205 | * @{ | |
206 | * @name Member functions to store and retrieve analysis parameters | |
207 | */ | |
208 | static TObject* MakeParameter(const char* name, UShort_t value); | |
209 | static TObject* MakeParameter(const char* name, Int_t value); | |
210 | static TObject* MakeParameter(const char* name, Double_t value); | |
211 | static TObject* MakeParameter(const char* name, Bool_t value); | |
212 | static void GetParameter(TObject* o, UShort_t& value); | |
213 | static void GetParameter(TObject* o, Int_t& value); | |
214 | static void GetParameter(TObject* o, Double_t& value); | |
215 | static void GetParameter(TObject* o, Bool_t& value); | |
216 | /* @} */ | |
217 | ||
0bd4b00f | 218 | /** |
219 | * @{ | |
220 | * @name Energy stragling functions | |
221 | */ | |
7f759bb7 | 222 | //__________________________________________________________________ |
223 | /** | |
224 | * Number of steps to do in the Landau, Gaussiam convolution | |
225 | */ | |
fb3430ac | 226 | static Int_t fgConvolutionSteps; // Number of convolution steps |
7f759bb7 | 227 | //------------------------------------------------------------------ |
228 | /** | |
229 | * How many sigma's of the Gaussian in the Landau, Gaussian | |
230 | * convolution to integrate over | |
231 | */ | |
fb3430ac | 232 | static Double_t fgConvolutionNSigma; // Number of convolution sigmas |
7f759bb7 | 233 | //------------------------------------------------------------------ |
234 | /** | |
235 | * Calculate the shifted Landau | |
236 | * @f[ | |
237 | * f'_{L}(x;\Delta,\xi) = f_L(x;\Delta+0.22278298\xi) | |
238 | * @f] | |
239 | * | |
240 | * where @f$ f_{L}@f$ is the ROOT implementation of the Landau | |
241 | * distribution (known to have @f$ \Delta_{p}=-0.22278298@f$ for | |
242 | * @f$\Delta=0,\xi=1@f$. | |
243 | * | |
244 | * @param x Where to evaluate @f$ f'_{L}@f$ | |
245 | * @param delta Most probable value | |
246 | * @param xi The 'width' of the distribution | |
247 | * | |
c389303e | 248 | * @return @f$ f'_{L}(x;\Delta,\xi) @f$ |
7f759bb7 | 249 | */ |
250 | static Double_t Landau(Double_t x, Double_t delta, Double_t xi); | |
251 | ||
252 | //------------------------------------------------------------------ | |
9d99b0dd | 253 | /** |
7f759bb7 | 254 | * Calculate the value of a Landau convolved with a Gaussian |
9d99b0dd | 255 | * |
7f759bb7 | 256 | * @f[ |
c389303e | 257 | * f(x;\Delta,\xi,\sigma') = \frac{1}{\sigma' \sqrt{2 \pi}} |
7f759bb7 | 258 | * \int_{-\infty}^{+\infty} d\Delta' f'_{L}(x;\Delta',\xi) |
c389303e | 259 | * \exp{-\frac{(\Delta-\Delta')^2}{2\sigma'^2}} |
7f759bb7 | 260 | * @f] |
9d99b0dd | 261 | * |
c389303e | 262 | * where @f$ f'_{L}@f$ is the Landau distribution, @f$ \Delta@f$ the |
263 | * energy loss, @f$ \xi@f$ the width of the Landau, and | |
264 | * @f$ \sigma'^2=\sigma^2-\sigma_n^2 @f$. Here, @f$\sigma@f$ is the | |
7f759bb7 | 265 | * variance of the Gaussian, and @f$\sigma_n@f$ is a parameter modelling |
266 | * noise in the detector. | |
267 | * | |
268 | * Note that this function uses the constants fgConvolutionSteps and | |
269 | * fgConvolutionNSigma | |
270 | * | |
271 | * References: | |
272 | * - <a href="http://dx.doi.org/10.1016/0168-583X(84)90472-5">Nucl.Instrum.Meth.B1:16</a> | |
273 | * - <a href="http://dx.doi.org/10.1103/PhysRevA.28.615">Phys.Rev.A28:615</a> | |
274 | * - <a href="http://root.cern.ch/root/htmldoc/tutorials/fit/langaus.C.html">ROOT implementation</a> | |
275 | * | |
276 | * @param x where to evaluate @f$ f@f$ | |
277 | * @param delta @f$ \Delta@f$ of @f$ f(x;\Delta,\xi,\sigma')@f$ | |
278 | * @param xi @f$ \xi@f$ of @f$ f(x;\Delta,\xi,\sigma')@f$ | |
c389303e | 279 | * @param sigma @f$ \sigma@f$ of @f$\sigma'^2=\sigma^2-\sigma_n^2 @f$ |
280 | * @param sigma_n @f$ \sigma_n@f$ of @f$\sigma'^2=\sigma^2-\sigma_n^2 @f$ | |
7f759bb7 | 281 | * |
282 | * @return @f$ f@f$ evaluated at @f$ x@f$. | |
9d99b0dd | 283 | */ |
7f759bb7 | 284 | static Double_t LandauGaus(Double_t x, Double_t delta, Double_t xi, |
285 | Double_t sigma, Double_t sigma_n); | |
0bd4b00f | 286 | |
287 | //------------------------------------------------------------------ | |
288 | /** | |
289 | * Evaluate | |
290 | * @f[ | |
291 | * f_i(x;\Delta,\xi,\sigma') = f(x;\Delta_i,\xi_i,\sigma_i') | |
292 | * @f] | |
293 | * corresponding to @f$ i@f$ particles i.e., with the substitutions | |
7c1a1f1d | 294 | * @f{eqnarray*}{ |
295 | * \Delta \rightarrow \Delta_i &=& i(\Delta + \xi\log(i))\\ | |
296 | * \xi \rightarrow \xi_i &=& i \xi\\ | |
297 | * \sigma \rightarrow \sigma_i &=& \sqrt{i}\sigma\\ | |
298 | * \sigma'^2 \rightarrow \sigma_i'^2 &=& \sigma_n^2 + \sigma_i^2 | |
299 | * @f} | |
0bd4b00f | 300 | * |
301 | * @param x Where to evaluate | |
302 | * @param delta @f$ \Delta@f$ | |
303 | * @param xi @f$ \xi@f$ | |
304 | * @param sigma @f$ \sigma@f$ | |
305 | * @param sigma_n @f$ \sigma_n@f$ | |
7c1a1f1d | 306 | * @param i @f$ i @f$ |
0bd4b00f | 307 | * |
7c1a1f1d | 308 | * @return @f$ f_i @f$ evaluated |
0bd4b00f | 309 | */ |
310 | static Double_t ILandauGaus(Double_t x, Double_t delta, Double_t xi, | |
311 | Double_t sigma, Double_t sigma_n, Int_t i); | |
312 | ||
313 | //------------------------------------------------------------------ | |
314 | /** | |
315 | * Numerically evaluate | |
316 | * @f[ | |
317 | * \left.\frac{\partial f_i}{\partial p_i}\right|_{x} | |
318 | * @f] | |
319 | * where @f$ p_i@f$ is the @f$ i^{\mbox{th}}@f$ parameter. The mapping | |
320 | * of the parameters is given by | |
321 | * | |
322 | * - 0: @f$\Delta@f$ | |
323 | * - 1: @f$\xi@f$ | |
324 | * - 2: @f$\sigma@f$ | |
325 | * - 3: @f$\sigma_n@f$ | |
326 | * | |
327 | * This is the partial derivative with respect to the parameter of | |
328 | * the response function corresponding to @f$ i@f$ particles i.e., | |
329 | * with the substitutions | |
330 | * @f[ | |
331 | * \Delta \rightarrow \Delta_i = i(\Delta + \xi\log(i))\\ | |
332 | * \xi \rightarrow \xi_i = i \xi\\ | |
333 | * \sigma \rightarrow \sigma_i = \sqrt{i}\sigma\\ | |
334 | * \sigma'^2 \rightarrow \sigma_i'^2 = \sigma_n^2 + \sigma_i^2 | |
335 | * @f] | |
336 | * | |
337 | * @param x Where to evaluate | |
338 | * @param ipar Parameter number | |
7c1a1f1d | 339 | * @param dp @f$ \epsilon\delta p_i@f$ for some value of @f$\epsilon@f$ |
0bd4b00f | 340 | * @param delta @f$ \Delta@f$ |
341 | * @param xi @f$ \xi@f$ | |
342 | * @param sigma @f$ \sigma@f$ | |
343 | * @param sigma_n @f$ \sigma_n@f$ | |
344 | * @param i @f$ i@f$ | |
345 | * | |
346 | * @return @f$ f_i@f$ evaluated | |
347 | */ | |
348 | static Double_t IdLandauGausdPar(Double_t x, UShort_t ipar, Double_t dp, | |
349 | Double_t delta, Double_t xi, | |
350 | Double_t sigma, Double_t sigma_n, Int_t i); | |
351 | ||
7f759bb7 | 352 | //------------------------------------------------------------------ |
9d99b0dd | 353 | /** |
7f759bb7 | 354 | * Evaluate |
c389303e | 355 | * @f[ |
0bd4b00f | 356 | * f_N(x;\Delta,\xi,\sigma') = \sum_{i=1}^N a_i f_i(x;\Delta,\xi,\sigma'a) |
357 | * @f] | |
9d99b0dd | 358 | * |
7f759bb7 | 359 | * where @f$ f(x;\Delta,\xi,\sigma')@f$ is the convolution of a |
360 | * Landau with a Gaussian (see LandauGaus). Note that | |
c389303e | 361 | * @f$ a_1 = 1@f$, @f$\Delta_i = i(\Delta_1 + \xi\log(i))@f$, |
362 | * @f$\xi_i=i\xi_1@f$, and @f$\sigma_i'^2 = \sigma_n^2 + i\sigma_1^2@f$. | |
7f759bb7 | 363 | * |
364 | * References: | |
365 | * - <a href="http://dx.doi.org/10.1016/0168-583X(84)90472-5">Nucl.Instrum.Meth.B1:16</a> | |
366 | * - <a href="http://dx.doi.org/10.1103/PhysRevA.28.615">Phys.Rev.A28:615</a> | |
367 | * - <a href="http://root.cern.ch/root/htmldoc/tutorials/fit/langaus.C.html">ROOT implementation</a> | |
9d99b0dd | 368 | * |
7f759bb7 | 369 | * @param x Where to evaluate @f$ f_N@f$ |
370 | * @param delta @f$ \Delta_1@f$ | |
371 | * @param xi @f$ \xi_1@f$ | |
372 | * @param sigma @f$ \sigma_1@f$ | |
373 | * @param sigma_n @f$ \sigma_n@f$ | |
374 | * @param n @f$ N@f$ in the sum above. | |
375 | * @param a Array of size @f$ N-1@f$ of the weights @f$ a_i@f$ for | |
376 | * @f$ i > 1@f$ | |
377 | * | |
378 | * @return @f$ f_N(x;\Delta,\xi,\sigma')@f$ | |
9d99b0dd | 379 | */ |
7f759bb7 | 380 | static Double_t NLandauGaus(Double_t x, Double_t delta, Double_t xi, |
381 | Double_t sigma, Double_t sigma_n, Int_t n, | |
fb3430ac | 382 | const Double_t* a); |
0bd4b00f | 383 | /** |
384 | * Generate a TF1 object of @f$ f_I@f$ | |
385 | * | |
386 | * @param c Constant | |
387 | * @param delta @f$ \Delta@f$ | |
388 | * @param xi @f$ \xi_1@f$ | |
389 | * @param sigma @f$ \sigma_1@f$ | |
390 | * @param sigma_n @f$ \sigma_n@f$ | |
391 | * @param i @f$ i@f$ - the number of particles | |
392 | * @param xmin Least value of range | |
393 | * @param xmax Largest value of range | |
394 | * | |
395 | * @return Newly allocated TF1 object | |
396 | */ | |
397 | static TF1* MakeILandauGaus(Double_t c, | |
398 | Double_t delta, Double_t xi, | |
399 | Double_t sigma, Double_t sigma_n, | |
400 | Int_t i, | |
401 | Double_t xmin, Double_t xmax); | |
402 | /** | |
403 | * Generate a TF1 object of @f$ f_N@f$ | |
404 | * | |
405 | * @param c Constant | |
406 | * @param delta @f$ \Delta@f$ | |
407 | * @param xi @f$ \xi_1@f$ | |
408 | * @param sigma @f$ \sigma_1@f$ | |
409 | * @param sigma_n @f$ \sigma_n@f$ | |
410 | * @param n @f$ N@f$ - how many particles to sum to | |
411 | * @param a Array of size @f$ N-1@f$ of the weights @f$ a_i@f$ for | |
412 | * @f$ i > 1@f$ | |
413 | * @param xmin Least value of range | |
414 | * @param xmax Largest value of range | |
415 | * | |
416 | * @return Newly allocated TF1 object | |
417 | */ | |
418 | static TF1* MakeNLandauGaus(Double_t c, | |
419 | Double_t delta, Double_t xi, | |
420 | Double_t sigma, Double_t sigma_n, | |
fb3430ac | 421 | Int_t n, const Double_t* a, |
0bd4b00f | 422 | Double_t xmin, Double_t xmax); |
423 | ||
7f759bb7 | 424 | //__________________________________________________________________ |
425 | /** | |
426 | * Structure to do fits to the energy loss spectrum | |
427 | * | |
bd6f5206 | 428 | * @ingroup pwglf_forward |
7f759bb7 | 429 | */ |
430 | struct ELossFitter | |
431 | { | |
c389303e | 432 | enum { |
433 | kC = 0, | |
434 | kDelta, | |
435 | kXi, | |
436 | kSigma, | |
437 | kSigmaN, | |
438 | kN, | |
439 | kA | |
440 | }; | |
7f759bb7 | 441 | /** |
442 | * Constructor | |
443 | * | |
444 | * @param lowCut Lower cut of spectrum - data below this cuts is ignored | |
445 | * @param maxRange Maximum range to fit to | |
446 | * @param minusBins The number of bins below maximum to use | |
447 | */ | |
448 | ELossFitter(Double_t lowCut, Double_t maxRange, UShort_t minusBins); | |
7984e5f7 | 449 | /** |
450 | * Destructor | |
451 | * | |
452 | */ | |
7f759bb7 | 453 | virtual ~ELossFitter(); |
454 | /** | |
455 | * Clear internal arrays | |
456 | * | |
457 | */ | |
458 | void Clear(); | |
459 | /** | |
460 | * Fit a 1-particle signal to the passed energy loss distribution | |
461 | * | |
462 | * Note that this function clears the internal arrays first | |
463 | * | |
464 | * @param dist Data to fit the function to | |
465 | * @param sigman If larger than zero, the initial guess of the | |
466 | * detector induced noise. If zero or less, then this | |
467 | * parameter is ignored in the fit (fixed at 0) | |
468 | * | |
469 | * @return The function fitted to the data | |
470 | */ | |
471 | TF1* Fit1Particle(TH1* dist, Double_t sigman=-1); | |
472 | /** | |
473 | * Fit a N-particle signal to the passed energy loss distribution | |
474 | * | |
475 | * If there's no 1-particle fit present, it does that first | |
476 | * | |
477 | * @param dist Data to fit the function to | |
c389303e | 478 | * @param n Number of particle signals to fit |
7f759bb7 | 479 | * @param sigman If larger than zero, the initial guess of the |
480 | * detector induced noise. If zero or less, then this | |
481 | * parameter is ignored in the fit (fixed at 0) | |
482 | * | |
483 | * @return The function fitted to the data | |
484 | */ | |
485 | TF1* FitNParticle(TH1* dist, UShort_t n, Double_t sigman=-1); | |
fb3430ac | 486 | /** |
487 | * Get Lower cut on data | |
488 | * | |
489 | * @return Lower cut on data | |
490 | */ | |
491 | Double_t GetLowCut() const { return fLowCut; } | |
492 | /** | |
493 | * Get Maximum range to fit | |
494 | * | |
495 | * @return Maximum range to fit | |
496 | */ | |
497 | Double_t GetMaxRange() const { return fMaxRange; } | |
498 | /** | |
499 | * Get Number of bins from maximum to fit 1st peak | |
500 | * | |
501 | * @return Number of bins from maximum to fit 1st peak | |
502 | */ | |
503 | UShort_t GetMinusBins() const { return fMinusBins; } | |
504 | /** | |
505 | * Get Array of fit results | |
506 | * | |
507 | * @return Array of fit results | |
508 | */ | |
509 | const TObjArray& GetFitResults() const { return fFitResults; } | |
510 | /** | |
511 | * Get Array of fit results | |
512 | * | |
513 | * @return Array of fit results | |
514 | */ | |
515 | TObjArray& GetFitResults() { return fFitResults; } | |
516 | /** | |
517 | * Get Array of functions | |
518 | * | |
519 | * @return Array of functions | |
520 | */ | |
521 | const TObjArray& GetFunctions() const { return fFunctions; } | |
522 | /** | |
523 | * Get Array of functions | |
524 | * | |
525 | * @return Array of functions | |
526 | */ | |
527 | TObjArray& GetFunctions() { return fFunctions; } | |
528 | private: | |
7f759bb7 | 529 | const Double_t fLowCut; // Lower cut on data |
530 | const Double_t fMaxRange; // Maximum range to fit | |
531 | const UShort_t fMinusBins; // Number of bins from maximum to fit 1st peak | |
532 | TObjArray fFitResults; // Array of fit results | |
533 | TObjArray fFunctions; // Array of functions | |
534 | }; | |
0bd4b00f | 535 | /* @} */ |
7f759bb7 | 536 | |
537 | ||
0bd4b00f | 538 | //================================================================== |
539 | /** | |
540 | * @{ | |
541 | * @name Convenience containers | |
542 | */ | |
7e4038b5 | 543 | /** |
544 | * Structure to hold histograms | |
545 | * | |
bd6f5206 | 546 | * @ingroup pwglf_forward |
7e4038b5 | 547 | */ |
548 | struct Histos : public TObject | |
549 | { | |
550 | /** | |
551 | * Constructor | |
552 | * | |
553 | * | |
554 | */ | |
555 | Histos() : fFMD1i(0), fFMD2i(0), fFMD2o(0), fFMD3i(0), fFMD3o(0) {} | |
556 | /** | |
557 | * Copy constructor | |
558 | * | |
559 | * @param o Object to copy from | |
560 | */ | |
561 | Histos(const Histos& o) | |
562 | : TObject(o), | |
563 | fFMD1i(o.fFMD1i), | |
564 | fFMD2i(o.fFMD2i), | |
565 | fFMD2o(o.fFMD2o), | |
566 | fFMD3i(o.fFMD3i), | |
567 | fFMD3o(o.fFMD3o) | |
568 | {} | |
569 | /** | |
570 | * Assignement operator | |
571 | * | |
572 | * @return Reference to this | |
573 | */ | |
574 | Histos& operator=(const Histos&) { return *this;} | |
575 | /** | |
b7ab8a2c | 576 | * Destructor. This does not delete the interally allocated |
577 | * memory. Use the member function Delete for that. | |
7e4038b5 | 578 | */ |
579 | ~Histos(); | |
b7ab8a2c | 580 | /** |
581 | * Clear internal memory. Note, if the internal histograms are | |
582 | * added to an output container, then we must not free this | |
583 | * memory. | |
584 | */ | |
585 | void Delete(Option_t* opt=""); | |
7e4038b5 | 586 | /** |
587 | * Initialize the object | |
588 | * | |
589 | * @param etaAxis Eta axis to use | |
590 | */ | |
591 | void Init(const TAxis& etaAxis); | |
592 | /** | |
593 | * Make a histogram | |
594 | * | |
595 | * @param d Detector | |
596 | * @param r Ring | |
597 | * @param etaAxis Eta axis to use | |
598 | * | |
599 | * @return Newly allocated histogram | |
600 | */ | |
601 | TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis) const; | |
602 | /** | |
603 | * Clear data | |
604 | * | |
605 | * @param option Not used | |
606 | */ | |
607 | void Clear(Option_t* option=""); | |
608 | // const TH2D* Get(UShort_t d, Char_t r) const; | |
609 | /** | |
610 | * Get the histogram for a particular detector,ring | |
611 | * | |
612 | * @param d Detector | |
613 | * @param r Ring | |
614 | * | |
615 | * @return Histogram for detector,ring or nul | |
616 | */ | |
617 | TH2D* Get(UShort_t d, Char_t r) const; | |
618 | TH2D* fFMD1i; // Histogram for FMD1i | |
619 | TH2D* fFMD2i; // Histogram for FMD2i | |
620 | TH2D* fFMD2o; // Histogram for FMD2o | |
621 | TH2D* fFMD3i; // Histogram for FMD3i | |
622 | TH2D* fFMD3o; // Histogram for FMD3o | |
9d99b0dd | 623 | |
624 | ClassDef(Histos,1) | |
7e4038b5 | 625 | }; |
626 | ||
9d99b0dd | 627 | //__________________________________________________________________ |
ca610c5c | 628 | /** |
629 | * Base class for structure holding ring specific histograms | |
630 | * | |
bd6f5206 | 631 | * @ingroup pwglf_forward |
ca610c5c | 632 | */ |
9d99b0dd | 633 | struct RingHistos : public TObject |
634 | { | |
ca610c5c | 635 | /** |
636 | * Constructor | |
637 | * | |
638 | */ | |
9d99b0dd | 639 | RingHistos() : fDet(0), fRing('\0'), fName("") {} |
ca610c5c | 640 | /** |
641 | * | |
642 | * | |
643 | * @param d Detector | |
644 | * @param r Ring | |
645 | */ | |
9d99b0dd | 646 | RingHistos(UShort_t d, Char_t r) |
647 | : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)) | |
648 | {} | |
ca610c5c | 649 | /** |
650 | * Copy constructor | |
651 | * | |
652 | * @param o Object to copy from | |
653 | */ | |
9d99b0dd | 654 | RingHistos(const RingHistos& o) |
655 | : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName) | |
656 | {} | |
ca610c5c | 657 | /** |
658 | * | |
659 | */ | |
9d99b0dd | 660 | virtual ~RingHistos() {} |
ca610c5c | 661 | /** |
662 | * Assignement operator | |
663 | * | |
664 | * @param o Object to assign from | |
665 | * | |
666 | * @return Reference to this | |
667 | */ | |
9d99b0dd | 668 | RingHistos& operator=(const RingHistos& o) |
669 | { | |
d015ecfe | 670 | if (&o == this) return *this; |
9d99b0dd | 671 | TObject::operator=(o); |
672 | fDet = o.fDet; | |
673 | fRing = o.fRing; | |
674 | fName = o.fName; | |
675 | return *this; | |
676 | } | |
ca610c5c | 677 | /** |
7984e5f7 | 678 | * Define the outout list in @a d |
ca610c5c | 679 | * |
7984e5f7 | 680 | * @param d Where to put the output list |
ca610c5c | 681 | * |
7984e5f7 | 682 | * @return Newly allocated TList object or null |
ca610c5c | 683 | */ |
9d99b0dd | 684 | TList* DefineOutputList(TList* d) const; |
ca610c5c | 685 | /** |
7984e5f7 | 686 | * Get our output list from the container @a d |
ca610c5c | 687 | * |
7984e5f7 | 688 | * @param d where to get the output list from |
ca610c5c | 689 | * |
7984e5f7 | 690 | * @return The found TList or null |
ca610c5c | 691 | */ |
fb3430ac | 692 | TList* GetOutputList(const TList* d) const; |
ca610c5c | 693 | /** |
7984e5f7 | 694 | * Find a specific histogram in the source list @a d |
ca610c5c | 695 | * |
7984e5f7 | 696 | * @param d (top)-container |
697 | * @param name Name of histogram | |
ca610c5c | 698 | * |
7984e5f7 | 699 | * @return Found histogram or null |
ca610c5c | 700 | */ |
fb3430ac | 701 | TH1* GetOutputHist(const TList* d, const char* name) const; |
ca610c5c | 702 | /** |
703 | * | |
704 | * | |
705 | * | |
706 | * @return | |
707 | */ | |
7f759bb7 | 708 | Color_t Color() const |
709 | { | |
cc83fca2 | 710 | return AliForwardUtil::RingColor(fDet, fRing); |
7f759bb7 | 711 | } |
290052e7 | 712 | /** |
713 | * The name of this ring | |
714 | * | |
715 | * @return Name of this ring | |
716 | */ | |
5bb5d1f6 | 717 | const char* GetName() const { return fName.Data(); } |
ca610c5c | 718 | UShort_t fDet; // Detector |
719 | Char_t fRing; // Ring | |
720 | TString fName; // Name | |
9d99b0dd | 721 | |
722 | ClassDef(RingHistos,1) | |
723 | }; | |
0bd4b00f | 724 | /* @} */ |
f53fb4f6 | 725 | |
726 | //__________________________________________________________________ | |
290052e7 | 727 | /** |
728 | * A guard idom for producing debug output | |
729 | * | |
730 | */ | |
f53fb4f6 | 731 | struct DebugGuard |
732 | { | |
290052e7 | 733 | /** |
734 | * Constructor | |
735 | * | |
736 | * @param lvl Current level | |
737 | * @param msgLvl Target level | |
738 | * @param format @c printf -like format | |
739 | * | |
740 | * @return | |
741 | */ | |
f53fb4f6 | 742 | DebugGuard(Int_t lvl, Int_t msgLvl, const char* format, ...); |
290052e7 | 743 | /** |
744 | * Destructor | |
745 | */ | |
f53fb4f6 | 746 | ~DebugGuard(); |
290052e7 | 747 | /** |
748 | * Make a message | |
749 | * | |
750 | * @param lvl Current level | |
751 | * @param msgLvl Target level | |
752 | * @param format @c printf -like format | |
753 | */ | |
40e32ce9 | 754 | static void Message(Int_t lvl, Int_t msgLvl, const char* format, ...); |
f53fb4f6 | 755 | private: |
290052e7 | 756 | /** |
757 | * Output the message | |
758 | * | |
759 | * @param in Direction | |
760 | * @param msg Message | |
761 | */ | |
40e32ce9 | 762 | static void Output(int in, TString& msg); |
290052e7 | 763 | /** |
764 | * Format a message | |
765 | * | |
766 | * @param out Output is stored here | |
767 | * @param format @c printf -like format | |
768 | * @param ap List of arguments | |
769 | */ | |
40e32ce9 | 770 | static void Format(TString& out, const char* format, va_list ap); |
f53fb4f6 | 771 | TString fMsg; |
772 | }; | |
8e400b14 | 773 | private: |
290052e7 | 774 | /** |
775 | * Constructor | |
776 | */ | |
8e400b14 | 777 | AliForwardUtil() {} |
290052e7 | 778 | /** |
779 | * Copy constructor | |
780 | * | |
781 | * @param o Object to copy from | |
782 | */ | |
8e400b14 | 783 | AliForwardUtil(const AliForwardUtil& o) : TObject(o) {} |
290052e7 | 784 | /** |
785 | * Assingment operator | |
786 | * | |
787 | * | |
788 | * @return Reference to this object | |
789 | */ | |
8e400b14 | 790 | AliForwardUtil& operator=(const AliForwardUtil&) { return *this; } |
290052e7 | 791 | /** |
792 | * Destructor | |
793 | */ | |
8e400b14 | 794 | ~AliForwardUtil() {} |
795 | ||
796 | ||
797 | ClassDef(AliForwardUtil,1) // Utilities - do not make object | |
7e4038b5 | 798 | }; |
799 | ||
40e32ce9 | 800 | // #ifdef LOG_NO_DEBUG |
801 | // # define DGUARD(L,N,F,...) do {} while(false) | |
802 | // #else | |
290052e7 | 803 | /** |
804 | * Macro to declare a DebugGuard | |
805 | * | |
806 | * @param L Current debug level | |
807 | * @param N Target debug level | |
808 | * @param F @c printf -like Format | |
809 | */ | |
f53fb4f6 | 810 | # define DGUARD(L,N,F,...) \ |
811 | AliForwardUtil::DebugGuard _GUARD(L,N,F, ## __VA_ARGS__) | |
290052e7 | 812 | /** |
813 | * Macro to make a debug message, using DebugGuard::Message | |
814 | * | |
815 | * @param L Current debug level | |
816 | * @param N Target debug level | |
817 | * @param F @c printf -like Format | |
818 | */ | |
40e32ce9 | 819 | # define DMSG(L,N,F,...) \ |
820 | AliForwardUtil::DebugGuard::Message(L,N,F, ## __VA_ARGS__) | |
821 | // #endif | |
7e4038b5 | 822 | #endif |
823 | // Local Variables: | |
824 | // mode: C++ | |
825 | // End: | |
826 |