]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliBasedNdetaTask.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliBasedNdetaTask.h
index 0eca148cf40dc6f1d7825cf8c555cc92bc2a0ca7..5db8d44ec62ca79049d71a9c998194138bbd014f 100644 (file)
  * 
  * @brief  
  * 
- * @ingroup pwg2_forward_dndeta
+ * @ingroup pwglf_forward_dndeta
  * 
  */
-#include <AliAnalysisTaskSE.h>
+#include "AliBaseAODTask.h"
+#include <AliAnalysisUtils.h>
 class TAxis;
 class TList;
 class TH2D;
+class TH2F;
 class TH1D;
 class TH1I;
 class AliAODEvent;
@@ -24,23 +26,26 @@ class AliAODForwardMult;
 class TObjArray;
 
 /** 
- * @defgroup pwg2_forward_tasks_dndeta dN/deta tasks 
- * @ingroup pwg2_forward_tasks 
+ * @defgroup pwglf_forward_tasks_dndeta dN/deta tasks 
+ *
+ * Code to produce @f$ dN/d\eta@f$
+ *
+ * @ingroup pwglf_forward_tasks 
  */
 /**
- * @defgroup pwg2_forward_dndeta dN/deta
+ * @defgroup pwglf_forward_dndeta dN/deta
  *
  * @f$ dN/d\eta@f$ code 
  *
- * @ingroup pwg2_forward_topical
+ * @ingroup pwglf_forward_topical
  */
 /**
  * Base class for tasks to determine @f$ dN/d\eta@f$ 
  *
- * @ingroup pwg2_forward_tasks_dndeta
- * @ingroup pwg2_forward_dndeta
+ * @ingroup pwglf_forward_tasks_dndeta
+ * @ingroup pwglf_forward_dndeta
  */
-class AliBasedNdetaTask : public AliAnalysisTaskSE
+class AliBasedNdetaTask : public AliBaseAODTask
 {
 public:
   /** 
@@ -52,21 +57,24 @@ public:
     /** 
      * Do the full normalisation 
      * @f[ 
-     *   N = \frac{1}{\epsilon_X}(N_A-N_A/N_V(N_T-N_V)) = 
-     *       \frac{1}{\epsilon_X}\frac{1}{\epsilon_V}N_A
+     *   N = (N_A-N_A/N_V(N_T-N_V)) = \frac{1}{\epsilon_V}N_A
      * @f]
      */
     kEventLevel = 0x1,
     /** 
-     * Do the shape correction
+     * Dummy 
      */
-    kShape = 0x2, 
+    kDummy = 0x2, 
     /** 
-     * Correct for background events (A+C-E). Not implemented yet
+     * Correct for background events (A+C-E)
      */
     kBackground = 0x4,
     /**
-     * Correct for the trigger efficiency from MC 
+     * Correct for the trigger efficiency
+     *
+     * @f[
+     *   N = N_A \frac{1}{\epsilon_X}
+     * @f]
      */
     kTriggerEfficiency = 0x8,
     /** 
@@ -76,7 +84,65 @@ public:
     /**
      * Do the full correction
      */
-    kFull = kEventLevel | kShape | kBackground | kTriggerEfficiency,
+    kFull = kEventLevel | kBackground | kTriggerEfficiency,
+  };
+  /**
+   * Mask for selecting pile-up 
+   */
+  enum EPileupMask { 
+    /**
+     * Use the flag from AOD 
+     */
+    kPileupNormal = 0, 
+    /** 
+     * Check the pile-up flag from SPD 
+     */
+    kPileupSPD    = 0x1, 
+    /** 
+     * Check the pileup flag from tracks 
+     */
+    kPileupTrk    = 0x2, 
+    /**
+     * Check the out-of-bunch pileup flag 
+     */
+    kPileupBC     = 0x4, 
+    /**
+     * Use the flag from AOD 
+     */
+    kPileupFull   = 0x8,
+    /** 
+     * Also accept pileup 
+     */
+    kPileupIgnore = 0x10,
+    /** 
+     * Use analysis utility class 
+     */
+    kPileupUtil = 0x20 
+  };
+
+  enum ECentralityEstimator { 
+    kCentNone,
+    kCentDefault,   // What ever stored in AOD 
+    kCentV0M,       // VZERO multiplcity 
+    kCentV0A,       // VZERO-A 
+    kCentV0A123,    // VZERO-A 
+    kCentV0C,       // VZERO-C
+    kCentFMD,       // FMD
+    kCentTrk,       // Tracks
+    kCentTkl,       // Tracklets
+    kCentCL0,       // Clusters in SPD-0
+    kCentCL1,       // Clusters in SPD-1
+    kCentCND,       // Clusters
+    kCentZNA,       // ZDC neutrons A-side
+    kCentZNC,       // ZDC neutrons C-side
+    kCentZPA,       // ZDC protons A-side
+    kCentZPC,       // ZDC protons C-side
+    kCentNPA,       // ?
+    kCentV0MvsFMD,  // V0M vs FMD
+    kCentTklvsV0M,  // Tracks vs V0M
+    kCentZEMvsZDC,  // ZDC veto vs neutrons
+    kCentTrue = 0x100, 
+    kCentEq   = 0x200
   };
   /** 
    * Constructor 
@@ -94,54 +160,17 @@ public:
    * 
    */
   virtual ~AliBasedNdetaTask();
-
+  
   /** 
    * @{ 
    * @name Task configuration 
    */
   /** 
-   * Set the vertex range to use 
-   * 
-   * @param min Minimum (in centermeter)
-   * @param max Maximum (in centermeter)
-   */  
-  void SetVertexRange(Double_t min, Double_t max) { fVtxMin=min; fVtxMax=max; }
-  /** 
-   * Set the rebinning factor 
+   * Set the debug level 
    * 
-   * @param rebin Rebinning factor 
+   * @param level Debug level
    */
-  void SetRebinning(Int_t rebin) { fRebin = rebin; }
-  /** 
-   * Set the trigger maskl 
-   * 
-   * @param mask Trigger mask
-   */
-  void SetTriggerMask(UShort_t mask);
-  /** 
-   * Set the trigger mask 
-   * 
-   * @param mask trigger mask 
-   */
-  void SetTriggerMask(const char* mask);
-  /** 
-   * Set the centrality bins to use. 
-   * 
-   * @code 
-   *   UShort_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
-   *   task->SetCentralityBins(11, bins);
-   * @endcode 
-   * 
-   * @param n     Number of bins (elements in @a bins minus 1)
-   * @param bins  Bin limits 
-   */
-  void SetCentralityAxis(UShort_t n, Short_t* bins);
-  /** 
-   * Whether to cut edges when merging 
-   * 
-   * @param cut If true, cut edges 
-   */
-  void SetCutEdges(Bool_t cut) {fCutEdges = cut;}
+  virtual void SetDebugLevel(Int_t level);
   /** 
    * Set whether to correct for empty bins when projecting on the X axis. 
    * 
@@ -162,12 +191,60 @@ public:
    */
   void SetTriggerEff(Double_t e) { fTriggerEff = e; } 
   /** 
-   * Set the shape correction (a.k.a., track correction) for selected
-   * trigger(s)
+   * Trigger efficiency for 0-bin for selected trigger(s)
+   * 
+   * @param e Trigger efficiency for 0-bin
+   */
+  void SetTriggerEff0(Double_t e) { fTriggerEff0 = e; } 
+  /**
+   * Set satellite vertex flag
+   *
+   * @param satVtx
+   */
+  void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; }
+  /** 
+   * Set which centrality estimator to use - if not set, use the one
+   * from the Forward AOD object.  Note, the string is diagnosed, and
+   * if found not to be valid, then a the program terminates via a
+   * Fatal.
+   *
+   * @param method String definining centrality method (case insensitive)
+   * Typical values are 
+   * - V0M (e.g., PbPb)
+   * - V0A 
+   * - V0C 
+   * - FMD 
+   * - ZNA (e.g., pPb) 
+   * - ZNC (e.g., Pbp)
+   * - ZPA 
+   * - ZPC 
+   * - ZEMvsZDC
+   *
+   * @return true if @a method is valid estimator 
+   */
+  Bool_t SetCentralityMethod(const TString& method);
+  /**
+   * Get reference to the analysis utility 
+   *
+   * @return reference to the AliAnalysisUtils object
+   */
+  AliAnalysisUtils& GetAnalysisUtils() { return fAnaUtil; }
+  /** 
+   * Get a string representing the normalization scheme 
+   * 
+   * @param scheme Normalization scheme bits 
+   * 
+   * @return String representation 
+   */
+  static const Char_t* NormalizationSchemeString(UShort_t scheme);
+  /** 
+   * Parse a string representing the normalization scheme 
    * 
-   * @param h Correction
+   * @param what String of the normalization scheme 
+   * 
+   * @return normalization scheme bits
    */
-  void SetShapeCorrection(const TH1* h);
+  static UShort_t ParseNormalizationScheme(const Char_t* what);
   /** 
    * Setthe normalisation scheme to use 
    * 
@@ -180,6 +257,12 @@ public:
    * @param what List of options 
    */
   void SetNormalizationScheme(const char* what);
+  /** 
+   * Set the mask for checking pile-up events 
+   *
+   * @param bits A bit pattern of EPileupMask bits 
+   */
+  void SetPileupMask(UShort_t bits) { fPileupMask = bits; }
   /** 
    * Filename of final MC correction
    * 
@@ -190,12 +273,21 @@ public:
     fFinalMCCorrFile.Append(filename); 
   }
   /** 
-   * Load the normalization data - done automatically if not set from outside
+   * Flag whether we should disregard SPD outlier events, as flagged
+   * by AliTriggerAnalysis::IsSPDClusterVsTrackletBG. The default
+   * setting for this flags events as outliers if
+   *
+   @f[ 
+   N_{cluster} > 65 + 4 N_{tracklet}
+   @f] 
    * 
-   * @param sys system
-   * @param energy energy
+   * where @f$N_{cluster}@f$ is the total number of clusters in both
+   * SPD layers, and @f$N_{tracklet}@f$ is the total number of
+   * tracklets in the SPD.
+   * 
+   * @param check If true, then check for SPD outlier events before processing. 
    */
-  void LoadNormalizationData(UShort_t sys, UShort_t energy);  
+  void SetCheckSPDOutlier(Bool_t check=true) { fCheckSPDOutlier = check; }
   /** @} */
   /** 
    * Print information 
@@ -206,55 +298,34 @@ public:
   /** @{ 
    *  @name Task interface 
    */
-  /** 
-   * Initialise on master - does nothing
-   * 
-   */
-  virtual void   Init() {}
   /** 
    * Create output objects.  
    *
    * This is called once per slave process 
+   *
+   * @return true on success
    */
-  virtual void UserCreateOutputObjects();
+  virtual Bool_t Book();
   /** 
    * Process a single event 
    * 
-   * @param option Not used
+   * @return true on success
    */
-  virtual void UserExec(Option_t* option);
+  virtual Bool_t Event(AliAODEvent& aod);
   /** 
    * Called at end of event processing.
    *
    * This is called once in the master 
    * 
-   * @param option Not used 
+   * @return true on success
    */
-  virtual void Terminate(Option_t* option);
+  virtual Bool_t Finalize();
   /* @} */
 
   /** 
    * @{ 
    * @name Services member functions 
    */
-  /** 
-   * Make a copy of the input histogram and rebin that histogram
-   * 
-   * @param h         Histogram to rebin
-   * @param rebin     Rebinning factor 
-   * @param cutEdges  Whether to cut edges when rebinning
-   * 
-   * @return New (rebinned) histogram
-   */
-  static TH1D* Rebin(const TH1D* h, Int_t rebin, Bool_t cutEdges=false);
-  /** 
-   * Make an extension of @a h to make it symmetric about 0 
-   * 
-   * @param h Histogram to symmertrice 
-   * 
-   * @return Symmetric extension of @a h 
-   */
-  static TH1* Symmetrice(const TH1* h);
   /** 
    * Project onto the X axis 
    * 
@@ -282,6 +353,13 @@ public:
    * @param norm Coverage histogram 
    */
   static void ScaleToCoverage(TH2D* copy, const TH1D* norm);
+  /** 
+   * Scale the copy of the 1D histogram by coverage in supplied 1D histogram
+   *  
+   * @param copy Data to scale 
+   * @param norm Coverage histogram 
+   */
+  static void ScaleToCoverage(TH1D* copy, const TH1D* norm);
   /** 
    * Set histogram graphical options, etc. 
    * 
@@ -293,7 +371,7 @@ public:
    */
   static void SetHistogramAttributes(TH1D* h, Int_t colour, Int_t marker, 
                                     const char* title, 
-                                    const char* ytitle="#frac{1}{N} #frac{dN_{ch}}{d#eta}");
+                                    const char* ytitle=0);
   /** @} */
 
   /**
@@ -310,24 +388,68 @@ public:
     kCross        = 0x00c,
     kStar         = 0x00e
   };
+  /** 
+   * Get the marker style from option bits
+   * 
+   * @param bits Option bits 
+   * 
+   * @return Marker style 
+   */
   static Int_t GetMarkerStyle(UShort_t bits);
+  /** 
+   * Get the marker option bits from a style 
+   * 
+   * @param style Style
+   * 
+   * @return option bits
+   */
   static UShort_t GetMarkerBits(Int_t style);
+  /** 
+   * Flip an option bit 
+   * 
+   * @param style Style parameter
+   * 
+   * @return New style 
+   */
   static Int_t FlipHollowStyle(Int_t style);
+  /**
+   * Setter of empirical correction
+   *
+   * @param h 2D histogram of ratio of nominal @f$ 1/N
+   * dN_{ch}/d\eta@f$ to satellite @f$ 1/N dN_{ch}/d\eta@f$ in PbPb
+   * collisions as a function of @f$\eta@f$ and interaction point
+   * Z-coordinate @f$ IP_{z}@f$
+   */
+  void SetGlobalEmpiricalcorrection(TH2D* h){fEmpiricalCorrection=h;}
 protected:
   /** 
-   * Copy contructor
+   * Copy contructor - not defined
    */
-  AliBasedNdetaTask(const AliBasedNdetaTask&);
+  AliBasedNdetaTask(const AliBasedNdetaTask&){;}
   /** 
-   * Assignment operator 
+   * Assignment operator - not defined
    * 
    * 
    * @return 
    */
-  AliBasedNdetaTask& operator=(const AliBasedNdetaTask&) { return *this; }
+  AliBasedNdetaTask& operator=(const AliBasedNdetaTask&);
   // Forward declaration 
   class CentralityBin;
-
+  /** 
+   * Check if the event corresponds to the selected trigger(s),
+   * vertex, and centrality.  Derived classes can overload this to
+   * enable event processing - even if the event is not within cuts.
+   * 
+   * @param forward Forward object
+   * 
+   * @return true if the event is within the cuts. 
+   */
+  virtual Bool_t CheckEvent(const AliAODForwardMult& forward);
+  /** 
+   * Create the CentralityBin objects if not already done.
+   * 
+   */
+  virtual void InitializeCentBins();
   /** 
    * Retrieve the histogram 
    * 
@@ -336,7 +458,7 @@ protected:
    * 
    * @return Retrieved histogram or null
    */
-  virtual TH2D* GetHistogram(const AliAODEvent* aod, Bool_t mc=false) = 0;
+  virtual TH2D* GetHistogram(const AliAODEvent& aod, Bool_t mc=false) = 0;
   /** 
    * Get the colour to use for markers (only pp - in PbPb we use a rainbow)
    * 
@@ -349,6 +471,16 @@ protected:
    * @return Marker style 
    */
   virtual Int_t GetMarker() const { return GetMarkerStyle(kCircle); }
+  /** 
+   * Massage data histograms if needed
+   * 
+   * @param vtx 
+   * @param data 
+   * @param mcData 
+   */
+  virtual void CheckEventData(Double_t vtx, 
+                             TH2*     data, 
+                             TH2*     mcData);
   /** 
    * Add a centrality bin 
    * 
@@ -369,6 +501,13 @@ protected:
   virtual CentralityBin* MakeCentralityBin(const char* name, Short_t low, 
                                           Short_t high) const;
   
+  // function which applies empirical correction to the AOD object 
+  Bool_t ApplyEmpiricalCorrection(const AliAODForwardMult* aod,TH2D* data);
+
+
+  static Int_t GetCentMethodID(const TString& meth);
+  static const char* GetCentMethod(UShort_t id);
+
   //==================================================================
   /**
    * Class that holds the sum of the data - possibly split into 0 or
@@ -380,10 +519,11 @@ protected:
     TH2D* fSum;     // Sum of non-zero events
     TH2D* fSum0;    // Sum of zero events 
     TH1I* fEvents;  // Distribution of events 
+    Int_t fDebug;   // Debug level
     /** 
      * I/O Constructor - do not use
      */    
-    Sum() : fSum(0), fSum0(0), fEvents(0) {}
+    Sum() : fSum(0), fSum0(0), fEvents(0), fDebug(0) {}
     /** 
      * Constructor 
      * 
@@ -394,7 +534,8 @@ protected:
       : TNamed(name,postfix), 
        fSum(0), 
        fSum0(0), 
-       fEvents(0) 
+       fEvents(0), 
+       fDebug(0) 
     {}
     /** 
      * Copy constructor
@@ -405,7 +546,8 @@ protected:
       : TNamed(o), 
        fSum(o.fSum), 
        fSum0(o.fSum0), 
-       fEvents(o.fEvents) 
+       fEvents(o.fEvents), 
+       fDebug(o.fDebug) 
     {}
     /** 
      * Assignment operator 
@@ -414,7 +556,9 @@ protected:
      * 
      * @return Reference to this object 
      */
-    Sum& operator=(const Sum& o) {
+    Sum& operator=(const Sum& o) 
+    {
+      if (&o == this) return *this;
       SetName(o.GetName()); fSum = o.fSum; fSum0 = o.fSum0; fEvents=o.fEvents;
       return *this;
     }
@@ -437,6 +581,17 @@ protected:
      * @param isZero  If this is zero event
      */
     void Add(const TH2D* data, Bool_t isZero=false);
+    /** 
+     * Get the histogram name 
+     * 
+     * @param name Base name 
+     * @param what Which one 
+     * @param post Possible postfix
+     * 
+     * @return Name 
+     */
+    static TString GetHistName(const char* name, Int_t what=0, 
+                              const char* post=0);
     /** 
      * Get the histogram name 
      * 
@@ -448,7 +603,6 @@ protected:
     /** 
      * Get the sum 
      * 
-     * @param l          List to get histograms from 
      * @param o          Output list
      * @param ntotal     On return, the total number of events
      * @param zeroEff    Zero-bin efficiency
@@ -459,9 +613,11 @@ protected:
      * 
      * @return The total sum histogram 
      */
-    TH2D* GetSum(const TList* l, TList* o, Double_t& ntotal,
-                Double_t zeroEff, Double_t otherEff=1, Int_t marker=20,
-                Bool_t rootXproj=false, Bool_t corrEmpty=true) const;
+    TH2D* CalcSum(TList* o, Double_t& ntotal,
+                 Double_t zeroEff, Double_t otherEff=1, Int_t marker=20,
+                 Bool_t rootXproj=false, Bool_t corrEmpty=true) const;
+
+    ClassDef(Sum,2); // Summed histograms
   };
     
   //==================================================================
@@ -472,7 +628,7 @@ protected:
   class CentralityBin : public TNamed
   {
   public:
-    /** dN
+    /** 
      * Constructor 
      */
     CentralityBin();
@@ -518,8 +674,9 @@ protected:
      * Create output objects 
      * 
      * @param dir   Parent list
+     * @param mask  Trigger mask
      */
-    virtual void CreateOutputObjects(TList* dir);
+    virtual void CreateOutputObjects(TList* dir, Int_t mask);
     /** 
      * Process an event
      * 
@@ -530,14 +687,18 @@ protected:
      * @param vzMax       Maximum IP z coordinate
      * @param data        Data histogram 
      * @param mc          MC histogram
+     * @param checkPileup If true, disregard pile-up events (global flag)
+     *
+     * @return true if the event was selected
      */
-    virtual void ProcessEvent(const AliAODForwardMult* forward, 
-                             Int_t                    triggerMask,
-                             Bool_t                   isZero,
-                             Double_t                 vzMin, 
-                             Double_t                 vzMax, 
-                             const TH2D*              data, 
-                             const TH2D*              mc);
+    virtual Bool_t ProcessEvent(const AliAODForwardMult* forward, 
+                               Int_t                    triggerMask,
+                               Bool_t                   isZero,
+                               Double_t                 vzMin, 
+                               Double_t                 vzMax, 
+                               const TH2D*              data, 
+                               const TH2D*              mc,
+                               Bool_t                   checkPileup);
     /** 
      * Calculate the Event-Level normalization. 
      * 
@@ -592,13 +753,15 @@ protected:
      * @param scheme  Normalisation scheme 
      * @param trgEff  Trigger efficiency 
      * @param ntotal  On return, the total number of events to normalise to.
+     * @param text    If non-null, fill with normalization calculation
      * 
      * @return @f$N_A/N@f$ or negative number in case of errors. 
      */
     virtual Double_t Normalization(const TH1I& t, 
                                   UShort_t    scheme,
                                   Double_t    trgEff,
-                                  Double_t&   ntotal) const;
+                                  Double_t&   ntotal,
+                                  TString*    text) const;
     /** 
      * Generate the dN/deta result from input 
      * 
@@ -606,11 +769,7 @@ protected:
      * @param postfix    Post fix on names
      * @param rootProj   Whether to use ROOT TH2::ProjectionX
      * @param corrEmpty  Correct for empty bins 
-     * @param shapeCorr  Shape correction to use 
      * @param scaler     Event-level normalization scaler  
-     * @param symmetrice Whether to make symmetric extensions 
-     * @param rebin      Whether to rebin
-     * @param cutEdges   Whether to cut edges when rebinning 
      * @param marker     Marker style 
      * @param color       Color of markers 
      * @param mclist      List of MC data 
@@ -620,11 +779,7 @@ protected:
                            const char* postfix, 
                            bool        rootProj, 
                            bool        corrEmpty,
-                           const TH1*  shapeCorr,
                            Double_t    scaler,
-                           bool        symmetrice, 
-                           Int_t       rebin, 
-                           bool        cutEdges, 
                            Int_t       marker,
                            Int_t       color, 
                            TList*      mclist,
@@ -635,13 +790,10 @@ protected:
      * @param sums        List of sums
      * @param results     Output list of results
      * @param scheme      Normalisation scheme options
-     * @param shapeCorr   Shape correction or nil
      * @param trigEff     Trigger efficiency 
-     * @param symmetrice  Whether to symmetrice the results
-     * @param rebin       Whether to rebin the results
+     * @param trigEff0    0-bin trigger efficiency 
      * @param rootProj    If true, use TH2::ProjectionX
      * @param corrEmpty   Whether to correct for empty bins
-     * @param cutEdges    Whether to cut edges when rebinning
      * @param triggerMask Trigger mask 
      * @param marker      Marker style 
      * @param color       Color of markers 
@@ -651,13 +803,10 @@ protected:
     virtual void End(TList*      sums, 
                     TList*      results,
                     UShort_t    scheme,
-                    const TH1*  shapeCorr, 
                     Double_t    trigEff,
-                    Bool_t      symmetrice,
-                    Int_t       rebin, 
+                    Double_t    trigEff0,
                     Bool_t      rootProj,
                     Bool_t      corrEmpty, 
-                    Bool_t      cutEdges, 
                     Int_t       triggerMask,
                     Int_t       marker,
                     Int_t       color,
@@ -694,46 +843,78 @@ protected:
      * 
      * @return Trigger histogram 
      */
-    TH1I* GetTrigggers() { return fTriggers; }
+    TH1I* GetTriggers() { return fTriggers; }
+    /** 
+     * Get trigger histogram
+     * 
+     * @return Trigger histogram
+     */
+    const TH1I* GetStatus() const { return fStatus; } 
+    /** 
+     * Get trigger histogram
+     * 
+     * @return Trigger histogram 
+     */
+    TH1I* GetStatus() { return fStatus; }
     /** @} */
 
     /** 
      * Get the color of the markers
      *
-     * @return 
+     * @param fallback Fall-back color 
+     *
+     * @return Color for this centrality bin 
      */
     Int_t GetColor(Int_t fallback=kRed+2) const;
     /** 
      * Get list of results 
      * 
-     * 
-     * @return 
+     * @return List of results
      */
     TList* GetResults() const { return fOutput; }
     /** 
-     * Get name of result histogram 
+     * Get name of result histogram. Note, the returned pointer points
+     * to static memory and should be copied/used immediately.
      * 
-     * @param rebin 
-     * @param sym 
-     * @param postfix 
+     * @param rebin    Whether to get rebinned result
+     * @param sym      Whether to get symmetric extension
+     * @param postfix  Possible postfix (e.g., "MC")
      * 
      * @return 
      */
-    const char* GetResultName(Int_t rebin, Bool_t sym, 
-                             const char* postfix="") const;
+    const char* GetResultName(const char* postfix="") const;
     /** 
      * Get a result 
      * 
-     * @param rebin 
-     * @param sym 
-     * @param postfix 
+     * @param postfix  Possible postfix (e.g., "MC")
+     * @param verbose  If true, complain about missing histogram
      * 
-     * @return 
+     * @return Pointer to histogram or null
      */
-    TH1* GetResult(Int_t rebin, Bool_t sym, 
-                  const char* postfix="") const;
-
+    TH1* GetResult(const char* postfix="",
+                  Bool_t      verbose=true) const;
+    /** 
+     * Set the debug level
+     * 
+     * @param lvl Debug level
+     */
+    void SetDebugLevel(Int_t lvl);
+    /**
+     * Set satellite vertex flag
+     *
+     * @param satVtx
+     */
+    void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; }
   protected:
+    /** 
+     * Read in sum hisotgram from list 
+     * 
+     * @param list List to read from 
+     * @param mc   True for MC input 
+     * 
+     * @return true if sum histogram is found
+     */
+    virtual Bool_t ReadSum(TList* list, bool mc=false);
     /** 
      * Create sum histogram 
      * 
@@ -754,41 +935,37 @@ protected:
     virtual Bool_t CheckEvent(const AliAODForwardMult* forward, 
                              Int_t                    triggerMask,
                              Double_t                 vzMin, 
-                             Double_t vzMax);
+                             Double_t                 vzMax,
+                             Bool_t                   checkPileup);
     TList*   fSums;      // Output list 
     TList*   fOutput;    // Output list 
     Sum*     fSum;       // Sum histogram
     Sum*     fSumMC;     // MC sum histogram
     TH1I*    fTriggers;  // Trigger histogram 
+    TH1I*    fStatus;    // Trigger histogram 
     UShort_t fLow;       // Lower limit (inclusive)
     UShort_t fHigh;      // Upper limit (exclusive)
     Bool_t   fDoFinalMCCorrection; //Do final MC correction
-    
-    ClassDef(CentralityBin,1); // A centrality bin 
+    Bool_t   fSatelliteVertices; // Satellite vertex flag
+    Int_t    fDebug;    // Debug level 
+
+    ClassDef(CentralityBin,4); // A centrality bin 
   };
-  TList*          fSums;         // Container of sums 
-  TList*          fOutput;       // Container of outputs 
-  Double_t        fVtxMin;       // Minimum v_z
-  Double_t        fVtxMax;       // Maximum v_z
-  Int_t           fTriggerMask;  // Trigger mask 
-  Int_t           fRebin;        // Rebinning factor 
-  Bool_t          fCutEdges;     // Whether to cut edges when rebinning
-  Bool_t          fSymmetrice;   // Whether to symmetrice data 
   Bool_t          fCorrEmpty;    // Correct for empty bins 
   Bool_t          fUseROOTProj;  // Whether to use ROOT's ProjectionX
   Double_t        fTriggerEff;   // Trigger efficiency for selected trigger(s)
-  TH1*            fShapeCorr;    // Shape correction 
+  Double_t        fTriggerEff0;  // Bin-0 Trigger efficiency for sel trigger(s)
   TObjArray*      fListOfCentralities; // Centrality bins 
-  TNamed*         fSNNString;    // sqrt(s_NN) string 
-  TNamed*         fSysString;    // Collision system string 
-  TH1D*           fCent;         // Centrality distribution 
-  TAxis*          fCentAxis;     // Centrality axis
   UShort_t        fNormalizationScheme; // Normalization scheme
-  TNamed*         fSchemeString;     
-  TNamed*         fTriggerString; 
   TString         fFinalMCCorrFile; //Filename for final MC corr
-  
-  ClassDef(AliBasedNdetaTask,4); // Determine multiplicity in base area
+  Bool_t          fSatelliteVertices; // satellite vertex flag
+  TH2D*           fEmpiricalCorrection; // Empirical correction 
+  TH2D*          fMeanVsC;         //mean signal per event vs cent
+  TString         fCentMethod;    // Centrality estimator 
+  UShort_t        fPileupMask;    // Pile-up checks 
+  AliAnalysisUtils fAnaUtil;      // Analysis utility 
+  Bool_t          fCheckSPDOutlier; // Check for SPD outliers 
+  ClassDef(AliBasedNdetaTask,17); // Determine charged particle density
 };
 
 #endif