]>
Commit | Line | Data |
---|---|---|
ce85db45 | 1 | // |
2 | // Task to analyse the AOD for for dN/deta in the base regions | |
3 | // | |
4 | #ifndef ALIBASEDNDETATASK_H | |
5 | #define ALIBASEDNDETATASK_H | |
ffca499d | 6 | /** |
7 | * @file AliBasedNdetaTask.h | |
8 | * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk> | |
9 | * @date Wed Mar 23 13:58:12 2011 | |
10 | * | |
11 | * @brief | |
12 | * | |
bd6f5206 | 13 | * @ingroup pwglf_forward_dndeta |
ffca499d | 14 | * |
15 | */ | |
c8b1a7db | 16 | #include "AliBaseAODTask.h" |
e308a636 | 17 | class TAxis; |
ce85db45 | 18 | class TList; |
19 | class TH2D; | |
f67d699c | 20 | class TH2F; |
ce85db45 | 21 | class TH1D; |
ffca499d | 22 | class TH1I; |
ce85db45 | 23 | class AliAODEvent; |
e1f47419 | 24 | class AliAODForwardMult; |
e308a636 | 25 | class TObjArray; |
ce85db45 | 26 | |
ffca499d | 27 | /** |
bd6f5206 | 28 | * @defgroup pwglf_forward_tasks_dndeta dN/deta tasks |
290052e7 | 29 | * |
30 | * Code to produce @f$ dN/d\eta@f$ | |
31 | * | |
bd6f5206 | 32 | * @ingroup pwglf_forward_tasks |
ffca499d | 33 | */ |
34 | /** | |
bd6f5206 | 35 | * @defgroup pwglf_forward_dndeta dN/deta |
ffca499d | 36 | * |
37 | * @f$ dN/d\eta@f$ code | |
38 | * | |
bd6f5206 | 39 | * @ingroup pwglf_forward_topical |
ffca499d | 40 | */ |
ce85db45 | 41 | /** |
ffca499d | 42 | * Base class for tasks to determine @f$ dN/d\eta@f$ |
43 | * | |
bd6f5206 | 44 | * @ingroup pwglf_forward_tasks_dndeta |
45 | * @ingroup pwglf_forward_dndeta | |
ce85db45 | 46 | */ |
c8b1a7db | 47 | class AliBasedNdetaTask : public AliBaseAODTask |
ce85db45 | 48 | { |
49 | public: | |
ffca499d | 50 | /** |
51 | * Bit mask values of the normalisation scheme | |
52 | */ | |
53 | enum { | |
54 | /** Only normalize to accepted events */ | |
55 | kNone = 0, | |
56 | /** | |
57 | * Do the full normalisation | |
58 | * @f[ | |
59 | * N = \frac{1}{\epsilon_X}(N_A-N_A/N_V(N_T-N_V)) = | |
60 | * \frac{1}{\epsilon_X}\frac{1}{\epsilon_V}N_A | |
61 | * @f] | |
62 | */ | |
63 | kEventLevel = 0x1, | |
ffca499d | 64 | /** |
65 | * Do the shape correction | |
66 | */ | |
0be6c8cd | 67 | kShape = 0x2, |
ffca499d | 68 | /** |
69 | * Correct for background events (A+C-E). Not implemented yet | |
70 | */ | |
0be6c8cd | 71 | kBackground = 0x4, |
ffca499d | 72 | /** |
0be6c8cd | 73 | * Correct for the trigger efficiency from MC |
ffca499d | 74 | */ |
0be6c8cd | 75 | kTriggerEfficiency = 0x8, |
4fa8d795 | 76 | /** |
77 | * Correct using zero-bin efficiency only | |
78 | */ | |
79 | kZeroBin = 0x10, | |
0be6c8cd | 80 | /** |
81 | * Do the full correction | |
ffca499d | 82 | */ |
0be6c8cd | 83 | kFull = kEventLevel | kShape | kBackground | kTriggerEfficiency, |
ffca499d | 84 | }; |
ce85db45 | 85 | /** |
86 | * Constructor | |
87 | * | |
88 | */ | |
89 | AliBasedNdetaTask(); | |
90 | /** | |
91 | * Constructor | |
92 | * | |
93 | * @param name Name of task | |
ce85db45 | 94 | */ |
95 | AliBasedNdetaTask(const char* name); | |
e1f47419 | 96 | /** |
97 | * Destructor | |
98 | * | |
99 | */ | |
100 | virtual ~AliBasedNdetaTask(); | |
ce85db45 | 101 | |
e1f47419 | 102 | /** |
103 | * @{ | |
104 | * @name Task configuration | |
105 | */ | |
290052e7 | 106 | /** |
107 | * Set the debug level | |
108 | * | |
109 | * @param level Debug level | |
110 | */ | |
f53fb4f6 | 111 | virtual void SetDebugLevel(Int_t level); |
ce85db45 | 112 | /** |
113 | * Set the rebinning factor | |
114 | * | |
115 | * @param rebin Rebinning factor | |
116 | */ | |
117 | void SetRebinning(Int_t rebin) { fRebin = rebin; } | |
3846ec25 | 118 | /** |
ffca499d | 119 | * Whether to cut edges when merging |
3846ec25 | 120 | * |
ffca499d | 121 | * @param cut If true, cut edges |
3846ec25 | 122 | */ |
123 | void SetCutEdges(Bool_t cut) {fCutEdges = cut;} | |
c25b5e1b | 124 | /** |
125 | * Set whether to correct for empty bins when projecting on the X axis. | |
126 | * | |
127 | * @param use Whether to correct for empty bins | |
128 | */ | |
129 | void SetCorrEmpty(Bool_t use) { fCorrEmpty = use; } | |
130 | /** | |
131 | * Set whether to use the ROOT TH2::ProjectionX method when | |
132 | * projecting on the X axis. | |
133 | * | |
134 | * @param use Whether to use TH2::ProjectionX | |
135 | */ | |
136 | void SetUseROOTProjectX(Bool_t use) { fUseROOTProj = use; } | |
e58000b7 | 137 | /** |
138 | * Trigger efficiency for selected trigger(s) | |
139 | * | |
140 | * @param e Trigger efficiency | |
141 | */ | |
142 | void SetTriggerEff(Double_t e) { fTriggerEff = e; } | |
66cf95f2 | 143 | /** |
144 | * Trigger efficiency for 0-bin for selected trigger(s) | |
145 | * | |
146 | * @param e Trigger efficiency for 0-bin | |
147 | */ | |
148 | void SetTriggerEff0(Double_t e) { fTriggerEff0 = e; } | |
e58000b7 | 149 | /** |
150 | * Set the shape correction (a.k.a., track correction) for selected | |
151 | * trigger(s) | |
152 | * | |
153 | * @param h Correction | |
154 | */ | |
f67d699c | 155 | void SetShapeCorrection(const TH2F* h); |
bfab35d9 | 156 | /** |
157 | * Set satellite vertex flag | |
158 | * | |
159 | * @param satVtx | |
160 | */ | |
161 | void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; } | |
a76fb27d | 162 | /** |
163 | * Get a string representing the normalization scheme | |
164 | * | |
165 | * @param scheme Normalization scheme bits | |
166 | * | |
167 | * @return String representation | |
168 | */ | |
169 | static const Char_t* NormalizationSchemeString(UShort_t scheme); | |
170 | /** | |
171 | * Parse a string representing the normalization scheme | |
172 | * | |
173 | * @param what String of the normalization scheme | |
174 | * | |
175 | * @return normalization scheme bits | |
176 | */ | |
177 | static UShort_t ParseNormalizationScheme(const Char_t* what); | |
678a4979 | 178 | /** |
ffca499d | 179 | * Setthe normalisation scheme to use |
180 | * | |
181 | * @param scheme Normalisation scheme | |
182 | */ | |
0be6c8cd | 183 | void SetNormalizationScheme(UShort_t scheme); |
ffca499d | 184 | /** |
185 | * Space, pipe, or comma separated list of options | |
186 | * | |
187 | * @param what List of options | |
678a4979 | 188 | */ |
ffca499d | 189 | void SetNormalizationScheme(const char* what); |
c89b9ac1 | 190 | /** |
191 | * Filename of final MC correction | |
192 | * | |
193 | * @param filename filename | |
194 | */ | |
195 | void SetMCFinalCorrFilename(const char* filename) { | |
196 | fFinalMCCorrFile.Clear(); | |
197 | fFinalMCCorrFile.Append(filename); | |
198 | } | |
678a4979 | 199 | /** |
200 | * Load the normalization data - done automatically if not set from outside | |
201 | * | |
e1f47419 | 202 | * @param sys system |
203 | * @param energy energy | |
678a4979 | 204 | */ |
e1f47419 | 205 | void LoadNormalizationData(UShort_t sys, UShort_t energy); |
206 | /** @} */ | |
0be6c8cd | 207 | /** |
208 | * Print information | |
209 | * | |
210 | * @param option Not used | |
211 | */ | |
212 | void Print(Option_t* option="") const; | |
e1f47419 | 213 | /** @{ |
214 | * @name Task interface | |
ce85db45 | 215 | */ |
ce85db45 | 216 | /** |
217 | * Create output objects. | |
218 | * | |
219 | * This is called once per slave process | |
c8b1a7db | 220 | * |
221 | * @return true on success | |
ce85db45 | 222 | */ |
c8b1a7db | 223 | virtual Bool_t Book(); |
ce85db45 | 224 | /** |
225 | * Process a single event | |
226 | * | |
c8b1a7db | 227 | * @return true on success |
ce85db45 | 228 | */ |
c8b1a7db | 229 | virtual Bool_t Event(AliAODEvent& aod); |
ce85db45 | 230 | /** |
ffca499d | 231 | * Called at end of event processing. |
ce85db45 | 232 | * |
233 | * This is called once in the master | |
234 | * | |
c8b1a7db | 235 | * @return true on success |
ce85db45 | 236 | */ |
c8b1a7db | 237 | virtual Bool_t Finalize(); |
ffca499d | 238 | /* @} */ |
ce85db45 | 239 | |
240 | /** | |
e1f47419 | 241 | * @{ |
242 | * @name Services member functions | |
ce85db45 | 243 | */ |
ce85db45 | 244 | /** |
245 | * Make a copy of the input histogram and rebin that histogram | |
246 | * | |
ffca499d | 247 | * @param h Histogram to rebin |
248 | * @param rebin Rebinning factor | |
249 | * @param cutEdges Whether to cut edges when rebinning | |
ce85db45 | 250 | * |
251 | * @return New (rebinned) histogram | |
252 | */ | |
e1f47419 | 253 | static TH1D* Rebin(const TH1D* h, Int_t rebin, Bool_t cutEdges=false); |
ce85db45 | 254 | /** |
255 | * Make an extension of @a h to make it symmetric about 0 | |
256 | * | |
257 | * @param h Histogram to symmertrice | |
258 | * | |
259 | * @return Symmetric extension of @a h | |
260 | */ | |
e1f47419 | 261 | static TH1* Symmetrice(const TH1* h); |
ce85db45 | 262 | /** |
263 | * Project onto the X axis | |
264 | * | |
265 | * @param h 2D histogram | |
266 | * @param name New name | |
267 | * @param firstbin First bin to use | |
268 | * @param lastbin Last bin to use | |
9f773c15 | 269 | * @param useROOT Use TH2::ProjectionX instead of custom code |
ffca499d | 270 | * @param corr Whether to do corrections or not |
ce85db45 | 271 | * @param error Whether to calculate errors |
272 | * | |
273 | * @return Newly created histogram or null | |
274 | */ | |
e1f47419 | 275 | static TH1D* ProjectX(const TH2D* h, |
276 | const char* name, | |
277 | Int_t firstbin, | |
278 | Int_t lastbin, | |
c25b5e1b | 279 | bool useROOT=false, |
e1f47419 | 280 | bool corr=true, |
281 | bool error=true); | |
4fa8d795 | 282 | /** |
283 | * Scale the copy of the 2D histogram by coverage in supplied 1D histogram | |
284 | * | |
285 | * @param copy Data to scale | |
286 | * @param norm Coverage histogram | |
287 | */ | |
288 | static void ScaleToCoverage(TH2D* copy, const TH1D* norm); | |
5ca83fee | 289 | /** |
290 | * Scale the copy of the 1D histogram by coverage in supplied 1D histogram | |
291 | * | |
292 | * @param copy Data to scale | |
293 | * @param norm Coverage histogram | |
294 | */ | |
295 | static void ScaleToCoverage(TH1D* copy, const TH1D* norm); | |
ce85db45 | 296 | /** |
297 | * Set histogram graphical options, etc. | |
298 | * | |
299 | * @param h Histogram to modify | |
300 | * @param colour Marker color | |
301 | * @param marker Marker style | |
302 | * @param title Title of histogram | |
303 | * @param ytitle Title on y-axis. | |
304 | */ | |
e1f47419 | 305 | static void SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker, |
306 | const char* title, | |
c8b1a7db | 307 | const char* ytitle=0); |
e1f47419 | 308 | /** @} */ |
9ecab72f | 309 | |
310 | /** | |
311 | * Marker styles | |
312 | */ | |
313 | enum { | |
314 | kSolid = 0x000, | |
315 | kHollow = 0x001, | |
316 | kCircle = 0x002, | |
317 | kSquare = 0x004, | |
318 | kUpTriangle = 0x006, | |
319 | kDownTriangle = 0x008, | |
320 | kDiamond = 0x00a, | |
321 | kCross = 0x00c, | |
322 | kStar = 0x00e | |
323 | }; | |
290052e7 | 324 | /** |
325 | * Get the marker style from option bits | |
326 | * | |
327 | * @param bits Option bits | |
328 | * | |
329 | * @return Marker style | |
330 | */ | |
9ecab72f | 331 | static Int_t GetMarkerStyle(UShort_t bits); |
290052e7 | 332 | /** |
333 | * Get the marker option bits from a style | |
334 | * | |
335 | * @param style Style | |
336 | * | |
337 | * @return option bits | |
338 | */ | |
9ecab72f | 339 | static UShort_t GetMarkerBits(Int_t style); |
290052e7 | 340 | /** |
341 | * Flip an option bit | |
342 | * | |
343 | * @param style Style parameter | |
344 | * | |
345 | * @return New style | |
346 | */ | |
9ecab72f | 347 | static Int_t FlipHollowStyle(Int_t style); |
f17f33fc | 348 | /** |
349 | * Setter of empirical correction | |
350 | * | |
351 | * @param h 2D histogram of ratio of nominal @f$ 1/N | |
352 | * dN_{ch}/d\eta@f$ to satellite @f$ 1/N dN_{ch}/d\eta@f$ in PbPb | |
353 | * collisions as a function of @f$\eta@f$ and interaction point | |
354 | * Z-coordinate @f$ IP_{z}@f$ | |
355 | */ | |
356 | void SetGlobalEmpiricalcorrection(TH2D* h){fEmpiricalCorrection=h;} | |
e1f47419 | 357 | protected: |
9ecab72f | 358 | /** |
c8b1a7db | 359 | * Copy contructor - not defined |
9ecab72f | 360 | */ |
e1f47419 | 361 | AliBasedNdetaTask(const AliBasedNdetaTask&); |
9ecab72f | 362 | /** |
c8b1a7db | 363 | * Assignment operator - not defined |
9ecab72f | 364 | * |
365 | * | |
366 | * @return | |
367 | */ | |
c8b1a7db | 368 | AliBasedNdetaTask& operator=(const AliBasedNdetaTask&); |
9ecab72f | 369 | // Forward declaration |
e1f47419 | 370 | class CentralityBin; |
c8b1a7db | 371 | /** |
372 | * Check if the event corresponds to the selected trigger(s), | |
373 | * vertex, and centrality. Derived classes can overload this to | |
374 | * enable event processing - even if the event is not within cuts. | |
375 | * | |
376 | * @param forward Forward object | |
377 | * | |
378 | * @return true if the event is within the cuts. | |
379 | */ | |
380 | virtual Bool_t CheckEvent(const AliAODForwardMult& forward); | |
f67d699c | 381 | /** |
382 | * Create the CentralityBin objects if not already done. | |
383 | * | |
384 | */ | |
385 | virtual void InitializeCentBins(); | |
e1f47419 | 386 | /** |
387 | * Retrieve the histogram | |
388 | * | |
389 | * @param aod AOD event | |
390 | * @param mc Whether to get the MC histogram or not | |
391 | * | |
392 | * @return Retrieved histogram or null | |
393 | */ | |
c8b1a7db | 394 | virtual TH2D* GetHistogram(const AliAODEvent& aod, Bool_t mc=false) = 0; |
ffca499d | 395 | /** |
9ecab72f | 396 | * Get the colour to use for markers (only pp - in PbPb we use a rainbow) |
ffca499d | 397 | * |
398 | * @return Marker colour | |
399 | */ | |
9ecab72f | 400 | virtual Int_t GetColor() const { return kBlack; } |
ffca499d | 401 | /** |
402 | * Get the marker style | |
403 | * | |
404 | * @return Marker style | |
405 | */ | |
9ecab72f | 406 | virtual Int_t GetMarker() const { return GetMarkerStyle(kCircle); } |
bfab35d9 | 407 | /** |
408 | * Massage data histograms if needed | |
409 | * | |
410 | * @param vtx | |
411 | * @param data | |
412 | * @param mcData | |
413 | */ | |
414 | virtual void CheckEventData(Double_t vtx, | |
415 | TH2* data, | |
416 | TH2* mcData); | |
e308a636 | 417 | /** |
418 | * Add a centrality bin | |
419 | * | |
ffca499d | 420 | * @param at Where in the list to add this bin |
e308a636 | 421 | * @param low Low cut |
422 | * @param high High cut | |
423 | */ | |
424 | void AddCentralityBin(UShort_t at, Short_t low, Short_t high); | |
e1f47419 | 425 | /** |
426 | * Make a centrality bin | |
427 | * | |
428 | * @param name Name used for histograms | |
429 | * @param low Low cut in percent | |
430 | * @param high High cut in percent | |
431 | * | |
432 | * @return A newly created centrality bin | |
433 | */ | |
434 | virtual CentralityBin* MakeCentralityBin(const char* name, Short_t low, | |
435 | Short_t high) const; | |
4fa8d795 | 436 | |
3d9b0442 | 437 | // function which applies empirical correction to the AOD object |
438 | Bool_t ApplyEmpiricalCorrection(const AliAODForwardMult* aod,TH2D* data); | |
4fa8d795 | 439 | //================================================================== |
9ecab72f | 440 | /** |
441 | * Class that holds the sum of the data - possibly split into 0 or | |
442 | * non-zero bins | |
443 | * | |
444 | */ | |
4fa8d795 | 445 | struct Sum : public TNamed |
446 | { | |
447 | TH2D* fSum; // Sum of non-zero events | |
448 | TH2D* fSum0; // Sum of zero events | |
449 | TH1I* fEvents; // Distribution of events | |
f53fb4f6 | 450 | Int_t fDebug; // Debug level |
9ecab72f | 451 | /** |
452 | * I/O Constructor - do not use | |
453 | */ | |
f53fb4f6 | 454 | Sum() : fSum(0), fSum0(0), fEvents(0), fDebug(0) {} |
9ecab72f | 455 | /** |
456 | * Constructor | |
457 | * | |
458 | * @param name Name | |
459 | * @param postfix Possible post-fix | |
460 | */ | |
4fa8d795 | 461 | Sum(const char* name, const char* postfix) |
462 | : TNamed(name,postfix), | |
463 | fSum(0), | |
464 | fSum0(0), | |
f53fb4f6 | 465 | fEvents(0), |
466 | fDebug(0) | |
4fa8d795 | 467 | {} |
9ecab72f | 468 | /** |
469 | * Copy constructor | |
470 | * | |
471 | * @param o Object to copy from | |
472 | */ | |
4fa8d795 | 473 | Sum(const Sum& o) |
474 | : TNamed(o), | |
475 | fSum(o.fSum), | |
476 | fSum0(o.fSum0), | |
f53fb4f6 | 477 | fEvents(o.fEvents), |
478 | fDebug(o.fDebug) | |
4fa8d795 | 479 | {} |
9ecab72f | 480 | /** |
481 | * Assignment operator | |
482 | * | |
483 | * @param o Object to assign from | |
484 | * | |
485 | * @return Reference to this object | |
486 | */ | |
997ba0f4 | 487 | Sum& operator=(const Sum& o) |
488 | { | |
489 | if (&o == this) return *this; | |
4fa8d795 | 490 | SetName(o.GetName()); fSum = o.fSum; fSum0 = o.fSum0; fEvents=o.fEvents; |
491 | return *this; | |
492 | } | |
9ecab72f | 493 | /** |
494 | * Destructor | |
495 | */ | |
4fa8d795 | 496 | ~Sum() {} |
9ecab72f | 497 | /** |
498 | * Initialise this object. | |
499 | * | |
500 | * @param list List to add histograms to | |
501 | * @param data Format of data to be cloned here | |
502 | * @param col Color | |
503 | */ | |
4fa8d795 | 504 | void Init(TList* list, const TH2D* data, Int_t col); |
9ecab72f | 505 | /** |
506 | * Add an event | |
507 | * | |
508 | * @param data Data to add | |
509 | * @param isZero If this is zero event | |
510 | */ | |
4fa8d795 | 511 | void Add(const TH2D* data, Bool_t isZero=false); |
f67d699c | 512 | /** |
513 | * Get the histogram name | |
514 | * | |
515 | * @param name Base name | |
516 | * @param what Which one | |
517 | * @param post Possible postfix | |
518 | * | |
519 | * @return Name | |
520 | */ | |
521 | static TString GetHistName(const char* name, Int_t what=0, | |
522 | const char* post=0); | |
9ecab72f | 523 | /** |
524 | * Get the histogram name | |
525 | * | |
526 | * @param what Which one | |
527 | * | |
528 | * @return Name | |
529 | */ | |
4fa8d795 | 530 | TString GetHistName(Int_t what=0) const; |
9ecab72f | 531 | /** |
532 | * Get the sum | |
533 | * | |
9ecab72f | 534 | * @param o Output list |
535 | * @param ntotal On return, the total number of events | |
536 | * @param zeroEff Zero-bin efficiency | |
537 | * @param otherEff Non-zero-bin efficiency | |
538 | * @param marker Marker to use | |
539 | * @param rootXproj Whether to use TH2::ProjectionX | |
540 | * @param corrEmpty Correct for empty bins | |
541 | * | |
542 | * @return The total sum histogram | |
543 | */ | |
f67d699c | 544 | TH2D* CalcSum(TList* o, Double_t& ntotal, |
545 | Double_t zeroEff, Double_t otherEff=1, Int_t marker=20, | |
546 | Bool_t rootXproj=false, Bool_t corrEmpty=true) const; | |
e12f8c42 | 547 | |
c8b1a7db | 548 | ClassDef(Sum,2); // Summed histograms |
4fa8d795 | 549 | }; |
4fa8d795 | 550 | |
551 | //================================================================== | |
e1f47419 | 552 | /** |
553 | * Calculations done per centrality | |
554 | * | |
555 | */ | |
badf1074 | 556 | class CentralityBin : public TNamed |
e1f47419 | 557 | { |
badf1074 | 558 | public: |
bfab35d9 | 559 | /** |
e1f47419 | 560 | * Constructor |
561 | */ | |
562 | CentralityBin(); | |
563 | /** | |
564 | * Constructor | |
565 | * | |
566 | * @param name Name used for histograms (e.g., Forward) | |
567 | * @param low Lower centrality cut in percent | |
568 | * @param high Upper centrality cut in percent | |
569 | */ | |
570 | CentralityBin(const char* name, Short_t low, Short_t high); | |
571 | /** | |
572 | * Copy constructor | |
573 | * | |
574 | * @param other Object to copy from | |
575 | */ | |
576 | CentralityBin(const CentralityBin& other); | |
577 | /** | |
578 | * Destructor | |
579 | */ | |
580 | virtual ~CentralityBin(); | |
581 | /** | |
582 | * Assignment operator | |
583 | * | |
584 | * @param other Object to assign from | |
585 | * | |
586 | * @return Reference to this | |
587 | */ | |
588 | CentralityBin& operator=(const CentralityBin& other); | |
589 | /** | |
590 | * Check if this is the 'all' bin | |
591 | * | |
592 | * @return true if low and high cuts are both zero | |
593 | */ | |
594 | Bool_t IsAllBin() const { return fLow == 0 && fHigh == 0; } | |
595 | /** | |
596 | * Get the list name | |
597 | * | |
598 | * @return List Name | |
599 | */ | |
600 | const char* GetListName() const; | |
601 | /** | |
602 | * Create output objects | |
603 | * | |
604 | * @param dir Parent list | |
1a7e2e15 | 605 | * @param mask Trigger mask |
e1f47419 | 606 | */ |
1a7e2e15 | 607 | virtual void CreateOutputObjects(TList* dir, Int_t mask); |
e1f47419 | 608 | /** |
609 | * Process an event | |
610 | * | |
611 | * @param forward Forward data (for trigger, vertex, & centrality) | |
612 | * @param triggerMask Trigger mask | |
9ecab72f | 613 | * @param isZero True if this is a zero bin event |
e1f47419 | 614 | * @param vzMin Minimum IP z coordinate |
615 | * @param vzMax Maximum IP z coordinate | |
616 | * @param data Data histogram | |
617 | * @param mc MC histogram | |
bfab35d9 | 618 | * |
619 | * @return true if the event was selected | |
e1f47419 | 620 | */ |
bfab35d9 | 621 | virtual Bool_t ProcessEvent(const AliAODForwardMult* forward, |
622 | Int_t triggerMask, | |
623 | Bool_t isZero, | |
624 | Double_t vzMin, | |
625 | Double_t vzMax, | |
626 | const TH2D* data, | |
627 | const TH2D* mc); | |
b30dee70 | 628 | /** |
629 | * Calculate the Event-Level normalization. | |
630 | * | |
631 | * The full event level normalization for trigger @f$X@f$ is given by | |
632 | * @f{eqnarray*}{ | |
633 | * N &=& \frac{1}{\epsilon_X} | |
634 | * \left(N_A+\frac{N_A}{N_V}(N_{-V}-\beta)\right)\\ | |
635 | * &=& \frac{1}{\epsilon_X}N_A | |
636 | * \left(1+\frac{1}{N_V}(N_T-N_V-\beta)\right)\\ | |
637 | * &=& \frac{1}{\epsilon_X}N_A | |
638 | * \left(1+\frac{N_T}{N_V}-1-\frac{\beta}{N_V}\right)\\ | |
639 | * &=& \frac{1}{\epsilon_X}N_A | |
640 | * \left(\frac{1}{\epsilon_V}-\frac{\beta}{N_V}\right) | |
641 | * @f} | |
642 | * where | |
643 | * | |
644 | * - @f$\epsilon_X=\frac{N_{T,X}}{N_X}@f$ is the trigger | |
645 | * efficiency evaluated in simulation. | |
646 | * - @f$\epsilon_V=\frac{N_V}{N_T}@f$ is the vertex efficiency | |
647 | * evaluated from the data | |
648 | * - @f$N_X@f$ is the Monte-Carlo truth number of events of type | |
649 | * @f$X@f$. | |
650 | * - @f$N_{T,X}@f$ is the Monte-Carlo truth number of events of type | |
651 | * @f$X@f$ which was also triggered as such. | |
652 | * - @f$N_T@f$ is the number of data events that where triggered | |
653 | * as type @f$X@f$ and had a collision trigger (CINT1B) | |
654 | * - @f$N_V@f$ is the number of data events that where triggered | |
655 | * as type @f$X@f$, had a collision trigger (CINT1B), and had | |
656 | * a vertex. | |
657 | * - @f$N_{-V}@f$ is the number of data events that where triggered | |
658 | * as type @f$X@f$, had a collision trigger (CINT1B), but no | |
659 | * vertex. | |
660 | * - @f$N_A@f$ is the number of data events that where triggered | |
661 | * as type @f$X@f$, had a collision trigger (CINT1B), and had | |
662 | * a vertex in the selected range. | |
663 | * - @f$\beta=N_a+N_c-N_e@f$ is the number of control triggers that | |
664 | * were also triggered as type @f$X@f$. | |
665 | * - @f$N_a@f$ Number of beam-empty events also triggered as type | |
666 | * @f$X@f$ events (CINT1-A or CINT1-AC). | |
667 | * - @f$N_c@f$ Number of empty-beam events also triggered as type | |
668 | * @f$X@f$ events (CINT1-C). | |
669 | * - @f$N_e@f$ Number of empty-empty events also triggered as type | |
670 | * @f$X@f$ events (CINT1-E). | |
671 | * | |
672 | * Note, that if @f$ \beta \ll N_A@f$ the last term can be ignored, and | |
673 | * the expression simplyfies to | |
674 | * @f[ | |
675 | * N = \frac{1}{\epsilon_X}\frac{1}{\epsilon_V}N_A | |
676 | * @f] | |
677 | * | |
678 | * @param t Histogram of triggers | |
679 | * @param scheme Normalisation scheme | |
680 | * @param trgEff Trigger efficiency | |
681 | * @param ntotal On return, the total number of events to normalise to. | |
1a7e2e15 | 682 | * @param text If non-null, fill with normalization calculation |
b30dee70 | 683 | * |
684 | * @return @f$N_A/N@f$ or negative number in case of errors. | |
685 | */ | |
686 | virtual Double_t Normalization(const TH1I& t, | |
687 | UShort_t scheme, | |
688 | Double_t trgEff, | |
1a7e2e15 | 689 | Double_t& ntotal, |
690 | TString* text) const; | |
c25b5e1b | 691 | /** |
692 | * Generate the dN/deta result from input | |
693 | * | |
694 | * @param sum Sum of 2D hists | |
695 | * @param postfix Post fix on names | |
696 | * @param rootProj Whether to use ROOT TH2::ProjectionX | |
697 | * @param corrEmpty Correct for empty bins | |
698 | * @param shapeCorr Shape correction to use | |
699 | * @param scaler Event-level normalization scaler | |
700 | * @param symmetrice Whether to make symmetric extensions | |
701 | * @param rebin Whether to rebin | |
702 | * @param cutEdges Whether to cut edges when rebinning | |
9f773c15 | 703 | * @param marker Marker style |
c6115ede | 704 | * @param color Color of markers |
705 | * @param mclist List of MC data | |
706 | * @param truthlist List of MC truth data | |
c25b5e1b | 707 | */ |
708 | virtual void MakeResult(const TH2D* sum, | |
709 | const char* postfix, | |
710 | bool rootProj, | |
711 | bool corrEmpty, | |
f67d699c | 712 | const TH2F* shapeCorr, |
c25b5e1b | 713 | Double_t scaler, |
714 | bool symmetrice, | |
715 | Int_t rebin, | |
716 | bool cutEdges, | |
9ecab72f | 717 | Int_t marker, |
c89b9ac1 | 718 | Int_t color, |
719 | TList* mclist, | |
720 | TList* truthlist); | |
e1f47419 | 721 | /** |
722 | * End of processing | |
723 | * | |
724 | * @param sums List of sums | |
725 | * @param results Output list of results | |
ffca499d | 726 | * @param scheme Normalisation scheme options |
e1f47419 | 727 | * @param shapeCorr Shape correction or nil |
728 | * @param trigEff Trigger efficiency | |
66cf95f2 | 729 | * @param trigEff0 0-bin trigger efficiency |
e1f47419 | 730 | * @param symmetrice Whether to symmetrice the results |
731 | * @param rebin Whether to rebin the results | |
c25b5e1b | 732 | * @param rootProj If true, use TH2::ProjectionX |
e1f47419 | 733 | * @param corrEmpty Whether to correct for empty bins |
734 | * @param cutEdges Whether to cut edges when rebinning | |
e1f47419 | 735 | * @param triggerMask Trigger mask |
ffca499d | 736 | * @param marker Marker style |
c6115ede | 737 | * @param color Color of markers |
738 | * @param mclist List of MC data | |
739 | * @param truthlist List of MC truth data | |
e1f47419 | 740 | */ |
741 | virtual void End(TList* sums, | |
742 | TList* results, | |
ffca499d | 743 | UShort_t scheme, |
f67d699c | 744 | const TH2F* shapeCorr, |
e1f47419 | 745 | Double_t trigEff, |
66cf95f2 | 746 | Double_t trigEff0, |
e1f47419 | 747 | Bool_t symmetrice, |
748 | Int_t rebin, | |
c25b5e1b | 749 | Bool_t rootProj, |
e1f47419 | 750 | Bool_t corrEmpty, |
751 | Bool_t cutEdges, | |
ffca499d | 752 | Int_t triggerMask, |
9ecab72f | 753 | Int_t marker, |
c89b9ac1 | 754 | Int_t color, |
755 | TList* mclist, | |
756 | TList* truthlist); | |
e1f47419 | 757 | /** |
758 | * @{ | |
759 | * @name Access histograms | |
760 | */ | |
761 | /** | |
762 | * Get sum histogram | |
763 | * | |
764 | * @param mc If true, return MC histogram | |
765 | * | |
766 | * @return Sum histogram | |
767 | */ | |
4fa8d795 | 768 | const Sum* GetSum(Bool_t mc=false) const { return mc ? fSumMC : fSum; } |
e1f47419 | 769 | /** |
770 | * Get sum histogram | |
771 | * | |
772 | * @param mc If true, return MC histogram | |
773 | * | |
774 | * @return Sum histogram | |
775 | */ | |
4fa8d795 | 776 | Sum* GetSum(Bool_t mc=false) { return mc ? fSumMC : fSum; } |
e1f47419 | 777 | /** |
778 | * Get trigger histogram | |
779 | * | |
780 | * @return Trigger histogram | |
781 | */ | |
ffca499d | 782 | const TH1I* GetTriggers() const { return fTriggers; } |
e1f47419 | 783 | /** |
784 | * Get trigger histogram | |
785 | * | |
786 | * @return Trigger histogram | |
787 | */ | |
bfab35d9 | 788 | TH1I* GetTriggers() { return fTriggers; } |
789 | /** | |
790 | * Get trigger histogram | |
791 | * | |
792 | * @return Trigger histogram | |
793 | */ | |
794 | const TH1I* GetStatus() const { return fStatus; } | |
795 | /** | |
796 | * Get trigger histogram | |
797 | * | |
798 | * @return Trigger histogram | |
799 | */ | |
800 | TH1I* GetStatus() { return fStatus; } | |
e1f47419 | 801 | /** @} */ |
5bb5d1f6 | 802 | |
9ecab72f | 803 | /** |
804 | * Get the color of the markers | |
805 | * | |
290052e7 | 806 | * @param fallback Fall-back color |
807 | * | |
808 | * @return Color for this centrality bin | |
9ecab72f | 809 | */ |
810 | Int_t GetColor(Int_t fallback=kRed+2) const; | |
811 | /** | |
812 | * Get list of results | |
813 | * | |
290052e7 | 814 | * @return List of results |
9ecab72f | 815 | */ |
5bb5d1f6 | 816 | TList* GetResults() const { return fOutput; } |
9ecab72f | 817 | /** |
c8b1a7db | 818 | * Get name of result histogram. Note, the returned pointer points |
819 | * to static memory and should be copied/used immediately. | |
9ecab72f | 820 | * |
c8b1a7db | 821 | * @param rebin Whether to get rebinned result |
822 | * @param sym Whether to get symmetric extension | |
823 | * @param postfix Possible postfix (e.g., "MC") | |
9ecab72f | 824 | * |
825 | * @return | |
826 | */ | |
5bb5d1f6 | 827 | const char* GetResultName(Int_t rebin, Bool_t sym, |
828 | const char* postfix="") const; | |
9ecab72f | 829 | /** |
830 | * Get a result | |
831 | * | |
c8b1a7db | 832 | * @param rebin Whether to get rebinned result |
833 | * @param sym Whether to get symmetric extension | |
834 | * @param postfix Possible postfix (e.g., "MC") | |
835 | * @param verbose If true, complain about missing histogram | |
9ecab72f | 836 | * |
c8b1a7db | 837 | * @return Pointer to histogram or null |
9ecab72f | 838 | */ |
c8b1a7db | 839 | TH1* GetResult(Int_t rebin, |
840 | Bool_t sym, | |
841 | const char* postfix="", | |
842 | Bool_t verbose=true) const; | |
290052e7 | 843 | /** |
844 | * Set the debug level | |
845 | * | |
846 | * @param lvl Debug level | |
847 | */ | |
f53fb4f6 | 848 | void SetDebugLevel(Int_t lvl); |
bfab35d9 | 849 | /** |
850 | * Set satellite vertex flag | |
851 | * | |
852 | * @param satVtx | |
853 | */ | |
854 | void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; } | |
e1f47419 | 855 | protected: |
290052e7 | 856 | /** |
857 | * Read in sum hisotgram from list | |
858 | * | |
859 | * @param list List to read from | |
860 | * @param mc True for MC input | |
861 | * | |
862 | * @return true if sum histogram is found | |
863 | */ | |
f67d699c | 864 | virtual Bool_t ReadSum(TList* list, bool mc=false); |
e1f47419 | 865 | /** |
866 | * Create sum histogram | |
867 | * | |
868 | * @param data Data histogram to clone | |
869 | * @param mc (optional) MC histogram to clone | |
870 | */ | |
871 | virtual void CreateSums(const TH2D* data, const TH2D* mc); | |
872 | /** | |
873 | * Check the trigger, vertex, and centrality | |
874 | * | |
ffca499d | 875 | * @param forward Event input |
876 | * @param triggerMask The used trigger mask | |
877 | * @param vzMin Least @f$ v_z@f$ | |
878 | * @param vzMax Largest @f$ v_z@f$ | |
e1f47419 | 879 | * |
880 | * @return true if the event is to be used | |
881 | */ | |
882 | virtual Bool_t CheckEvent(const AliAODForwardMult* forward, | |
ffca499d | 883 | Int_t triggerMask, |
884 | Double_t vzMin, | |
885 | Double_t vzMax); | |
e1f47419 | 886 | TList* fSums; // Output list |
887 | TList* fOutput; // Output list | |
4fa8d795 | 888 | Sum* fSum; // Sum histogram |
889 | Sum* fSumMC; // MC sum histogram | |
ffca499d | 890 | TH1I* fTriggers; // Trigger histogram |
bfab35d9 | 891 | TH1I* fStatus; // Trigger histogram |
e1f47419 | 892 | UShort_t fLow; // Lower limit (inclusive) |
893 | UShort_t fHigh; // Upper limit (exclusive) | |
c89b9ac1 | 894 | Bool_t fDoFinalMCCorrection; //Do final MC correction |
bfab35d9 | 895 | Bool_t fSatelliteVertices; // Satellite vertex flag |
f53fb4f6 | 896 | Int_t fDebug; // Debug level |
897 | ||
c8b1a7db | 898 | ClassDef(CentralityBin,4); // A centrality bin |
e1f47419 | 899 | }; |
ce85db45 | 900 | Int_t fRebin; // Rebinning factor |
901 | Bool_t fCutEdges; // Whether to cut edges when rebinning | |
902 | Bool_t fSymmetrice; // Whether to symmetrice data | |
903 | Bool_t fCorrEmpty; // Correct for empty bins | |
c25b5e1b | 904 | Bool_t fUseROOTProj; // Whether to use ROOT's ProjectionX |
e58000b7 | 905 | Double_t fTriggerEff; // Trigger efficiency for selected trigger(s) |
66cf95f2 | 906 | Double_t fTriggerEff0; // Bin-0 Trigger efficiency for sel trigger(s) |
f67d699c | 907 | TH2F* fShapeCorr; // Shape correction |
e308a636 | 908 | TObjArray* fListOfCentralities; // Centrality bins |
ffca499d | 909 | UShort_t fNormalizationScheme; // Normalization scheme |
c89b9ac1 | 910 | TString fFinalMCCorrFile; //Filename for final MC corr |
bfab35d9 | 911 | Bool_t fSatelliteVertices; // satellite vertex flag |
f17f33fc | 912 | TH2D* fEmpiricalCorrection; // Empirical correction |
913 | TH2D* fMeanVsC; //mean signal per event vs cent | |
c8b1a7db | 914 | ClassDef(AliBasedNdetaTask,14); // Determine charged particle density |
ce85db45 | 915 | }; |
916 | ||
917 | #endif | |
918 | // | |
919 | // Local Variables: | |
920 | // mode: C++ | |
921 | // End: | |
922 | // |