]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliBasedNdetaTask.h
Merge branch 'workdir'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliBasedNdetaTask.h
index cfff147c4a5f119161ab13550c58afc67dbd9201..a4a65fd5ceadd06e6fe5fdf27fc7effa9356cc68 100644 (file)
@@ -13,7 +13,7 @@
  * @ingroup pwglf_forward_dndeta
  * 
  */
-#include <AliAnalysisTaskSE.h>
+#include "AliBaseAODTask.h"
 class TAxis;
 class TList;
 class TH2D;
@@ -26,6 +26,9 @@ class TObjArray;
 
 /** 
  * @defgroup pwglf_forward_tasks_dndeta dN/deta tasks 
+ *
+ * Code to produce @f$ dN/d\eta@f$
+ *
  * @ingroup pwglf_forward_tasks 
  */
 /**
@@ -41,7 +44,7 @@ class TObjArray;
  * @ingroup pwglf_forward_tasks_dndeta
  * @ingroup pwglf_forward_dndeta
  */
-class AliBasedNdetaTask : public AliAnalysisTaskSE
+class AliBasedNdetaTask : public AliBaseAODTask
 {
 public:
   /** 
@@ -100,44 +103,18 @@ public:
    * @{ 
    * @name Task configuration 
    */
-  virtual void SetDebugLevel(Int_t level);
   /** 
-   * Set the vertex range to use 
+   * Set the debug level 
    * 
-   * @param min Minimum (in centermeter)
-   * @param max Maximum (in centermeter)
-   */  
-  void SetVertexRange(Double_t min, Double_t max) { fVtxMin=min; fVtxMax=max; }
+   * @param level Debug level
+   */
+  virtual void SetDebugLevel(Int_t level);
   /** 
    * Set the rebinning factor 
    * 
    * @param rebin Rebinning factor 
    */
   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 
    * 
@@ -163,6 +140,12 @@ public:
    * @param e Trigger efficiency 
    */
   void SetTriggerEff(Double_t e) { fTriggerEff = e; } 
+  /** 
+   * Trigger efficiency for 0-bin for selected trigger(s)
+   * 
+   * @param e Trigger efficiency for 0-bin
+   */
+  void SetTriggerEff0(Double_t e) { fTriggerEff0 = e; } 
   /** 
    * Set the shape correction (a.k.a., track correction) for selected
    * trigger(s)
@@ -170,6 +153,28 @@ public:
    * @param h Correction
    */
   void SetShapeCorrection(const TH2F* h);
+  /**
+    * Set satellite vertex flag
+    *
+    * @param satVtx
+    */
+  void SetSatelliteVertices(Bool_t satVtx) { fSatelliteVertices = satVtx; }
+  /** 
+   * 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 what String of the normalization scheme 
+   * 
+   * @return normalization scheme bits
+   */
+  static UShort_t ParseNormalizationScheme(const Char_t* what);
   /** 
    * Setthe normalisation scheme to use 
    * 
@@ -208,31 +213,28 @@ 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();
   /* @} */
 
   /** 
@@ -284,6 +286,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. 
    * 
@@ -295,7 +304,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);
   /** @} */
 
   /**
@@ -312,32 +321,56 @@ 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*/
+   void SetGlobalEmpiricalcorrection(TH2D* globalempiricalcorrection){fglobalempiricalcorrection=globalempiricalcorrection;}
 protected:
   /** 
-   * Copy contructor
+   * Copy contructor - not defined
    */
   AliBasedNdetaTask(const AliBasedNdetaTask&);
   /** 
-   * Assignment operator 
+   * Assignment operator - not defined
    * 
    * 
    * @return 
    */
-  AliBasedNdetaTask& operator=(const AliBasedNdetaTask&) { return *this; }
+  AliBasedNdetaTask& operator=(const AliBasedNdetaTask&);
   // Forward declaration 
   class CentralityBin;
   /** 
-   * Retrieve the AOD event 
-   *
-   * @param isESD If true, assume the AOD event is the output 
+   * 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 Pointer to AOD event or null 
+   * @return true if the event is within the cuts. 
    */
-  AliAODEvent* GetAODEvent(Bool_t isESD=false);
-
+  virtual Bool_t CheckEvent(const AliAODForwardMult& forward);
   /** 
    * Create the CentralityBin objects if not already done.
    * 
@@ -351,7 +384,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)
    * 
@@ -364,6 +397,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 
    * 
@@ -384,6 +427,8 @@ 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);
   //==================================================================
   /**
    * Class that holds the sum of the data - possibly split into 0 or
@@ -432,7 +477,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;
     }
@@ -490,6 +537,8 @@ protected:
     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
   };
     
   //==================================================================
@@ -500,7 +549,7 @@ protected:
   class CentralityBin : public TNamed
   {
   public:
-    /** dN
+    /** 
      * Constructor 
      */
     CentralityBin();
@@ -546,8 +595,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
      * 
@@ -558,14 +608,16 @@ protected:
      * @param vzMax       Maximum IP z coordinate
      * @param data        Data histogram 
      * @param mc          MC histogram
+     *
+     * @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);
     /** 
      * Calculate the Event-Level normalization. 
      * 
@@ -620,13 +672,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 
      * 
@@ -665,6 +719,7 @@ protected:
      * @param scheme      Normalisation scheme options
      * @param shapeCorr   Shape correction or nil
      * @param trigEff     Trigger efficiency 
+     * @param trigEff0    0-bin trigger efficiency 
      * @param symmetrice  Whether to symmetrice the results
      * @param rebin       Whether to rebin the results
      * @param rootProj    If true, use TH2::ProjectionX
@@ -681,6 +736,7 @@ protected:
                     UShort_t    scheme,
                     const TH2F* shapeCorr, 
                     Double_t    trigEff,
+                    Double_t    trigEff0,
                     Bool_t      symmetrice,
                     Int_t       rebin, 
                     Bool_t      rootProj,
@@ -722,28 +778,42 @@ 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 
      */
@@ -752,17 +822,38 @@ protected:
     /** 
      * Get a result 
      * 
-     * @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")
+     * @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="",
+                  Bool_t      verbose=true) const;
+    /** 
+     * Set the debug level
+     * 
+     * @param lvl Debug level
      */
-    TH1* GetResult(Int_t rebin, Bool_t sym, 
-                  const char* postfix="") const;
-
     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 
@@ -790,37 +881,30 @@ protected:
     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
+    Bool_t   fSatelliteVertices; // Satellite vertex flag
     Int_t    fDebug;    // Debug level 
 
-    ClassDef(CentralityBin,2); // A centrality bin 
+    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)
+  Double_t        fTriggerEff0;  // Bin-0 Trigger efficiency for sel trigger(s)
   TH2F*           fShapeCorr;    // Shape correction 
   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;     // Normalization scheme string
-  TNamed*         fTriggerString;    // Trigger string 
   TString         fFinalMCCorrFile; //Filename for final MC corr
-  Bool_t          fIsESD;           // Whether we have ESD input or not
-  
-  ClassDef(AliBasedNdetaTask,6); // Determine multiplicity in base area
+  Bool_t          fSatelliteVertices; // satellite vertex flag
+  TH2D*           fglobalempiricalcorrection; // the ratio of PbPb analysis normal displace vertex
+  TH2D*          fmeabsignalvscentr; //mean signal per event vs cent             
+  ClassDef(AliBasedNdetaTask,14); // Determine charged particle density
 };
 
 #endif