Moved calculations of flow weights (after burner) into a
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 May 2012 11:26:30 +0000 (11:26 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 May 2012 11:26:30 +0000 (11:26 +0000)
separate class (AliForwardFlowWeights), since the code
was common to AliBaseMCTrackDensity and AliForwardMCFlowTask.

PWGLF/CMakelibPWGLFforward2.pkg
PWGLF/FORWARD/analysis2/AliBaseMCTrackDensity.cxx
PWGLF/FORWARD/analysis2/AliBaseMCTrackDensity.h
PWGLF/FORWARD/analysis2/AliForwardFlowWeights.cxx [new file with mode: 0644]
PWGLF/FORWARD/analysis2/AliForwardFlowWeights.h [new file with mode: 0644]
PWGLF/FORWARD/analysis2/AliForwardMCFlowTaskQC.cxx
PWGLF/FORWARD/analysis2/AliForwardMCFlowTaskQC.h
PWGLF/PWGLFforward2LinkDef.h

index 45c7d72..599d1b9 100644 (file)
@@ -64,6 +64,7 @@ set ( SRCS
   FORWARD/analysis2/AliForwardCorrectionManager.cxx
   FORWARD/analysis2/AliForwarddNdetaTask.cxx
   FORWARD/analysis2/AliForwardFlowTaskQC.cxx
+  FORWARD/analysis2/AliForwardFlowWeights.cxx
   FORWARD/analysis2/AliForwardMCCorrectionsTask.cxx
   FORWARD/analysis2/AliForwardMCFlowTaskQC.cxx
   FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx 
@@ -121,7 +122,8 @@ add_custom_target( PWGLFforward-doxy DEPENDS FORWARD/doc/html/index.html )
 add_custom_target( install-PWGLFforward2.par 
   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/${PACKAGE}.par ${CMAKE_INSTALL_PREFIX}
   COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green --bold "${PACKAGE}.par installed in ${CMAKE_INSTALL_PREFIX}"
-  DEPENDS ${CMAKE_BINARY_DIR}/${PACKAGE}.par)
+  DEPENDS ${CMAKE_BINARY_DIR}/${PACKAGE}.par
+  DEPENDS test-${PACKAGE}.par)
 
 # --------------------------------------------------------------------
 # Extra installation targets 
index 42cf1ad..f693a80 100644 (file)
@@ -24,10 +24,7 @@ AliBaseMCTrackDensity::AliBaseMCTrackDensity()
     fEtaBinFlow(0),
     fPhiBinFlow(0),
     fNRefs(0),
-    fV2Eta(0), 
-    fV22Pt(0), 
-    fV24Pt(0), 
-    fV2B(0),
+    fWeights(),
     fVz(0), 
     fB(0),
     fPhiR(0),
@@ -46,10 +43,7 @@ AliBaseMCTrackDensity::AliBaseMCTrackDensity(const char* name)
     fEtaBinFlow(0),
     fPhiBinFlow(0),
     fNRefs(0),
-    fV2Eta(0), 
-    fV22Pt(0), 
-    fV24Pt(0), 
-    fV2B(0), 
+    fWeights(),
     fVz(0), 
     fB(0),
     fPhiR(0),
@@ -68,10 +62,7 @@ AliBaseMCTrackDensity::AliBaseMCTrackDensity(const AliBaseMCTrackDensity& o)
     fEtaBinFlow(o.fEtaBinFlow),
     fPhiBinFlow(o.fPhiBinFlow),
     fNRefs(o.fNRefs),
-    fV2Eta(o.fV2Eta), 
-    fV22Pt(o.fV22Pt), 
-    fV24Pt(o.fV24Pt), 
-    fV2B(o.fV2B), 
+    fWeights(o.fWeights),
     fVz(o.fVz), 
     fB(o.fB),
     fPhiR(o.fPhiR),
@@ -96,10 +87,7 @@ AliBaseMCTrackDensity::operator=(const AliBaseMCTrackDensity& o)
   fNRefs                = o.fNRefs;
   fDebug                = o.fDebug;
   fUseFlowWeights       = o.fUseFlowWeights;
-  fV2Eta                = o.fV2Eta;
-  fV22Pt                = o.fV22Pt;
-  fV24Pt                = o.fV24Pt;
-  fV2B                  = o.fV2B;
+  fWeights              = o.fWeights;
   fVz                   = o.fVz;
   fB                    = o.fB;
   fPhiR                 = o.fPhiR;
@@ -146,67 +134,8 @@ AliBaseMCTrackDensity::DefineOutput(TList* l)
   fNRefs->SetFillStyle(3001);
   fNRefs->SetDirectory(0);
   ll->Add(fNRefs);
-
-  SetupWeights(ll);
-}
-
-//____________________________________________________________________
-void 
-AliBaseMCTrackDensity::SetupWeights(TList* l)
-{
-  DGUARD(fDebug,2,"MC track setup phi weights");
-  fV2Eta = new TF1("v2eta", "gaus", -6, 6);
-  fV2Eta->SetParameters(20 * 0.1, 0, 9);
-  l->Add(fV2Eta);
-
-  Int_t          ptN     = 19;
-  const Double_t ptX[]   = {0.00,     0.25,     0.350,    0.45, 
-                           0.55,     0.650,    0.75,     0.85, 
-                           0.950,    1.10,     1.30,     1.500,
-                           1.70,     1.90,     2.250,    2.75, 
-                           3.25,     3.750,    4.50};
-  { 
-    // v2{2} dependence on pt
-    const Double_t y[] = {0.00000,  0.043400, 0.059911, 0.073516,
-                         0.089756, 0.105486, 0.117391, 0.128199,
-                         0.138013, 0.158271, 0.177726, 0.196383,
-                         0.208277, 0.216648, 0.242954, 0.249961,
-                         0.240131, 0.269006, 0.207796};
-    
-    fV22Pt = new TGraph(ptN, ptX, y);
-    fV22Pt->SetName("v2_2_vs_pt");
-    fV22Pt->SetMarkerStyle(20);
-    fV22Pt->SetMarkerColor(kRed+1);
-    l->Add(fV22Pt);
-  }
-
-  {
-    const Double_t y[] = {0.000000, 0.038646, 0.049824, 0.066662,
-                         0.075856, 0.081583, 0.099778, 0.104674,
-                         0.118545, 0.131874, 0.152959, 0.155348,
-                         0.169751, 0.179052, 0.178532, 0.198851,
-                         0.185737, 0.239901, 0.186098};
-
-    // v2{4} dependence on pt 
-    fV24Pt = new TGraph(ptN, ptX, y);
-    fV24Pt->SetName("v2_4_vs_pt");
-    fV24Pt->SetMarkerStyle(20);
-    fV24Pt->SetMarkerColor(kBlue+1);
-    l->Add(fV24Pt);
-  }
-  {
-    // V2 dependence on centrality
-    Int_t n            = 8;
-    const Double_t x[] = {1.75,     4.225,    5.965,    7.765,
-                         9.215,    10.46,    11.565,   12.575};
-    const Double_t y[] = {0.017855, 0.032440, 0.055818, 0.073137,
-                         0.083898, 0.086690, 0.082040, 0.077777};
-    fV2B = new TGraph(n, x, y);
-    fV2B->SetName("v2_vs_b");
-    fV2B->SetMarkerStyle(20);
-    fV2B->SetMarkerColor(kGreen+1);
-    l->Add(fV2B);
-  }
+  
+  fWeights.Init(ll);
 }
 
 
@@ -402,16 +331,7 @@ Double_t
 AliBaseMCTrackDensity::CalculateWeight(Double_t eta, Double_t pt, 
                                       Double_t phi, Int_t id) const
 {
-  Double_t w = (fV2Eta->Eval(eta) * 0.5 * (fV22Pt->Eval(pt) + fV24Pt->Eval(pt)) 
-               * fV2B->Eval(fB) / fV2B->Eval(10.46) 
-               * 2 * TMath::Cos(2* (phi - fPhiR)));
-  UInt_t aid = TMath::Abs(id);
-  switch (aid) { 
-  case 211:  w *= 1.3; break; // pions 
-  case 2212: w *= 1.0; break; // protons 
-  default:   w *= 0.7; break;
-  }
-  return w;
+  return fWeights.CalcWeight(eta, pt, phi, id, fPhiR, fB);
 }
 //____________________________________________________________________
 void
index 376fd7f..086beb2 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef ALIBaseMCTRACKDENSITY_MC
 #define ALIBaseMCTRACKDENSITY_MC
 #include <TNamed.h>
+#include "AliForwardFlowWeights.h"
 class TList;
 class TH1D;
 class TH2D;
@@ -95,7 +96,6 @@ public:
    */
   virtual void Print(Option_t* option="") const;
 protected:
-  virtual void SetupWeights(TList* l);
   /** 
    * Loops over all the particles in the passed event.  If @a primary
    * is not null, then that histogram is filled with the primary
@@ -218,16 +218,13 @@ protected:
   TH2D*    fEtaBinFlow;           // dEta vs eta of strip
   TH2D*    fPhiBinFlow;           // dPhi vs phi of strip
   TH1D*    fNRefs;                // Number of track-references per track
-  TF1*     fV2Eta;                // Eta flow weight 
-  TGraph*  fV22Pt;                // Pt flow weight (v2{2})
-  TGraph*  fV24Pt;                // Pt flow weight (v2{4})
-  TGraph*  fV2B;                  // Impact paramter flow weight
+  AliForwardFlowWeights fWeights; // Flow weights
   Double_t fVz;                   // IP z-coordinate of this event
   Double_t fB;                    // Impact parameter of this event
   Double_t fPhiR;                 // Reaction plane  of this event
   Bool_t   fDebug;                // Debug flag
 
-  ClassDef(AliBaseMCTrackDensity,1); // Calculate track-ref density
+  ClassDef(AliBaseMCTrackDensity,2); // Calculate track-ref density
 };
 
 #endif
diff --git a/PWGLF/FORWARD/analysis2/AliForwardFlowWeights.cxx b/PWGLF/FORWARD/analysis2/AliForwardFlowWeights.cxx
new file mode 100644 (file)
index 0000000..44e8b34
--- /dev/null
@@ -0,0 +1,255 @@
+#include "AliForwardFlowWeights.h"
+#include <TGraph.h>
+#include <TF1.h>
+#include <TList.h>
+#include <TMath.h>
+
+//____________________________________________________________________
+AliForwardFlowWeights::AliForwardFlowWeights()
+  : fV22Pt(0), 
+    fV24Pt(0), 
+    fV24AltPt(0),
+    fV2B(0), 
+    fV2C(0)
+{}
+
+//____________________________________________________________________
+AliForwardFlowWeights::AliForwardFlowWeights(const AliForwardFlowWeights& o)
+  : TObject(o),
+    fV22Pt(o.fV22Pt),
+    fV24Pt(o.fV24Pt),
+    fV24AltPt(o.fV24AltPt),
+    fV2B(o.fV2B), 
+    fV2C(o.fV2C)
+{}
+
+//____________________________________________________________________
+AliForwardFlowWeights&
+AliForwardFlowWeights::operator=(const AliForwardFlowWeights& o)
+{
+  if (&o == this) return *this;
+
+  fV22Pt    = (o.fV22Pt ?    static_cast<TGraph*>(o.fV22Pt->Clone())    : 0);
+  fV24Pt    = (o.fV24Pt ?    static_cast<TGraph*>(o.fV24Pt->Clone())    : 0);
+  fV24AltPt = (o.fV24AltPt ? static_cast<TGraph*>(o.fV24AltPt->Clone()) : 0);
+  fV2B      = (o.fV2B   ?    static_cast<TGraph*>(o.fV2B->Clone())      : 0);
+  fV2C      = (o.fV2C   ?    static_cast<TGraph*>(o.fV2C->Clone())      : 0);
+
+  return *this;
+}
+
+namespace {
+  const char* fgkPt2Name = "v22VsPt";
+  const char* fgkPt4Name = "v24VsPt";
+  const char* fgkPt4Alt  = "v24AltVsPt";
+  const char* fgkBName   = "v2VsB";
+  const char* fgkCName   = "v2VsC";
+}
+
+//____________________________________________________________________
+void
+AliForwardFlowWeights::Init(TList* l)
+{
+  Int_t          ptN     = 19;
+  const Double_t ptX[]   = {0.00,     0.25,     0.350,    0.45, 
+                           0.55,     0.650,    0.75,     0.85, 
+                           0.950,    1.10,     1.30,     1.500,
+                           1.70,     1.90,     2.250,    2.75, 
+                           3.25,     3.750,    4.50};
+  { 
+    // v2{2} dependence on pt
+    const Double_t y[] = {0.00000,  0.043400, 0.059911, 0.073516,
+                         0.089756, 0.105486, 0.117391, 0.128199,
+                         0.138013, 0.158271, 0.177726, 0.196383,
+                         0.208277, 0.216648, 0.242954, 0.249961,
+                         0.240131, 0.269006, 0.207796};
+    
+    fV22Pt = new TGraph(ptN, ptX, y);
+    fV22Pt->SetName(fgkPt2Name);
+    fV22Pt->SetMarkerStyle(20);
+    fV22Pt->SetMarkerColor(kRed+1);
+    l->Add(fV22Pt);
+  }
+
+  {
+    const Double_t y[] = {0.000000, 0.038646, 0.049824, 0.066662,
+                         0.075856, 0.081583, 0.099778, 0.104674,
+                         0.118545, 0.131874, 0.152959, 0.155348,
+                         0.169751, 0.179052, 0.178532, 0.198851,
+                         0.185737, 0.239901, 0.186098};
+
+    // v2{4} dependence on pt 
+    fV24Pt = new TGraph(ptN, ptX, y);
+    fV24Pt->SetName(fgkPt4Name);
+    fV24Pt->SetMarkerStyle(20);
+    fV24Pt->SetMarkerColor(kBlue+1);
+    l->Add(fV24Pt);
+  }
+
+  {
+    const Double_t y[] = {0.000000, 0.037071, 0.048566, 0.061083,
+                         0.070910, 0.078831, 0.091396, 0.102026,
+                         0.109691, 0.124449, 0.139819, 0.155561,
+                         0.165701, 0.173678, 0.191149, 0.202015,
+                         0.204540, 0.212560, 0.195885};
+    // v2{4} dependence on pt (30-40%)
+    fV24AltPt = new TGraph(ptN, ptX, y);
+    fV24AltPt->SetName(fgkPt4Alt);
+    fV24AltPt->SetMarkerStyle(20);
+    fV24AltPt->SetMarkerColor(kBlue+1);
+    l->Add(fV24AltPt);
+  }
+  Int_t nb            = 8;
+  const Double_t by[] = {0.017855, 0.032440, 0.055818, 0.073137,
+                        0.083898, 0.086690, 0.082040, 0.077777};
+  {
+    // V2 dependence on impact parameter
+    const Double_t x[] = {1.75,     4.225,    5.965,    7.765,
+                         9.215,    10.46,    11.565,   12.575};
+    fV2B = new TGraph(nb, x, by);
+    fV2B->SetName(fgkBName);
+    fV2B->SetMarkerStyle(20);
+    fV2B->SetMarkerColor(kGreen+1);
+    l->Add(fV2B);
+  }
+  {
+    // V2 dependence on impact parameter
+    const Double_t x[] = { 2.5, 7.5, 15, 25, 35, 45, 55, 65};
+    fV2C = new TGraph(nb, x, by);
+    fV2C->SetName(fgkCName);
+    fV2C->SetMarkerStyle(20);
+    fV2C->SetMarkerColor(kGreen+1);
+    l->Add(fV2C);
+  }
+}
+
+//____________________________________________________________________
+Double_t
+AliForwardFlowWeights::CalcEtaWeight(Double_t eta, Int_t type) const
+{
+  if (type == 0) return 1;
+  return 0.1 * TMath::Gaus(eta, 0, (type == 2 ? 3. : 
+                                   type == 3 ? 15 : 9));
+}
+//____________________________________________________________________
+Double_t
+AliForwardFlowWeights::CalcPidWeight(Int_t id, Int_t type) const
+{
+  if (type == 0) return 1;
+  if (type == 2) return 1.207;
+  switch (TMath::Abs(id)) {
+  case 211:  return 1.3; break; // pions 
+  case 2212: return 1.0; break; // protons 
+  default:   return 0.7; break;
+  }
+  return 1;
+}
+//____________________________________________________________________
+Double_t
+AliForwardFlowWeights::CalcPtWeight(Double_t pt, Int_t type) const
+{
+  switch (type) { 
+  case 0: return 1;
+  case 2: return fV22Pt->Eval(pt);
+  case 3: return fV24AltPt->Eval(pt); // From 30-40
+  case 4: return fV24Pt->Eval(pt);
+  }
+  return 0.5 * (fV22Pt->Eval(pt) + fV24Pt->Eval(pt));
+}
+
+//____________________________________________________________________
+Double_t
+AliForwardFlowWeights::CalcBWeight(Double_t b) const
+{
+  return fV2B->Eval(b) / fV2B->Eval(10.46);
+}
+
+//____________________________________________________________________
+Double_t
+AliForwardFlowWeights::CalcCentWeight(Double_t c) const
+{
+  return fV2C->Eval(c) / fV2C->Eval(45);
+}
+
+//____________________________________________________________________
+Double_t
+AliForwardFlowWeights::CalcWeight(Double_t eta, 
+                                 Double_t pt, 
+                                 Double_t phi,  
+                                 Int_t    id, 
+                                 Double_t phiR, 
+                                 Double_t cOrB, 
+                                 Int_t    type, 
+                                 UShort_t order,
+                                 UShort_t what) const
+{
+  Double_t w = 1;
+  if (what & kEta)  w *= CalcEtaWeight(eta, type);
+  if (what & kPt)   w *= CalcPtWeight(pt, type);
+  if (what & kPID)  w *= CalcPidWeight(id, type);
+  if      (what & kCent) w *= CalcCentWeight(cOrB);
+  else if (what & kB)    w *= CalcBWeight(cOrB);
+  
+  w *= 20 * 2. * TMath::Cos(order * (phi - phiR));
+
+  return w;
+}
+
+//____________________________________________________________________
+Double_t
+AliForwardFlowWeights::CalcWeight(Double_t eta,  Double_t pt, 
+                                 Double_t phi,  Int_t id, 
+                                 Double_t phiR, Double_t b) const
+{
+  return CalcWeight(eta, pt, phi, id, phiR, b, 1, 2, kEta|kPt|kPID|kB);
+  
+}
+
+namespace {
+  TObject* GetListObject(TList* l, const char* name)
+  {
+    if (!name || name[0] == '\0') { 
+      Error("GetListObject", "No object name");
+      return 0;
+    }
+    if (!l) { 
+      Error("GetListObject", "No list");
+      return 0;
+    }
+    TObject* o = l->FindObject(name);
+    if (!o) { 
+      Error("GetListObject", "Object %s not found in list %s",  
+           name, l->GetName());
+      return 0;
+    }
+    return o;
+  }
+}
+//____________________________________________________________________
+AliForwardFlowWeights*
+AliForwardFlowWeights::FromList(TList* l)
+{
+  TObject* pt2 = GetListObject(l, fgkPt2Name);
+  TObject* pt4 = GetListObject(l, fgkPt4Name);
+  TObject* alt = GetListObject(l, fgkPt4Alt);
+  TObject* b   = GetListObject(l, fgkBName);
+  TObject* c   = GetListObject(l, fgkCName);
+
+  if (!pt2 || !pt4 || !alt || !b || !c) {
+    ::Error("FromList", "One or more histograms not found");
+    return 0;
+  }
+  AliForwardFlowWeights* ret = new AliForwardFlowWeights;
+  ret->fV22Pt    = static_cast<TGraph*>(pt2);
+  ret->fV24Pt    = static_cast<TGraph*>(pt4);
+  ret->fV24AltPt = static_cast<TGraph*>(alt);
+  ret->fV2B      = static_cast<TGraph*>(b);
+  ret->fV2C      = static_cast<TGraph*>(c);
+  
+  return ret;
+}
+
+//____________________________________________________________________
+//
+// EOF
+//
diff --git a/PWGLF/FORWARD/analysis2/AliForwardFlowWeights.h b/PWGLF/FORWARD/analysis2/AliForwardFlowWeights.h
new file mode 100644 (file)
index 0000000..7341120
--- /dev/null
@@ -0,0 +1,117 @@
+#ifndef ALIROOT_ALIFORWARDFLOWWEIGHTS
+#define ALIROOT_ALIFORWARDFLOWWEIGHTS
+#include <TObject.h>
+class TGraph;
+class TF1;
+class TList;
+
+/** 
+ * Utility class to calculate flow weights 
+ * 
+ */
+class AliForwardFlowWeights : public TObject
+{
+public:
+  enum { 
+    kEta   = 0x01,  // include eta effect 
+    kPt    = 0x02,  // include pt effect
+    kPID   = 0x04,  // include PID effect
+    kCent  = 0x08,  // include centrality effect
+    kB     = 0x10   // include impact parmaeter effect
+  };
+  /** 
+   * Constructor 
+   */
+  AliForwardFlowWeights();
+  /** 
+   * copy constructor 
+   * 
+   * @param o Object to copy from 
+   */
+  AliForwardFlowWeights(const AliForwardFlowWeights& o);
+  /** 
+   * Assignment operator 
+   * 
+   * @param o Object to assign from 
+   */
+  AliForwardFlowWeights& operator=(const AliForwardFlowWeights& o);
+  /** 
+   * Destructor
+   */
+  virtual ~AliForwardFlowWeights();
+
+  /** 
+   * Initialize 
+   * 
+   * @param l List to add objects to 
+   */
+  virtual void Init(TList* l);
+  /** 
+   * 
+   * 
+   * @param eta   Pseudo-rapidity of particle (@f$\eta@f$)
+   * @param pt    Transverse momentum of particle (@f$p_T@f$) in GeV
+   * @param phi   Azimuthal angle of particle (@f$\phi@f$) in radians
+   * @param id    Particle type of particle 
+   * @param phiR  Event plane angle (@f$\phi_R@f$) in radians
+   * @param bOrC  Impact paramter/Centrality of event (@f$b@f$) in fm
+   * @param type  Type of flow to add 
+   * @param order Order of flow weight 
+   * @param what  Which effects to include
+   * 
+   * @return 
+   */
+  Double_t CalcWeight(Double_t eta, 
+                     Double_t pt, 
+                     Double_t phi,  
+                     Int_t    id, 
+                     Double_t phiR, 
+                     Double_t bOrC, 
+                     Int_t    type, 
+                     UShort_t order,
+                     UShort_t what) const;
+  /** 
+   * Calculate the weights 
+   * 
+   * @param eta  Pseudo-rapidity of particle (@f$\eta@f$)
+   * @param pt   Transverse momentum of particle (@f$p_T@f$) in GeV
+   * @param phi  Azimuthal angle of particle (@f$\phi@f$) in radians
+   * @param id   Particle type of particle 
+   * @param phiR Event plane angle (@f$\phi_R@f$) in radians
+   * @param b    Impact paramter of event (@f$b@f$) in fm
+   * 
+   * @return 
+   */
+  virtual Double_t CalcWeight(Double_t eta, Double_t pt, 
+                             Double_t phi, Int_t id, 
+                             Double_t phiR, Double_t b) const;
+  /** 
+   * Construct an object from objects found in list, or null
+   * 
+   * @param l List to find objects in 
+   * 
+   * @return Newly created object, or null 
+   */
+  static AliForwardFlowWeights* FromList(TList* l);
+protected:
+  Double_t CalcEtaWeight(Double_t eta, Int_t type) const;
+  Double_t CalcPidWeight(Int_t id, Int_t type) const;
+  Double_t CalcPtWeight(Double_t pt, Int_t type) const;
+  Double_t CalcCentWeight(Double_t c) const;
+  Double_t CalcBWeight(Double_t b) const;
+
+  TGraph* fV22Pt;    // Contribution from v2{2} as a function of pt
+  TGraph* fV24Pt;    // Contribution from v2{4} as a function of pt
+  TGraph* fV24AltPt; // Contribution from v2{4} as a function of pt
+  TGraph* fV2B;      // Contribution from v2 as a function of b
+  TGraph* fV2C;      // Contribution from v2 as a function of centrality
+    
+  ClassDef(AliForwardFlowWeights,1);
+};
+
+#endif
+//
+// Local Variables: 
+//  mode: C++ 
+// End:
+//
index e277070..f1efd93 100644 (file)
 #include "AliAODCentralMult.h"
 
 ClassImp(AliForwardMCFlowTaskQC)
-
+#if 0
+;
+#endif
 //_____________________________________________________________________
-AliForwardMCFlowTaskQC::AliForwardMCFlowTaskQC() :
-  AliForwardFlowTaskQC(), 
-  fBinsFMDTR(),          // List of FMDTR analysis objects
-  fBinsSPDTR(),          // List of SPDTR analysis objects
-  fBinsMC(),             // List of MC truth analysis objects
-  fdNdedpMC(),           // MC truth d^2N/detadphi histogram
-  fAliceCent4th(),       // Alice QC4 vs. centrality data points
-  fAlicePt2nd4050(),     // Alice QC2 vs. pT data points
-  fAlicePt4th3040(),     // Alice QC4 vs. pT data points
-  fAlicePt4th4050(),     // Alice QC4 vs. pT data points
-  fImpactParToCent(),    // Impact parameter to centrality graph
-  fUseImpactPar(0),      // Use impact par for centrality
-  fAddFlow(0),           // Add flow to MC truth
-  fAddType(0),           // Add type of flow to MC truth
-  fAddOrder(0)           // Add order of flow to MC truth        
-   {} 
+AliForwardMCFlowTaskQC::AliForwardMCFlowTaskQC() 
+  : AliForwardFlowTaskQC(), 
+    fBinsFMDTR(),          // List of FMDTR analysis objects
+    fBinsSPDTR(),          // List of SPDTR analysis objects
+    fBinsMC(),             // List of MC truth analysis objects
+    fdNdedpMC(),           // MC truth d^2N/detadphi histogram
+    fWeights(),            // Flow weights
+    fImpactParToCent(),    // Impact parameter to centrality graph
+    fUseImpactPar(0),      // Use impact par for centrality
+    fAddFlow(0),           // Add flow to MC truth
+    fAddType(0),           // Add type of flow to MC truth
+    fAddOrder(0)           // Add order of flow to MC truth        
+{} 
   //
   // Default Constructor
   //
 //_____________________________________________________________________
-AliForwardMCFlowTaskQC::AliForwardMCFlowTaskQC(const char* name) :
-  AliForwardFlowTaskQC(name),
-  fBinsFMDTR(),          // List of FMDTR analysis objects
-  fBinsSPDTR(),          // List of SPDTR analysis objects
-  fBinsMC(),             // List of MC truth analysis objects
-  fdNdedpMC(),           // MC truth d^2N/detadphi histogram
-  fAliceCent4th(),       // Alice QC4 vs. centrality data points
-  fAlicePt2nd4050(),     // Alice QC2 vs. pT data points
-  fAlicePt4th3040(),     // Alice QC4 vs. pT data points
-  fAlicePt4th4050(),     // Alice QC4 vs. pT data points
-  fImpactParToCent(),    // Impact parameter to centrality graph
-  fUseImpactPar(0),      // Use impact par for centrality
-  fAddFlow(0),           // Add flow to MC truth
-  fAddType(0),           // Add type of flow to MC truth
-  fAddOrder(0)           // Add order of flow to MC truth        
+AliForwardMCFlowTaskQC::AliForwardMCFlowTaskQC(const char* name) 
+  : AliForwardFlowTaskQC(name),
+    fBinsFMDTR(),          // List of FMDTR analysis objects
+    fBinsSPDTR(),          // List of SPDTR analysis objects
+    fBinsMC(),             // List of MC truth analysis objects
+    fdNdedpMC(),           // MC truth d^2N/detadphi histogram
+    fWeights(),            // Flow weights
+    fImpactParToCent(),    // Impact parameter to centrality graph
+    fUseImpactPar(0),      // Use impact par for centrality
+    fAddFlow(0),           // Add flow to MC truth
+    fAddType(0),           // Add type of flow to MC truth
+    fAddOrder(0)           // Add order of flow to MC truth        
 { 
   // 
   // Constructor
   // Parameters:
   //  name: Name of task
   //
-  fdNdedpMC = TH2D("fdNdedpMC", "fdNdedpMC", 48, -6., 6., 200, 0., 2.*TMath::Pi());
+  fdNdedpMC = TH2D("fdNdedpMC", "fdNdedpMC", 
+                  48, -6., 6., 200, 0., 2.*TMath::Pi());
   fdNdedpMC.Sumw2();
   
-  // Add parametrizations of ALICE data
-  Double_t xCumulant4thTPCrefMultTPConlyAll[] = {2.5,7.5,15,25,35,45,55,65};
-  Double_t yCumulant4thTPCrefMultTPConlyAll[] = {0.017855,0.032440,0.055818,0.073137,0.083898,0.086690,0.082040,0.077777};
-  Int_t nPointsCumulant4thTPCrefMultTPConlyAll = sizeof(xCumulant4thTPCrefMultTPConlyAll)/sizeof(Double_t);
-  fAliceCent4th = new TGraph(nPointsCumulant4thTPCrefMultTPConlyAll,xCumulant4thTPCrefMultTPConlyAll,
-                                                        yCumulant4thTPCrefMultTPConlyAll);
-  Double_t xCumulant2nd4050ALICE[] = {0.000000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
-  1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
-  Double_t yCumulant2nd4050ALICE[] = {0.000000,0.043400,0.059911,0.073516,0.089756,0.105486,0.117391,0.128199,0.138013,
-  0.158271,0.177726,0.196383,0.208277,0.216648,0.242954,0.249961,0.240131,0.269006,0.207796};
-  Int_t nPointsCumulant2nd4050ALICE = sizeof(xCumulant2nd4050ALICE)/sizeof(Double_t);                                      
-  fAlicePt2nd4050 = new TGraph(nPointsCumulant2nd4050ALICE,xCumulant2nd4050ALICE,yCumulant2nd4050ALICE);
-
-  Double_t xCumulant4th3040ALICE[] = {0.00000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
-  1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000,
-  5.500000,7.000000,9.000000};
-  Double_t yCumulant4th3040ALICE[] = {0.000000,0.037071,0.048566,0.061083,0.070910,0.078831,0.091396,0.102026,0.109691,
-  0.124449,0.139819,0.155561,0.165701,0.173678,0.191149,0.202015,0.204540,0.212560,0.195885,
-  0.000000,0.000000,0.000000};
-  Int_t nPointsCumulant4th3040ALICE = sizeof(xCumulant4th3040ALICE)/sizeof(Double_t);                                      
-  fAlicePt4th3040 = new TGraph(nPointsCumulant4th3040ALICE,xCumulant4th3040ALICE,yCumulant4th3040ALICE);
-
-  Double_t xCumulant4th4050ALICE[] = {0.000000,0.250000,0.350000,0.450000,0.550000,0.650000,0.750000,0.850000,0.950000,
-  1.100000,1.300000,1.500000,1.700000,1.900000,2.250000,2.750000,3.250000,3.750000,4.500000};
-  Double_t yCumulant4th4050ALICE[] = {0.000000,0.038646,0.049824,0.066662,0.075856,0.081583,0.099778,0.104674,0.118545,
-  0.131874,0.152959,0.155348,0.169751,0.179052,0.178532,0.198851,0.185737,0.239901,0.186098};
-  Int_t nPointsCumulant4th4050ALICE = sizeof(xCumulant4th4050ALICE)/sizeof(Double_t);   
-  fAlicePt4th4050 = new TGraph(nPointsCumulant4th4050ALICE, xCumulant4th4050ALICE, yCumulant4th4050ALICE);
-
-//  Double_t impactParam[] = {0.,1.75,4.225,5.965,7.765,9.215,10.46,11.565,12.575,13.515,16.679};
-//  Double_t centrality[] = {0.,2.5,7.5,15,25,35,45,55,65,75,90};
-  Double_t impactParam[] = {0., 3.72, 5.23, 7.31, 8.88, 10.20, 11.38, 12.47, 13.50, 14.51, 16.679};
-  Double_t centrality[] = {0., 5., 10., 20., 30., 40., 50., 60., 70., 80., 100.};
+  //  Double_t impactParam[] = {0.,1.75,4.225,5.965,7.765,9.215,10.46,
+  //                            11.565,12.575,13.515,16.679};
+  //  Double_t centrality[] = {0.,2.5,7.5,15,25,35,45,55,65,75,90};
+  Double_t impactParam[] = { 0.00,  3.72,  5.23,  7.31,  8.88, 10.20, 
+                           11.38, 12.47, 13.50, 14.51, 16.679};
+  Double_t centrality[]  = { 0.,    5.,   10.,   20.,   30.,   40., 
+                           50.,   60.,   70.,   80.,  100.};
 
   Int_t nPoints = sizeof(impactParam)/sizeof(Double_t);
   fImpactParToCent = new TGraph(nPoints, impactParam, centrality);
 
 }
 //_____________________________________________________________________
-AliForwardMCFlowTaskQC::AliForwardMCFlowTaskQC(const AliForwardMCFlowTaskQC& o) :
-  AliForwardFlowTaskQC(o), 
-  fBinsFMDTR(),                          // List of FMDTR analysis objects
-  fBinsSPDTR(),                          // List of SPDTR analysis objects
-  fBinsMC(),                             // List of MC truth analysis objects
-  fdNdedpMC(o.fdNdedpMC),                // MC truth d^2N/detadphi histogram
-  fAliceCent4th(o.fAliceCent4th),        // Alice QC4 vs. centrality data points
-  fAlicePt2nd4050(o.fAlicePt2nd4050),    // Alice QC2 vs. pT data points
-  fAlicePt4th3040(o.fAlicePt4th3040),    // Alice QC4 vs. pT data points
-  fAlicePt4th4050(o.fAlicePt4th4050),    // Alice QC4 vs. pT data points
-  fImpactParToCent(o.fImpactParToCent),  // Impact parameter to centrality graph
-  fUseImpactPar(o.fUseImpactPar),        // Use impact par for centrality
-  fAddFlow(o.fAddFlow),                  // Add flow to MC truth
-  fAddType(o.fAddType),                  // Add type of flow to MC truth
-  fAddOrder(o.fAddOrder)                 // Add order of flow to MC truth        
-   {} 
+AliForwardMCFlowTaskQC::AliForwardMCFlowTaskQC(const AliForwardMCFlowTaskQC& o) 
+  : AliForwardFlowTaskQC(o), 
+    fBinsFMDTR(),                          // List of FMDTR analysis objects
+    fBinsSPDTR(),                          // List of SPDTR analysis objects
+    fBinsMC(),                             // List of MC truth analysis objects
+    fdNdedpMC(o.fdNdedpMC),                // MC truth d^2N/detadphi histogram
+    fWeights(o.fWeights),                  // Flow weights
+    fImpactParToCent(o.fImpactParToCent),  // Impact parameter to centrality
+    fUseImpactPar(o.fUseImpactPar),        // Use impact par for centrality
+    fAddFlow(o.fAddFlow),                  // Add flow to MC truth
+    fAddType(o.fAddType),                  // Add type of flow to MC truth
+    fAddOrder(o.fAddOrder)                 // Add order of flow to MC truth
+{
   //
   // Copy Constructor
   //
+} 
 //_____________________________________________________________________
 AliForwardMCFlowTaskQC&
 AliForwardMCFlowTaskQC::operator=(const AliForwardMCFlowTaskQC& o)
@@ -134,10 +102,7 @@ AliForwardMCFlowTaskQC::operator=(const AliForwardMCFlowTaskQC& o)
   //
   if (&o == this) return *this;
   fdNdedpMC        = o.fdNdedpMC;
-  fAliceCent4th    = o.fAliceCent4th;
-  fAlicePt2nd4050  = o.fAlicePt2nd4050;
-  fAlicePt4th3040  = o.fAlicePt4th3040;
-  fAlicePt4th4050  = o.fAlicePt4th4050;
+  fWeights         = o.fWeights;
   fImpactParToCent = o.fImpactParToCent;
   fUseImpactPar    = o.fUseImpactPar;
   fAddFlow         = o.fAddFlow;
@@ -155,13 +120,15 @@ void AliForwardMCFlowTaskQC::InitVertexBins()
 
   for(UShort_t n = 1; n <= 6; n++) {
     if (!fv[n]) continue;
-      for (Int_t v = 1; v <= fVtxAxis->GetNbins(); v++) {
-      fBinsFMDTR.Add(new VertexBin(fVtxAxis->GetBinLowEdge(v), fVtxAxis->GetBinUpEdge(v), n, "FMDTR"));
-      fBinsSPDTR.Add(new VertexBin(fVtxAxis->GetBinLowEdge(v), fVtxAxis->GetBinUpEdge(v), n, "SPDTR"));
-      fBinsMC.Add(new VertexBin(fVtxAxis->GetBinLowEdge(v), fVtxAxis->GetBinUpEdge(v), n, "MC"));
+    for (Int_t v = 1; v <= fVtxAxis->GetNbins(); v++) {
+      Int_t vL = Int_t(fVtxAxis->GetBinLowEdge(v));
+      Int_t vH = Int_t(fVtxAxis->GetBinUpEdge(v));
+      
+      fBinsFMDTR.Add(new VertexBin(vL, vH, n, "FMDTR"));
+      fBinsSPDTR.Add(new VertexBin(vL, vH, n, "SPDTR"));
+      fBinsMC.Add(new VertexBin(vL, vH, n, "MC"));
     }
   }
-
 }
 //_____________________________________________________________________
 void AliForwardMCFlowTaskQC::InitHists()
@@ -185,6 +152,7 @@ void AliForwardMCFlowTaskQC::InitHists()
     bin->AddOutput(fSumList);
   }
 
+  fWeights.Init(fSumList);
 }
 //_____________________________________________________________________
 Bool_t AliForwardMCFlowTaskQC::Analyze() 
@@ -196,8 +164,10 @@ Bool_t AliForwardMCFlowTaskQC::Analyze()
   if (!AliForwardFlowTaskQC::Analyze()) return kFALSE;
 
   // Run analysis on trackrefs from FMD and SPD
-  const AliAODForwardMult* aodfmult = static_cast<AliAODForwardMult*>(fAOD->FindListObject("ForwardMC"));
-  const AliAODCentralMult* aodcmult = static_cast<AliAODCentralMult*>(fAOD->FindListObject("CentralClustersMC"));
+  const AliAODForwardMult* aodfmult = 
+    static_cast<AliAODForwardMult*>(fAOD->FindListObject("ForwardMC"));
+  const AliAODCentralMult* aodcmult = 
+    static_cast<AliAODCentralMult*>(fAOD->FindListObject("CentralClustersMC"));
   if (!aodfmult || !aodcmult) return kFALSE;
   
   // if objects are present, get histograms
@@ -257,23 +227,34 @@ Bool_t AliForwardMCFlowTaskQC::LoopAODMC()
   fdNdedpMC.Reset();
 
   //retreive MC particles from event
-  TClonesArray* mcArray = (TClonesArray*)fAOD->FindListObject(AliAODMCParticle::StdBranchName());
+  TClonesArray* mcArray = 
+    static_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::
+                                                   StdBranchName()));
   if(!mcArray){
-//    AliWarning("No MC array found in AOD. Try making it again.");
+    //    AliWarning("No MC array found in AOD. Try making it again.");
     return kFALSE;
   }
 
   Double_t rp = 0;
-  AliAODMCHeader* header = dynamic_cast<AliAODMCHeader*>(fAOD->FindListObject(AliAODMCHeader::StdBranchName()));
-  if (!header) {
+  AliAODMCHeader* header = 
+    dynamic_cast<AliAODMCHeader*>(fAOD->FindListObject(AliAODMCHeader::
+                                                      StdBranchName()));
+  if (!header) 
     AliWarning("No header file found.");
-  }
-  else {
+  else 
     rp = header->GetReactionPlaneAngle();
-  }
 
   Int_t ntracks = mcArray->GetEntriesFast();
 
+  UShort_t flowFlags = 0;
+  if (fAddFlow.Length() > 1) {
+    if (fAddFlow.Contains("pt"))   flowFlags |= AliForwardFlowWeights::kPt;
+    if (fAddFlow.Contains("pid"))  flowFlags |= AliForwardFlowWeights::kPt;
+    if (fAddFlow.Contains("eta"))  flowFlags |= AliForwardFlowWeights::kEta;
+    if (fAddFlow.Contains("cent")) flowFlags |= AliForwardFlowWeights::kCent;
+  }
+
+
   // Track loop: chek how many particles will be accepted
   Double_t weight = 0;
   for (Int_t it = 0; it < ntracks; it++) {
@@ -290,19 +271,10 @@ Bool_t AliForwardMCFlowTaskQC::LoopAODMC()
     Double_t phi = particle->Phi();
     if (eta > -4. && eta < 5.) {
       // Add flow if it is in the argument
-      if (fAddFlow.Length() > 1) {
-        if (fAddFlow.Contains("pt"))
-          weight *= AddptFlow(pT);
-        if (fAddFlow.Contains("pid"))
-          weight *= AddpidFlow(particle->PdgCode());
-        if (fAddFlow.Contains("eta"))
-          weight *= AddetaFlow(eta);
-        if (fAddFlow.Contains("cent")) 
-          weight *= fAliceCent4th->Eval(fCent)/fAliceCent4th->Eval(45);
-        
-        weight *= 20*2.*TMath::Cos((Double_t)fAddOrder*(phi-rp)); 
-        weight += 1;
-      }
+      if (flowFlags != 0) 
+       weight = fWeights.CalcWeight(eta, pT, phi, particle->PdgCode(), 
+                                    rp, fCent, fAddType, fAddOrder, 
+                                    flowFlags) + 1;
       fdNdedpMC.Fill(eta, phi, weight);
     }
   }
@@ -310,81 +282,6 @@ Bool_t AliForwardMCFlowTaskQC::LoopAODMC()
   return kTRUE;
 }
 //_____________________________________________________________________
-Double_t AliForwardMCFlowTaskQC::AddptFlow(Double_t pt = 0) const 
-{
-  //
-  // Add pt dependent flow factor
-  // Parameters:
-  //  pt: pT parametrization to use
-  //
-  Double_t weight = 0;
-
-  switch(fAddType) 
-  {
-    case 1: weight = fAlicePt2nd4050->Eval(pt)*0.5+fAlicePt4th4050->Eval(pt)*0.5;
-            break;
-    case 2: weight = fAlicePt2nd4050->Eval(pt);
-            break;
-    case 3: weight = fAlicePt4th3040->Eval(pt);
-            break;
-    case 4: weight = fAlicePt4th4050->Eval(pt);
-            break;
-  } 
-  
-  return weight;
-}
-//_____________________________________________________________________
-Double_t AliForwardMCFlowTaskQC::AddpidFlow(Int_t id = 0) const 
-{
-  //
-  // Add pid dependent flow factor 
-  // Parameters:
-  //  id: choose PID dependent setup
-  //
-  Double_t weight = 0;
-
-  switch(fAddType)
-  {
-    case 1: if (TMath::Abs(id) ==  211) // pion flow
-              weight = 1.3;
-            else if (TMath::Abs(id) ==  2212) // proton flow
-              weight = 1.;
-            else 
-              weight = 0.7;
-            break;
-    case 2: weight = 1.207;
-            break;
-  }
-
-  return weight;
-}
-//_____________________________________________________________________
-Double_t AliForwardMCFlowTaskQC::AddetaFlow(Double_t eta = 0) const 
-{
-  //
-  // Add eta dependent flow factor 
-  // Parameters:
-  //  eta: choose v_n(eta) shape
-  //
-  Double_t weight = 0;
-
-  TF1 gaus = TF1("gaus", "gaus", -6, 6);
-
-  switch(fAddType)
-  {
-     case 1: gaus.SetParameters(0.1, 0., 9);
-             break;
-     case 2: gaus.SetParameters(0.1, 0., 3);
-             break;
-     case 3: gaus.SetParameters(0.1, 0., 15);
-             break;
-  }
-
-  weight = gaus.Eval(eta);
-
-  return weight;
-}
-//_____________________________________________________________________
 Double_t AliForwardMCFlowTaskQC::GetCentFromB() const
 {
   //
@@ -392,7 +289,9 @@ Double_t AliForwardMCFlowTaskQC::GetCentFromB() const
   //
   Double_t cent = -1.;
   Double_t b = -1.;
-  AliAODMCHeader* header = (AliAODMCHeader*)fAOD->FindListObject(AliAODMCHeader::StdBranchName());
+  AliAODMCHeader* header = 
+    static_cast<AliAODMCHeader*>(fAOD->FindListObject(AliAODMCHeader::
+                                                     StdBranchName()));
   if (!header) return cent;
   b = header->GetImpactParameter();
 
index 75cdec0..f6d04d8 100644 (file)
@@ -14,6 +14,7 @@
  * @ingroup pwglf_forward_flow
  */
 #include "AliForwardFlowTaskQC.h"
+#include "AliForwardFlowWeights.h"
 #include <TH2D.h>
 class TGraph;
 
@@ -124,27 +125,6 @@ protected:
    */
   Bool_t LoopAODMC();
   /**
-   * Add pt dependent flow factor
-   *
-   * @param Pt   @f$ p_T@f$
-   * @param type Type of flow 
-   */
-  Double_t AddptFlow(Double_t pt) const;
-  /**
-   * Add pid dependent flow factor
-   *
-   * @param ID   Particle ID 
-   * @param type Type of flow
-   */
-  Double_t AddpidFlow(Int_t id) const;
-  /**
-   * Add eta dependent flow factor
-   * 
-   * @param Eta  @f$\eta@f$ 
-   * @param type Type of flow 
-   */
-  Double_t AddetaFlow(Double_t eta) const;
-  /**
    * Get centrality form MC impact parameter
    */
   Double_t GetCentFromB() const;
@@ -153,17 +133,14 @@ protected:
   TList         fBinsSPDTR;         //  List with SPDTR VertexBin objects
   TList         fBinsMC;            //  List with MC VertexBin objects
   TH2D          fdNdedpMC;          //  d^2N/detadphi MC truth histogram
-  TGraph*       fAliceCent4th;      //  Parametrization of ALICE QC4 vs. cent. data
-  TGraph*       fAlicePt2nd4050;    //  Parametrization of ALICE QC2 vs. pT data
-  TGraph*       fAlicePt4th3040;    //  Parametrization of ALICE QC4 vs. pT data
-  TGraph*       fAlicePt4th4050;    //  Parametrization of ALICE QC4 vs. pT data
-  TGraph*       fImpactParToCent;   //  Parametrization of b to centrality datapoints
-  Bool_t       fUseImpactPar;      //  Flag to use impact parameter for cent
+  AliForwardFlowWeights fWeights;   //  Flow after burner 
+  TGraph*       fImpactParToCent;   //  Parametrization of b to centrality
+  Bool_t        fUseImpactPar;      //  Flag to use impact parameter for cent
   TString       fAddFlow;           //  Add flow string
   Int_t         fAddType;           //  Add flow type #
   Int_t         fAddOrder;          //  Add flow order
 
-  ClassDef(AliForwardMCFlowTaskQC, 1); // FMD MC analysis task 
+  ClassDef(AliForwardMCFlowTaskQC, 2); // FMD MC analysis task 
 };
  
 #endif
index 597da30..6ef6ba1 100644 (file)
@@ -84,6 +84,7 @@
 #pragma link C++ class AliForwarddNdetaTask::CentralityBin+;
 #pragma link C++ class AliForwardFlowTaskQC+;
 #pragma link C++ class AliForwardFlowTaskQC::VertexBin+;
+#pragma link C++ class AliForwardFlowWeights+;
 #pragma link C++ class AliForwardMCCorrectionsTask+;
 #pragma link C++ class AliForwardMCCorrectionsTask::VtxBin+;
 #pragma link C++ class AliForwardMCFlowTaskQC+;