]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliForwardMultiplicityBase.h
Coverity fixes
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardMultiplicityBase.h
index 76fab615b0554de5cc1fde255b7ccefb258fc6eb..a3b92ac4b770f9aa73832185e28bdb585cfa2974 100644 (file)
  * @brief  
  * 
  * 
- * @ingroup pwg2_forward_aod
+ * @ingroup pwglf_forward_aod
  */
-#include <AliAnalysisTaskSE.h>
-class AliFMDEventInspector;
-class AliFMDEnergyFitter;
+#include "AliBaseESDTask.h"
+#include "AliForwardUtil.h"
+#include "AliAODForwardMult.h"
+#include "AliAODForwardEP.h"
+// class AliFMDEnergyFitter;
 class AliFMDSharingFilter;
 class AliFMDDensityCalculator;
 class AliFMDCorrector;
 class AliFMDHistCollector;
-class AliForwardCorrectionManager;
+class AliFMDEventPlaneFinder;
+class AliAODHandler;
 class AliESDEvent;
 class TH2D;
 class TList;
 class TTree;
 class TAxis;
+class TProfile;
 
 /** 
- * @mainpage ALICE PWG2 Forward Multiplcity Analysis 
- * 
- * This is the analysis code for analysis of the Forward data. 
- * 
- * @par Code overview 
- * 
- * See the <a href="modules.html">Modules</a> page 
- * 
- * @par Run.sh script 
- * 
- * @verbatim 
- * Usage: Run.sh [OPTIONS]
- * 
- * Do Pass1 and Pass2 on ESD files in current directory.  
- * 
- * Options:
- *     -h,--help               This help                  
- *     -n,--events N           Number of events            (-1)
- *     -1,--pass1              Run pass 1, only AOD        (0)
- *     -2,--pass2              Run pass 2, only Hists      (0)
- *     -3,--pass3              Draw results                (0)
- *     -v,--vz-min CM          Minimum value of vz         (-10)
- *     -V,--vz-max CM          Maximum value of vz         (10)
- *     -t,--trigger TYPE       Select trigger TYPE         (INEL)
- *     -b,--batch              Do batch processing         (0)
- *     -P,--proof NWORKERS     Run in PROOF(Lite) mode     (0)
- *     -M,--mc                 Run over MC data            (0)
- *     -g,--gdb                Run in GDB mode             (0)
- *     -E,--eloss              Run energy loss script      
- *      -r,--rebin              Rebin factor                (1)
- *      -C,--use-centrality     Run centrality task         (0)
- *     -O,--show-older         Show older data             (0)
- *     -J,--show-published     Show ALICE published data   (1)
- *     -R,--show-ratios        Show ratios to other data   (1)
- *     -Z,--show-asymmetry     Show asymmetry              (1)
- *     -S,--scheme SCHEME      Normalisation scheme        (full)
- *     -T,--title STRING       Title on plots              ()
- * 
- * TYPE is a comma or space separated list of 
- *  
- *   INEL            Inelastic triggers (V0A|V0C|SPD)
- *   INEL>0      As above + N_ch > 0 in -0.5<eta<+0.5
- *   NSD         Non-single diffractive ((VOA&VOC)|N_ch > 5 -1.9<eta<+1.9)
- * 
- * SCHEME is a comma or space separated list of 
- * 
- *   NONE          No event-level normalization except trivial one 
- *   EVENTLEVEL    Event-level normalization 
- *   ALTEVENTLEVEL Event-level normalization (alternative version)
- *   BACKGROUND    Not implemented yet 
- *   SHAPE         Shape correction 
- *   FULL          Same as EVENTLEVEL,BACKGROUND,SHAPE
- *   ALTFULL       Same as ALTEVENTLEVEL,BACKGROUND,SHAPE
- * 
- * If NWORKERS is 0, then the analysis will be run in local mode.
- * @endverbatim
- */
-/** 
- * @defgroup pwg2_forward PWG2 Forward analysis
+ * @defgroup pwglf_forward PWGLF Forward analysis
  *
  * Code to do the multiplicity analysis in the forward psuedo-rapidity
  * regions
  *
  */
 /** 
- * @defgroup pwg2_forward_tasks Tasks
+ * @defgroup pwglf_forward_tasks Tasks
  *
  * Code to do the multiplicity analysis in the forward psuedo-rapidity
  * regions
  *
- * @ingroup pwg2_forward 
+ * @ingroup pwglf_forward 
  */
 /** 
- * @defgroup pwg2_forward_topical Topical
+ * @defgroup pwglf_forward_topical Topical
+ *
+ * The code divided according to topic
  */
 /** 
- * @defgroup pwg2_forward_aod AOD
- * @ingroup pwg2_forward_topical
+ * @defgroup pwglf_forward_aod AOD
+ * 
+ * Code to do with AOD production 
+ *
+ * @ingroup pwglf_forward_topical
  */
 /** 
  * Base class for classes that calculate the multiplicity in the
@@ -122,39 +73,47 @@ class TAxis;
  *   
  * @par Corrections used 
  * 
- * @ingroup pwg2_forward_tasks
- * @ingroup pwg2_forward_aod
+ * @ingroup pwglf_forward_tasks
+ * @ingroup pwglf_forward_aod
  * 
  */
-class AliForwardMultiplicityBase : public AliAnalysisTaskSE
+class AliForwardMultiplicityBase : public AliBaseESDTask
 {
 public:
+  enum { 
+    kTimingEventInspector    = 1,
+    kTimingSharingFilter     = 2, 
+    kTimingDensityCalculator = 3, 
+    kTimingCorrections       = 4, 
+    kTimingHistCollector     = 5, 
+    kTimingEventPlaneFinder  = 6, 
+    kTimingTotal             = 7
+  };
   /** 
    * @{ 
    * @name Interface methods 
    */
-  /** 
-   * Initialize the task 
-   * 
-   */
-  virtual void Init() { fFirstEvent = true; }
   /** 
    * Create output objects 
-   * 
+   *
+   * @return true on success
    */
-  virtual void UserCreateOutputObjects() = 0;
+  virtual Bool_t Book();
   /** 
-   * Process each event 
+   * Initialise the sub objects and stuff.  Called on first event
    *
-   * @param option Not used
-   */  
-  virtual void UserExec(Option_t* option) = 0;
+   * @param vertex Vertex axis to use 
+   * @param eta    Eta axis to use 
+   *
+   * @return false on errors 
+   */
+  virtual Bool_t PreData(const TAxis& vertex, const TAxis& eta);
   /** 
    * End of job
    * 
-   * @param option Not used 
+   * @return true on success
    */
-  virtual void Terminate(Option_t* option) = 0;
+  virtual Bool_t Finalize();
   /** 
    * @} 
    */
@@ -164,6 +123,12 @@ public:
    * @param option Not used
    */
   virtual void Print(Option_t* option="") const;
+  /** 
+   * Set whether to make a timing histogram 
+   * 
+   * @param enable 
+   */
+  virtual void SetDoTiming(Bool_t enable=true) { fDoTiming = enable; }
   /** 
    * Whether to enable low-flux code 
    * 
@@ -174,12 +139,6 @@ public:
    * @{ 
    * @name Access to sub-algorithms 
    */
-  /**
-   * Get reference to the EventInspector algorithm 
-   * 
-   * @return Reference to AliFMDEventInspector object 
-   */
-  virtual AliFMDEventInspector& GetEventInspector() = 0;
   /**
    * Get reference to the SharingFilter algorithm 
    * 
@@ -204,12 +163,6 @@ public:
    * @return Reference to AliFMDHistCollector object 
    */
   virtual AliFMDHistCollector& GetHistCollector() = 0;
-  /**
-   * Get reference to the EventInspector algorithm 
-   * 
-   * @return Reference to AliFMDEventInspector object 
-   */
-  virtual const AliFMDEventInspector& GetEventInspector() const = 0;
   /**
    * Get reference to the SharingFilter algorithm 
    * 
@@ -234,10 +187,35 @@ public:
    * @return Reference to AliFMDHistCollector object 
    */
   virtual const AliFMDHistCollector& GetHistCollector() const = 0;
+   /**
+   * Get reference to the EventPlaneFinder algorithm 
+   * 
+   * @return Reference to AliFMDEventPlaneFinder object 
+   */
+  virtual AliFMDEventPlaneFinder& GetEventPlaneFinder() = 0;
+  /**
+   * Get reference to the EventPlaneFinder algorithm 
+   * 
+   * @return Reference to AliFMDEventPlaneFinder object 
+   */
+  virtual const AliFMDEventPlaneFinder& GetEventPlaneFinder() const = 0;
+  /* @} */
+
   /** 
-   * @} 
+   * Set the debug level 
+   * 
+   * @param dbg 
+   */
+  virtual void SetDebug(Int_t dbg);
+  /** 
+   * Set whether to make separate branches for each ring.  If enabled
+   * there will be 5 additional branches on the AOD tree - each
+   * holding a TH2D object of the charged particle multiplicity in
+   * @f$(\eta,\varphi)@f$ bins for that event.
+   * 
+   * @param use If true, make separate branches for each ring. 
    */
-  virtual void SetDebug(Int_t dbg) = 0;
+  void SetStorePerRing(Bool_t use) { fStorePerRing = use; }
 protected: 
   /** 
    * Constructor 
@@ -249,22 +227,23 @@ protected:
    * Constructor
    */
   AliForwardMultiplicityBase() 
-  : AliAnalysisTaskSE(), 
-    fEnableLowFlux(true), 
-    fFirstEvent(true),
-    fCorrManager(0)
+    : AliBaseESDTask(), 
+      fEnableLowFlux(true), 
+      fStorePerRing(false),
+      fHData(0),
+      fHistos(),
+      fAODFMD(),
+      fAODEP(),
+      fRingSums(),
+      fDoTiming(false), 
+      fHTiming(0)
   {}
   /** 
    * Copy constructor 
    * 
    * @param o Object to copy from 
    */
-  AliForwardMultiplicityBase(const AliForwardMultiplicityBase& o)
-    : AliAnalysisTaskSE(o),
-      fEnableLowFlux(o.fEnableLowFlux), 
-      fFirstEvent(o.fFirstEvent),
-      fCorrManager(o.fCorrManager)
-  {}
+  AliForwardMultiplicityBase(const AliForwardMultiplicityBase& o);
   /** 
    * Assignment operator 
    * 
@@ -274,35 +253,40 @@ protected:
    */
   AliForwardMultiplicityBase& operator=(const AliForwardMultiplicityBase& o);
   /** 
-   * Check if all needed corrections are there and accounted for.  If not,
-   * do a Fatal exit 
-   * 
-   * @param what Which corrections is needed
+   * Initialize members based on eta and vertex axis - only available
+   * after first event - called from SetupForData.
    * 
-   * @return true if all present, false otherwise
-   */  
-  Bool_t CheckCorrections(UInt_t what) const;
-  /**
-   * Read corrections
-   *
+   * @param pe @f$\eta@f$ axis
+   * @param pv Interaction point Z-coordinate axis 
    */
-  virtual Bool_t ReadCorrections(const TAxis*& pe, 
-                                const TAxis*& pv,
-                                Bool_t mc=false);
+  virtual void InitMembers(const TAxis& pe, const TAxis& pv);
   /**
-   * Get the ESD event. IF this is the first event, initialise
+   * Create output branches - called from UserCreateOutputObjects
    */
-  virtual AliESDEvent* GetESDEvent();
+  virtual void CreateBranches(AliAODHandler* ah);
   /** 
-   * Initialise the sub objects and stuff.  Called on first event
-   *
+   * Do estimates of @f$dN/d\eta@f$  - called at Terminate
+   * 
+   * @param input  Input list
+   * @param output Output list
    */
-  virtual void InitializeSubs() = 0;
-  /**
-   * Mark this event as one to store in the AOD 
+  virtual void EstimatedNdeta(const TList* input, TList* output) const;
+  /** 
+   * Calculate a simple dN/deta from all accepted events 
    * 
+   * @param input  Input list
+   * @param output Output list
+   * @param nTr    On return, number of triggers
+   * @param nTrVtx On return, number of trigger+vertex events
+   * @param nAcc   On return, number of accepted events
+   * 
+   * @return true on success 
    */
-  virtual void MarkEventForStore() const;
+  virtual Bool_t MakeSimpledNdeta(const TList* input, 
+                                 TList*       output,
+                                 Double_t&    nTr, 
+                                 Double_t&    nTrVtx, 
+                                 Double_t&    nAcc);
   /** 
    * Make Ring @f$ dN/d\eta @f$ histogram and a stack 
    * 
@@ -317,22 +301,23 @@ protected:
                              TList*       output,
                              const char*  outName,
                              Int_t        style=20) const;
-  Bool_t fEnableLowFlux;// Whether to use low-flux specific code
-  Bool_t fFirstEvent;   // Whether the event is the first seen 
-private:
-  /**
-   * A pointer to the corrections manager.  This is here to make the
-   * corrections manager persistent - that is, when we write the
-   * analysis train to a file (as done in PROOF) we should also write
-   * down the corrections mananger.   This pointer ensures that. 
-   * 
-   */
-  AliForwardCorrectionManager* fCorrManager; // Pointer to corrections manager
+  TAxis* DefaultEtaAxis() const { return new TAxis(200,-4,6); }
+  TAxis* DefaultVertexAxis() const { return new TAxis(10,-10,10); }
+  Bool_t                 fEnableLowFlux;// Whether to use low-flux specific code
+  Bool_t                 fStorePerRing; // Store each ring on separate branch
+  TH2D*                  fHData;        // Summed 1/Nd^2N_{ch}/dphideta
+  AliForwardUtil::Histos fHistos;       // Cache histograms 
+  AliAODForwardMult      fAODFMD;       // Output object
+  AliAODForwardEP        fAODEP;        // Output object
+  AliForwardUtil::Histos fRingSums;     // Cache histograms 
+  Bool_t                 fDoTiming;     // Whether to do timing or not
+  TProfile*              fHTiming;
 
-  ClassDef(AliForwardMultiplicityBase,2) // Forward multiplicity class
+  ClassDef(AliForwardMultiplicityBase,5) // Forward multiplicity class
 };
 
 #endif
+
 // Local Variables:
 //  mode: C++
 // End: