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