AliPhysics  4e47bdd (4e47bdd)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliForwardFlowWeights.cxx
Go to the documentation of this file.
2 #include <TGraph.h>
3 #include <TF1.h>
4 #include <TList.h>
5 #include <TMath.h>
6 #include "AliForwardUtil.h"
7 #include <TROOT.h>
8 #include <iostream>
9 
10 //____________________________________________________________________
12  : fV22Pt(0),
13  fV24Pt(0),
14  fV24AltPt(0),
15  fV2B(0),
16  fV2C(0)
17 {}
18 
19 //____________________________________________________________________
21  : AliBaseMCWeights (o),
22  fV22Pt(o.fV22Pt),
23  fV24Pt(o.fV24Pt),
24  fV24AltPt(o.fV24AltPt),
25  fV2B(o.fV2B),
26  fV2C(o.fV2C)
27 {}
28 
29 //____________________________________________________________________
32 {
33  if (&o == this) return *this;
34 
35  fV22Pt = (o.fV22Pt ? static_cast<TGraph*>(o.fV22Pt->Clone()) : 0);
36  fV24Pt = (o.fV24Pt ? static_cast<TGraph*>(o.fV24Pt->Clone()) : 0);
37  fV24AltPt = (o.fV24AltPt ? static_cast<TGraph*>(o.fV24AltPt->Clone()) : 0);
38  fV2B = (o.fV2B ? static_cast<TGraph*>(o.fV2B->Clone()) : 0);
39  fV2C = (o.fV2C ? static_cast<TGraph*>(o.fV2C->Clone()) : 0);
40 
41  return *this;
42 }
43 //____________________________________________________________________
45 {
46 }
47 
48 namespace {
49  const char* fgkPt2Name = "v22VsPt";
50  const char* fgkPt4Name = "v24VsPt";
51  const char* fgkPt4Alt = "v24AltVsPt";
52  const char* fgkBName = "v2VsB";
53  const char* fgkCName = "v2VsC";
54 }
55 
56 //____________________________________________________________________
57 void
59 {
60  Int_t ptN = 19;
61  const Double_t ptX[] = {0.00, 0.25, 0.350, 0.45,
62  0.55, 0.650, 0.75, 0.85,
63  0.950, 1.10, 1.30, 1.500,
64  1.70, 1.90, 2.250, 2.75,
65  3.25, 3.750, 4.50};
66  {
67  // v2{2} dependence on pt
68  const Double_t y[] = {0.00000, 0.043400, 0.059911, 0.073516,
69  0.089756, 0.105486, 0.117391, 0.128199,
70  0.138013, 0.158271, 0.177726, 0.196383,
71  0.208277, 0.216648, 0.242954, 0.249961,
72  0.240131, 0.269006, 0.207796};
73 
74  fV22Pt = new TGraph(ptN, ptX, y);
75  fV22Pt->SetName(fgkPt2Name);
76  fV22Pt->SetMarkerStyle(20);
77  fV22Pt->SetMarkerColor(kRed+1);
78  l->Add(fV22Pt);
79  }
80 
81  {
82  const Double_t y[] = {0.000000, 0.038646, 0.049824, 0.066662,
83  0.075856, 0.081583, 0.099778, 0.104674,
84  0.118545, 0.131874, 0.152959, 0.155348,
85  0.169751, 0.179052, 0.178532, 0.198851,
86  0.185737, 0.239901, 0.186098};
87 
88  // v2{4} dependence on pt
89  fV24Pt = new TGraph(ptN, ptX, y);
90  fV24Pt->SetName(fgkPt4Name);
91  fV24Pt->SetMarkerStyle(20);
92  fV24Pt->SetMarkerColor(kBlue+1);
93  l->Add(fV24Pt);
94  }
95 
96  {
97  const Double_t y[] = {0.000000, 0.037071, 0.048566, 0.061083,
98  0.070910, 0.078831, 0.091396, 0.102026,
99  0.109691, 0.124449, 0.139819, 0.155561,
100  0.165701, 0.173678, 0.191149, 0.202015,
101  0.204540, 0.212560, 0.195885};
102  // v2{4} dependence on pt (30-40%)
103  fV24AltPt = new TGraph(ptN, ptX, y);
104  fV24AltPt->SetName(fgkPt4Alt);
105  fV24AltPt->SetMarkerStyle(20);
106  fV24AltPt->SetMarkerColor(kBlue+1);
107  l->Add(fV24AltPt);
108  }
109  Int_t nb = 8;
110  const Double_t by[] = {0.017855, 0.032440, 0.055818, 0.073137,
111  0.083898, 0.086690, 0.082040, 0.077777};
112  {
113  // V2 dependence on impact parameter
114  const Double_t x[] = {1.75, 4.225, 5.965, 7.765,
115  9.215, 10.46, 11.565, 12.575};
116  fV2B = new TGraph(nb, x, by);
117  fV2B->SetName(fgkBName);
118  fV2B->SetMarkerStyle(20);
119  fV2B->SetMarkerColor(kGreen+1);
120  l->Add(fV2B);
121  }
122  {
123  // V2 dependence on impact parameter
124  const Double_t x[] = { 2.5, 7.5, 15, 25, 35, 45, 55, 65};
125  fV2C = new TGraph(nb, x, by);
126  fV2C->SetName(fgkCName);
127  fV2C->SetMarkerStyle(20);
128  fV2C->SetMarkerColor(kGreen+1);
129  l->Add(fV2C);
130  }
131 }
132 
133 //____________________________________________________________________
134 Double_t
136 {
137  if (type == 0) return 1;
138  return 0.1 * TMath::Gaus(eta, 0, (type == 2 ? 3. :
139  type == 3 ? 15 : 9));
140 }
141 //____________________________________________________________________
142 Double_t
144 {
145  if (type == 0) return 1;
146  if (type == 2) return 1.207;
147  switch (TMath::Abs(id)) {
148  case 211: return 1.3; break; // pions
149  case 2212: return 1.0; break; // protons
150  default: /* return 0.7;*/ break;
151  }
152  return .7; // Was 1
153 }
154 //____________________________________________________________________
155 Double_t
157 {
158  switch (type) {
159  case 0: return 1;
160  case 2: return fV22Pt->Eval(pt);
161  case 3: return fV24AltPt->Eval(pt); // From 30-40
162  case 4: return fV24Pt->Eval(pt);
163  }
164  return 0.5 * (fV22Pt->Eval(pt) + fV24Pt->Eval(pt));
165 }
166 
167 //____________________________________________________________________
168 Double_t
170 {
171  return fV2B->Eval(b) / fV2B->Eval(10.46);
172 }
173 
174 //____________________________________________________________________
175 Double_t
177 {
178  return fV2C->Eval(c) / fV2C->Eval(45);
179 }
180 
181 //____________________________________________________________________
182 Double_t
184  Double_t pt,
185  Double_t phi,
186  Int_t id,
187  Double_t phiR,
188  Double_t cOrB,
189  Int_t type,
190  UShort_t order,
191  UShort_t what) const
192 {
193  Double_t w = 1;
194  if (what & kEta) w *= CalcEtaWeight(eta, type);
195  if (what & kPt) w *= CalcPtWeight(pt, type);
196  if (what & kPID) w *= CalcPidWeight(id, type);
197  if (what & kCent) w *= CalcCentWeight(cOrB);
198  else if (what & kB) w *= CalcBWeight(cOrB);
199 
200  w *= 20 * 2. * TMath::Cos(order * (phi - phiR));
201 
202  return w;
203 }
204 
205 //____________________________________________________________________
206 Double_t
208  Double_t phi, Int_t id,
209  Double_t phiR, Double_t b) const
210 {
211  return CalcWeight(eta, pt, phi, id, phiR, b, 1, 2, kEta|kPt|kPID|kB);
212 
213 }
214 
215 namespace {
216  TObject* GetListObject(TList* l, const char* name)
217  {
218  if (!name || name[0] == '\0') {
219  Error("GetListObject", "No object name");
220  return 0;
221  }
222  if (!l) {
223  Error("GetListObject", "No list");
224  return 0;
225  }
226  TObject* o = l->FindObject(name);
227  if (!o) {
228  Error("GetListObject", "Object %s not found in list %s",
229  name, l->GetName());
230  return 0;
231  }
232  return o;
233  }
234 }
235 //____________________________________________________________________
238 {
239  TObject* pt2 = GetListObject(l, fgkPt2Name);
240  TObject* pt4 = GetListObject(l, fgkPt4Name);
241  TObject* alt = GetListObject(l, fgkPt4Alt);
242  TObject* b = GetListObject(l, fgkBName);
243  TObject* c = GetListObject(l, fgkCName);
244 
245  if (!pt2 || !pt4 || !alt || !b || !c) {
246  ::Error("FromList", "One or more histograms not found");
247  return 0;
248  }
250  ret->fV22Pt = static_cast<TGraph*>(pt2);
251  ret->fV24Pt = static_cast<TGraph*>(pt4);
252  ret->fV24AltPt = static_cast<TGraph*>(alt);
253  ret->fV2B = static_cast<TGraph*>(b);
254  ret->fV2C = static_cast<TGraph*>(c);
255 
256  return ret;
257 }
258 
259 #define PF(N,V,...) \
260  AliForwardUtil::PrintField(N,V, ## __VA_ARGS__)
261 #define PFB(N,FLAG) \
262  do { \
263  AliForwardUtil::PrintName(N); \
264  std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \
265  } while(false)
266 #define PFV(N,VALUE) \
267  do { \
268  AliForwardUtil::PrintName(N); \
269  std::cout << (VALUE) << std::endl; } while(false)
270 
271 //____________________________________________________________________
273 {
274  PFV("MC Weights", "For flow");
275  gROOT->IncreaseDirLevel();
276  gROOT->DecreaseDirLevel();
277 }
278 
279 //____________________________________________________________________
280 //
281 // EOF
282 //
static AliForwardFlowWeights * FromList(TList *l)
double Double_t
Definition: External.C:58
virtual void Init(TList *l)
Double_t CalcPtWeight(Double_t pt, Int_t type) const
Double_t CalcBWeight(Double_t b) const
TCanvas * c
Definition: TestFitELoss.C:172
#define PFV(N, VALUE)
int Int_t
Definition: External.C:63
Various utilities used in PWGLF/FORWARD.
Double_t CalcEtaWeight(Double_t eta, Int_t type) const
virtual void Print(Option_t *option="") const
AliForwardFlowWeights & operator=(const AliForwardFlowWeights &o)
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
unsigned short UShort_t
Definition: External.C:28
const char Option_t
Definition: External.C:48
Double_t CalcCentWeight(Double_t c) const
Double_t CalcPidWeight(Int_t id, Int_t type) const