]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/dNdEta/drawSystematicsNew.C
Reconstruction QA by Sylwester
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / drawSystematicsNew.C
CommitLineData
9e952c39 1
2Int_t markers[] = {20,21,22,23,28,29};
3Int_t colors[] = {1,2,3,4,6,8,102};
4
b541c64c 5void DrawpiKpAndCombinedZOnly(Float_t upperPtLimit=0.99)
6{
7 //gROOT->ProcessLine(".L drawPlots.C");
8 gSystem->Load("libPWG0base");
9
10 const char* fileNames[] = { "systematics.root", "systematics.root", "systematics.root", "correction_map.root" };
11 const char* folderNames[] = { "correction_0", "correction_1", "correction_2", "dndeta_correction" };
12 const char* legendNames[] = { "#pi", "K", "p", "standard" };
13 Int_t folderCount = 3;
14
15
16
17 TH2F* h2DCorrections[4];
18 TH1F* h1DCorrections[4];
19 for (Int_t i=0; i<4; i++) {
20 TFile::Open(fileNames[i]);
21 AlidNdEtaCorrection* correctionTmp = new AlidNdEtaCorrection(folderNames[i],folderNames[i]);
22 correctionTmp->LoadHistograms();
23
24 // h2DCorrections[i] = correctionTmp->GetTrack2ParticleCorrection()->GetTrackCorrection()->Get2DCorrectionHistogram("yz",-1,1);
25
26 h1DCorrections[i] = correctionTmp->GetTrack2ParticleCorrection()->GetTrackCorrection()->Get1DCorrectionHistogram("z",-10,10,0.8,0.8);
27 }
28
29 TH2F* null = new TH2F("","",100,0.1,10,100,0.5,9.99);
30 null->SetXTitle("p_{T} (GeV/c)");
31 null->SetXTitle("Correction");
32
33 null->Draw();
34
35 //h1DCorrections[0]->SetMaximum(5);
36 //h1DCorrections[0]->Draw();
37 // h2DCorrections[0]->Draw("colz");
38 for (Int_t i=1; i<4; i++) {
39 h1DCorrections[i]->Draw("same");
40 }
41
42}
43
44
45void DrawEffectOfChangeInCrossSection() {
46
47 //get the data
48 TFile* fin = TFile::Open("systematics_xsections.root");
49
50 const Char_t* changes[] = {"pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless"};
51 Int_t colors[] = {1,2,103,102,4,6,1};
52
53 TH1F* hRatios[7];
54 for(Int_t i=0; i<7; i++) {
55 hRatios[i] = (TH1F*)fin->Get(Form("ratio_vertexReco_triggerBias_%s",changes[i]));
56 hRatios[i]->SetLineWidth(2);
57 hRatios[i]->SetLineColor(colors[i]);
58 hRatios[i]->SetMarkerStyle(22);
59 hRatios[i]->SetMarkerSize(0.8);
60 }
61
62 TPad* p = DrawCanvasAndPad("syst_changeInXsection",700,400);
63 p->SetRightMargin(0.2);
64 p->SetLeftMargin(0.13);
65
66 TH2F* null = new TH2F("","",100,-1.05,1.05,100,0.93,1.06);
67 null->GetXaxis()->SetTitle("#eta");
68 null->GetYaxis()->SetTitle("Ratio pythia/modified cross-sections");
69 null->Draw();
70
71 TLatex* text[7];
72
73 for(Int_t i=1; i<7; i++) {
74 hRatios[i]->Draw("same");
75
76 TString str(hRatios[i]->GetTitle());
77 str.Remove(0,str.First("DD"));
78 str.Remove(str.First(")"),1);
79 text[i] = new TLatex(1.08,hRatios[i]->GetBinContent(hRatios[i]->FindBin(0.))-0.002,str.Data());
80 text[i]->SetTextColor(colors[i]);
81 text[i]->Draw();
82 }
83}
84
85
86void DrawEffectOfChangeInComposition() {
87
88 //get the data
89 TFile* fin = TFile::Open("systematics_composition.root");
90
91 Int_t colors[] = {1,2,103,102,4,6,1};
92
93 TH1F* hRatios[6];
94
28899aeb 95 Float_t etaRange = 0.899;
96
b541c64c 97 for (Int_t i=0; i<6; i++) {
98 hRatios[i] = (TH1F*)fin->Get(Form("ratio_%d",i));
28899aeb 99
b541c64c 100 hRatios[i]->SetLineWidth(2);
28899aeb 101 hRatios[i]->SetLineColor(colors[i]);
b541c64c 102 hRatios[i]->SetMarkerStyle(22);
103 hRatios[i]->SetMarkerSize(0.8);
28899aeb 104
105 hRatios[i]->GetXaxis()->SetRangeUser(-etaRange, etaRange);
b541c64c 106 }
107
108 TPad* p = DrawCanvasAndPad("syst_changeOfComposition",700,400);
109 p->SetRightMargin(0.2);
110 p->SetLeftMargin(0.13);
111
112 TH2F* null = new TH2F("","",100,-1.05,1.05,100,0.97,1.03);
113 null->GetXaxis()->SetTitle("#eta");
114 null->GetYaxis()->SetTitle("Ratio pythia/modified composition");
115 null->Draw();
116
117 TLatex* text[6];
118
119 for(Int_t i=0; i<6; i++) {
120 hRatios[i]->Draw("same");
121
122 TString str(hRatios[i]->GetTitle());
123 str.Remove(0,16);
28899aeb 124 text[i] = new TLatex(1.08,hRatios[i]->GetBinContent(hRatios[i]->FindBin(0))-0.002,str.Data());
b541c64c 125 text[i]->SetTextColor(colors[i]);
126 text[i]->SetTextSize(0.053);
127
128 text[i]->Draw();
129 }
130
131
132}
133
134TPad* DrawCanvasAndPad(const Char_t* name, Int_t sizeX=600, Int_t sizeY=500) {
135
136 gStyle->SetOptStat(0);
137 gStyle->SetOptTitle(0);
138 gStyle->SetOptFit(0);
139
140 gStyle->SetTextSize(0.04);
141 gStyle->SetTitleSize(0.05,"xyz");
142 //gStyle->SetTitleFont(133, "xyz");
143 //gStyle->SetLabelFont(133, "xyz");
144 //gStyle->SetLabelSize(17, "xyz");
145 gStyle->SetLabelOffset(0.01, "xyz");
146
147 gStyle->SetTitleOffset(1.1, "y");
148 gStyle->SetTitleOffset(1.1, "x");
149 gStyle->SetEndErrorSize(0.0);
150
151 //##############################################
152
153 //making canvas and pads
154 TCanvas *c = new TCanvas(name,name,sizeX,sizeY);
155
156 TPad* p1 = new TPad("pad1","", 0, 0.0, 1.0, 1.0, 0, 0, 0);
157
158 p1->SetBottomMargin(0.15);
159 p1->SetTopMargin(0.03);
160 p1->SetLeftMargin(0.15);
161 p1->SetRightMargin(0.03);
162
163 p1->SetGridx();
164 p1->SetGridy();
165
166 p1->Draw();
167 p1->cd();
168
169 return p1;
170}
9e952c39 171
172void MisalignmentShowRawTrackPlots()
173{
174 gSystem->Load("libPWG0base");
175 TFile* file = TFile::Open("resC-resC/analysis_esd_raw.root");
176 dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
177 fdNdEtaAnalysis->LoadHistograms("dndeta");
178
179 TFile* file2 = TFile::Open("resC-fullA/analysis_esd_raw.root");
180 dNdEtaAnalysis* fdNdEtaAnalysis2 = new dNdEtaAnalysis("dndeta", "dndeta");
181 fdNdEtaAnalysis2->LoadHistograms("dndeta");
182
183 TH3* track1 = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("track1");
184 TH3* track2 = fdNdEtaAnalysis2->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("track2");
185
186 // normalize to number of events;
187 TH2* event1 = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram();
188 TH2* event2 = fdNdEtaAnalysis2->GetData()->GetEventCorrection()->GetMeasuredHistogram();
189 Int_t event1Count = event1->Integral();
190 Int_t event2Count = event2->Integral();
191 track1->Scale(1.0 / event1Count);
192 track2->Scale(1.0 / event2Count);
193
194 const Float_t innerLimit = 0.49;
195 const Float_t outerLimit = 0.99;
196
197 track1->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
198 track2->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
199 AliPWG0Helper::CreateDividedProjections(track1, track2, "ze1");
200 TH1* fullRange = gROOT->FindObject("track1_ze1_div_track2_ze1");
201
202 track1->GetYaxis()->SetRangeUser(-innerLimit, innerLimit);
203 track2->GetYaxis()->SetRangeUser(-innerLimit, innerLimit);
204 AliPWG0Helper::CreateDividedProjections(track1, track2, "ze2");
205 TH1* central = gROOT->FindObject("track1_ze2_div_track2_ze2");
206 central->SetLineColor(1);
207 central->SetMarkerStyle(21);
208
209 for (Int_t x=1; x<track1->GetXaxis()->GetNbins(); ++x)
210 for (Int_t y=track1->GetYaxis()->FindBin(-innerLimit); y<track1->GetYaxis()->FindBin(innerLimit); ++y)
211 for (Int_t z=1; z<track1->GetZaxis()->GetNbins(); ++z)
212 {
213 track1->SetBinContent(x, y, z, 0);
214 track1->SetBinError(x, y, z, 0);
215 track2->SetBinContent(x, y, z, 0);
216 track2->SetBinError(x, y, z, 0);
217 }
218
219 track1->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
220 track2->GetYaxis()->SetRangeUser(-outerLimit, outerLimit);
221 AliPWG0Helper::CreateDividedProjections(track1, track2, "ze3");
222 TH1* peripheral = gROOT->FindObject("track1_ze3_div_track2_ze3");
223 peripheral->SetLineColor(2);
224 peripheral->SetMarkerStyle(22);
225 peripheral->SetMarkerColor(2);
226
227 TH2* tmp = new TH2F("tmp", ";p_{T} [GeV/c] ;#frac{tracks residual misalignment}{tracks full misalignment}", 1, 0.1, 10, 1, 0.9, 1.3);
228
229 tmp->SetStats(kFALSE);
230 //tmp->GetXaxis()->SetNoExponent();
231
232 Float_t ptStart = 0.1;
233
234 fullRange->GetXaxis()->SetRangeUser(ptStart, 9.9);
235 central->GetXaxis()->SetRangeUser(ptStart, 9.9);
236 peripheral->GetXaxis()->SetRangeUser(ptStart, 9.9);
237
238 TCanvas* canvas = new TCanvas("MisalignmentShowRawTrackPlots", "MisalignmentShowRawTrackPlots", 700, 400);
239 gPad->SetLogx();
240 gPad->SetGridx();
241 gPad->SetGridy();
242
243 TLegend* legend = new TLegend(0.2, 0.7, 0.4, 0.8);
244
245 legend->AddEntry(central, "|#eta| < 0.5");
246 legend->AddEntry(peripheral, "0.5 < |#eta| < 1.0");
247
248 legend->SetFillColor(0);
249
250 tmp->Draw();
251 //fullRange->Draw("SAME");
252 central->Draw("SAME");
253 peripheral->Draw("SAME");
254
255 legend->Draw();
256
257 canvas->SaveAs("syst_mis_ntracks.eps");
258}
259
260
261void drawdNdEtaRatios(const char* canvasName, Int_t n, const char** files, const char** dirs, const char** names, Int_t* histID)
262{
263 gSystem->Load("libPWG0base");
264
265 TCanvas* canvas = new TCanvas(canvasName, canvasName, 1000, 500);
266 canvas->Divide(2, 1);
267
268 TLegend* legend = new TLegend(0.63, 0.73, 0.98, 0.98);
269 legend->SetFillColor(0);
270
271 TH1* base = 0;
272
273 for (Int_t i = 0; i < n; ++i)
274 {
275 TFile::Open(files[i]);
276
277 dNdEtaAnalysis* tmp = new dNdEtaAnalysis(dirs[i], dirs[i]);
278 tmp->LoadHistograms();
279
280 TH1* hist = tmp->GetdNdEtaPtCutOffCorrectedHistogram(histID[i]);
281
282 if (i == 0)
283 base = hist;
284
285 legend->AddEntry(hist, names[i]);
286
287 hist->SetMarkerColor(colors[i]);
288 hist->SetMarkerStyle(markers[i]);
289
290 canvas->cd(1);
291 hist->DrawCopy((i == 0) ? "" : "SAME");
292
293 if (i != 0)
294 {
295 canvas->cd(2);
296 hist->Divide(hist, base, 1, 1, "B");
297 hist->GetYaxis()->SetRangeUser(0.98, 1.02);
298 hist->DrawCopy((i == 1) ? "" : "SAME");
299 }
300 }
301
302 legend->Draw();
303
304 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
305}
306
307void drawdNdEtaRatios(const char* canvasName, Int_t n, const char** files1, const char** files2, const char** dirs1, const char** dirs2, const char** names, Int_t* histID)
308{
309 gSystem->Load("libPWG0base");
310
311 TCanvas* canvas = new TCanvas(canvasName, canvasName, 700, 400);
312 canvas->SetLeftMargin(0.12);
313
314 TLegend* legend = new TLegend(0.35, 0.7, 0.65, 0.85);
315 legend->SetFillColor(0);
316
317 for (Int_t i = 0; i < n; ++i)
318 {
319 TFile::Open(files1[i]);
320
321 dNdEtaAnalysis* tmp1 = new dNdEtaAnalysis(dirs1[i], dirs1[i]);
322 tmp1->LoadHistograms();
323
324 TFile::Open(files2[i]);
325
326 dNdEtaAnalysis* tmp2 = new dNdEtaAnalysis(dirs2[i], dirs2[i]);
327 tmp2->LoadHistograms();
328
329 TH1* hist1 = tmp1->GetdNdEtaPtCutOffCorrectedHistogram(histID[i]);
330 TH1* hist2 = tmp2->GetdNdEtaPtCutOffCorrectedHistogram(histID[i]);
331
332 TH1* division = hist1->Clone();
333
334 division->Divide(hist1, hist2, 1, 1, "B");
335
336 division->SetMarkerColor(colors[i]);
337 division->SetMarkerStyle(markers[i]);
338
339 legend->AddEntry(division, names[i]);
340
341 division->SetTitle("");
342 division->GetYaxis()->SetTitle("#frac{dN_{ch}/d#eta using MC vtx}{dN_{ch}/d#eta using ESD vtx}");
343 division->SetStats(kFALSE);
344 division->GetYaxis()->SetTitleOffset(1.3);
345 division->GetXaxis()->SetRangeUser(-0.99, 0.99);
346 division->GetYaxis()->SetRangeUser(0.981, 1.02);
347 division->DrawCopy((i == 0) ? "" : "SAME");
348 }
349
350 gPad->SetGridx();
351 gPad->SetGridy();
352
353 legend->Draw();
354
355 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
356}
357
358void vertexShiftStudy(Int_t histID)
359{
360 const char* files[] = { "maps/idealA/mc-vertex/analysis_esd.root", "results/idealC-idealA/analysis_esd.root", "maps/idealA/mc-vertex-shift-0.05/analysis_esd.root", "maps/idealA/mc-vertex-shift-0.1/analysis_esd.root", "maps/idealA/mc-vertex-shift-dep/analysis_esd.root" };
361 const char* dirs[] = { "dndeta", "dndeta", "dndeta", "dndeta", "dndeta" };
362 const char* names[] = { "mc vtx", "esd vtx", "+ 0.05 cm", "+ 0.1 cm", "old vtx shift" };
363 Int_t hist[] = { histID, histID, histID, histID, histID };
364
365 drawdNdEtaRatios("syst_vertex_shift1", 5, files, dirs, names, hist);
366
367 const char* files1[] = { "maps/idealA/mc-vertex/analysis_esd.root", "maps/idealA/mc-vertex/analysis_esd.root", "maps/idealA/mc-vertex/analysis_esd.root" };
368 const char* files2[] = { "results/idealC-idealA/analysis_esd.root", "results/idealC-idealA/analysis_esd.root", "results/idealC-idealA/analysis_esd.root" };
369 const char* dirs1[] = { "dndeta", "dndeta", "dndeta"};
370 const char* names[] = { "|vtx-z| < 10 cm", "-10 cm < vtx-z < 0 cm", "0 cm < vtx-z < 10 cm" };
371 Int_t hist[] = { 0, 1, 2 };
372
373 drawdNdEtaRatios("syst_vertex_shift2", 3, files1, files2, dirs, dirs, names, hist);
374}
375
376void vertexShift()
377{
378 TFile::Open("vertex.root");
379
380 TH2* hist = gFile->Get("fVertexCorr");
381 TProfile* prof = hist->ProfileX();
382
383 prof->SetStats(kFALSE);
384 prof->SetTitle(";MC vtx-z [cm];mean (ESD vtx-z - MC vtx-z) [cm]");
385 prof->GetYaxis()->SetTitleOffset(1.2);
386
387 prof->SetLineWidth(2);
388
389 TCanvas* canvas = new TCanvas("syst_vertex_shift", "syst_vertex_shift", 700, 400);
390
391 gPad->SetGridx();
392 gPad->SetGridy();
393
394 prof->Draw();
395
396 canvas->SaveAs(Form("%s.eps", canvas->GetName()));
397}
398