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