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