9 #include <TProfile2D.h>
11 #include "AliFMDAnaESD.h"
12 #include "AliFMDAnaFlowRing.h"
15 # include "background.C"
16 // # include "background2.C"
18 TH2* bgFMD1i() { return 0; }
19 TH2* bgFMD2i() { return 0; }
20 TH2* bgFMD2o() { return 0; }
21 TH2* bgFMD3o() { return 0; }
22 TH2* bgFMD3o() { return 0; }
25 # include "reactionplane.C"
27 Float_t reactionplane(int ev) { return 0; }
32 //====================================================================
33 class AliFMDAnaFlow : public AliFMDAnaESD
36 //__________________________________________________________________
38 AliFMDAnaFlow(Int_t n=2, Bool_t bg=false, Float_t cut0=.68)
39 : fAxis(n, -3.7, 5.3),
40 fV2("all", "Full FMD", 2, 1, fAxis)
42 for (int i = 0; i < 5; i++) {
43 UShort_t det = (i == 0 ? 1 : (i <= 2 ? 2 : 3));
44 Char_t rng = (i == 0 ? 'I' : (i % 2 == 1 ? 'I' : 'O'));
45 AddRing(new AliFMDAnaFlowRing(det,rng,n,EtaMin(i)+.1,EtaMax(i)-.1,
46 Bg(bg,i),cut0,Cut1(i)));
49 //__________________________________________________________________
51 AliFMDAnaFlow(Float_t deta, Bool_t bg=false, Float_t cut0=.68)
52 : fAxis(Int_t((5.3- -3.7)/deta), -3.7, 5.3),
53 fV2("all", "Full FMD", 2, 1, fAxis)
55 for (int i = 0; i < 5; i++) {
56 UShort_t det = (i == 0 ? 1 : i <= 2 ? 2 : 3);
57 Char_t rng = (i % 2 == 0 ? 'I' : 'O');
58 AddRing(new AliFMDAnaFlowRing(det,rng,fAxis,Bg(bg,i),cut0,Cut1(i)));
61 //__________________________________________________________________
70 Float_t pi2 = 2 * TMath::Pi();
72 fPsi = new TH2D("all_psi", "Event planes",
73 fAxis.N(), fAxis.Bins(), 40, 0, pi2);
74 fPsi->SetXTitle("#eta");
75 fPsi->SetYTitle("#Psi");
76 fPsi->SetZTitle("Frequency");
77 fPsi->SetMarkerStyle(20);
79 fDPsi = new TProfile("all_dpsi", "Distance to real #Psi_{R}",
80 fAxis.N(), fAxis.Bins(), -pi2, pi2);
81 fDPsi->SetXTitle("#eta");
82 fDPsi->SetYTitle("#Delta#Psi=|#Psi-#Psi_{R}|");
84 fDPhi = new TProfile2D("all_dphi","Distribution of phi signals",
85 fAxis.N(), -3.7, 5.3, 40, 0, pi2, 0, 20);
86 fDPhi->SetXTitle("#eta");
87 fDPhi->SetYTitle("#varphi");
88 fDPhi->SetZTitle("signal");
89 fDPhi->SetMarkerStyle(20);
91 return AliFMDAnaESD::Init();
93 //__________________________________________________________________
94 /** Called at the beginning of an event */
95 Bool_t Begin(Int_t ev)
98 Float_t psir = reactionplane(fNEvents);
99 AliFMDAnaFlowRing* fring = 0;
100 for (size_t i = 0; i < 5; i++) {
101 if (!fRing[i]) continue;
102 fring = static_cast<AliFMDAnaFlowRing*>(fRing[i]);
103 fring->fTrue.SetPsi(psir);
105 return AliFMDAnaESD::Begin(ev);
107 //__________________________________________________________________
108 /** Fill in one strip */
109 void Fill(Float_t phi, Float_t eta, Float_t mult)
111 Int_t imult = Int_t(mult+.33);
112 if (fNObserv + imult >= fEtas.fN) {
113 ULong_t n = Int_t(fEtas.fN * 1.5)+imult;
118 for (Int_t i = 0; i < imult; i++) {
119 fEtas[fNObserv] = eta;
120 fPhis[fNObserv] = phi;
121 fWeights[fNObserv] = 1;
124 fDPhi->Fill(eta, phi);
126 //__________________________________________________________________
127 /** Called at the end of an event */
130 float psir = reactionplane(fNEvents-1);
131 // std::cout << "PsiR=" << psir << std::endl;
132 fV2.Event(fNObserv, fPhis.fArray, fEtas.fArray,
133 fWeights.fArray, fWeights.fArray);
134 for (UShort_t i = 0; i < fAxis.N(); i++) {
135 AliFMDFlowBin* bin = fV2.GetBin(i);
136 if (bin && bin->Counts() > 0) {
137 fPsi->Fill(fAxis.BinCenter(i), bin->Psi() - psir);
138 fDPsi->Fill(fAxis.BinCenter(i), bin->Psi() - psir);
141 return AliFMDAnaESD::End();
143 //__________________________________________________________________
145 TH1* MakeFrame(const char* xname, const char* yname,
146 Float_t ymin, Float_t ymax)
150 TH1* frame = new TH1D(Form("frame%d", id), "Frame",
151 fAxis.N(), fAxis.Bins()[0], fAxis.Bins()[fAxis.N()]);
152 frame->SetMinimum(ymin);
153 frame->SetMaximum(ymax);
154 frame->SetXTitle(xname);
155 frame->SetYTitle(yname);
156 frame->SetLabelFont(132, "XYZ");
157 frame->SetTitleFont(132, "XYZ");
158 frame->SetLabelSize(.08, "XYZ");
159 frame->SetTitleSize(.08, "XYZ");
160 frame->SetTitleOffset(.5, "XYZ");
161 frame->SetNdivisions(8, "XYZ");
165 //__________________________________________________________________
166 /** called at the end of a run */
169 gStyle->SetPalette(1);
170 gStyle->SetOptTitle(0);
171 gStyle->SetOptStat(0);
172 AliFMDAnaFlowRing* fring[5];
173 for (size_t i = 0; i < 5; i++)
174 fring[i] = static_cast<AliFMDAnaFlowRing*>(fRing[i]);
176 TCanvas* c = new TCanvas("c1", "Result", 600, 750);
179 c->SetTopMargin(0.02);
180 c->SetRightMargin(0.02);
184 c->SetHighLightColor(0);
194 f = MakeFrame("#eta", "|#Psi_{2}-#Psi_{R}|", -TMath::Pi(), TMath::Pi());
195 for (int i = 0; i < 5; i++) fring[i]->fDPsi.Draw("same");
202 f = MakeFrame("#eta", "R_{k}", .7, 1);
203 for (int i = 0; i < 5; i++) fring[i]->fV2.Draw("tr:same");
210 f = MakeFrame("#eta", "v_{2}", 0, .1);
211 for (int i = 0; i < 5; i++) {
212 fring[i]->fV2.Draw("th:same");
213 fring[i]->fTrue.Draw("th:same");
218 for (int i = 0; i < 5; i++) {
219 fring[i]->fV2.Print("s");
220 fring[i]->fTrue.Print("s");
223 gROOT->GetListOfSpecials()->Add(this);
226 void ToFile(const char* file) {
227 TFile* out = TFile::Open(file, "RECREATE");
228 for (int i = 0; i < 5; i++) fRing[i]->Write(fRing[i]->Name());
230 if (fPsi) fPsi->Write();
231 if (fDPsi) fDPsi->Write();
232 if (fDPhi) fDPhi->Write();
238 //__________________________________________________________________
239 /** Get min pseudo rapidity of ring idx */
240 Float_t EtaMin(Int_t idx) const {
242 case 0: return 3.61728; break; // FMD1I
243 case 1: return 2.18122; break; // FMD2I
244 case 2: return 1.79821; break; // FMD2O
245 case 3: return -3.39913; break; // FMD3I
246 case 4: return -2.28925; break; // FMD3O
250 //__________________________________________________________________
251 /** Get max pseudo rapidity of ring idx */
252 Float_t EtaMax(Int_t idx) const {
254 case 0: return 5.02643; break; // FMD1I
255 case 1: return 3.57899; break; // FMD2I
256 case 2: return 2.39085; break; // FMD2O
257 case 3: return -2.00644; break; // FMD3I
258 case 4: return -1.70080; break; // FMD3O
262 //__________________________________________________________________
263 /** Get cut 1 of ring idx */
264 Float_t Cut1(Int_t idx) const {
266 case 0: return 1.33857; break; // FMD1I
267 case 1: return 1.30464; break; // FMD2I
268 case 2: return 1.27263; break; // FMD2O
269 case 3: return 1.28052; break; // FMD3I
270 case 4: return 1.23041; break; // FMD3O
274 //__________________________________________________________________
275 /** Get background correction of ring idx */
276 TH2* Bg(Bool_t use, Int_t idx) const {
279 case 0: return bgFMD1i(); break;
280 case 1: return bgFMD2i(); break;
281 case 2: return bgFMD2o(); break;
282 case 3: return bgFMD3i(); break;
283 case 4: return bgFMD3o(); break;
288 AliFMDFlowAxis fAxis;
290 AliFMDFlowBinned1D fV2;
295 /** Cache of weights */
297 /** Number of observables */
299 /** Histogram of Psi */
300 TH2D* fPsi; // Event planes
301 /** Histogram of dPsi */
302 TProfile* fDPsi; // Mean distance to Psi
303 /** Histogram of dPhi */
305 ClassDef(AliFMDAnaFlow,1)
308 //____________________________________________________________________