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