]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliCentralMultiplicityTask.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliCentralMultiplicityTask.h
index aae4c4fe9867e2b812d224d467fc06d48d1cbac8..2433a3968ed7ea5b034ccb8bcc249527598b23ad 100644 (file)
  * @ingroup pwglf_forward_aod
  * 
  */
-#include <AliAnalysisTaskSE.h>
+#include "AliBaseESDTask.h"
 #include "AliFMDEventInspector.h"
 #include "AliAODCentralMult.h"
-#include "AliCentralCorrAcceptance.h"
-#include "AliCentralCorrSecondaryMap.h"
-//class AliForwardCorrectionManager;
+class AliCentralCorrectionManager;
 class AliESDEvent;
 class AliMultiplicity;
 class TH2D;
 class TList;
 class TTree;
+class TObjArray;
 
 /** 
  * Class that calculates the multiplicity in the
@@ -44,7 +43,7 @@ class TTree;
  * @ingroup pwglf_forward_aod
  * 
  */
-class AliCentralMultiplicityTask : public AliAnalysisTaskSE
+class AliCentralMultiplicityTask : public AliBaseESDTask
 {
 public:
   /** 
@@ -64,44 +63,46 @@ public:
    */
   AliCentralMultiplicityTask();
   /** 
-   * Copy constructor 
+   * Create output objects 
    * 
-   * @param o Object to copy from 
+   * @return true on success
    */
-  AliCentralMultiplicityTask(const AliCentralMultiplicityTask& o);
+  virtual Bool_t Book();
   /** 
-   * Assignment operator 
-   * 
-   * @param o Object to assign from 
+   * Creat output objects in tree 
    * 
-   * @return Reference to this object 
+   * @param ah Handler 
    */
-  AliCentralMultiplicityTask& operator=(const AliCentralMultiplicityTask& o);
+  virtual void CreateBranches(AliAODHandler* ah);
   /** 
-   * Configure this task via a macro 
+   * Called just before first event
    * 
-   * @param macro Macro to configure va 
+   * @param v Vertex axis 
+   * @param e @f$\eta@f$ axis
    * 
-   * @return true on success, false otherwise
+   * @return true on success
    */
-  virtual Bool_t Configure(const char* macro="CentralAODConfig.C");
+  virtual Bool_t PreData(const TAxis& v, const TAxis& e);
   /** 
-   * Create output objects 
+   * Called before event
    * 
+   * @return true on success
    */
-  virtual void UserCreateOutputObjects();
+  virtual Bool_t PreEvent();
   /** 
    * Process each event 
    *
-   * @param option Not used
+   * @param esd ESD event
+   * 
+   * @return true on success   
    */  
-  virtual void UserExec(Option_t* option);
+  virtual Bool_t Event(AliESDEvent& esd);
   /** 
    * End of job
    * 
-   * @param option Not used 
+   * @return true on success   
    */
-  virtual void Terminate(Option_t* option);
+  virtual Bool_t Finalize();
   /** 
    * Print information 
    * 
@@ -120,265 +121,155 @@ public:
    * @param use Whether to use acceptance corrections 
    */
   virtual void SetUseAcceptance(Bool_t use) { fUseAcceptance = use; }
+  /** 
+   * Set whether to make diagnostics or not
+   * 
+   * @param use If true, store some extra diagnostic histograms
+   */
+  virtual void SetMakeDiagnostics(Bool_t use=true) { fStore = use; }
+  /** 
+   * Get the event inspector
+   * 
+   * @return Reference to used event inspector
+   */
+  AliFMDEventInspector& GetEventInspector() { return fInspector; }
+  /** 
+   * Get the event inspector
+   * 
+   * @return Reference to used event inspector
+   */
+  const AliFMDEventInspector& GetEventInspector() const { return fInspector; }
 
-  AliFMDEventInspector& GetInspector() { return fInspector; }
-  const AliFMDEventInspector& GetInspector() const { return fInspector; }
-
-  //__________________________________________________________________
+protected:
+  /** 
+   * Copy constructor 
+   * 
+   * @param o Object to copy from 
+   */
+  AliCentralMultiplicityTask(const AliCentralMultiplicityTask& o);
+  /** 
+   * Assignment operator 
+   * 
+   * @param o Object to assign from 
+   * 
+   * @return Reference to this object 
+   */
+  AliCentralMultiplicityTask& operator=(const AliCentralMultiplicityTask& o);
+  /** 
+   * Process the ESD SPD information 
+   * 
+   * @param hist    Histogram to fill
+   * @param spdmult SPD multiplicity object
+   */
+  virtual void ProcessESD(TH2D& hist, 
+                         const AliMultiplicity* spdmult) const;
   /**
-   * Manager of corrections 
+   * A vertex bin. 
    *
-   * This is a small class to fetch corrections for secondaries and
-   * dead channels.
-   * 
+   * Used to store and apply corrections and fiducial cuts
    */
-  class Manager 
+  struct VtxBin : public TObject
   {
-  public:
     /** 
-     * Constructor
+     * Constructor 
      * 
+     * @param iVz    Bin number
+     * @param minIpZ Least @f$IP_{z}@f$
+     * @param maxIpZ Largest  @f$IP_{z}@f$
      */
-    Manager();
+    VtxBin(Int_t iVz=0, Double_t minIpZ=0, Double_t maxIpZ=0);
     /** 
-     * Copy constructor 
+     * Copy constructor
      * 
-     * @param o 
-     */
-    Manager(const Manager& o);
-    /** 
-     * Destructor
+     * @param o Object to copy from 
      */
-    virtual ~Manager() {}
+    VtxBin(const VtxBin& o);
     /** 
-     * Assignment operator 
+     * Assignment operator
      * 
      * @param o Object to assign from 
      * 
-     * @return Reference to this object 
-     */
-    Manager& operator=(const Manager& o);
-    
+     * @return Reference to this object
+     */  
+    VtxBin& operator=(const VtxBin& o);
     /** 
-     * Initializ
+     * Get the nam
      * 
-     * @param sys    Collision system (1: pp, 2: PbPb)
-     * @param sNN    Center of mass energy per nucleon pair [GeV]
-     * @param field  Magnetic field [kG]
+     * @return The name 
      */
-    void Init(UShort_t sys, UShort_t sNN, Short_t field);
-    
+    const char* GetName() const;
     /** 
-     * Is initialized 
+     * Prepare for data 
      * 
-     * @return true if initialized 
+     * @param l         List
+     * @param coverage  Template 
+     * @param store     Whether to store results
      */
-    Bool_t IsInit() { return fIsInit; }
+    void SetupForData(TList* l, TH2* coverage, Bool_t store=true);
     /** 
-     * Check if we have the secondary correction
+     * Correct the input data
      * 
-     * @return true if it is read in
+     * @param aodHist       Histogram
+     * @param useSecondary  Whether to use secondary correction or not 
+     * @param useAcceptance Whether to use acceptance correction or not 
+     * @param sum           Whether to sum or not 
      */
-    Bool_t HasSecondaryCorrection() const { return fSecmap != 0; }
+    void Correct(TH2D&  aodHist,
+                Bool_t useSecondary,
+                Bool_t useAcceptance,
+                Bool_t sum=true) const;
     /** 
-     * Check if we have the acceptance correction
+     * Print information
      * 
-     * @return true if it is read in
-     */
-    Bool_t HasAcceptanceCorrection() const { return fAcceptance != 0; }
-
-    /** 
-     * Get the acceptance path
-     * 
-     * @return 
-     */
-    const char* GetAcceptancePath() const {return fAcceptancePath.Data(); }
-    /** 
-     * Get the secondary path 
-     * 
-     * @return 
-     */
-    const char* GetSecMapPath() const {return fSecMapPath.Data(); }
-    /** 
-     * Set the path to the acceptance maps 
-     * 
-     * @param path PAth to object file 
-     */
-    void SetAcceptancePath(const char* path) {fAcceptancePath=path; }
-    /** 
-     * Set the path to the secondary maps 
-     * 
-     * @param path Path to object files 
-     */
-    void  SetSecMapPath(const char* path) {fSecMapPath=path; }
-    /** 
-     * Get full path name to object file 
-     * 
-     * @param what   What to get 
-     * @param sys    Collision system
-     * @param sNN    Center of mass energy 
-     * @param field  Magnetic field 
-     * 
-     * @return 
-     */
-    const char* GetFullFileName(UShort_t what, UShort_t sys, UShort_t sNN, 
-                               Short_t  field) const;
-    /** 
-     * Get the full path name 
-     * 
-     * @param what   What to get
-     * @param sys    Collision system
-     * @param sNN    Center of mass energy 
-     * @param field  Magnetic field 
-     * 
-     * @return 
-     */
-    const char* GetFileName(UShort_t what, UShort_t sys, UShort_t sNN,
-                           Short_t field) const;
-
-    /** 
-     * Get the obejct name 
-     * 
-     * @param what which correction
-     * 
-     * @return Name of object
-     */
-    const char* GetObjectName(UShort_t what) const { 
-      return what == 0 ? GetSecMapName() : GetAcceptanceName(); }
-    /** 
-     * Get the directory part of the full file name 
-     * 
-     * @param what What correction 
-     * 
-     * @return directory path
-     */
-    const char* GetFileDir(UShort_t what) const {
-      return what == 0 ? fSecMapPath.Data() : fAcceptancePath.Data(); }
-
-    /** 
-     * Get the acceptance object name 
-     * 
-     * @return 
-     */
-    const char* GetAcceptanceName() const {return fAcceptanceName.Data(); }
-    /** 
-     * Get the secondary object name 
-     * 
-     * @return 
-     */
-    const char* GetSecMapName() const {return fSecMapName.Data(); }
-    
-    /** 
-     * Get the secondary map
-     * 
-     * @param vtxbin 
-     * 
-     * @return 
-     */
-    TH2D* GetSecMapCorrection(UShort_t vtxbin) const;
-    /** 
-     * Get the acceptance correction 
-     * 
-     * @param vtxbin 
-     * 
-     * @return 
-     */
-    TH1D* GetAcceptanceCorrection(UShort_t vtxbin) const;
-    /** 
-     * Get the secondary correction map object 
-     *
-     * @return The secondary correction map 
-     */
-    AliCentralCorrSecondaryMap* GetSecMap() const { return fSecmap; }
-    /** 
-     * Write a correction object to (a temporary) file.  
-     *    
-     * @param what   What kind of correction
-     * @param sys    Collision system
-     * @param cms    Center of mass energy
-     * @param field  Field 
-     * @param o      Object to write
-     * @param full   If true, write to full path
-     * 
-     * @return True on success 
-     */
-    Bool_t WriteFile(UShort_t what, UShort_t sys, UShort_t cms, Short_t field, 
-                    TObject* o, Bool_t full) const;
-    /** 
-     * Print the object 
-     * 
-     * @param option Not used
+     * @param option Not used 
      */
     void Print(Option_t* option="") const;
-  private:
-    
-    TString                     fAcceptancePath; // Path to acceptance 
-    TString                     fSecMapPath;     // Path to secondary map
-    AliCentralCorrAcceptance*   fAcceptance;     // Acceptance 
-    AliCentralCorrSecondaryMap* fSecmap;         // Secindary map
-    TString                     fAcceptanceName; // Acceptance name
-    TString                     fSecMapName;     // Secindary name
-    Bool_t                      fIsInit;         // Are we init
 
-    ClassDef(Manager,1); // Manager of data 
+    Int_t        fId;     // Vertex bin number 
+    Double_t     fMinIpZ; // Least value of ipZ 
+    Double_t     fMaxIpZ; // Largest value of ipZ 
+    Int_t        fEtaMin; // Smallest eta bin to use 
+    Int_t        fEtaMax; // Largest eta bin to use 
+    TH2*         fSec;    // Our secondary correction
+    TH1*         fAcc;    // Our acceptance correction 
+    mutable TH2* fHits;   // Diagnostics sum 
+
+    ClassDef(VtxBin,1);
   };
+    
+protected: 
   /** 
-   * Get the ESD event and initialise manager on first event if not
-   * done already
-   * 
-   * @return Pointer to valid ESD event object 
-   */
-  virtual AliESDEvent* GetESDEvent();
-  /** 
-   * Mark this event for storage in AOD output
-   * 
-   */
-  virtual void MarkEventForStore() const;
-  /** 
-   * Process the ESD SPD information 
-   * 
-   * @param hist    Histogram to fill
-   * @param spdmult SPD multiplicity object
-   */
-  virtual void ProcessESD(TH2D& hist, const AliMultiplicity* spdmult) const;
-  /** 
-   * Corret the data 
-   * 
-   * @param hist    Histogram to correct
-   * @param vtxbin  Vertex bin 
-   */
-  virtual void CorrectData(TH2D& hist, UShort_t vtxbin) const;
-  /** 
-   * Get a reference to the manager 
+   * Make a simple @f$\frac{dN_{ch}}{d\eta}@f$ estimate. 
    * 
-   * @return Reference to corrections manager 
-   */
-  Manager& GetManager() { return fManager; }
-  /** 
-   * Get a reference to the manager 
+   * @param input   Sum list
+   * @param output  Output list 
+   * @param nTr     On return, the number of events w/triggers
+   * @param nTrVtx  On return, the number of events w/triggers+vertex
+   * @param nAcc    On return, the number of accepted events 
    * 
-   * @return Reference to corrections manager 
+   * @return true on success, false otherwise 
    */
-  const Manager& GetManager() const { return fManager; }
-  void FindEtaLimits();
-
-protected: 
+  Bool_t MakeSimpledNdeta(const TList* input, 
+                         TList*       output,
+                         Double_t&    nTr, 
+                         Double_t&    nTrVtx, 
+                         Double_t&    nAcc);
+  TAxis* DefaultEtaAxis() const { return new TAxis(200,-4,6); }
+  TAxis* DefaultVertexAxis() const { return new TAxis(10,-10,10); }
   AliFMDEventInspector   fInspector;        // Inspect events 
-  TH2D*                  fData;             // sum histogram if needed
-  TList*                 fList;             // Output List for diagnostics
   AliAODCentralMult      fAODCentral;       // Output object
-  Manager                fManager;          // Manager object for corrections
   Bool_t                 fUseSecondary;     // Whether to secondary map
   Bool_t                 fUseAcceptance;    // Whether to use acceptance corr.
-  Bool_t                 fFirstEventSeen;   // Have we seen first event     
   Int_t                  fIvz;              // Event's vertex bin 
   TH2D*                  fNClusterTracklet; // # of clusters vs tracklets 
   TH2D*                  fClusterPerTracklet; // Clusters per tracklet. 
   TH1D*                  fNCluster;         //! Number of clusters 
   TH1D*                  fNTracklet;        //! number of tracklets 
-  TArrayI                fEtaMin;           // Least eta bin to use
-  TArrayI                fEtaMax;           // Largest eta bin to use
-  ClassDef(AliCentralMultiplicityTask,2)    // Forward multiplicity class
+  TObjArray*             fVtxList;          //! Array of vertex bins
+  Bool_t                 fStore;            // Store diagnostics
+  TH2D*                  fHData;            // Sum of signals 
+private:
+  ClassDef(AliCentralMultiplicityTask,5)    // Forward multiplicity class
 };
 
 #endif