]>
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 | * | |
13 | * @ingroup pwg2_forward_dndeta | |
14 | * | |
15 | */ | |
ce85db45 | 16 | #include <AliAnalysisTaskSE.h> |
e308a636 | 17 | class TAxis; |
ce85db45 | 18 | class TList; |
19 | class TH2D; | |
20 | class TH1D; | |
ffca499d | 21 | class TH1I; |
ce85db45 | 22 | class AliAODEvent; |
e1f47419 | 23 | class AliAODForwardMult; |
e308a636 | 24 | class TObjArray; |
ce85db45 | 25 | |
ffca499d | 26 | /** |
27 | * @defgroup pwg2_forward_tasks_dndeta dN/deta tasks | |
28 | * @ingroup pwg2_forward_tasks | |
29 | */ | |
30 | /** | |
31 | * @defgroup pwg2_forward_dndeta dN/deta | |
32 | * | |
33 | * @f$ dN/d\eta@f$ code | |
34 | * | |
35 | * @ingroup pwg2_forward_topical | |
36 | */ | |
ce85db45 | 37 | /** |
ffca499d | 38 | * Base class for tasks to determine @f$ dN/d\eta@f$ |
39 | * | |
40 | * @ingroup pwg2_forward_tasks_dndeta | |
41 | * @ingroup pwg2_forward_dndeta | |
ce85db45 | 42 | */ |
43 | class AliBasedNdetaTask : public AliAnalysisTaskSE | |
44 | { | |
45 | public: | |
ffca499d | 46 | /** |
47 | * Bit mask values of the normalisation scheme | |
48 | */ | |
49 | enum { | |
50 | /** Only normalize to accepted events */ | |
51 | kNone = 0, | |
52 | /** | |
53 | * Do the full normalisation | |
54 | * @f[ | |
55 | * N = \frac{1}{\epsilon_X}(N_A-N_A/N_V(N_T-N_V)) = | |
56 | * \frac{1}{\epsilon_X}\frac{1}{\epsilon_V}N_A | |
57 | * @f] | |
58 | */ | |
59 | kEventLevel = 0x1, | |
ffca499d | 60 | /** |
61 | * Do the shape correction | |
62 | */ | |
0be6c8cd | 63 | kShape = 0x2, |
ffca499d | 64 | /** |
65 | * Correct for background events (A+C-E). Not implemented yet | |
66 | */ | |
0be6c8cd | 67 | kBackground = 0x4, |
ffca499d | 68 | /** |
0be6c8cd | 69 | * Correct for the trigger efficiency from MC |
ffca499d | 70 | */ |
0be6c8cd | 71 | kTriggerEfficiency = 0x8, |
72 | /** | |
73 | * Do the full correction | |
ffca499d | 74 | */ |
0be6c8cd | 75 | kFull = kEventLevel | kShape | kBackground | kTriggerEfficiency, |
ffca499d | 76 | }; |
ce85db45 | 77 | /** |
78 | * Constructor | |
79 | * | |
80 | */ | |
81 | AliBasedNdetaTask(); | |
82 | /** | |
83 | * Constructor | |
84 | * | |
85 | * @param name Name of task | |
ce85db45 | 86 | */ |
87 | AliBasedNdetaTask(const char* name); | |
e1f47419 | 88 | /** |
89 | * Destructor | |
90 | * | |
91 | */ | |
92 | virtual ~AliBasedNdetaTask(); | |
ce85db45 | 93 | |
e1f47419 | 94 | /** |
95 | * @{ | |
96 | * @name Task configuration | |
97 | */ | |
ce85db45 | 98 | /** |
99 | * Set the vertex range to use | |
100 | * | |
101 | * @param min Minimum (in centermeter) | |
102 | * @param max Maximum (in centermeter) | |
103 | */ | |
104 | void SetVertexRange(Double_t min, Double_t max) { fVtxMin=min; fVtxMax=max; } | |
105 | /** | |
106 | * Set the rebinning factor | |
107 | * | |
108 | * @param rebin Rebinning factor | |
109 | */ | |
110 | void SetRebinning(Int_t rebin) { fRebin = rebin; } | |
111 | /** | |
112 | * Set the trigger maskl | |
113 | * | |
114 | * @param mask Trigger mask | |
115 | */ | |
0be6c8cd | 116 | void SetTriggerMask(UShort_t mask); |
ce85db45 | 117 | /** |
118 | * Set the trigger mask | |
119 | * | |
120 | * @param mask trigger mask | |
121 | */ | |
122 | void SetTriggerMask(const char* mask); | |
e308a636 | 123 | /** |
124 | * Set the centrality bins to use. | |
125 | * | |
126 | * @code | |
127 | * UShort_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; | |
128 | * task->SetCentralityBins(11, bins); | |
129 | * @endcode | |
130 | * | |
131 | * @param n Number of bins (elements in @a bins minus 1) | |
132 | * @param bins Bin limits | |
133 | */ | |
134 | void SetCentralityAxis(UShort_t n, Short_t* bins); | |
3846ec25 | 135 | /** |
ffca499d | 136 | * Whether to cut edges when merging |
3846ec25 | 137 | * |
ffca499d | 138 | * @param cut If true, cut edges |
3846ec25 | 139 | */ |
140 | void SetCutEdges(Bool_t cut) {fCutEdges = cut;} | |
e58000b7 | 141 | /** |
142 | * Trigger efficiency for selected trigger(s) | |
143 | * | |
144 | * @param e Trigger efficiency | |
145 | */ | |
146 | void SetTriggerEff(Double_t e) { fTriggerEff = e; } | |
147 | /** | |
148 | * Set the shape correction (a.k.a., track correction) for selected | |
149 | * trigger(s) | |
150 | * | |
151 | * @param h Correction | |
152 | */ | |
678a4979 | 153 | void SetShapeCorrection(const TH1* h); |
154 | /** | |
ffca499d | 155 | * Setthe normalisation scheme to use |
156 | * | |
157 | * @param scheme Normalisation scheme | |
158 | */ | |
0be6c8cd | 159 | void SetNormalizationScheme(UShort_t scheme); |
ffca499d | 160 | /** |
161 | * Space, pipe, or comma separated list of options | |
162 | * | |
163 | * @param what List of options | |
678a4979 | 164 | */ |
ffca499d | 165 | void SetNormalizationScheme(const char* what); |
678a4979 | 166 | /** |
167 | * Load the normalization data - done automatically if not set from outside | |
168 | * | |
e1f47419 | 169 | * @param sys system |
170 | * @param energy energy | |
678a4979 | 171 | */ |
e1f47419 | 172 | void LoadNormalizationData(UShort_t sys, UShort_t energy); |
173 | /** @} */ | |
0be6c8cd | 174 | /** |
175 | * Print information | |
176 | * | |
177 | * @param option Not used | |
178 | */ | |
179 | void Print(Option_t* option="") const; | |
e1f47419 | 180 | /** @{ |
181 | * @name Task interface | |
ce85db45 | 182 | */ |
ce85db45 | 183 | /** |
184 | * Initialise on master - does nothing | |
185 | * | |
186 | */ | |
187 | virtual void Init() {} | |
188 | /** | |
189 | * Create output objects. | |
190 | * | |
191 | * This is called once per slave process | |
192 | */ | |
193 | virtual void UserCreateOutputObjects(); | |
194 | /** | |
195 | * Process a single event | |
196 | * | |
197 | * @param option Not used | |
198 | */ | |
199 | virtual void UserExec(Option_t* option); | |
200 | /** | |
ffca499d | 201 | * Called at end of event processing. |
ce85db45 | 202 | * |
203 | * This is called once in the master | |
204 | * | |
205 | * @param option Not used | |
206 | */ | |
207 | virtual void Terminate(Option_t* option); | |
ffca499d | 208 | /* @} */ |
ce85db45 | 209 | |
210 | /** | |
e1f47419 | 211 | * @{ |
212 | * @name Services member functions | |
ce85db45 | 213 | */ |
ce85db45 | 214 | /** |
215 | * Make a copy of the input histogram and rebin that histogram | |
216 | * | |
ffca499d | 217 | * @param h Histogram to rebin |
218 | * @param rebin Rebinning factor | |
219 | * @param cutEdges Whether to cut edges when rebinning | |
ce85db45 | 220 | * |
221 | * @return New (rebinned) histogram | |
222 | */ | |
e1f47419 | 223 | static TH1D* Rebin(const TH1D* h, Int_t rebin, Bool_t cutEdges=false); |
ce85db45 | 224 | /** |
225 | * Make an extension of @a h to make it symmetric about 0 | |
226 | * | |
227 | * @param h Histogram to symmertrice | |
228 | * | |
229 | * @return Symmetric extension of @a h | |
230 | */ | |
e1f47419 | 231 | static TH1* Symmetrice(const TH1* h); |
ce85db45 | 232 | /** |
233 | * Project onto the X axis | |
234 | * | |
235 | * @param h 2D histogram | |
236 | * @param name New name | |
237 | * @param firstbin First bin to use | |
238 | * @param lastbin Last bin to use | |
ffca499d | 239 | * @param corr Whether to do corrections or not |
ce85db45 | 240 | * @param error Whether to calculate errors |
241 | * | |
242 | * @return Newly created histogram or null | |
243 | */ | |
e1f47419 | 244 | static TH1D* ProjectX(const TH2D* h, |
245 | const char* name, | |
246 | Int_t firstbin, | |
247 | Int_t lastbin, | |
248 | bool corr=true, | |
249 | bool error=true); | |
ce85db45 | 250 | /** |
251 | * Set histogram graphical options, etc. | |
252 | * | |
253 | * @param h Histogram to modify | |
254 | * @param colour Marker color | |
255 | * @param marker Marker style | |
256 | * @param title Title of histogram | |
257 | * @param ytitle Title on y-axis. | |
258 | */ | |
e1f47419 | 259 | static void SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker, |
260 | const char* title, | |
261 | const char* ytitle="#frac{1}{N} #frac{dN_{ch}}{d#eta}"); | |
262 | /** @} */ | |
263 | protected: | |
264 | AliBasedNdetaTask(const AliBasedNdetaTask&); | |
265 | AliBasedNdetaTask& operator=(const AliBasedNdetaTask&) { return *this; } | |
266 | class CentralityBin; | |
267 | ||
268 | /** | |
269 | * Retrieve the histogram | |
270 | * | |
271 | * @param aod AOD event | |
272 | * @param mc Whether to get the MC histogram or not | |
273 | * | |
274 | * @return Retrieved histogram or null | |
275 | */ | |
276 | virtual TH2D* GetHistogram(const AliAODEvent* aod, Bool_t mc=false) = 0; | |
ffca499d | 277 | /** |
278 | * Get the colour to use for markers | |
279 | * | |
280 | * @return Marker colour | |
281 | */ | |
282 | virtual Int_t GetColor() const { return kRed+1; } | |
283 | /** | |
284 | * Get the marker style | |
285 | * | |
286 | * @return Marker style | |
287 | */ | |
288 | virtual Int_t GetMarker() const { return 20; } | |
e308a636 | 289 | /** |
290 | * Add a centrality bin | |
291 | * | |
ffca499d | 292 | * @param at Where in the list to add this bin |
e308a636 | 293 | * @param low Low cut |
294 | * @param high High cut | |
295 | */ | |
296 | void AddCentralityBin(UShort_t at, Short_t low, Short_t high); | |
e1f47419 | 297 | /** |
298 | * Make a centrality bin | |
299 | * | |
300 | * @param name Name used for histograms | |
301 | * @param low Low cut in percent | |
302 | * @param high High cut in percent | |
303 | * | |
304 | * @return A newly created centrality bin | |
305 | */ | |
306 | virtual CentralityBin* MakeCentralityBin(const char* name, Short_t low, | |
307 | Short_t high) const; | |
e1f47419 | 308 | /** |
309 | * Calculations done per centrality | |
310 | * | |
311 | */ | |
312 | struct CentralityBin : public TNamed | |
313 | { | |
ffca499d | 314 | /** dN |
e1f47419 | 315 | * Constructor |
316 | */ | |
317 | CentralityBin(); | |
318 | /** | |
319 | * Constructor | |
320 | * | |
321 | * @param name Name used for histograms (e.g., Forward) | |
322 | * @param low Lower centrality cut in percent | |
323 | * @param high Upper centrality cut in percent | |
324 | */ | |
325 | CentralityBin(const char* name, Short_t low, Short_t high); | |
326 | /** | |
327 | * Copy constructor | |
328 | * | |
329 | * @param other Object to copy from | |
330 | */ | |
331 | CentralityBin(const CentralityBin& other); | |
332 | /** | |
333 | * Destructor | |
334 | */ | |
335 | virtual ~CentralityBin(); | |
336 | /** | |
337 | * Assignment operator | |
338 | * | |
339 | * @param other Object to assign from | |
340 | * | |
341 | * @return Reference to this | |
342 | */ | |
343 | CentralityBin& operator=(const CentralityBin& other); | |
344 | /** | |
345 | * Check if this is the 'all' bin | |
346 | * | |
347 | * @return true if low and high cuts are both zero | |
348 | */ | |
349 | Bool_t IsAllBin() const { return fLow == 0 && fHigh == 0; } | |
350 | /** | |
351 | * Get the list name | |
352 | * | |
353 | * @return List Name | |
354 | */ | |
355 | const char* GetListName() const; | |
356 | /** | |
357 | * Create output objects | |
358 | * | |
359 | * @param dir Parent list | |
360 | */ | |
361 | virtual void CreateOutputObjects(TList* dir); | |
362 | /** | |
363 | * Process an event | |
364 | * | |
365 | * @param forward Forward data (for trigger, vertex, & centrality) | |
366 | * @param triggerMask Trigger mask | |
367 | * @param vzMin Minimum IP z coordinate | |
368 | * @param vzMax Maximum IP z coordinate | |
369 | * @param data Data histogram | |
370 | * @param mc MC histogram | |
371 | */ | |
372 | virtual void ProcessEvent(const AliAODForwardMult* forward, | |
ffca499d | 373 | Int_t triggerMask, |
374 | Double_t vzMin, | |
375 | Double_t vzMax, | |
376 | const TH2D* data, | |
377 | const TH2D* mc); | |
e1f47419 | 378 | /** |
379 | * End of processing | |
380 | * | |
381 | * @param sums List of sums | |
382 | * @param results Output list of results | |
ffca499d | 383 | * @param scheme Normalisation scheme options |
e1f47419 | 384 | * @param shapeCorr Shape correction or nil |
385 | * @param trigEff Trigger efficiency | |
386 | * @param symmetrice Whether to symmetrice the results | |
387 | * @param rebin Whether to rebin the results | |
388 | * @param corrEmpty Whether to correct for empty bins | |
389 | * @param cutEdges Whether to cut edges when rebinning | |
390 | * @param vzMin Minimum IP z coordinate | |
391 | * @param vzMax Maximum IP z coordinate | |
392 | * @param triggerMask Trigger mask | |
ffca499d | 393 | * @param color Base colour for markers |
394 | * @param marker Marker style | |
e1f47419 | 395 | */ |
396 | virtual void End(TList* sums, | |
397 | TList* results, | |
ffca499d | 398 | UShort_t scheme, |
e1f47419 | 399 | const TH1* shapeCorr, |
400 | Double_t trigEff, | |
401 | Bool_t symmetrice, | |
402 | Int_t rebin, | |
403 | Bool_t corrEmpty, | |
404 | Bool_t cutEdges, | |
405 | Double_t vzMin, | |
406 | Double_t vzMax, | |
ffca499d | 407 | Int_t triggerMask, |
408 | Int_t color, | |
409 | Int_t marker); | |
e1f47419 | 410 | /** |
411 | * @{ | |
412 | * @name Access histograms | |
413 | */ | |
414 | /** | |
415 | * Get sum histogram | |
416 | * | |
417 | * @param mc If true, return MC histogram | |
418 | * | |
419 | * @return Sum histogram | |
420 | */ | |
421 | const TH2D* GetSum(Bool_t mc=false) const { return mc ? fSumMC : fSum; } | |
422 | /** | |
423 | * Get sum histogram | |
424 | * | |
425 | * @param mc If true, return MC histogram | |
426 | * | |
427 | * @return Sum histogram | |
428 | */ | |
429 | TH2D* GetSum(Bool_t mc=false) { return mc ? fSumMC : fSum; } | |
430 | /** | |
431 | * Get trigger histogram | |
432 | * | |
433 | * @return Trigger histogram | |
434 | */ | |
ffca499d | 435 | const TH1I* GetTriggers() const { return fTriggers; } |
e1f47419 | 436 | /** |
437 | * Get trigger histogram | |
438 | * | |
439 | * @return Trigger histogram | |
440 | */ | |
ffca499d | 441 | TH1I* GetTrigggers() { return fTriggers; } |
e1f47419 | 442 | /** @} */ |
443 | protected: | |
444 | /** | |
445 | * Create sum histogram | |
446 | * | |
447 | * @param data Data histogram to clone | |
448 | * @param mc (optional) MC histogram to clone | |
449 | */ | |
450 | virtual void CreateSums(const TH2D* data, const TH2D* mc); | |
451 | /** | |
452 | * Check the trigger, vertex, and centrality | |
453 | * | |
ffca499d | 454 | * @param forward Event input |
455 | * @param triggerMask The used trigger mask | |
456 | * @param vzMin Least @f$ v_z@f$ | |
457 | * @param vzMax Largest @f$ v_z@f$ | |
e1f47419 | 458 | * |
459 | * @return true if the event is to be used | |
460 | */ | |
461 | virtual Bool_t CheckEvent(const AliAODForwardMult* forward, | |
ffca499d | 462 | Int_t triggerMask, |
463 | Double_t vzMin, | |
464 | Double_t vzMax); | |
e1f47419 | 465 | TList* fSums; // Output list |
466 | TList* fOutput; // Output list | |
467 | TH2D* fSum; // Sum histogram | |
468 | TH2D* fSumMC; // MC sum histogram | |
ffca499d | 469 | TH1I* fTriggers; // Trigger histogram |
e1f47419 | 470 | UShort_t fLow; // Lower limit (inclusive) |
471 | UShort_t fHigh; // Upper limit (exclusive) | |
ce85db45 | 472 | |
e1f47419 | 473 | ClassDef(CentralityBin,1); // A centrality bin |
474 | }; | |
ce85db45 | 475 | TList* fSums; // Container of sums |
476 | TList* fOutput; // Container of outputs | |
ce85db45 | 477 | Double_t fVtxMin; // Minimum v_z |
478 | Double_t fVtxMax; // Maximum v_z | |
479 | Int_t fTriggerMask; // Trigger mask | |
480 | Int_t fRebin; // Rebinning factor | |
481 | Bool_t fCutEdges; // Whether to cut edges when rebinning | |
482 | Bool_t fSymmetrice; // Whether to symmetrice data | |
483 | Bool_t fCorrEmpty; // Correct for empty bins | |
e58000b7 | 484 | Double_t fTriggerEff; // Trigger efficiency for selected trigger(s) |
485 | TH1* fShapeCorr; // Shape correction | |
e308a636 | 486 | TObjArray* fListOfCentralities; // Centrality bins |
e1f47419 | 487 | TNamed* fSNNString; // sqrt(s_NN) string |
488 | TNamed* fSysString; // Collision system string | |
489 | TH1D* fCent; // Centrality distribution | |
e308a636 | 490 | TAxis* fCentAxis; // Centrality axis |
ffca499d | 491 | UShort_t fNormalizationScheme; // Normalization scheme |
0be6c8cd | 492 | TNamed* fSchemeString; |
493 | TNamed* fTriggerString; | |
494 | ClassDef(AliBasedNdetaTask,4); // Determine multiplicity in base area | |
ce85db45 | 495 | }; |
496 | ||
497 | #endif | |
498 | // | |
499 | // Local Variables: | |
500 | // mode: C++ | |
501 | // End: | |
502 | // |