]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/AliForwardUtil.h
Updates
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardUtil.h
index 6a61ddcf8f36195f2047d23b693262e30373cb69..030362c0ebfc599a9d07a812c272f99835f3905b 100644 (file)
@@ -22,6 +22,7 @@ class TH1I;
 class TH1;
 class TF1;
 class TAxis;
+class TArrayD;
 class AliESDEvent;
 class AliAODEvent;
 class AliAnalysisTaskSE;
@@ -34,6 +35,9 @@ class AliAnalysisTaskSE;
 class AliForwardUtil : public TObject
 {
 public:
+  enum { 
+    kSkipRing = (1 << 19) // Bit for skipping a histogram
+  };
   /** 
    * Get the standard color for a ring  
    *
@@ -48,6 +52,29 @@ public:
            + ((r == 'I' || r == 'i') ? 2 : -3));
   }
   //==================================================================
+  /** 
+   * @{ 
+   * @name AliROOT version
+   */
+  /** 
+   * Get the revision number of AliROOT
+   * 
+   * @return Subversion revision number of AliROOT used
+   */
+  static ULong_t AliROOTRevision();
+  /**
+   * Get the branch identifier of AliROOT.  In case of trunk, return
+   * 0xFFFFFFFF, while for @b vM-N-R{-S}, we get
+   *
+   * @code 
+   *    ((M & 0xFF) << 12 | (N & 0xFF) << 8 | (R & 0xFF) << 3 | (X))
+   * @endcode 
+   * where @c X is 0xAA if @b S is specified (e.g., analysis tag). 
+   *
+   * @return branch identifer encoded in bits 
+   */
+  static ULong_t AliROOTBranch();
+  //==================================================================
   /** 
    * @{ 
    * @name Collision/run parameters 
@@ -153,6 +180,21 @@ public:
    * @return Short integer value of magnetic field in kG 
    */
   static Short_t ParseMagneticField(Float_t field);
+  /** 
+   * Get a string representation of the magnetic field
+   * 
+   * @param field Magnetic field in kG
+   * 
+   * @return String representation of the magnetic field
+   */
+  static const char* MagneticFieldString(Short_t field);
+  /* @} */
+
+  //==================================================================
+  /** 
+   * @{ 
+   * @name Recalculate @f$\eta@f$, @f$\phi@f$, etc. 
+   */
   /** 
    * Get the radius of a strip. 
    * 
@@ -184,17 +226,13 @@ public:
    */  
   static Double_t GetPhiFromStrip(Char_t ring, UShort_t strip, 
                                  Double_t phi, Double_t xvtx, Double_t yvtx);
-  /** 
-   * Get a string representation of the magnetic field
-   * 
-   * @param field Magnetic field in kG
-   * 
-   * @return String representation of the magnetic field
-   */
-   static const char* MagneticFieldString(Short_t field);
   /* @} */
 
-  //__________________________________________________________________
+  //==================================================================
+  /** 
+   * @{ 
+   * @name Manager related tasks 
+   */
   /** 
    * Get the AOD event - either from the input (AOD analysis) or the
    * output (ESD analysis)
@@ -222,8 +260,9 @@ public:
    * @return true if the needed task was found 
    */
   static Bool_t CheckForTask(const char* clsOrName, Bool_t cls=true);
+  /* @} */
 
-  //__________________________________________________________________
+  //==================================================================
   /** 
    * @{ 
    * @name Member functions to store and retrieve analysis parameters 
@@ -232,12 +271,29 @@ public:
   static TObject* MakeParameter(const char* name, Int_t value);
   static TObject* MakeParameter(const char* name, Double_t value);
   static TObject* MakeParameter(const char* name, Bool_t value);
+  static TObject* MakeParameter(const char* name, ULong_t value);
   static void GetParameter(TObject* o, UShort_t& value);
   static void GetParameter(TObject* o, Int_t& value);
   static void GetParameter(TObject* o, Double_t& value);
   static void GetParameter(TObject* o, Bool_t& value);
+  static void GetParameter(TObject* o, ULong_t& value);
   /* @} */
 
+  //==================================================================
+  /** 
+   * @{ 
+   * @name Axis functions 
+   */
+  static TAxis* MakeFullIpZAxis(Int_t nCenter=20);
+  static void MakeFullIpZAxis(Int_t nCenter, TArrayD& bins);
+  static void MakeLogScale(Int_t nBins, Int_t minOrder, Int_t maxOrder, TArrayD& bins);
+  static void PrintTask(const TObject& o);
+  static void PrintName(const char* name);
+  static void PrintField(const char* name, const char* value, ...);
+  /* @} */
+
+  //==================================================================
+#if 0 // Moved to separate classes
   /** 
    * @{ 
    * @name Energy stragling functions 
@@ -474,8 +530,9 @@ public:
      * 
      */
     virtual ~ELossFitter();
+    void SetDebug(Bool_t debug=true) { fDebug = debug; }
     /** 
-     * Clear internal arrays 
+     * Clear internal arrays
      * 
      */
     void Clear();
@@ -506,6 +563,18 @@ public:
      * @return The function fitted to the data 
      */
     TF1* FitNParticle(TH1* dist, UShort_t n, Double_t sigman=-1);
+    /** 
+     * Fit a composite distribution of energy loss from both primaries
+     * and secondaries
+     * 
+     * @param dist   Distribution 
+     * @param sigman If larger than zero, the initial guess of the
+     *                detector included noise.  If zero or less this
+     *                parameter is fixed to 0.
+     * 
+     * @return Function fitted to the data 
+     */
+    TF1* FitComposite(TH1* dist, Double_t sigman);
     /**
      * Get Lower cut on data 
      *
@@ -554,9 +623,10 @@ public:
     const UShort_t fMinusBins;  // Number of bins from maximum to fit 1st peak
     TObjArray fFitResults;      // Array of fit results 
     TObjArray fFunctions;       // Array of functions 
+    Bool_t    fDebug;
   };
   /* @} */
-      
+#endif      
 
   //==================================================================
   /** 
@@ -612,6 +682,12 @@ public:
      * @param etaAxis Eta axis to use 
      */
     void Init(const TAxis& etaAxis);
+    /** 
+     * Re-initialize the object with new @f$\eta@f$ axis 
+     * 
+     * @param etaAxis Eta axis to use 
+     */
+    void ReInit(const TAxis& etaAxis);
     /** 
      * Make a histogram 
      * 
@@ -621,7 +697,14 @@ public:
      * 
      * @return Newly allocated histogram 
      */
-    TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis) const;
+    static TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis);
+    /** 
+     * Set the @f$\eta@f$ axis 
+     * 
+     * @param hist    Histogram
+     * @param etaAxis @f$\eta@f$ axis to use
+     */
+    static void RebinEta(TH2D* hist, const TAxis& etaAxis);
     /** 
      * Clear data 
      * 
@@ -659,7 +742,7 @@ public:
      * Constructor
      * 
      */
-    RingHistos() : fDet(0), fRing('\0'), fName("") {}
+    RingHistos() : fDet(0), fRing('\0'), fName(""), fkNSector(0), fkNStrip(0) {}
     /** 
      * 
      * 
@@ -667,7 +750,9 @@ public:
      * @param r Ring 
      */
     RingHistos(UShort_t d, Char_t r) 
-      : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)) 
+      : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)),
+       fkNSector(r == 'i' || r == 'I' ? 20 : 40), 
+       fkNStrip(r == 'i' || r == 'I' ? 512 : 256)
     {}
     /** 
      * Copy constructor
@@ -675,7 +760,8 @@ public:
      * @param o Object to copy from 
      */
     RingHistos(const RingHistos& o) 
-      : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName)
+      : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName),
+       fkNSector(o.fkNSector), fkNStrip(o.fkNStrip)
     {}
     /** 
      * 
@@ -695,6 +781,8 @@ public:
       fDet  = o.fDet;
       fRing = o.fRing;
       fName = o.fName;
+      fkNSector = o.fkNSector;
+      fkNStrip  = o.fkNStrip;
       return *this;
     }
     /** 
@@ -723,7 +811,7 @@ public:
      */
     TH1* GetOutputHist(const TList* d, const char* name) const;
     /** 
-     * 
+     * Get the colour of this ring 
      * 
      * 
      * @return 
@@ -738,9 +826,19 @@ public:
      * @return Name of this ring 
      */
     const char* GetName() const { return fName.Data(); } 
+    /** 
+     * Get number of sectors 
+     */
+    const UShort_t& NSector() const { return fkNSector; }
+    /** 
+     * Get number of strips 
+     */
+    const UShort_t& NStrip() const { return fkNStrip; }
     UShort_t fDet;   // Detector
     Char_t   fRing;  // Ring
     TString  fName;  // Name
+    UShort_t fkNSector; // Number of sectors 
+    UShort_t fkNStrip;  // Number of strips 
 
     ClassDef(RingHistos,1) 
   };