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