]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliForwardFlowWeights.cxx
Moved calculations of flow weights (after burner) into a
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardFlowWeights.cxx
1 #include "AliForwardFlowWeights.h"
2 #include <TGraph.h>
3 #include <TF1.h>
4 #include <TList.h>
5 #include <TMath.h>
6
7 //____________________________________________________________________
8 AliForwardFlowWeights::AliForwardFlowWeights()
9   : fV22Pt(0), 
10     fV24Pt(0), 
11     fV24AltPt(0),
12     fV2B(0), 
13     fV2C(0)
14 {}
15
16 //____________________________________________________________________
17 AliForwardFlowWeights::AliForwardFlowWeights(const AliForwardFlowWeights& o)
18   : TObject(o),
19     fV22Pt(o.fV22Pt),
20     fV24Pt(o.fV24Pt),
21     fV24AltPt(o.fV24AltPt),
22     fV2B(o.fV2B), 
23     fV2C(o.fV2C)
24 {}
25
26 //____________________________________________________________________
27 AliForwardFlowWeights&
28 AliForwardFlowWeights::operator=(const AliForwardFlowWeights& o)
29 {
30   if (&o == this) return *this;
31
32   fV22Pt    = (o.fV22Pt ?    static_cast<TGraph*>(o.fV22Pt->Clone())    : 0);
33   fV24Pt    = (o.fV24Pt ?    static_cast<TGraph*>(o.fV24Pt->Clone())    : 0);
34   fV24AltPt = (o.fV24AltPt ? static_cast<TGraph*>(o.fV24AltPt->Clone()) : 0);
35   fV2B      = (o.fV2B   ?    static_cast<TGraph*>(o.fV2B->Clone())      : 0);
36   fV2C      = (o.fV2C   ?    static_cast<TGraph*>(o.fV2C->Clone())      : 0);
37
38   return *this;
39 }
40
41 namespace {
42   const char* fgkPt2Name = "v22VsPt";
43   const char* fgkPt4Name = "v24VsPt";
44   const char* fgkPt4Alt  = "v24AltVsPt";
45   const char* fgkBName   = "v2VsB";
46   const char* fgkCName   = "v2VsC";
47 }
48
49 //____________________________________________________________________
50 void
51 AliForwardFlowWeights::Init(TList* l)
52 {
53   Int_t          ptN     = 19;
54   const Double_t ptX[]   = {0.00,     0.25,     0.350,    0.45, 
55                             0.55,     0.650,    0.75,     0.85, 
56                             0.950,    1.10,     1.30,     1.500,
57                             1.70,     1.90,     2.250,    2.75, 
58                             3.25,     3.750,    4.50};
59   { 
60     // v2{2} dependence on pt
61     const Double_t y[] = {0.00000,  0.043400, 0.059911, 0.073516,
62                           0.089756, 0.105486, 0.117391, 0.128199,
63                           0.138013, 0.158271, 0.177726, 0.196383,
64                           0.208277, 0.216648, 0.242954, 0.249961,
65                           0.240131, 0.269006, 0.207796};
66     
67     fV22Pt = new TGraph(ptN, ptX, y);
68     fV22Pt->SetName(fgkPt2Name);
69     fV22Pt->SetMarkerStyle(20);
70     fV22Pt->SetMarkerColor(kRed+1);
71     l->Add(fV22Pt);
72   }
73
74   {
75     const Double_t y[] = {0.000000, 0.038646, 0.049824, 0.066662,
76                           0.075856, 0.081583, 0.099778, 0.104674,
77                           0.118545, 0.131874, 0.152959, 0.155348,
78                           0.169751, 0.179052, 0.178532, 0.198851,
79                           0.185737, 0.239901, 0.186098};
80
81     // v2{4} dependence on pt 
82     fV24Pt = new TGraph(ptN, ptX, y);
83     fV24Pt->SetName(fgkPt4Name);
84     fV24Pt->SetMarkerStyle(20);
85     fV24Pt->SetMarkerColor(kBlue+1);
86     l->Add(fV24Pt);
87   }
88
89   {
90     const Double_t y[] = {0.000000, 0.037071, 0.048566, 0.061083,
91                           0.070910, 0.078831, 0.091396, 0.102026,
92                           0.109691, 0.124449, 0.139819, 0.155561,
93                           0.165701, 0.173678, 0.191149, 0.202015,
94                           0.204540, 0.212560, 0.195885};
95     // v2{4} dependence on pt (30-40%)
96     fV24AltPt = new TGraph(ptN, ptX, y);
97     fV24AltPt->SetName(fgkPt4Alt);
98     fV24AltPt->SetMarkerStyle(20);
99     fV24AltPt->SetMarkerColor(kBlue+1);
100     l->Add(fV24AltPt);
101   }
102   Int_t nb            = 8;
103   const Double_t by[] = {0.017855, 0.032440, 0.055818, 0.073137,
104                          0.083898, 0.086690, 0.082040, 0.077777};
105   {
106     // V2 dependence on impact parameter
107     const Double_t x[] = {1.75,     4.225,    5.965,    7.765,
108                           9.215,    10.46,    11.565,   12.575};
109     fV2B = new TGraph(nb, x, by);
110     fV2B->SetName(fgkBName);
111     fV2B->SetMarkerStyle(20);
112     fV2B->SetMarkerColor(kGreen+1);
113     l->Add(fV2B);
114   }
115   {
116     // V2 dependence on impact parameter
117     const Double_t x[] = { 2.5, 7.5, 15, 25, 35, 45, 55, 65};
118     fV2C = new TGraph(nb, x, by);
119     fV2C->SetName(fgkCName);
120     fV2C->SetMarkerStyle(20);
121     fV2C->SetMarkerColor(kGreen+1);
122     l->Add(fV2C);
123   }
124 }
125
126 //____________________________________________________________________
127 Double_t
128 AliForwardFlowWeights::CalcEtaWeight(Double_t eta, Int_t type) const
129 {
130   if (type == 0) return 1;
131   return 0.1 * TMath::Gaus(eta, 0, (type == 2 ? 3. : 
132                                     type == 3 ? 15 : 9));
133 }
134 //____________________________________________________________________
135 Double_t
136 AliForwardFlowWeights::CalcPidWeight(Int_t id, Int_t type) const
137 {
138   if (type == 0) return 1;
139   if (type == 2) return 1.207;
140   switch (TMath::Abs(id)) {
141   case 211:  return 1.3; break; // pions 
142   case 2212: return 1.0; break; // protons 
143   default:   return 0.7; break;
144   }
145   return 1;
146 }
147 //____________________________________________________________________
148 Double_t
149 AliForwardFlowWeights::CalcPtWeight(Double_t pt, Int_t type) const
150 {
151   switch (type) { 
152   case 0: return 1;
153   case 2: return fV22Pt->Eval(pt);
154   case 3: return fV24AltPt->Eval(pt); // From 30-40
155   case 4: return fV24Pt->Eval(pt);
156   }
157   return 0.5 * (fV22Pt->Eval(pt) + fV24Pt->Eval(pt));
158 }
159
160 //____________________________________________________________________
161 Double_t
162 AliForwardFlowWeights::CalcBWeight(Double_t b) const
163 {
164   return fV2B->Eval(b) / fV2B->Eval(10.46);
165 }
166
167 //____________________________________________________________________
168 Double_t
169 AliForwardFlowWeights::CalcCentWeight(Double_t c) const
170 {
171   return fV2C->Eval(c) / fV2C->Eval(45);
172 }
173
174 //____________________________________________________________________
175 Double_t
176 AliForwardFlowWeights::CalcWeight(Double_t eta, 
177                                   Double_t pt, 
178                                   Double_t phi,  
179                                   Int_t    id, 
180                                   Double_t phiR, 
181                                   Double_t cOrB, 
182                                   Int_t    type, 
183                                   UShort_t order,
184                                   UShort_t what) const
185 {
186   Double_t w = 1;
187   if (what & kEta)  w *= CalcEtaWeight(eta, type);
188   if (what & kPt)   w *= CalcPtWeight(pt, type);
189   if (what & kPID)  w *= CalcPidWeight(id, type);
190   if      (what & kCent) w *= CalcCentWeight(cOrB);
191   else if (what & kB)    w *= CalcBWeight(cOrB);
192   
193   w *= 20 * 2. * TMath::Cos(order * (phi - phiR));
194
195   return w;
196 }
197
198 //____________________________________________________________________
199 Double_t
200 AliForwardFlowWeights::CalcWeight(Double_t eta,  Double_t pt, 
201                                   Double_t phi,  Int_t id, 
202                                   Double_t phiR, Double_t b) const
203 {
204   return CalcWeight(eta, pt, phi, id, phiR, b, 1, 2, kEta|kPt|kPID|kB);
205   
206 }
207
208 namespace {
209   TObject* GetListObject(TList* l, const char* name)
210   {
211     if (!name || name[0] == '\0') { 
212       Error("GetListObject", "No object name");
213       return 0;
214     }
215     if (!l) { 
216       Error("GetListObject", "No list");
217       return 0;
218     }
219     TObject* o = l->FindObject(name);
220     if (!o) { 
221       Error("GetListObject", "Object %s not found in list %s",  
222             name, l->GetName());
223       return 0;
224     }
225     return o;
226   }
227 }
228 //____________________________________________________________________
229 AliForwardFlowWeights*
230 AliForwardFlowWeights::FromList(TList* l)
231 {
232   TObject* pt2 = GetListObject(l, fgkPt2Name);
233   TObject* pt4 = GetListObject(l, fgkPt4Name);
234   TObject* alt = GetListObject(l, fgkPt4Alt);
235   TObject* b   = GetListObject(l, fgkBName);
236   TObject* c   = GetListObject(l, fgkCName);
237
238   if (!pt2 || !pt4 || !alt || !b || !c) {
239     ::Error("FromList", "One or more histograms not found");
240     return 0;
241   }
242   AliForwardFlowWeights* ret = new AliForwardFlowWeights;
243   ret->fV22Pt    = static_cast<TGraph*>(pt2);
244   ret->fV24Pt    = static_cast<TGraph*>(pt4);
245   ret->fV24AltPt = static_cast<TGraph*>(alt);
246   ret->fV2B      = static_cast<TGraph*>(b);
247   ret->fV2C      = static_cast<TGraph*>(c);
248   
249   return ret;
250 }
251
252 //____________________________________________________________________
253 //
254 // EOF
255 //