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