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