The revisited SPD cluster analysis in the new AOD framework and the corrections for...
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 13 Feb 2011 21:30:12 +0000 (21:30 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 13 Feb 2011 21:30:12 +0000 (21:30 +0000)
13 files changed:
PWG2/CMakelibPWG2forward2.pkg
PWG2/FORWARD/analysis2/AddTaskCentral.C [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliAODCentralMult.cxx [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliAODCentralMult.h [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralCorrAcceptance.cxx [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralCorrAcceptance.h [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralCorrSecondaryMap.cxx [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralCorrSecondaryMap.h [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.cxx [new file with mode: 0644]
PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.h [new file with mode: 0644]
PWG2/FORWARD/analysis2/scripts/RunCopyCentralSecMap.C [new file with mode: 0644]
PWG2/FORWARD/corrections/CentralAcceptance/centralacceptance_pp_0900GeV_p5kG.root [new file with mode: 0644]
PWG2/FORWARD/corrections/CentralSecMap/centralsecmap_pp_0900GeV_p5kG.root [new file with mode: 0644]

index ccf8d0f..1cd26a7 100644 (file)
@@ -51,12 +51,16 @@ set ( SRCS
     FORWARD/analysis2/AliForwardMCCorrectionsTask.cxx
     FORWARD/analysis2/AliForwarddNdetaTask.cxx
     FORWARD/analysis2/AliForwardUtil.cxx
+    FORWARD/analysis2/AliCentralMultiplicityTask.cxx
+    FORWARD/analysis2/AliAODCentralMult.cxx
+    FORWARD/analysis2/AliCentralCorrSecondaryMap.cxx
+    FORWARD/analysis2/AliCentralCorrAcceptance.cxx 
 )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 set ( HDRS ${HDRS} FORWARD/analysis2/AliFMDStripIndex.h )
 
-set ( EINCLUDE  ANALYSIS )
+set ( EINCLUDE  ANALYSIS)
 
 set ( EXPORT FORWARD/analysis2/AliAODForwardMult.h 
              FORWARD/analysis2/AliForwardUtil.h )
diff --git a/PWG2/FORWARD/analysis2/AddTaskCentral.C b/PWG2/FORWARD/analysis2/AddTaskCentral.C
new file mode 100644 (file)
index 0000000..1cce090
--- /dev/null
@@ -0,0 +1,41 @@
+/** 
+ * @defgroup pwg2_forward_scripts Scripts used in the analysis
+ *
+ * @ingroup pwg2_forward
+ */
+/**
+ * @file 
+ * @ingroup pwg2_forward_scripts
+ * 
+ */
+/**
+ * This is the macro to include the Forward multiplicity in a train.  
+ * 
+ * @ingroup pwg2_forward_scripts
+ */
+AliAnalysisTask* AddTaskCentral()
+{
+  gSystem->Load("libPWG2forward2");
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTaskCentral", "No analysis manager to connect to.");
+    return NULL;
+  }   
+
+  // --- Make the task and add it to the manager ---------------------
+  AliCentralMultiplicityTask* task = new AliCentralMultiplicityTask("Central");
+  task->InitManager(1,900,5);
+  mgr->AddTask(task);
+  
+  // --- Make the output container and connect it --------------------
+  TString outputfile = AliAnalysisManager::GetCommonFileName();
+  
+  AliAnalysisDataContainer* histOut = 
+    mgr->CreateContainer("Central", TList::Class(), 
+                        AliAnalysisManager::kOutputContainer,outputfile);
+  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(task, 1, histOut);
+  
+  return task;
+}
diff --git a/PWG2/FORWARD/analysis2/AliAODCentralMult.cxx b/PWG2/FORWARD/analysis2/AliAODCentralMult.cxx
new file mode 100644 (file)
index 0000000..bd88c01
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// Class that contains the central multiplicity data per event 
+//
+// This class contains a histogram of 
+// @f[
+//   \frac{d^2N_{ch}}{d\eta d\phi}\quad,
+// @f]
+// as well as a trigger mask for each analysed event.  
+// 
+// The eta acceptance of the event is stored in the underflow bins of
+// the histogram.  So to build the final histogram, one needs to
+// correct for this acceptance (properly weighted by the events), and
+// the vertex efficiency.  This simply boils down to defining a 2D
+// histogram and summing the event histograms in that histogram.  One
+// should of course also do proper book-keeping of the accepted event.
+//
+#include "AliAODCentralMult.h"
+#include <TBrowser.h>
+#include <iostream>
+#include <TMath.h>
+#include <TObjString.h>
+
+ClassImp(AliAODCentralMult)
+#if 0 
+; // For Emacs 
+#endif
+
+//____________________________________________________________________
+AliAODCentralMult::AliAODCentralMult()
+  : fIsMC(false),
+    fHist()
+{
+  // 
+  // Constructor 
+  // 
+}
+
+//____________________________________________________________________
+AliAODCentralMult::AliAODCentralMult(Bool_t isMC) 
+  : fIsMC(isMC),
+    fHist("centralMult", "d^{2}N_{ch}/d#etad#varphi in the central regions", 
+         200, -4, 6, 20, 0, 2*TMath::Pi())
+{
+  // 
+  // Constructor 
+  // 
+  // Parameters: 
+  //  isMC   If set to true this is for MC data (effects branch name)
+  // 
+  fHist.SetXTitle("#eta");
+  fHist.SetYTitle("#varphi [radians]");
+  fHist.SetZTitle("#frac{d^{2}N_{ch}}{d#etad#varphi}");
+  fHist.SetDirectory(0);
+  fHist.Sumw2();
+}
+//____________________________________________________________________
+void
+AliAODCentralMult::Clear(Option_t*) {
+  
+  fHist.Reset();
+  
+}
+//____________________________________________________________________
+void
+AliAODCentralMult::Init(const TAxis& etaAxis)
+{
+  // Initialize the histogram with an eta axis 
+  // 
+  // Parameters: 
+  //   etaAxis       Eta axis to use 
+  // 
+  fHist.SetBins(etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(), 
+               20, 0, 2*TMath::Pi());
+}
+
+//____________________________________________________________________
+void
+AliAODCentralMult::Browse(TBrowser* b)
+{
+  // Browse this object 
+  // 
+  // Parameters: 
+  //   b   Browser to use 
+
+  b->Add(&fHist);
+
+}
+//____________________________________________________________________
+void
+AliAODCentralMult::Print(Option_t* option) const
+{
+  // Print this object 
+  // 
+  // Parameters: 
+  //  option   Passed to TH1::Print 
+  fHist.Print(option);
+}
+
+//____________________________________________________________________
+//
+// EOF
+//
diff --git a/PWG2/FORWARD/analysis2/AliAODCentralMult.h b/PWG2/FORWARD/analysis2/AliAODCentralMult.h
new file mode 100644 (file)
index 0000000..9845be1
--- /dev/null
@@ -0,0 +1,107 @@
+//
+// See implementation or Doxygen comments for more information
+//
+#ifndef ALIAODCENTRALMULT_H
+#define ALIAODCENTRALMULT_H
+#include <TObject.h>
+#include <TH2D.h>
+class TBrowser;
+/**
+ * Class that contains the central multiplicity data per event 
+ *
+ * This class contains a histogram of 
+ * @f[
+ *   \frac{d^2N_{ch}}{d\eta d\phi}\quad,
+ * @f]
+ * as well as a trigger mask for each analysed event.  
+ * 
+ * The eta acceptance of the event is stored in the underflow bins of
+ * the histogram.  So to build the final histogram, one needs to
+ * correct for this acceptance (properly weighted by the events), and
+ * the vertex efficiency.  This simply boils down to defining a 2D
+ * histogram and summing the event histograms in that histogram.  One
+ * should of course also do proper book-keeping of the accepted event.
+ */
+
+class AliAODCentralMult : public TObject
+{
+public:
+  
+  /** 
+   * Default constructor 
+   * 
+   * Used by ROOT I/O sub-system - do not use
+   */
+  AliAODCentralMult();
+  /** 
+   * Constructor 
+   * 
+   * @param isMC Whether this was from MC or not 
+   */
+  AliAODCentralMult(Bool_t isMC);
+  /** 
+   * Destructor 
+   */
+  virtual ~AliAODCentralMult() {} // Destructor 
+  /** 
+   * Initialize 
+   * 
+   * @param etaAxis  Pseudo-rapidity axis
+   */
+  void Init(const TAxis& etaAxis);
+  /** 
+   * Get the @f$ d^2N_{ch}/d\eta d\phi@f$ histogram, 
+   *
+   * @return @f$ d^2N_{ch}/d\eta d\phi@f$ histogram, 
+   */  
+  const TH2D& GetHistogram() const { return fHist; } // Get histogram 
+  /** 
+   * Get the @f$ d^2N_{ch}/d\eta d\phi@f$ histogram, 
+   *
+   * @return @f$ d^2N_{ch}/d\eta d\phi@f$ histogram, 
+   */  
+  TH2D& GetHistogram() { return fHist; } // Get histogram 
+  /**
+   * Clear Object between events
+   * @param t option
+   *
+   */
+  void Clear(Option_t*);
+  /** 
+   * browse this object 
+   * 
+   * @param b Browser 
+   */
+  void Browse(TBrowser* b);
+  /** 
+   * This is a folder 
+   * 
+   * @return Always true
+   */
+  Bool_t IsFolder() const { return kTRUE; } // Always true 
+  /** 
+   * Print content 
+   * 
+   * @param option Passed verbatim to TH2::Print 
+   */
+  void Print(Option_t* option="") const;
+
+  /** 
+   * Get the name of the object 
+   * 
+   * @return Name of object 
+   */
+  const Char_t* GetName() const { return (fIsMC ? "CentralClustersMC" : "CentralClusters"); }
+
+protected: 
+  Bool_t  fIsMC;     // Whether this is from MC 
+  TH2D    fHist;     // Histogram of d^2N_{ch}/(deta dphi) for this event
+  
+  ClassDef(AliAODCentralMult,1); // AOD forward multiplicity 
+};
+
+#endif
+// Local Variables:
+//  mode: C++
+// End:
+
diff --git a/PWG2/FORWARD/analysis2/AliCentralCorrAcceptance.cxx b/PWG2/FORWARD/analysis2/AliCentralCorrAcceptance.cxx
new file mode 100644 (file)
index 0000000..48ce962
--- /dev/null
@@ -0,0 +1,240 @@
+//
+// This class contains the acceptance correction due to dead channels 
+// 
+//
+#include "AliCentralCorrAcceptance.h"
+#include <TBrowser.h>
+#include <TH1D.h>
+#include <AliLog.h>
+#include <iostream>
+
+//____________________________________________________________________
+AliCentralCorrAcceptance::AliCentralCorrAcceptance()
+  : fArray(), 
+    fVertexAxis(0,0,0)
+{
+  // 
+  // Default constructor 
+  //
+  fArray.SetOwner(kTRUE);
+  fArray.SetName("acceptance");
+  fVertexAxis.SetName("vtxAxis");
+  fVertexAxis.SetTitle("v_{z} [cm]");
+  
+}
+//____________________________________________________________________
+AliCentralCorrAcceptance::AliCentralCorrAcceptance(const 
+                                              AliCentralCorrAcceptance& o)
+  : TObject(o), 
+    fArray(o.fArray), 
+    fVertexAxis(o.fVertexAxis.GetNbins(), o.fVertexAxis.GetXmin(), 
+               o.fVertexAxis.GetXmax())
+{
+  // 
+  // Copy constructor 
+  // 
+  // Parameters:
+  //    o Object to copy from 
+  //
+  fVertexAxis.SetName("vtxAxis");
+  fVertexAxis.SetTitle("v_{z} [cm]");
+}
+//____________________________________________________________________
+AliCentralCorrAcceptance::~AliCentralCorrAcceptance()
+{
+  //
+  // Destructor 
+  // 
+  //
+  fArray.Clear();
+}
+//____________________________________________________________________
+AliCentralCorrAcceptance&
+AliCentralCorrAcceptance::operator=(const AliCentralCorrAcceptance& o)
+{
+  // 
+  // Assignment operator 
+  // 
+  // Parameters:
+  //    o Object to assign from 
+  // 
+  // Return:
+  //    Reference to this object 
+  //
+  fArray        = o.fArray;
+  SetVertexAxis(o.fVertexAxis);
+
+  return *this;
+}
+//____________________________________________________________________
+TH1D*
+AliCentralCorrAcceptance::GetCorrection(Double_t v) const
+{
+  // 
+  // Get the acceptance correction @f$ a_{r,v}@f$ 
+  // 
+  // Parameters:
+  //    d  Detector number (1-3)
+  //    r  Ring identifier (I or O)
+  //    v  Primary interaction point @f$z@f$ coordinate
+  // 
+  // Return:
+  //    The correction @f$ a_{r,v}@f$ 
+  //
+  Int_t b = FindVertexBin(v);
+  if (b <= 0) return 0;
+  return GetCorrection(UShort_t(b));
+}
+//____________________________________________________________________
+TH1D*
+AliCentralCorrAcceptance::GetCorrection(UShort_t b) const
+{
+  // 
+  // Get the acceptance correction @f$ a_{r,v}@f$ 
+  // 
+  // Parameters:
+  //    d  Detector number (1-3)
+  //    r  Ring identifier (I or O)
+  //    b  Bin corresponding to the primary interaction point 
+  //           @f$z@f$ coordinate (1 based)
+  // 
+  // Return:
+  //    The correction @f$ a_{r,v}@f$ 
+  //
+  
+  // TObjArray* ringArray = GetRingArray(d, r);
+  //if (!ringArray) return 0;
+
+  if (b <= 0 || b > fArray.GetEntriesFast()) {
+    AliWarning(Form("vertex bin %d out of range [1,%d]", 
+                   b, fArray.GetEntriesFast()));
+    return 0;
+  }
+
+  TObject* o = fArray.At(b-1);
+  if (!o) { 
+    AliWarning(Form("No dead channels map found for SPD in vertex bin %d",
+                   b));
+    return 0;
+  }
+  return static_cast<TH1D*>(o);
+}
+  
+//____________________________________________________________________
+Int_t
+AliCentralCorrAcceptance::FindVertexBin(Double_t v) const
+{
+  // 
+  // Find the vertex bin that corresponds to the passed vertex 
+  // 
+  // Parameters:
+  //    vertex The interaction points @f$z@f$-coordinate 
+  // 
+  // Return:
+  //    Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if 
+  // out of range 
+  //
+  if (fVertexAxis.GetNbins() <= 0) { 
+    AliWarning("No vertex array defined");
+    return 0;
+  }
+  Int_t bin = const_cast<TAxis&>(fVertexAxis).FindBin(v);
+  if (bin <= 0 || bin > fVertexAxis.GetNbins()) { 
+    AliWarning(Form("vertex %+8.4f out of range [%+8.4f,%+8.4f]",
+                   v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
+    return 0;
+  }
+  return bin;
+}
+
+//____________________________________________________________________
+Bool_t
+AliCentralCorrAcceptance::SetCorrection(UShort_t b, TH1D*  h) 
+{
+  // 
+  // Set the acceptance correction @f$ a_{r,v}(\eta)@f$ 
+  // Note, that the object takes ownership of the passed pointer.
+  // 
+  // Parameters:
+  //    b    Bin corresponding to the primary interaction point 
+  //             @f$z@f$ coordinate  (1 based)
+  //    h    @f$ a_{r,v}(\eta)@f$ 
+  // 
+  // Return:
+  //    true if operation succeeded 
+  //
+  
+  if (b <= 0 || b > fVertexAxis.GetNbins()) { 
+    AliWarning(Form("Vertex bin %3d out of range [1,%3d]", 
+                   b, fVertexAxis.GetNbins()));
+    return false;
+  }
+  
+  h->SetName(Form("SPD_vtxbin%03d",  b));
+  h->SetTitle(Form("Acceptance correction for SPD "
+                  "in vertex bin %d [%+8.4f,%+8.4f]", 
+                  b, fVertexAxis.GetBinLowEdge(b), 
+                  fVertexAxis.GetBinUpEdge(b)));
+  h->SetXTitle("#eta");
+  h->SetYTitle("dN_{ch}/d#eta / sum_i N_{ch,i}");
+  h->SetFillStyle(3001);
+  h->SetDirectory(0);
+  h->SetStats(0);
+  fArray.AddAtAndExpand(h, b-1);
+  return kTRUE;
+}
+//____________________________________________________________________
+Bool_t
+AliCentralCorrAcceptance::SetCorrection(Double_t v, TH1D*  h) 
+{
+  // 
+  // Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
+  // Note, that the object takes ownership of the passed pointer.
+  // 
+  // Parameters
+  //    v    Primary interaction point @f$z@f$ coordinate  
+  //    h    @f$ a_{r,v}(\eta)@f$ 
+  // 
+  // Return:
+  //    true if operation succeeded 
+  //
+  Int_t b = FindVertexBin(v);
+  if (b <= 0 || b > fVertexAxis.GetNbins()) { 
+    AliWarning(Form("Vertex %+8.4f out of range [%+8.4f,%+8.4f]", 
+                   v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
+    return false;
+  }
+  return SetCorrection(UShort_t(b), h);
+}
+//____________________________________________________________________
+void
+AliCentralCorrAcceptance::Browse(TBrowser* b)
+{
+  // 
+  // Browse this object in the browser
+  // 
+  // Parameters:
+  //    b 
+  //
+  b->Add(&fArray);
+  b->Add(&fVertexAxis);
+}
+//____________________________________________________________________
+void
+AliCentralCorrAcceptance::Print(Option_t* option) const
+{
+  // 
+  // Print this object 
+  // 
+  // Parameters:
+  //    option 
+  //  
+  std::cout << "Acceptance correction due to dead channels" << std::endl;
+  fArray.Print(option);
+  fVertexAxis.Print(option);
+}
+    
+//____________________________________________________________________
+//
+// EOF
+//
diff --git a/PWG2/FORWARD/analysis2/AliCentralCorrAcceptance.h b/PWG2/FORWARD/analysis2/AliCentralCorrAcceptance.h
new file mode 100644 (file)
index 0000000..3f43299
--- /dev/null
@@ -0,0 +1,178 @@
+//
+// This class contains the acceptance correction due to dead channels
+//
+//
+#ifndef ALICENTRALCORRACCEPTANCE_H
+#define ALICENTRALCORRACCEPTANCE_H
+#include <TObject.h>
+#include <TObjArray.h>
+#include <TAxis.h>
+class TH1D;
+
+/**
+ * This class contains the acceptance correction due to dead channels
+ *
+ * These are generated from the on-line dead channel calculations 
+ *
+ * @ingroup pwg2_forward_corr
+ */
+class AliCentralCorrAcceptance : public TObject 
+{
+public:
+  /** 
+   * Default constructor 
+   */
+  AliCentralCorrAcceptance();
+  /** 
+   * Copy constructor 
+   * 
+   * @param o Object to copy from 
+   */
+  AliCentralCorrAcceptance(const AliCentralCorrAcceptance& o);
+  /**
+   * Destructor 
+   * 
+   */
+  virtual ~AliCentralCorrAcceptance();
+  /** 
+   * @{ 
+   * @name Get corrections and parameters 
+   */
+  /** 
+   * Assignment operator 
+   * 
+   * @param o Object to assign from 
+   * 
+   * @return Reference to this object 
+   */
+  AliCentralCorrAcceptance& operator=(const AliCentralCorrAcceptance& o);
+  /** 
+   * Get the acceptance correction @f$ a_{r,v}@f$ 
+   *
+   * @param d  Detector number (1-3)
+   * @param r  Ring identifier (I or O)
+   * @param v  Primary interaction point @f$z@f$ coordinate
+   * 
+   * @return The correction @f$ a_{r,v}@f$ 
+   */
+  TH1D* GetCorrection(Double_t v) const;
+  /** 
+   * Get the acceptance correction @f$ a_{r,v}@f$ 
+   *
+   * @param d  Detector number (1-3)
+   * @param r  Ring identifier (I or O)
+   * @param b  Bin corresponding to the primary interaction point 
+   *           @f$z@f$ coordinate (1 based)
+   * 
+   * @return The correction @f$ a_{r,v}@f$ 
+   */
+  TH1D* GetCorrection(UShort_t b) const;
+  /** 
+   * Get the vertex axis used 
+   * 
+   * @return vertex axis 
+   */
+  const TAxis& GetVertexAxis() const { return fVertexAxis; }
+  /* @} */
+
+  /** 
+   * @{ 
+   * @name Set corrections and parameters 
+   */
+  /** 
+   * Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
+   * Note, that the object takes ownership of the passed pointer.
+   * 
+   * @param d    Detector number (1-3)
+   * @param r    Ring identifier (I or O)
+   * @param v    Primary interaction point @f$z@f$ coordinate  
+   * @param h    @f$ a_{r,v}(\eta)@f$ 
+   * 
+   * @return true if operation succeeded 
+   */
+  Bool_t SetCorrection(Double_t v, TH1D* h);
+  /** 
+   * Set the acceptance correction @f$ a_{r,v}(\eta)@f$ 
+   * Note, that the object takes ownership of the passed pointer.
+   * 
+   * @param d    Detector number (1-3)
+   * @param r    Ring identifier (I or O)
+   * @param b    Bin corresponding to the primary interaction point 
+   *             @f$z@f$ coordinate  (1 based)
+   * @param h    @f$ a_{r,v}(\eta)@f$ 
+   * 
+   * @return true if operation succeeded 
+   */
+  Bool_t SetCorrection(UShort_t b, TH1D* h);
+  /** 
+   * Set the vertex axis to use 
+   * 
+   * @param axis Vertex axis 
+   */
+  void SetVertexAxis(const TAxis& axis);
+  /** 
+   * Set the vertex axis to use 
+   * 
+   * @param nBins   Number of bins
+   * @param min     Minimum
+   * @param max     Maximum
+   */
+  void SetVertexAxis(Int_t nBins, Double_t min, Double_t max);
+  /* @} */
+
+  /** 
+   * @{ 
+   * @name Auxiliary member functions 
+   */
+  /** 
+   * Declare this as a folder
+   * 
+   * @return Always true 
+   */
+  Bool_t IsFolder() const { return true; }
+  /** 
+   * Browse this object in the browser
+   * 
+   * @param b 
+   */
+  void Browse(TBrowser* b);
+  /** 
+   * Print this object 
+   * 
+   * @param option 
+   */  
+  void Print(Option_t* option="R") const; //*MENU*
+  /* @} */
+protected:
+  /** 
+   * Find the vertex bin that corresponds to the passed vertex 
+   * 
+   * @param vertex The interaction points @f$z@f$-coordinate 
+   * 
+   * @return Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if 
+   * out of range 
+   */
+  Int_t FindVertexBin(Double_t vertex) const;
+
+  TObjArray fArray;          // Array of per-vertex acceptance corr
+  TAxis     fVertexAxis;     // The vertex axis 
+  ClassDef(AliCentralCorrAcceptance,1); // Acceptance correction due to dead areas
+};
+
+//____________________________________________________________________
+inline void 
+AliCentralCorrAcceptance::SetVertexAxis(Int_t nBins, Double_t min, 
+                                          Double_t max)
+{
+  fVertexAxis.Set(nBins, min, max);
+}
+//____________________________________________________________________
+inline void 
+AliCentralCorrAcceptance::SetVertexAxis(const TAxis& e)
+{
+  fVertexAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
+}
+#endif
+// Local Variables:
+//  mode: C++
+// End:
diff --git a/PWG2/FORWARD/analysis2/AliCentralCorrSecondaryMap.cxx b/PWG2/FORWARD/analysis2/AliCentralCorrSecondaryMap.cxx
new file mode 100644 (file)
index 0000000..2a26358
--- /dev/null
@@ -0,0 +1,234 @@
+//
+// This class contains the secondary correction 
+// for the central region
+//
+#include "AliCentralCorrSecondaryMap.h"
+#include <TBrowser.h>
+#include <TH2D.h>
+#include <AliLog.h>
+#include <iostream>
+
+//____________________________________________________________________
+AliCentralCorrSecondaryMap::AliCentralCorrSecondaryMap()
+  : fArray(), 
+    fVertexAxis(0,0,0)
+{
+  // 
+  // Default constructor 
+  //
+  fArray.SetOwner(kTRUE);
+  fArray.SetName("rings");
+  fVertexAxis.SetName("vtxAxis");
+  fVertexAxis.SetTitle("v_{z} [cm]");
+  
+}
+//____________________________________________________________________
+AliCentralCorrSecondaryMap::AliCentralCorrSecondaryMap(const 
+                                              AliCentralCorrSecondaryMap& o)
+  : TObject(o), 
+    fArray(o.fArray), 
+    fVertexAxis(o.fVertexAxis.GetNbins(), o.fVertexAxis.GetXmin(), 
+               o.fVertexAxis.GetXmax())
+{
+  // 
+  // Copy constructor 
+  // 
+  // Parameters:
+  //    o Object to copy from 
+  //
+  fVertexAxis.SetName("vtxAxis");
+  fVertexAxis.SetTitle("v_{z} [cm]");
+}
+//____________________________________________________________________
+AliCentralCorrSecondaryMap::~AliCentralCorrSecondaryMap()
+{
+  //
+  // Destructor 
+  // 
+  //
+  fArray.Clear();
+}
+//____________________________________________________________________
+AliCentralCorrSecondaryMap&
+AliCentralCorrSecondaryMap::operator=(const AliCentralCorrSecondaryMap& o)
+{
+  // 
+  // Assignment operator 
+  // 
+  // Parameters:
+  //    o Object to assign from 
+  // 
+  // Return:
+  //    Reference to this object 
+  //
+  fArray        = o.fArray;
+  SetVertexAxis(o.fVertexAxis);
+
+  return *this;
+}
+//____________________________________________________________________
+TH2D*
+AliCentralCorrSecondaryMap::GetCorrection(Double_t v) const
+{
+  // 
+  // Get the acceptance correction @f$ a_{r,v}@f$ 
+  // 
+  // Parameters:
+  //    d  Detector number (1-3)
+  //    r  Ring identifier (I or O)
+  //    v  Primary interaction point @f$z@f$ coordinate
+  // 
+  // Return:
+  //    The correction @f$ a_{r,v}@f$ 
+  //
+  Int_t b = FindVertexBin(v);
+  if (b <= 0) return 0;
+  return GetCorrection(UShort_t(b));
+}
+//____________________________________________________________________
+TH2D*
+AliCentralCorrSecondaryMap::GetCorrection(UShort_t b) const
+{
+  // 
+  // Get the acceptance correction @f$ a_{r,v}@f$ 
+  // 
+  // Parameters:
+  //    d  Detector number (1-3)
+  //    r  Ring identifier (I or O)
+  //    b  Bin corresponding to the primary interaction point 
+  //           @f$z@f$ coordinate (1 based)
+  // 
+  // Return:
+  //    The correction @f$ a_{r,v}@f$ 
+  //
+  
+  TObject* o = fArray.At(b-1);
+  if (!o) { 
+    AliWarning(Form("No dead channels map found for SPD in vertex bin %d",
+                   b));
+    return 0;
+  }
+  return static_cast<TH2D*>(o);
+}
+  
+//____________________________________________________________________
+Int_t
+AliCentralCorrSecondaryMap::FindVertexBin(Double_t v) const
+{
+  // 
+  // Find the vertex bin that corresponds to the passed vertex 
+  // 
+  // Parameters:
+  //    vertex The interaction points @f$z@f$-coordinate 
+  // 
+  // Return:
+  //    Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if 
+  // out of range 
+  //
+  if (fVertexAxis.GetNbins() <= 0) { 
+    AliWarning("No vertex array defined");
+    return 0;
+  }
+  Int_t bin = const_cast<TAxis&>(fVertexAxis).FindBin(v);
+  if (bin <= 0 || bin > fVertexAxis.GetNbins()) { 
+    AliWarning(Form("vertex %+8.4f out of range [%+8.4f,%+8.4f]",
+                   v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
+    return 0;
+  }
+  return bin;
+}
+
+//____________________________________________________________________
+Bool_t
+AliCentralCorrSecondaryMap::SetCorrection(UShort_t b, TH2D*  h) 
+{
+  // 
+  // Set the acceptance correction @f$ a_{r,v}(\eta)@f$ 
+  // Note, that the object takes ownership of the passed pointer.
+  // 
+  // Parameters:
+  //    d    Detector number (1-3)
+  //    r    Ring identifier (I or O)
+  //    b    Bin corresponding to the primary interaction point 
+  //             @f$z@f$ coordinate  (1 based)
+  //    h    @f$ a_{r,v}(\eta)@f$ 
+  // 
+  // Return:
+  //    true if operation succeeded 
+  //
+  
+  if (b <= 0 || b > fVertexAxis.GetNbins()) { 
+    AliWarning(Form("Vertex bin %3d out of range [1,%3d]", 
+                   b, fVertexAxis.GetNbins()));
+    return false;
+  }
+  h->SetName(Form("SPD_vtxbin%03d", b));
+  h->SetTitle(Form("SecondaryMap correction for SPD "
+                  "in vertex bin %d [%+8.4f,%+8.4f]", 
+                  b, fVertexAxis.GetBinLowEdge(b), 
+                  fVertexAxis.GetBinUpEdge(b)));
+  h->SetXTitle("#eta");
+  h->SetYTitle("dN_{ch}/d#eta / sum_i N_{ch,i}");
+  h->SetFillStyle(3001);
+  h->SetDirectory(0);
+  h->SetStats(0);
+  fArray.AddAtAndExpand(h, b-1);
+  return kTRUE;
+}
+//____________________________________________________________________
+Bool_t
+AliCentralCorrSecondaryMap::SetCorrection(Double_t v, TH2D*  h) 
+{
+  // 
+  // Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
+  // Note, that the object takes ownership of the passed pointer.
+  // 
+  // Parameters:
+  //    d    Detector number (1-3)
+  //    r    Ring identifier (I or O)
+  //    v    Primary interaction point @f$z@f$ coordinate  
+  //    h    @f$ a_{r,v}(\eta)@f$ 
+  // 
+  // Return:
+  //    true if operation succeeded 
+  //
+  Int_t b = FindVertexBin(v);
+  if (b <= 0 || b > fVertexAxis.GetNbins()) { 
+    AliWarning(Form("Vertex %+8.4f out of range [%+8.4f,%+8.4f]", 
+                   v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax()));
+    return false;
+  }
+  return SetCorrection( UShort_t(b), h);
+}
+//____________________________________________________________________
+void
+AliCentralCorrSecondaryMap::Browse(TBrowser* b)
+{
+  // 
+  // Browse this object in the browser
+  // 
+  // Parameters:
+  //    b 
+  //
+  b->Add(&fArray);
+  b->Add(&fVertexAxis);
+}
+//____________________________________________________________________
+void
+AliCentralCorrSecondaryMap::Print(Option_t* option) const
+{
+  // 
+  // Print this object 
+  // 
+  // Parameters:
+  //    option 
+  //  
+  std::cout << "SecondaryMap correction" << std::endl;
+  fArray.Print(option);
+  fVertexAxis.Print(option);
+}
+    
+//____________________________________________________________________
+//
+// EOF
+//
diff --git a/PWG2/FORWARD/analysis2/AliCentralCorrSecondaryMap.h b/PWG2/FORWARD/analysis2/AliCentralCorrSecondaryMap.h
new file mode 100644 (file)
index 0000000..5c2a2b2
--- /dev/null
@@ -0,0 +1,186 @@
+//
+// This class contains the secondary correction 
+// for the central region
+//
+#ifndef ALICENTRALCORRSECONDARYMAP_H
+#define ALICENTRALCORRSECONDARYMAP_H
+#include <TObject.h>
+#include <TObjArray.h>
+#include <TAxis.h>
+class TH2D;
+
+/**
+ * This class contains the acceptance correction due to dead channels
+ *
+ * These are generated from the on-line dead channel calculations 
+ *
+ * @ingroup pwg2_forward_corr
+ */
+class AliCentralCorrSecondaryMap : public TObject 
+{
+public:
+  /** 
+   * Default constructor 
+   */
+  AliCentralCorrSecondaryMap();
+  /** 
+   * Copy constructor 
+   * 
+   * @param o Object to copy from 
+   */
+  AliCentralCorrSecondaryMap(const AliCentralCorrSecondaryMap& o);
+  /**
+   * Destructor 
+   * 
+   */
+  virtual ~AliCentralCorrSecondaryMap();
+  /** 
+   * @{ 
+   * @name Get corrections and parameters 
+   */
+  /** 
+   * Assignment operator 
+   * 
+   * @param o Object to assign from 
+   * 
+   * @return Reference to this object 
+   */
+  AliCentralCorrSecondaryMap& operator=(const AliCentralCorrSecondaryMap& o);
+  /** 
+   * Get the acceptance correction @f$ a_{r,v}@f$ 
+   *
+   * @param d  Detector number (1-3)
+   * @param r  Ring identifier (I or O)
+   * @param v  Primary interaction point @f$z@f$ coordinate
+   * 
+   * @return The correction @f$ a_{r,v}@f$ 
+   */
+  TH2D* GetCorrection(Double_t v) const;
+  /** 
+   * Get the acceptance correction @f$ a_{r,v}@f$ 
+   *
+   * @param d  Detector number (1-3)
+   * @param r  Ring identifier (I or O)
+   * @param b  Bin corresponding to the primary interaction point 
+   *           @f$z@f$ coordinate (1 based)
+   * 
+   * @return The correction @f$ a_{r,v}@f$ 
+   */
+  TH2D* GetCorrection(UShort_t b) const;
+  /** 
+   * Get the vertex axis used 
+   * 
+   * @return vertex axis 
+   */
+  const TAxis& GetVertexAxis() const { return fVertexAxis; }
+  /* @} */
+
+  /** 
+   * @{ 
+   * @name Set corrections and parameters 
+   */
+  /** 
+   * Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
+   * Note, that the object takes ownership of the passed pointer.
+   * 
+   * @param d    Detector number (1-3)
+   * @param r    Ring identifier (I or O)
+   * @param v    Primary interaction point @f$z@f$ coordinate  
+   * @param h    @f$ a_{r,v}(\eta)@f$ 
+   * 
+   * @return true if operation succeeded 
+   */
+  Bool_t SetCorrection(Double_t v, TH2D* h);
+  /** 
+   * Set the acceptance correction @f$ a_{r,v}(\eta)@f$ 
+   * Note, that the object takes ownership of the passed pointer.
+   * 
+   * @param d    Detector number (1-3)
+   * @param r    Ring identifier (I or O)
+   * @param b    Bin corresponding to the primary interaction point 
+   *             @f$z@f$ coordinate  (1 based)
+   * @param h    @f$ a_{r,v}(\eta)@f$ 
+   * 
+   * @return true if operation succeeded 
+   */
+  Bool_t SetCorrection(UShort_t b, TH2D* h);
+  /** 
+   * Set the vertex axis to use 
+   * 
+   * @param axis Vertex axis 
+   */
+  void SetVertexAxis(const TAxis& axis);
+  /** 
+   * Set the vertex axis to use 
+   * 
+   * @param nBins   Number of bins
+   * @param min     Minimum
+   * @param max     Maximum
+   */
+  void SetVertexAxis(Int_t nBins, Double_t min, Double_t max);
+  /* @} */
+
+  /** 
+   * @{ 
+   * @name Auxiliary member functions 
+   */
+  /** 
+   * Declare this as a folder
+   * 
+   * @return Always true 
+   */
+  Bool_t IsFolder() const { return true; }
+  /** 
+   * Browse this object in the browser
+   * 
+   * @param b 
+   */
+  void Browse(TBrowser* b);
+  /** 
+   * Print this object 
+   * 
+   * @param option 
+   */  
+  void Print(Option_t* option="R") const; //*MENU*
+  /* @} */
+protected:
+  /** 
+   * Find the vertex bin that corresponds to the passed vertex 
+   * 
+   * @param vertex The interaction points @f$z@f$-coordinate 
+   * 
+   * @return Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if 
+   * out of range 
+   */
+  Int_t FindVertexBin(Double_t vertex) const;
+  /** 
+   * Get the index corresponding to the given ring 
+   * 
+   * @param d Detector
+   * @param r Ring 
+   * 
+   * @return Index (0 based) or negative in case of errors
+   */
+    
+  TObjArray fArray;      // Array of per-ring, per-vertex 2nd map
+  TAxis     fVertexAxis;     // The vertex axis 
+  ClassDef(AliCentralCorrSecondaryMap,1); // SecondaryMap correction due to dead areas
+};
+
+//____________________________________________________________________
+inline void 
+AliCentralCorrSecondaryMap::SetVertexAxis(Int_t nBins, Double_t min, 
+                                          Double_t max)
+{
+  fVertexAxis.Set(nBins, min, max);
+}
+//____________________________________________________________________
+inline void 
+AliCentralCorrSecondaryMap::SetVertexAxis(const TAxis& e)
+{
+  fVertexAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
+}
+#endif
+// Local Variables:
+//  mode: C++
+// End:
diff --git a/PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.cxx b/PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.cxx
new file mode 100644 (file)
index 0000000..a45a784
--- /dev/null
@@ -0,0 +1,210 @@
+//====================================================================
+// 
+// Base class for classes that calculate the multiplicity in the
+// central region event-by-event
+// 
+// Inputs: 
+//   - AliESDEvent 
+//
+// Outputs: 
+//   - AliAODCentralMult 
+// 
+// Histograms 
+//   
+// Corrections used 
+#include "AliCentralMultiplicityTask.h"
+#include "AliForwardCorrectionManager.h"
+#include "AliForwardUtil.h"
+#include "AliLog.h"
+#include "AliAODHandler.h"
+#include "AliInputEventHandler.h"
+#include "AliESDInputHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliMultiplicity.h"
+#include <TROOT.h>
+#include <TFile.h>
+#include <iostream>
+#include <iomanip>
+
+//====================================================================
+AliCentralMultiplicityTask::AliCentralMultiplicityTask(const char* name) 
+  : AliAnalysisTaskSE(name),
+    fData(0),
+    fList(0),
+    fAODCentral(kFALSE),
+    fManager()
+{
+  
+  DefineOutput(1, TList::Class());
+}
+//____________________________________________________________________
+void AliCentralMultiplicityTask::UserCreateOutputObjects() {
+
+  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
+  AliAODHandler*      ah = 
+    dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
+  if (!ah) AliFatal("No AOD output handler set in analysis manager");
+  
+  
+  TObject* obj = &fAODCentral;
+  ah->AddBranch("AliAODCentralMult", &obj);
+  
+  fList = new TList();
+  PostData(1,fList);
+  
+}
+//____________________________________________________________________
+void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/) {
+  
+  AliESDInputHandler* eventHandler = 
+    dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()
+                                      ->GetInputEventHandler());
+  if (!eventHandler) {
+    AliWarning("No inputhandler found for this event!");
+    return;}
+  
+  AliESDEvent* esd = eventHandler->GetEvent();
+  
+  //Selecting only events with |valid vertex| < 10 cm
+  const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
+  if (!vertex) return;
+  if(!(vertex->GetStatus())) return;
+  if(vertex->GetNContributors() <= 0) return ;
+  if(vertex->GetZRes() > 0.1 ) return;
+  Double_t vertexXYZ[3]={0,0,0};
+  vertex->GetXYZ(vertexXYZ);
+  if(TMath::Abs(vertexXYZ[2]) > 10) return;
+  
+  Double_t delta = 2 ;
+  Double_t vertexBinDouble = (vertexXYZ[2] + 10) / delta;
+  Int_t vtxbin = (Int_t)vertexBinDouble +1 ; //HHD: The vtxbins are 1-10, not 0-9
+  
+  // Make sure AOD is filled
+  AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
+  AliAODHandler*      ah = 
+    dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler());
+  if (!ah)  
+    AliFatal("No AOD output handler set in analysis manager");
+  
+  ah->SetFillAOD(kTRUE);
+  
+  //Doing analysis
+  fAODCentral.Clear("");
+  TH2D *aodHist = &(fAODCentral.GetHistogram());
+  
+  const AliMultiplicity* spdmult = esd->GetMultiplicity();
+  //Filling clusters in layer 1 used for tracklets...
+  for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++) {
+    aodHist->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
+  }
+  //...and then the unused ones in layer 1 
+  for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++) {
+    aodHist->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),
+                  spdmult->GetPhiSingle(j));
+  }
+  
+  // Corrections
+  
+  TH2D* hSecMap     = fManager.GetSecMapCorrection(vtxbin);
+  TH1D* hAcceptance = fManager.GetAcceptanceCorrection(vtxbin);
+  
+  aodHist->Divide(hSecMap);
+  
+  for(Int_t nx = 1; nx <= aodHist->GetNbinsX(); nx++) {
+    Float_t acccor = hAcceptance->GetBinContent(nx);
+    
+    Bool_t etabinSeen = kFALSE;  
+    for(Int_t ny = 1; ny <= aodHist->GetNbinsY(); ny++) {
+      Float_t aodvalue = aodHist->GetBinContent(nx,ny);
+      Float_t seccor = hSecMap->GetBinContent(nx,ny);
+      if(seccor > 0.5) etabinSeen = kTRUE;
+      if(aodvalue < 0.000001) { aodHist->SetBinContent(nx,ny, 0); continue; }
+      
+      Float_t aodnew   = aodvalue / acccor ;
+      aodHist->SetBinContent(nx,ny, aodnew);
+      Float_t error = aodnew*TMath::Sqrt(TMath::Power(aodHist->GetBinError(nx,ny)/aodvalue,2) +
+                                        TMath::Power(hAcceptance->GetBinError(nx)/acccor,2) );
+      aodHist->SetBinError(nx,ny,error);
+      
+    }
+    //Filling underflow bin if we eta bin is in range
+    if(etabinSeen) aodHist->SetBinContent(nx,0, 1.);
+    
+  }  
+
+  PostData(1,fList);
+  
+}
+//____________________________________________________________________
+void AliCentralMultiplicityTask::Terminate(Option_t* /*option*/) {
+
+
+
+}
+//____________________________________________________________________
+void
+AliCentralMultiplicityTask::Print(Option_t* /*option*/) const
+{
+   
+}
+//____________________________________________________________________
+AliCentralMultiplicityTask::Manager::Manager() :
+  fAcceptancePath("$ALICE_ROOT/PWG2/FORWARD/corrections/CentralAcceptance"),
+  fSecMapPath("$ALICE_ROOT/PWG2/FORWARD/corrections/CentralSecMap"),
+  fAcceptance(),
+  fSecmap(),
+  fAcceptanceName("centralacceptance"),
+  fSecMapName("centralsecmap")
+{
+
+
+}
+//____________________________________________________________________
+const char* AliCentralMultiplicityTask::Manager::GetFileName(UShort_t  what ,
+                                                            UShort_t  sys, 
+                                                            UShort_t  sNN,
+                                                            Short_t   field) {
+  
+  TString fname = "";
+  
+  switch(what) {
+  case 0:
+    fname.Append(fSecMapName.Data());
+    break;
+  case 1: 
+    fname.Append(fAcceptanceName.Data());
+    break;
+  default:
+    printf("Invalid indentifier for central object, must be 0 or 1!");
+    break;
+  }
+  fname.Append(Form("_%s_%04dGeV_%c%1dkG.root", 
+                   AliForwardUtil::CollisionSystemString(sys), 
+                   sNN, (field < 0 ? 'm' : 'p'), TMath::Abs(field)));
+  
+  return fname.Data();
+  
+}
+//____________________________________________________________________
+void AliCentralMultiplicityTask::Manager::Init( UShort_t  sys, 
+                                               UShort_t  sNN,
+                                               Short_t   field) {
+  
+  TFile fsec(GetFullFileName(0,sys,sNN,field));
+  fSecmap = dynamic_cast<AliCentralCorrSecondaryMap*>(fsec.Get(fSecMapName.Data()));  
+  if(!fSecmap) {
+    printf("no central Secondary Map found!") ;
+    return;
+  }
+  TFile facc(GetFullFileName(1,sys,sNN,field));
+  fAcceptance = dynamic_cast<AliCentralCorrAcceptance*>(facc.Get(fAcceptanceName.Data()));
+if(!fAcceptance) {
+  printf("no central Acceptance found!") ;
+  return;
+ }
+
+}
+//
+// EOF
+//
diff --git a/PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.h b/PWG2/FORWARD/analysis2/AliCentralMultiplicityTask.h
new file mode 100644 (file)
index 0000000..3765472
--- /dev/null
@@ -0,0 +1,257 @@
+// 
+// Base class for classes that calculate the multiplicity in the
+// SPD clusters event-by-event
+// 
+#ifndef ALICENTRALMULTIPLICITYTASK_H
+#define ALICENTRALMULTIPLICITYTASK_H
+#include <AliAnalysisTaskSE.h>
+#include "AliForwardUtil.h"
+#include "AliAODCentralMult.h"
+#include "AliCentralCorrAcceptance.h"
+#include "AliCentralCorrSecondaryMap.h"
+//class AliForwardCorrectionManager;
+class AliESDEvent;
+class TH2D;
+class TList;
+class TTree;
+
+
+/** 
+ * @mainpage ALICE PWG2 Forward Multiplcity Analysis 
+ */
+/** 
+ * @defgroup pwg2_forward PWG2 Forward analysis
+ *
+ * Code to do the multiplicity analysis in the central pseudo-rapidity
+ * regions
+ *
+ */
+/** 
+ * @defgroup pwg2_forward_tasks Tasks
+ *
+ * Code to do the multiplicity analysis in the central pseudo-rapidity
+ * regions
+ *
+ * @ingroup pwg2_forward 
+ */
+/** 
+ * Class that calculates the multiplicity in the
+ * central region event-by-event
+ * 
+ * @par Inputs: 
+ *   - AliESDEvent 
+ *
+ * @par Outputs: 
+ *   - AliAODCentralMult 
+ * 
+ * @par Histograms 
+ *   
+ * @par Corrections used 
+ * 
+ * @ingroup pwg2_forward_tasks
+ * 
+ */
+class AliCentralMultiplicityTask : public AliAnalysisTaskSE
+{
+public:
+  /** 
+   * @{ 
+   * @name Interface methods 
+   */
+   /** 
+   * Constructor 
+   * 
+   * @param name Name of task 
+   */
+  AliCentralMultiplicityTask(const char* name); 
+  /** 
+   * Constructor
+   */
+  AliCentralMultiplicityTask() 
+    : AliAnalysisTaskSE(),
+      fData(0),
+      fList(0),
+      fAODCentral(),
+      fManager()
+  {
+    DefineOutput(1, TList::Class());
+  }
+  /** 
+   * Copy constructor 
+   * 
+   * @param o Object to copy from 
+   */
+  AliCentralMultiplicityTask(const AliCentralMultiplicityTask& o)
+    : AliAnalysisTaskSE(o),
+      fData(o.fData),
+      fList(o.fList),
+      fAODCentral(o.fAODCentral),
+      fManager(o.fManager)
+  {
+    DefineOutput(1, TList::Class());
+  }
+  /** 
+   * Assignment operator 
+   * 
+   * @param o Object to assign from 
+   * 
+   * @return Reference to this object 
+   */
+  AliCentralMultiplicityTask& operator=(const AliCentralMultiplicityTask& o)
+  {
+    fData       = o.fData;
+    fList       = o.fList;
+    fAODCentral = o.fAODCentral;
+    fManager    = o.fManager;
+    
+    
+    DefineOutput(1, TList::Class());
+    
+    return *this;
+  }
+  /** 
+   * Create output objects 
+   * 
+   */
+  virtual void UserCreateOutputObjects();
+  /** 
+   * Process each event 
+   *
+   * @param option Not used
+   */  
+  virtual void UserExec(Option_t* option);
+  /** 
+   * End of job
+   * 
+   * @param option Not used 
+   */
+  virtual void Terminate(Option_t* option);
+  /** 
+   * @} 
+   */
+  /** 
+   * Init the task and the manager  
+   * 
+   * @param option Not used
+   */
+  void InitManager(UShort_t sys, 
+                  UShort_t  sNN,
+                  Short_t   field) {fManager.Init(sys, sNN, field);}
+  /** 
+   * @} 
+   */
+  /** 
+   * Print information 
+   * 
+   * @param option Not used
+   */
+  virtual void Print(Option_t* option="") const;
+  /** 
+   * Set Path for acceptance 
+   * 
+   * @param path
+   */
+  void          SetAcceptancePath(const char* path) {fManager.SetAcceptancePath(path); }
+  /** 
+   * Set Path for Secondary Map 
+   * 
+   * @param path
+   */
+  
+  void          SetSecMapPath(const char* path) {fManager.SetSecMapPath(path); }
+  
+  char*         GetFullFileName(UShort_t  what ,
+                               UShort_t  sys, 
+                               UShort_t  sNN,
+                               Short_t   field) {return fManager.GetFullFileName(what ,sys, sNN, field); }
+  
+  const char*   GetAcceptanceName() {return fManager.GetAcceptanceName(); }
+  const char*   GetSecMapName() {return fManager.GetSecMapName(); }
+  
+  
+  class Manager {
+    
+    // This is a small class to fetch corrections for secondaries and dead
+    // channels.
+    
+  public:
+    Manager();
+    Manager(const Manager& o) :
+      fAcceptancePath(o.fAcceptancePath),
+      fSecMapPath(o.fSecMapPath),
+      fAcceptance(o.fAcceptance),
+      fSecmap(o.fSecmap),
+      fAcceptanceName(o.fAcceptanceName),
+      fSecMapName(o.fSecMapName) {}
+    
+  /** 
+   * Assignment operator 
+   * 
+   * @param o Object to assign from 
+   * 
+   * @return Reference to this object 
+   */
+  Manager& operator=(const Manager& o)
+  {
+    fAcceptancePath = o.fAcceptancePath;
+    fSecMapPath     = o.fSecMapPath;
+    fAcceptance     = o.fAcceptance;
+    fSecmap         = o.fSecmap;
+    fAcceptanceName = o.fAcceptanceName;
+    fSecMapName     = o.fSecMapName;
+    return *this;
+  }
+
+    void          Init(UShort_t  sys, 
+                      UShort_t  sNN,
+                      Short_t   field);
+    const char*   GetAcceptancePath() {return fAcceptancePath.Data(); }
+    const char*   GetSecMapPath() {return fSecMapPath.Data(); }
+    void          SetAcceptancePath(const char* path) {fAcceptancePath=path; }
+    void          SetSecMapPath(const char* path) {fSecMapPath=path; }
+    char*         GetFullFileName(UShort_t  what ,
+                                 UShort_t  sys, 
+                                 UShort_t  sNN,
+                                 Short_t   field) {return Form("%s/%s",
+what == 0 ? GetSecMapPath() : GetAcceptancePath(), GetFileName(what, sys, sNN, field));}
+    const char*   GetAcceptanceName() {return fAcceptanceName.Data(); }
+    const char*   GetSecMapName() {return fSecMapName.Data(); }
+    
+    TH2D* GetSecMapCorrection(UShort_t vtxbin) {return fSecmap->GetCorrection(vtxbin);}
+    TH1D* GetAcceptanceCorrection(UShort_t vtxbin) {return fAcceptance->GetCorrection(vtxbin);}
+    
+  private:
+    
+    
+    const char*   GetFileName(UShort_t  what ,
+                             UShort_t  sys, 
+                             UShort_t  sNN,
+                             Short_t   field);
+    
+    
+    TString fAcceptancePath;
+    TString fSecMapPath;
+    AliCentralCorrAcceptance* fAcceptance;
+    AliCentralCorrSecondaryMap*     fSecmap;
+    TString fAcceptanceName;
+    TString fSecMapName;
+
+  };
+
+protected: 
+private:
+  
+  TH2D*                  fData;          //sum histogram if needed
+  TList*                 fList;          //Output List for diagnostics
+  AliAODCentralMult      fAODCentral;    // Output object
+  Manager                fManager;       //Manager object for corrections
+  ClassDef(AliCentralMultiplicityTask,1) // Forward multiplicity class
+};
+
+#endif
+// Local Variables:
+//  mode: C++
+// End:
+
diff --git a/PWG2/FORWARD/analysis2/scripts/RunCopyCentralSecMap.C b/PWG2/FORWARD/analysis2/scripts/RunCopyCentralSecMap.C
new file mode 100644 (file)
index 0000000..ce47a0e
--- /dev/null
@@ -0,0 +1,140 @@
+Color_t Color(UShort_t d, Char_t r ) const 
+{ 
+  return ((d == 1 ? kRed : (d == 2 ? kGreen : kBlue))
+         + ((r == 'I' || r == 'i') ? 2 : -2));
+}
+
+/*void
+RunCopyCentralSecMap(UShort_t sys, UShort_t cms, Short_t field, const Char_t* path=0)
+{
+  RunCopyCentralSecMap(sys == 1 ? "pp" : "PbPb", 
+               cms, 
+               field, 
+               path);
+               }*/
+/** 
+ * 
+ * @param sys       Collision system 
+ * @param cms       Center of mass energy per nucleon in GeV
+ * @param field     Magnetic field 
+ * 
+ * @ingroup pwg2_forward_analysis_scripts
+ */
+//void
+//RunCopyCentralSecMap(const char* sys, UShort_t cms, Short_t field,
+                    //       const Char_t* path=0)
+void
+RunCopyCentralSecMap(UShort_t sys, UShort_t cms, Short_t field, const Char_t* path=0)
+{
+  gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
+  gSystem->Load("libPWG2forward.so");
+
+  AliFMDAnaParameters* p = AliFMDAnaParameters::Instance();
+  p->SetEnergy(Float_t(cms));
+  p->SetMagField(Float_t(field));
+  p->SetCollisionSystem(sys);
+  if (path) {
+    p->SetBackgroundPath(path);
+    p->SetEnergyPath(path);
+    p->SetEventSelectionPath(path);
+    p->SetSharingEfficiencyPath(path);
+  }
+  p->Init(true, AliFMDAnaParameters::kBackgroundCorrection);
+  
+  Int_t    nVtx   = p->GetNvtxBins();
+  Double_t minVtx = -p->GetVtxCutZ();
+  Double_t maxVtx = p->GetVtxCutZ();
+  Int_t    nEta   = p->GetNetaBins();
+  Double_t minEta = p->GetEtaMin();
+  Double_t maxEta = p->GetEtaMax();
+
+  TAxis vtxAxis(nVtx, minVtx, maxVtx);
+  AliCentralCorrSecondaryMap* m = new AliCentralCorrSecondaryMap;
+  m->SetVertexAxis(nVtx, minVtx, maxVtx);
+  
+  AliCentralCorrAcceptance* a = new AliCentralCorrAcceptance;
+  a->SetVertexAxis(nVtx, minVtx, maxVtx);
+  
+  
+  //m->SetEtaAxis(nEta,minEta,maxEta);
+  //AliFMDCorrDoubleHit* dh = new AliFMDCorrDoubleHit;
+
+  
+
+  for (UShort_t b = 1; b <= nVtx; b++) { 
+    TH2F* oldmap = p->GetBackgroundCorrection(0, 'Q', b-1);
+    if (!oldmap) {
+      Warning("RunCopySecMap",
+             "Didn't find secondary map correction "
+             "for SPD, vertex bin %3d", b);
+      continue;
+    }
+    
+       TH2D* newmap = new TH2D(Form("SPD_vtxbin%03d",  b), 
+                               Form("Secondary map correction for SPD "
+                                    "in vertex bin %d [%+8.4f,%+8.4f]", 
+                                    b, vtxAxis.GetBinLowEdge(b), 
+                                    vtxAxis.GetBinUpEdge(b)), 
+                               nEta, minEta, maxEta, 
+                               oldmap->GetYaxis()->GetNbins(), 
+                               oldmap->GetYaxis()->GetXmin(), 
+                               oldmap->GetYaxis()->GetXmax());
+       newmap->SetXTitle("#eta");
+       newmap->SetYTitle("#phi [radians]");
+       newmap->SetZTitle("#sum_{i} N_{ch,i,primary} / #sum_{i} N_{ch,i,FMD}");
+       newmap->SetDirectory(0);
+       newmap->SetStats(0);
+       newmap->Sumw2();
+       newmap->Add(oldmap);
+       
+       Info("RunCopySecMap",
+            "Copying %s to %s", oldmap->GetName(), newmap->GetName());
+       
+       m->SetCorrection(b, newmap);
+       std::cout<<m->GetCorrection(b)<<std::endl;
+       
+       //Acceptance 
+       TH1F* oldacc = p->GetSPDDeadCorrection(b-1);
+       if (!oldacc) {
+         Warning("RunCopySecMap",
+                 "Didn't find acceptance correction "
+                 "for SPD, vertex bin %3d", b);
+         continue;
+       }
+       
+       TH1D* newacc = new TH1D(Form("SPDdead_vtxbin%03d",  b), 
+                               Form("Acceptance correction for SPD "
+                                    "in vertex bin %d [%+8.4f,%+8.4f]", 
+                                    b, vtxAxis.GetBinLowEdge(b), 
+                                    vtxAxis.GetBinUpEdge(b)), 
+                               nEta, minEta, maxEta);
+       newacc->SetXTitle("#eta");
+       newacc->SetYTitle("correction");
+       //newacc->SetZTitle("#sum_{i} N_{ch,i,primary} / #sum_{i} N_{ch,i,FMD}");
+       newacc->SetDirectory(0);
+       newacc->SetStats(0);
+       newacc->Sumw2();
+       newacc->Add(oldacc);
+       
+       Info("RunCopySecMap",
+            "Copying %s to %s", oldacc->GetName(), newacc->GetName());
+       
+       a->SetCorrection(b, newacc);
+       std::cout<<a->GetCorrection(b)<<std::endl;
+       
+
+  }
+  
+  AliCentralMultiplicityTask* task = new AliCentralMultiplicityTask("central");
+
+  TFile f(task->GetFullFileName(0.,sys+1,cms,field), "RECREATE");
+  m->Write(task->GetSecMapName());
+  f.Close();
+  TFile f2(task->GetFullFileName(1.,sys+1,cms,field), "RECREATE");
+  a->Write(task->GetAcceptanceName());
+  f2.Close();
+
+}
+//
+// EOF
+//
diff --git a/PWG2/FORWARD/corrections/CentralAcceptance/centralacceptance_pp_0900GeV_p5kG.root b/PWG2/FORWARD/corrections/CentralAcceptance/centralacceptance_pp_0900GeV_p5kG.root
new file mode 100644 (file)
index 0000000..457ca55
Binary files /dev/null and b/PWG2/FORWARD/corrections/CentralAcceptance/centralacceptance_pp_0900GeV_p5kG.root differ
diff --git a/PWG2/FORWARD/corrections/CentralSecMap/centralsecmap_pp_0900GeV_p5kG.root b/PWG2/FORWARD/corrections/CentralSecMap/centralsecmap_pp_0900GeV_p5kG.root
new file mode 100644 (file)
index 0000000..c932f45
Binary files /dev/null and b/PWG2/FORWARD/corrections/CentralSecMap/centralsecmap_pp_0900GeV_p5kG.root differ