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