]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/drawProtonQAResults.C
Updates of the macro that dispays the results (efficiency plots) - Efficiency calcula...
[u/mrichter/AliRoot.git] / PWG2 / drawProtonQAResults.C
CommitLineData
0008a5a6 1void drawProtonQAResults(const char* filename1 = "Protons.QA.root",
2 const char* filename2 = "Protons.MC.QA.root") {
3 //Macro to visualize the results of the proton QA task
cc0fbd97 4 gStyle->SetPalette(1,0);
1c21299a 5
6 TFile *fQA = TFile::Open(filename1);
7 TList *listGlobalQA = (TList *)fQA->Get("globalQAList");
8 drawCutStatistics(listGlobalQA);
9
10 TFile *fMC = TFile::Open(filename2);
11 TList *listPDG = (TList *)fMC->Get("pdgCodeList");
12 TList *listMCProcesses = (TList *)fMC->Get("mcProcessList");
13 drawMCQA(listPDG,listMCProcesses);
14
15 fQA->Close();
16 fMC->Close();
0008a5a6 17}
cc0fbd97 18
0008a5a6 19//________________________________________//
1c21299a 20void drawCutStatistics(TList *list) {
0008a5a6 21 //Function to display the statistics from the cuts
22 //The histogram shows the influence of each cut on the primary
23 //and secondary (anti)protons
24 const Int_t NQAHISTOSPERLIST = 26;
cc0fbd97 25
1c21299a 26 Double_t gEntriesQA2DList[10] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
cc0fbd97 27 Double_t gEntriesQAPrimaryProtonsAcceptedList[NQAHISTOSPERLIST], gEntriesQAPrimaryProtonsRejectedList[NQAHISTOSPERLIST];
28 Double_t gEntriesQASecondaryProtonsAcceptedList[NQAHISTOSPERLIST], gEntriesQASecondaryProtonsRejectedList[NQAHISTOSPERLIST];
29 Double_t gEntriesQAPrimaryAntiProtonsAcceptedList[NQAHISTOSPERLIST], gEntriesQAPrimaryAntiProtonsRejectedList[NQAHISTOSPERLIST];
30 Double_t gEntriesQASecondaryAntiProtonsAcceptedList[NQAHISTOSPERLIST], gEntriesQASecondaryAntiProtonsRejectedList[NQAHISTOSPERLIST];
31
32 for(Int_t i = 0; i < NQAHISTOSPERLIST; i++) {
33 gEntriesQAPrimaryProtonsAcceptedList[i] = 0.0;
34 gEntriesQAPrimaryProtonsRejectedList[i] = 0.0;
35 gEntriesQASecondaryProtonsAcceptedList[i] = 0.0;
36 gEntriesQASecondaryProtonsRejectedList[i] = 0.0;
37 gEntriesQAPrimaryAntiProtonsAcceptedList[i] = 0.0;
38 gEntriesQAPrimaryAntiProtonsRejectedList[i] = 0.0;
39 gEntriesQASecondaryAntiProtonsAcceptedList[i] = 0.0;
40 gEntriesQASecondaryAntiProtonsRejectedList[i] = 0.0;
41 }
42
cc0fbd97 43 TList *fQA2DList = (TList *)list->At(0);
44 GetQAEntries(fQA2DList,gEntriesQA2DList);
45
46 TList *fQAPrimaryProtonsAcceptedList = (TList *)list->At(1);
47 GetQAEntries(fQAPrimaryProtonsAcceptedList,gEntriesQAPrimaryProtonsAcceptedList);
48
49 TList *fQAPrimaryProtonsRejectedList = (TList *)list->At(2);
50 GetQAEntries(fQAPrimaryProtonsRejectedList,gEntriesQAPrimaryProtonsRejectedList);
51
52 TList *fQASecondaryProtonsAcceptedList = (TList *)list->At(3);
53 GetQAEntries(fQASecondaryProtonsAcceptedList,gEntriesQASecondaryProtonsAcceptedList);
54
55 TList *fQASecondaryProtonsRejectedList = (TList *)list->At(4);
56 GetQAEntries(fQASecondaryProtonsRejectedList,gEntriesQASecondaryProtonsRejectedList);
57
58 TList *fQAPrimaryAntiProtonsAcceptedList = (TList *)list->At(5);
59 GetQAEntries(fQAPrimaryAntiProtonsAcceptedList,gEntriesQAPrimaryAntiProtonsAcceptedList);
60
61 TList *fQAPrimaryAntiProtonsRejectedList = (TList *)list->At(6);
62 GetQAEntries(fQAPrimaryAntiProtonsRejectedList,gEntriesQAPrimaryAntiProtonsRejectedList);
63
64 TList *fQASecondaryAntiProtonsAcceptedList = (TList *)list->At(7);
65 GetQAEntries(fQASecondaryAntiProtonsAcceptedList,gEntriesQASecondaryAntiProtonsAcceptedList);
66
67 TList *fQASecondaryAntiProtonsRejectedList = (TList *)list->At(8);
68 GetQAEntries(fQASecondaryAntiProtonsRejectedList,gEntriesQASecondaryAntiProtonsRejectedList);
69
70 //_______________________________________________________//
71 //Create the histograms
0008a5a6 72 const Int_t nx = 26;
cc0fbd97 73 char *fCutName[nx] = {"Tracks","",
74 "ITS Clusters",
75 "#chi^{2}/N_{ITS-Clusters}",
76 "TPC Clusters",
77 "#chi^{2}/N_{TPC-Clusters}",
78 "ExtCov11",
79 "ExtCov22",
80 "ExtCov33",
81 "ExtCov44",
82 "ExtCov55",
83 "#sigma_{Vertex}",
84 "#sigma_{Vertex-TPC}",
0008a5a6 85 "DCA_{xy}",
86 "DCA_{xy}(TPC)",
87 "DCA_{z}",
88 "DCA_{z}(TPC)",
89 "#chi^{2}(vertex)",
cc0fbd97 90 "ITS refit",
91 "TPC refit",
92 "ESD pid",
93 "TPC pid","",
94 "N_{Secondaries}/N_{total}","",""};
0008a5a6 95 char *fCutITSName[6] = {"SPD_{1}","SPD_{2}",
96 "SDD_{1}","SDD_{2}",
97 "SSD_{1}","SSD_{2}"};
cc0fbd97 98
0008a5a6 99 //cut influence
cc0fbd97 100 TH2F *hEmpty = new TH2F("hEmpty","",nx,0,nx,100,0,100);
101 hEmpty->SetStats(kFALSE);
102 hEmpty->SetMarkerStyle(kFullCircle);
103 hEmpty->SetLineColor(2); hEmpty->SetMarkerColor(2);
104 hEmpty->GetYaxis()->SetTitle("Influence of the cuts [%]");
105 for(Int_t i = 1; i <= nx; i++)
106 hEmpty->GetXaxis()->SetBinLabel(i,fCutName[i-1]);
107 hEmpty->GetXaxis()->SetLabelOffset(0.01);
108 hEmpty->GetXaxis()->SetLabelSize(0.045);
109
110 //primary protons
111 TH1F *hPrimaryProtons = new TH1F("hPrimaryProtons","",nx,0,nx);
112 hPrimaryProtons->SetStats(kFALSE);
113 hPrimaryProtons->SetMarkerStyle(kFullCircle);
114 hPrimaryProtons->SetLineColor(4); hPrimaryProtons->SetLineWidth(2);
115 hPrimaryProtons->SetMarkerColor(4);
116 hPrimaryProtons->GetYaxis()->SetTitle("Influence of the cuts [%]");
117 for(Int_t i = 1; i <= nx; i++) {
118 hPrimaryProtons->SetBinContent(i,-10.);
119 hPrimaryProtons->GetXaxis()->SetBinLabel(i,fCutName[i-1]);
120 }
121 hPrimaryProtons->GetXaxis()->SetLabelOffset(0.01);
122 hPrimaryProtons->GetXaxis()->SetLabelSize(0.045);
123
124 //secondary protons
125 TH1F *hSecondaryProtons = new TH1F("hSecondaryProtons","",nx,0,nx);
126 hSecondaryProtons->SetStats(kFALSE);
127 hSecondaryProtons->SetMarkerStyle(22);
128 hSecondaryProtons->SetMarkerSize(1.4);
129 hSecondaryProtons->SetLineColor(2); hSecondaryProtons->SetLineWidth(2);
130 hSecondaryProtons->SetMarkerColor(2);
131 hSecondaryProtons->GetYaxis()->SetTitle("Influence of the cuts [%]");
132 for(Int_t i = 1; i <= nx; i++) {
133 hSecondaryProtons->SetBinContent(i,-10.);
134 hSecondaryProtons->GetXaxis()->SetBinLabel(i,fCutName[i-1]);
135 }
136 hSecondaryProtons->GetXaxis()->SetLabelOffset(0.01);
137 hSecondaryProtons->GetXaxis()->SetLabelSize(0.045);
138
139 //primary antiprotons
140 TH1F *hPrimaryAntiProtons = new TH1F("hPrimaryAntiProtons","",nx,0,nx);
141 hPrimaryAntiProtons->SetStats(kFALSE);
142 hPrimaryAntiProtons->SetMarkerStyle(kFullCircle);
143 hPrimaryAntiProtons->SetLineColor(4); hPrimaryAntiProtons->SetLineWidth(2);
144 hPrimaryAntiProtons->SetMarkerColor(4);
145 hPrimaryAntiProtons->GetYaxis()->SetTitle("Influence of the cuts [%]");
146 for(Int_t i = 1; i <= nx; i++) {
147 hPrimaryAntiProtons->SetBinContent(i,-10.);
148 hPrimaryAntiProtons->GetXaxis()->SetBinLabel(i,fCutName[i-1]);
149 }
150 hPrimaryAntiProtons->GetXaxis()->SetLabelOffset(0.01);
151 hPrimaryAntiProtons->GetXaxis()->SetLabelSize(0.045);
152
153 //secondary antiprotons
154 TH1F *hSecondaryAntiProtons = new TH1F("hSecondaryAntiProtons","",nx,0,nx);
155 hSecondaryAntiProtons->SetStats(kFALSE);
156 hSecondaryAntiProtons->SetMarkerStyle(22);
157 hSecondaryAntiProtons->SetMarkerSize(1.4);
158 hSecondaryAntiProtons->SetLineColor(2); hSecondaryAntiProtons->SetLineWidth(2);
159 hSecondaryAntiProtons->SetMarkerColor(2);
160 hSecondaryAntiProtons->GetYaxis()->SetTitle("Influence of the cuts [%]");
161 for(Int_t i = 1; i <= nx; i++) {
162 hSecondaryAntiProtons->SetBinContent(i,-10.);
163 hSecondaryAntiProtons->GetXaxis()->SetBinLabel(i,fCutName[i-1]);
164 }
165 hSecondaryAntiProtons->GetXaxis()->SetLabelOffset(0.01);
166 hSecondaryAntiProtons->GetXaxis()->SetLabelSize(0.045);
167 //_______________________________________________________//
168
169 //1D for primary protons
0008a5a6 170 //cout<<"_____________________________________________________"<<endl;
171 //cout<<"_______________PRIMARY PROTONS_______________________"<<endl;
cc0fbd97 172 hPrimaryProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[0],gEntriesQA2DList[1]));
173
0008a5a6 174 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
cc0fbd97 175 hPrimaryProtons->SetBinContent(i+1,GetPercentage(gEntriesQAPrimaryProtonsAcceptedList[i-2],
0008a5a6 176 gEntriesQAPrimaryProtonsRejectedList[i-2]));
cc0fbd97 177
178 //1D for secondary protons
0008a5a6 179 //cout<<"_____________________________________________________"<<endl;
180 //cout<<"_______________SECONDARY PROTONS_____________________"<<endl;
cc0fbd97 181 hSecondaryProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[2],gEntriesQA2DList[3]));
0008a5a6 182
183 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
cc0fbd97 184 hSecondaryProtons->SetBinContent(i+1,GetPercentage(gEntriesQASecondaryProtonsAcceptedList[i-2],
0008a5a6 185 gEntriesQASecondaryProtonsRejectedList[i-2]));
186 hSecondaryProtons->SetBinContent(24,GetPercentage(gEntriesQA2DList[0],gEntriesQA2DList[2]));
cc0fbd97 187
188 //1D for primary antiprotons
0008a5a6 189 //cout<<"_________________________________________________________"<<endl;
190 //cout<<"_______________PRIMARY ANTIPROTONS_______________________"<<endl;
cc0fbd97 191 hPrimaryAntiProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[4],gEntriesQA2DList[5]));
0008a5a6 192
193 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
cc0fbd97 194 hPrimaryAntiProtons->SetBinContent(i+1,GetPercentage(gEntriesQAPrimaryAntiProtonsAcceptedList[i-2],
0008a5a6 195 gEntriesQAPrimaryAntiProtonsRejectedList[i-2]));
196
cc0fbd97 197 //1D for secondary antiprotons
0008a5a6 198 //cout<<"_________________________________________________________"<<endl;
199 //cout<<"_______________SECONDARY ANTIPROTONS_____________________"<<endl;
cc0fbd97 200 hSecondaryAntiProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[6],gEntriesQA2DList[7]));
cc0fbd97 201
0008a5a6 202 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
cc0fbd97 203 hSecondaryAntiProtons->SetBinContent(i+1,GetPercentage(gEntriesQASecondaryAntiProtonsAcceptedList[i-2],
0008a5a6 204 gEntriesQASecondaryAntiProtonsRejectedList[i-2]));
205 hSecondaryAntiProtons->SetBinContent(24,GetPercentage(gEntriesQA2DList[4],gEntriesQA2DList[6]));
cc0fbd97 206
207 TLatex *t1 = new TLatex();
208 t1->SetTextSize(0.04);
209 //_________________________________________________________//
0008a5a6 210 TCanvas *c1 = new TCanvas("c1","Cut Influence - Protons",0,0,950,550);
cc0fbd97 211 c1->SetFillColor(10); c1->GetFrame()->SetFillColor(10);
212 c1->SetHighLightColor(10); c1->SetBottomMargin(0.15);
213 c1->SetGridx(); c1->SetGridy();
214
215 for(Int_t i = 1; i <= nx; i++) {
216 hPrimaryProtons->SetBinError(i,1.0);
217 hSecondaryProtons->SetBinError(i,1.0);
218 }
1c21299a 219 hEmpty->DrawCopy();
220 hPrimaryProtons->DrawCopy("EHISTSAME");
221 hSecondaryProtons->DrawCopy("EHISTSAME");
0008a5a6 222 DrawMarker(20.5, 90, 20, 1.2, 4);
223 t1->DrawLatex(21,88,"Primary p");
224 DrawMarker(20.5, 80, 22, 1.2, 2);
225 t1->DrawLatex(21,78,"Secondary p");
cc0fbd97 226
0008a5a6 227 c1->SaveAs("CutInfluence-Protons.gif");
cc0fbd97 228
229 //_________________________________________________________//
1c21299a 230 TCanvas *c2 = new TCanvas("c2","Cut Influence - AntiProtons",50,50,950,550);
cc0fbd97 231 c2->SetFillColor(10); c2->GetFrame()->SetFillColor(10);
232 c2->SetHighLightColor(10); c2->SetBottomMargin(0.15);
233 c2->SetGridx(); c2->SetGridy();
234
235 for(Int_t i = 1; i <= nx; i++) {
236 hPrimaryAntiProtons->SetBinError(i,1.0);
237 hSecondaryAntiProtons->SetBinError(i,1.0);
238 }
1c21299a 239 hEmpty->DrawCopy();
240 hPrimaryAntiProtons->DrawCopy("EHISTSAME");
241 hSecondaryAntiProtons->DrawCopy("EHISTSAME");
0008a5a6 242 DrawMarker(20.5, 90, 20, 1.2, 4);
243 t1->DrawLatex(21,88,"Primary #bar{p}");
244 DrawMarker(20.5, 80, 22, 1.2, 2);
245 t1->DrawLatex(21,78,"Secondary #bar{p}");
246
247 c2->SaveAs("CutInfluence-AntiProtons.gif");
248
249 //_________________________________________________________//
250 //ITS layers influence
251 TH2F *hEmptyITS = new TH2F("hEmptyITS","",10,0,10,100,0,100);
252 hEmptyITS->SetStats(kFALSE);
253 hEmptyITS->SetMarkerStyle(kFullCircle);
254 hEmptyITS->SetLineColor(2); hEmptyITS->SetMarkerColor(2);
255 hEmptyITS->GetYaxis()->SetTitle("Influence of the ITS layers [%]");
256 hEmptyITS->GetYaxis()->SetTitleOffset(1.3);
257 for(Int_t i = 1; i <= 6; i++)
258 hEmptyITS->GetXaxis()->SetBinLabel(i,fCutITSName[i-1]);
259 hEmptyITS->GetXaxis()->SetLabelOffset(0.01);
260 hEmptyITS->GetXaxis()->SetLabelSize(0.045);
261
262 //_________________________________________________________//
263 //primary protons
264 TH1F *hPrimaryProtonsITS = new TH1F("hPrimaryProtonsITS","",7,0,7);
265 hPrimaryProtonsITS->SetStats(kFALSE);
266 hPrimaryProtonsITS->SetMarkerStyle(kFullCircle);
267 hPrimaryProtonsITS->SetLineColor(4); hPrimaryProtonsITS->SetLineWidth(2);
268 hPrimaryProtonsITS->SetMarkerColor(4);
269 hPrimaryProtonsITS->GetYaxis()->SetTitle("Influence of the cuts [%]");
270 for(Int_t i = 1; i <= 6; i++) {
271 hPrimaryProtonsITS->SetBinContent(i,-10.);
272 hPrimaryProtonsITS->GetXaxis()->SetBinLabel(i,fCutITSName[i-1]);
273 }
274 hPrimaryProtonsITS->GetXaxis()->SetLabelOffset(0.01);
275 hPrimaryProtonsITS->GetXaxis()->SetLabelSize(0.045);
276
277 //secondary protons
278 TH1F *hSecondaryProtonsITS = new TH1F("hSecondaryProtonsITS","",7,0,7);
279 hSecondaryProtonsITS->SetStats(kFALSE);
280 hSecondaryProtonsITS->SetMarkerStyle(22);
281 hSecondaryProtonsITS->SetMarkerSize(1.4);
282 hSecondaryProtonsITS->SetLineColor(2); hSecondaryProtonsITS->SetLineWidth(2);
283 hSecondaryProtonsITS->SetMarkerColor(2);
284 hSecondaryProtonsITS->GetYaxis()->SetTitle("Influence of the cuts [%]");
285 for(Int_t i = 1; i <= 6; i++) {
286 hSecondaryProtonsITS->SetBinContent(i,-10.);
287 hSecondaryProtonsITS->GetXaxis()->SetBinLabel(i,fCutITSName[i-1]);
288 }
289 hSecondaryProtonsITS->GetXaxis()->SetLabelOffset(0.01);
290 hSecondaryProtonsITS->GetXaxis()->SetLabelSize(0.045);
291
292 //primary antiprotons
293 TH1F *hPrimaryAntiProtonsITS = new TH1F("hPrimaryAntiProtonsITS","",7,0,7);
294 hPrimaryAntiProtonsITS->SetStats(kFALSE);
295 hPrimaryAntiProtonsITS->SetMarkerStyle(kFullCircle);
296 hPrimaryAntiProtonsITS->SetLineColor(4); hPrimaryAntiProtonsITS->SetLineWidth(2);
297 hPrimaryAntiProtonsITS->SetMarkerColor(4);
298 hPrimaryAntiProtonsITS->GetYaxis()->SetTitle("Influence of the cuts [%]");
299 for(Int_t i = 1; i <= 6; i++) {
300 hPrimaryAntiProtonsITS->SetBinContent(i,-10.);
301 hPrimaryAntiProtonsITS->GetXaxis()->SetBinLabel(i,fCutITSName[i-1]);
302 }
303 hPrimaryAntiProtonsITS->GetXaxis()->SetLabelOffset(0.01);
304 hPrimaryAntiProtonsITS->GetXaxis()->SetLabelSize(0.045);
cc0fbd97 305
0008a5a6 306 //secondary antiprotons
307 TH1F *hSecondaryAntiProtonsITS = new TH1F("hSecondaryAntiProtonsITS","",7,0,7);
308 hSecondaryAntiProtonsITS->SetStats(kFALSE);
309 hSecondaryAntiProtonsITS->SetMarkerStyle(22);
310 hSecondaryAntiProtonsITS->SetMarkerSize(1.4);
311 hSecondaryAntiProtonsITS->SetLineColor(2); hSecondaryAntiProtonsITS->SetLineWidth(2);
312 hSecondaryAntiProtonsITS->SetMarkerColor(2);
313 hSecondaryAntiProtonsITS->GetYaxis()->SetTitle("Influence of the cuts [%]");
314 for(Int_t i = 1; i <= 6; i++) {
315 hSecondaryAntiProtonsITS->SetBinContent(i,-10.);
316 hSecondaryAntiProtonsITS->GetXaxis()->SetBinLabel(i,fCutITSName[i-1]);
317 }
318 hSecondaryAntiProtonsITS->GetXaxis()->SetLabelOffset(0.01);
319 hSecondaryAntiProtonsITS->GetXaxis()->SetLabelSize(0.045);
320
321 //_______________________________________________________//
1c21299a 322 TCanvas *c9 = new TCanvas("c9","ITS cluster map - (anti)protons",
323 100,100,950,550);
0008a5a6 324 c9->SetFillColor(10); c9->GetFrame()->SetFillColor(10);
325 c9->SetHighLightColor(10); c9->Divide(2,1);
326 for(Int_t i = 1; i <= 6; i++) {
327 hPrimaryProtonsITS->SetBinError(i,1.0);
328 hSecondaryProtonsITS->SetBinError(i,1.0);
329 hPrimaryAntiProtonsITS->SetBinError(i,1.0);
330 hSecondaryAntiProtonsITS->SetBinError(i,1.0);
331 }
332 c9->cd(1)->SetBottomMargin(0.15);
333 c9->cd(1)->SetLeftMargin(0.15);
334 c9->cd(1)->SetGridx(); c9->cd(1)->SetGridy();
335 hEmptyITS->SetTitle("Protons");
336 hEmptyITS->DrawCopy();
337
338 for(Int_t i = 1; i < 7; i++) {
339 hPrimaryProtonsITS->SetBinContent(i,GetPercentage(gEntriesQAPrimaryProtonsAcceptedList[19+i],
340 gEntriesQAPrimaryProtonsRejectedList[19+i]));
341 hSecondaryProtonsITS->SetBinContent(i,GetPercentage(gEntriesQASecondaryProtonsAcceptedList[19+i],
342 gEntriesQASecondaryProtonsRejectedList[19+i]));
343 }
1c21299a 344 hPrimaryProtonsITS->DrawCopy("EHISTSAME");
345 hSecondaryProtonsITS->DrawCopy("EHISTSAME");
0008a5a6 346 DrawMarker(6.5, 90, 20, 1.2, 4);
347 t1->DrawLatex(7,88,"Primary p");
348 DrawMarker(6.5, 80, 22, 1.2, 2);
349 t1->DrawLatex(7,78,"Secondary p");
350
351 c9->cd(2)->SetBottomMargin(0.15);
352 c9->cd(2)->SetLeftMargin(0.15);
353 c9->cd(2)->SetGridx(); c9->cd(2)->SetGridy();
354 hEmptyITS->SetTitle("Antiprotons");
355 hEmptyITS->DrawCopy();
356 for(Int_t i = 1; i < 7; i++) {
357 hPrimaryAntiProtonsITS->SetBinContent(i,GetPercentage(gEntriesQAPrimaryAntiProtonsAcceptedList[19+i],
358 gEntriesQAPrimaryAntiProtonsRejectedList[19+i]));
359 hSecondaryAntiProtonsITS->SetBinContent(i,GetPercentage(gEntriesQASecondaryAntiProtonsAcceptedList[19+i],
360 gEntriesQASecondaryAntiProtonsRejectedList[19+i]));
361 }
1c21299a 362 hPrimaryAntiProtonsITS->DrawCopy("EHISTSAME");
363 hSecondaryAntiProtonsITS->DrawCopy("EHISTSAME");
0008a5a6 364 DrawMarker(6.5, 90, 20, 1.2, 4);
365 t1->DrawLatex(7,88,"Primary #bar{p}");
366 DrawMarker(6.5, 80, 22, 1.2, 2);
367 t1->DrawLatex(7,78,"Secondary #bar{p}");
368
369 c9->SaveAs("CutInfluence-ITS.gif");
1c21299a 370
371 //Contamination plots
372 DrawContamination(fQA2DList);
373 DrawEfficiency(fQA2DList);
0008a5a6 374}
375
376//________________________________________________//
377void DrawContamination(TList *inputList) {
378 //loops over the list entries and
379 //draws the rapidity and pT dependence
380 //of the percentage of primary and secondary
381 //protons and antiprotons after the track cuts
382 cout<<"Extracting the entries for the histograms in the list: "<<
383 inputList->GetName()<<"..."<<endl;
384
385 TLatex *t1 = new TLatex();
386 t1->SetTextSize(0.04);
387
388 TH2F *hPrimaryProtons = (TH2F *)inputList->At(0);
389 TH2F *hSecondaryProtons = (TH2F *)inputList->At(2);
390 TH2F *hPrimaryAntiProtons = (TH2F *)inputList->At(4);
391 TH2F *hSecondaryAntiProtons = (TH2F *)inputList->At(6);
392
393 //rapidity dependence
394 //Protons
395 TH1D *gYPrimaryProtons = (TH1D *)hPrimaryProtons->ProjectionX("gYPrimaryProtons",0,hPrimaryProtons->GetXaxis()->GetNbins(),"e");
396 TH1D *gYSecondaryProtons = (TH1D *)hSecondaryProtons->ProjectionX("gYSecondaryProtons",0,hSecondaryProtons->GetXaxis()->GetNbins(),"e");
397 TH1D *gYTotalProtons = (TH1D *)hPrimaryProtons->ProjectionX("gYTotalProtons",0,hPrimaryProtons->GetXaxis()->GetNbins(),"e");
398 gYTotalProtons->Add(gYSecondaryProtons);
399
400 TH1D *gYPrimaryProtonsPercentage = new TH1D("gYPrimaryProtonsPercentage",
401 "",
402 hPrimaryProtons->GetXaxis()->GetNbins(),
403 hPrimaryProtons->GetXaxis()->GetXmin(),
404 hPrimaryProtons->GetXaxis()->GetXmax());
405 gYPrimaryProtonsPercentage->Divide(gYPrimaryProtons,
406 gYTotalProtons,100.,1.0);
1c21299a 407 SetError(gYPrimaryProtonsPercentage,gYTotalProtons);
0008a5a6 408 gYPrimaryProtonsPercentage->SetMarkerStyle(kFullCircle);
409
410 TH1D *gYSecondaryProtonsPercentage = new TH1D("gYSecondaryProtonsPercentage",
411 "",
412 hSecondaryProtons->GetXaxis()->GetNbins(),
413 hSecondaryProtons->GetXaxis()->GetXmin(),
414 hSecondaryProtons->GetXaxis()->GetXmax());
415 gYSecondaryProtonsPercentage->Divide(gYSecondaryProtons,
416 gYTotalProtons,100.,1.0);
1c21299a 417 SetError(gYSecondaryProtonsPercentage,gYTotalProtons);
0008a5a6 418 gYSecondaryProtonsPercentage->SetMarkerStyle(kOpenCircle);
419
420
421 //Antiprotons
422 TH1D *gYPrimaryAntiProtons = (TH1D *)hPrimaryAntiProtons->ProjectionX("gYPrimaryAntiProtons",0,hPrimaryAntiProtons->GetXaxis()->GetNbins(),"e");
423 TH1D *gYSecondaryAntiProtons = (TH1D *)hSecondaryAntiProtons->ProjectionX("gYSecondaryAntiProtons",0,hSecondaryAntiProtons->GetXaxis()->GetNbins(),"e");
424 TH1D *gYTotalAntiProtons = (TH1D *)hPrimaryAntiProtons->ProjectionX("gYTotalAntiProtons",0,hPrimaryAntiProtons->GetXaxis()->GetNbins(),"e");
425 gYTotalAntiProtons->Add(gYSecondaryAntiProtons);
426
427 TH1D *gYPrimaryAntiProtonsPercentage = new TH1D("gYPrimaryAntiProtonsPercentage",
428 "",
429 hPrimaryAntiProtons->GetXaxis()->GetNbins(),
430 hPrimaryAntiProtons->GetXaxis()->GetXmin(),
431 hPrimaryAntiProtons->GetXaxis()->GetXmax());
432 gYPrimaryAntiProtonsPercentage->Divide(gYPrimaryAntiProtons,
433 gYTotalAntiProtons,100.,1.0);
1c21299a 434 SetError(gYPrimaryAntiProtonsPercentage,gYTotalAntiProtons);
0008a5a6 435 gYPrimaryAntiProtonsPercentage->SetMarkerStyle(kFullCircle);
436
437 TH1D *gYSecondaryAntiProtonsPercentage = new TH1D("gYSecondaryAntiProtonsPercentage",
438 "",
439 hSecondaryAntiProtons->GetXaxis()->GetNbins(),
440 hSecondaryAntiProtons->GetXaxis()->GetXmin(),
441 hSecondaryAntiProtons->GetXaxis()->GetXmax());
442 gYSecondaryAntiProtonsPercentage->Divide(gYSecondaryAntiProtons,
443 gYTotalAntiProtons,100.,1.0);
1c21299a 444 SetError(gYSecondaryAntiProtonsPercentage,gYTotalAntiProtons);
0008a5a6 445 gYSecondaryAntiProtonsPercentage->SetMarkerStyle(kOpenCircle);
446
447
448 TH2F *hEmptyY = new TH2F("hEmptyCompositionY","",
449 100,-1.2,1.2,100,-10.0,130);
450 hEmptyY->SetStats(kFALSE);
451 hEmptyY->GetYaxis()->SetTitle("Particle composition [%]");
452 hEmptyY->GetYaxis()->SetTitleOffset(1.3);
453 hEmptyY->GetXaxis()->SetTitle("y");
454
1c21299a 455 TCanvas *c7 = new TCanvas("c7","(Anti)Proton contamination vs y",
456 150,150,950,550);
0008a5a6 457 c7->SetFillColor(10); c7->GetFrame()->SetFillColor(10);
458 c7->SetHighLightColor(10); c7->Divide(2,1);
459
460 c7->cd(1)->SetBottomMargin(0.15);
461 c7->cd(1)->SetLeftMargin(0.15);
462 c7->cd(1)->SetGridx(); c7->cd(1)->SetGridy();
463 hEmptyY->SetTitle("Protons");
464 hEmptyY->DrawCopy();
1c21299a 465 gYPrimaryProtonsPercentage->DrawCopy("ESAME");
466 gYSecondaryProtonsPercentage->DrawCopy("ESAME");
0008a5a6 467
468 DrawMarker(0, 55, kFullCircle, 1.2, 1);
469 t1->DrawLatex(0.1,53,"Primaries");
470 DrawMarker(0, 45, kOpenCircle, 1.2, 1);
471 t1->DrawLatex(0.1,43,"Secondaries");
472
473 c7->cd(2)->SetBottomMargin(0.15);
474 c7->cd(2)->SetLeftMargin(0.15);
475 c7->cd(2)->SetGridx(); c7->cd(2)->SetGridy();
476 hEmptyY->SetTitle("Antiprotons");
477 hEmptyY->DrawCopy();
1c21299a 478 gYPrimaryAntiProtonsPercentage->DrawCopy("ESAME");
479 gYSecondaryAntiProtonsPercentage->DrawCopy("ESAME");
0008a5a6 480
481 DrawMarker(0, 55, kFullCircle, 1.2, 1);
482 t1->DrawLatex(0.1,53,"Primaries");
483 DrawMarker(0, 45, kOpenCircle, 1.2, 1);
484 t1->DrawLatex(0.1,43,"Secondaries");
485
486 c7->SaveAs("Contamination-Protons-Rapidity.gif");
487
488 //pT dependence
489 //Protons
490 TH1D *gPtPrimaryProtons = (TH1D *)hPrimaryProtons->ProjectionY("gPtPrimaryProtons",0,hPrimaryProtons->GetYaxis()->GetNbins(),"e");
491 TH1D *gPtSecondaryProtons = (TH1D *)hSecondaryProtons->ProjectionY("gPtSecondaryProtons",0,hSecondaryProtons->GetYaxis()->GetNbins(),"e");
492 TH1D *gPtTotalProtons = (TH1D *)hPrimaryProtons->ProjectionY("gPtTotalProtons",0,hPrimaryProtons->GetYaxis()->GetNbins(),"e");
493 gPtTotalProtons->Add(gPtSecondaryProtons);
494
495 TH1D *gPtPrimaryProtonsPercentage = new TH1D("gPtPrimaryProtonsPercentage",
496 "",
497 hPrimaryProtons->GetYaxis()->GetNbins(),
498 hPrimaryProtons->GetYaxis()->GetXmin(),
499 hPrimaryProtons->GetYaxis()->GetXmax());
500 gPtPrimaryProtonsPercentage->Divide(gPtPrimaryProtons,
501 gPtTotalProtons,100.,1.0);
1c21299a 502 SetError(gPtPrimaryProtonsPercentage,gPtTotalProtons);
0008a5a6 503 gPtPrimaryProtonsPercentage->SetMarkerStyle(kFullCircle);
504
505 TH1D *gPtSecondaryProtonsPercentage = new TH1D("gPtSecondaryProtonsPercentage",
506 "",
507 hSecondaryProtons->GetYaxis()->GetNbins(),
508 hSecondaryProtons->GetYaxis()->GetXmin(),
509 hSecondaryProtons->GetYaxis()->GetXmax());
510 gPtSecondaryProtonsPercentage->Divide(gPtSecondaryProtons,
511 gPtTotalProtons,100.,1.0);
1c21299a 512 SetError(gPtSecondaryProtonsPercentage,gPtTotalProtons);
0008a5a6 513 gPtSecondaryProtonsPercentage->SetMarkerStyle(kOpenCircle);
514
515
516 //Antiprotons
517 TH1D *gPtPrimaryAntiProtons = (TH1D *)hPrimaryAntiProtons->ProjectionY("gPtPrimaryAntiProtons",0,hPrimaryAntiProtons->GetYaxis()->GetNbins(),"e");
518 TH1D *gPtSecondaryAntiProtons = (TH1D *)hSecondaryAntiProtons->ProjectionY("gPtSecondaryAntiProtons",0,hSecondaryAntiProtons->GetYaxis()->GetNbins(),"e");
519 TH1D *gPtTotalAntiProtons = (TH1D *)hPrimaryAntiProtons->ProjectionY("gPtTotalAntiProtons",0,hPrimaryAntiProtons->GetYaxis()->GetNbins(),"e");
520 gPtTotalAntiProtons->Add(gPtSecondaryAntiProtons);
521
522 TH1D *gPtPrimaryAntiProtonsPercentage = new TH1D("gPtPrimaryAntiProtonsPercentage",
523 "",
524 hPrimaryAntiProtons->GetYaxis()->GetNbins(),
525 hPrimaryAntiProtons->GetYaxis()->GetXmin(),
526 hPrimaryAntiProtons->GetYaxis()->GetXmax());
527 gPtPrimaryAntiProtonsPercentage->Divide(gPtPrimaryAntiProtons,
528 gPtTotalAntiProtons,100.,1.0);
1c21299a 529 SetError(gPtPrimaryAntiProtonsPercentage,gPtTotalAntiProtons);
0008a5a6 530 gPtPrimaryAntiProtonsPercentage->SetMarkerStyle(kFullCircle);
531
532 TH1D *gPtSecondaryAntiProtonsPercentage = new TH1D("gPtSecondaryAntiProtonsPercentage",
533 "",
534 hSecondaryAntiProtons->GetYaxis()->GetNbins(),
535 hSecondaryAntiProtons->GetYaxis()->GetXmin(),
536 hSecondaryAntiProtons->GetYaxis()->GetXmax());
537 gPtSecondaryAntiProtonsPercentage->Divide(gPtSecondaryAntiProtons,
538 gPtTotalAntiProtons,100.,1.0);
1c21299a 539 SetError(gPtSecondaryAntiProtonsPercentage,gPtTotalAntiProtons);
0008a5a6 540 gPtSecondaryAntiProtonsPercentage->SetMarkerStyle(kOpenCircle);
541
542 TH2F *hEmptyPt = new TH2F("hEmptyCompositionPt","",
543 100,0.0,4.0,100,-10.0,130);
544 hEmptyPt->SetStats(kFALSE);
545 hEmptyPt->GetYaxis()->SetTitle("Particle composition [%]");
546 hEmptyPt->GetYaxis()->SetTitleOffset(1.3);
547 hEmptyPt->GetXaxis()->SetTitle("P_{T} [GeV/c]");
548
1c21299a 549 TCanvas *c8 = new TCanvas("c8","(Anti)Proton comtamination vs pT",
550 200,200,950,550);
0008a5a6 551 c8->SetFillColor(10); c8->GetFrame()->SetFillColor(10);
552 c8->SetHighLightColor(10); c8->Divide(2,1);
553
554 c8->cd(1)->SetBottomMargin(0.15);
555 c8->cd(1)->SetLeftMargin(0.15);
556 c8->cd(1)->SetGridx(); c8->cd(1)->SetGridy();
557 hEmptyPt->SetTitle("Protons");
558 hEmptyPt->DrawCopy();
1c21299a 559 gPtPrimaryProtonsPercentage->DrawCopy("ESAME");
560 gPtSecondaryProtonsPercentage->DrawCopy("ESAME");
0008a5a6 561
562 DrawMarker(2.0, 55, kFullCircle, 1.2, 1);
563 t1->DrawLatex(2.1,53,"Primaries");
564 DrawMarker(2.0, 45, kOpenCircle, 1.2, 1);
565 t1->DrawLatex(2.1,43,"Secondaries");
566
567 c8->cd(2)->SetBottomMargin(0.15);
568 c8->cd(2)->SetLeftMargin(0.15);
569 c8->cd(2)->SetGridx(); c8->cd(2)->SetGridy();
570 hEmptyPt->SetTitle("Antirotons");
571 hEmptyPt->DrawCopy();
1c21299a 572 gPtPrimaryAntiProtonsPercentage->DrawCopy("ESAME");
573 gPtSecondaryAntiProtonsPercentage->DrawCopy("ESAME");
0008a5a6 574
575 DrawMarker(2.0, 55, kFullCircle, 1.2, 1);
576 t1->DrawLatex(2.1,53,"Primaries");
577 DrawMarker(2.0, 45, kOpenCircle, 1.2, 1);
578 t1->DrawLatex(2.1,43,"Secondaries");
579
580 c8->SaveAs("Contamination-Protons-Pt.gif");
5b8133c7 581
582 TFile *fout = TFile::Open("Contamination.root","recreate");
583 gYPrimaryProtonsPercentage->Write();
584 gYSecondaryProtonsPercentage->Write();
585 gPtPrimaryProtonsPercentage->Write();
586 gPtSecondaryProtonsPercentage->Write();
587 gYPrimaryAntiProtonsPercentage->Write();
588 gYSecondaryAntiProtonsPercentage->Write();
589 gPtPrimaryAntiProtonsPercentage->Write();
590 gPtSecondaryAntiProtonsPercentage->Write();
591 fout->Close();
cc0fbd97 592}
593
1c21299a 594//________________________________________________//
595void DrawEfficiency(TList *inputList) {
596 //loops over the list entries and
597 //draws the rapidity and pT dependence
598 //of the percentage of primary and secondary
599 //protons and antiprotons after the track cuts
600 cout<<"Extracting the entries for the histograms in the list: "<<
601 inputList->GetName()<<"..."<<endl;
602
603 TLatex *t1 = new TLatex();
604 t1->SetTextSize(0.04);
605
606 TH2F *hPrimaryESDProtons = (TH2F *)inputList->At(0);
607 TH2F *hPrimaryESDAntiProtons = (TH2F *)inputList->At(4);
608 TH2F *hPrimaryMCProtons = (TH2F *)inputList->At(8);
609 TH2F *hPrimaryMCAntiProtons = (TH2F *)inputList->At(9);
610
611 //rapidity dependence
612 //Protons
613 TH1D *gYPrimaryESDProtons = (TH1D *)hPrimaryESDProtons->ProjectionX("gYPrimaryESDProtons",0,hPrimaryESDProtons->GetXaxis()->GetNbins(),"e");
614 TH1D *gYPrimaryMCProtons = (TH1D *)hPrimaryMCProtons->ProjectionX("gYPrimaryMCProtons",0,hPrimaryMCProtons->GetXaxis()->GetNbins(),"e");
615 gYPrimaryESDProtons->Divide(gYPrimaryMCProtons);
616 gYPrimaryESDProtons->Scale(100.);
617 SetError(gYPrimaryESDProtons,gYPrimaryMCProtons);
618 gYPrimaryESDProtons->SetMarkerStyle(kFullCircle);
619
620 //Antiprotons
621 TH1D *gYPrimaryESDAntiProtons = (TH1D *)hPrimaryESDAntiProtons->ProjectionX("gYPrimaryESDAntiProtons",0,hPrimaryESDAntiProtons->GetXaxis()->GetNbins(),"e");
622 TH1D *gYPrimaryMCAntiProtons = (TH1D *)hPrimaryMCAntiProtons->ProjectionX("gYPrimaryMCAntiProtons",0,hPrimaryMCAntiProtons->GetXaxis()->GetNbins(),"e");
623 gYPrimaryESDAntiProtons->Divide(gYPrimaryMCAntiProtons);
624 gYPrimaryESDAntiProtons->Scale(100.);
625 SetError(gYPrimaryESDAntiProtons,gYPrimaryMCAntiProtons);
626 gYPrimaryESDAntiProtons->SetMarkerStyle(kFullCircle);
627
628 TH2F *hEmptyY = new TH2F("hEmptyEfficiencyY","",
629 100,-1.2,1.2,100,-10.0,130);
630 hEmptyY->SetStats(kFALSE);
631 hEmptyY->GetYaxis()->SetTitle("#epsilon [%]");
632 hEmptyY->GetYaxis()->SetTitleOffset(1.3);
633 hEmptyY->GetXaxis()->SetTitle("y");
634
635 TCanvas *c10 = new TCanvas("c10","(Anti)Proton efficiency vs y",
636 250,250,950,550);
637 c10->SetFillColor(10); c10->GetFrame()->SetFillColor(10);
638 c10->SetHighLightColor(10); c10->Divide(2,1);
639
640 c10->cd(1)->SetBottomMargin(0.15);
641 c10->cd(1)->SetLeftMargin(0.15);
642 c10->cd(1)->SetGridx(); c10->cd(1)->SetGridy();
643 hEmptyY->SetTitle("Protons");
644 hEmptyY->DrawCopy();
645 gYPrimaryESDProtons->DrawCopy("ESAME");
646
647 c10->cd(2)->SetBottomMargin(0.15);
648 c10->cd(2)->SetLeftMargin(0.15);
649 c10->cd(2)->SetGridx(); c10->cd(2)->SetGridy();
650 hEmptyY->SetTitle("Antiprotons");
651 hEmptyY->DrawCopy();
652 gYPrimaryESDAntiProtons->DrawCopy("ESAME");
653
654 c10->SaveAs("Efficiency-Protons-Rapidity.gif");
655
656 //pT dependence
657 //Protons
658 TH1D *gPtPrimaryESDProtons = (TH1D *)hPrimaryESDProtons->ProjectionY("gPtPrimaryESDProtons",0,hPrimaryESDProtons->GetYaxis()->GetNbins(),"e");
659 TH1D *gPtPrimaryMCProtons = (TH1D *)hPrimaryMCProtons->ProjectionY("gPtPrimaryMCProtons",0,hPrimaryMCProtons->GetYaxis()->GetNbins(),"e");
660 gPtPrimaryESDProtons->Divide(gPtPrimaryMCProtons);
661 gPtPrimaryESDProtons->Scale(100.);
662 SetError(gPtPrimaryESDProtons,gPtPrimaryMCProtons);
663 gPtPrimaryESDProtons->SetMarkerStyle(kFullCircle);
664
665 //Antiprotons
666 TH1D *gPtPrimaryESDAntiProtons = (TH1D *)hPrimaryESDAntiProtons->ProjectionY("gPtPrimaryESDAntiProtons",0,hPrimaryESDAntiProtons->GetYaxis()->GetNbins(),"e");
667 TH1D *gPtPrimaryMCAntiProtons = (TH1D *)hPrimaryMCAntiProtons->ProjectionY("gPtPrimaryMCAntiProtons",0,hPrimaryMCAntiProtons->GetYaxis()->GetNbins(),"e");
668 gPtPrimaryESDAntiProtons->Divide(gPtPrimaryMCAntiProtons);
669 gPtPrimaryESDAntiProtons->Scale(100.);
670 SetError(gPtPrimaryESDAntiProtons,gPtPrimaryMCAntiProtons);
671 gPtPrimaryESDAntiProtons->SetMarkerStyle(kFullCircle);
672
673 TH2F *hEmptyPt = new TH2F("hEmptyEfficiencyPt","",
674 100,0.0,4.0,100,-10.0,130);
675 hEmptyPt->SetStats(kFALSE);
676 hEmptyPt->GetYaxis()->SetTitle("#epsilon [%]");
677 hEmptyPt->GetYaxis()->SetTitleOffset(1.3);
678 hEmptyPt->GetXaxis()->SetTitle("P_{T} [GeV/c]");
679
680 TCanvas *c11 = new TCanvas("c11","(Anti)Proton efficiency vs pT",
681 300,300,950,550);
682 c11->SetFillColor(10); c11->GetFrame()->SetFillColor(10);
683 c11->SetHighLightColor(10); c11->Divide(2,1);
684
685 c11->cd(1)->SetBottomMargin(0.15);
686 c11->cd(1)->SetLeftMargin(0.15);
687 c11->cd(1)->SetGridx(); c11->cd(1)->SetGridy();
688 hEmptyPt->SetTitle("Protons");
689 hEmptyPt->DrawCopy();
690 gPtPrimaryESDProtons->DrawCopy("ESAME");
691
692 c11->cd(2)->SetBottomMargin(0.15);
693 c11->cd(2)->SetLeftMargin(0.15);
694 c11->cd(2)->SetGridx(); c11->cd(2)->SetGridy();
695 hEmptyPt->SetTitle("Antirotons");
696 hEmptyPt->DrawCopy();
697 gPtPrimaryESDAntiProtons->DrawCopy("ESAME");
698
699 c11->SaveAs("Efficiency-Protons-Pt.gif");
700
701 TFile *fout = TFile::Open("Efficiency.root","recreate");
702 gYPrimaryESDProtons->Write();
703 gYPrimaryESDAntiProtons->Write();
704 gPtPrimaryESDProtons->Write();
705 gPtPrimaryESDAntiProtons->Write();
706 fout->Close();
707}
708
cc0fbd97 709//________________________________________________//
710void GetQAEntries(TList *inputList, Double_t *entries) {
711 //loops over the list entries
712 //extracts the entries for each histogram
0008a5a6 713 //cout<<"Extracting the entries for the histograms in the list: "<<
714 //inputList->GetName()<<"..."<<endl;
cc0fbd97 715
716 for(Int_t i = 0; i < inputList->GetEntries(); i++) {
717 TH1F *gHist = (TH1F *)inputList->At(i);
718 entries[i] = gHist->GetEntries();
719 cout<<"Histogram: "<<gHist->GetName()<<
720 " - Entries: "<<entries[i]<<endl;
721 gHist = 0;
722 }
723}
724
725//________________________________________________//
726Double_t GetPercentage(Double_t nPassEntries,
727 Double_t nRejectEntries) {
728 //returns the percentage of tracks that were rejected by a cut
729 Int_t nTotalEntries = nPassEntries + nRejectEntries;
730
731 if(nTotalEntries == 0)
732 return -1;
733
734 return 100.*nRejectEntries/nTotalEntries;
735}
736
0008a5a6 737//________________________________________//
1c21299a 738void drawMCQA(TList *listPDG, TList *listMCProcesses) {
0008a5a6 739 //Function to display the composition of secondary (anti)protons
740 //The histogram shows the percentage of secondary (anti)protons
741 //originating from each particle species.
742 //The box summarizes the MC process that gave these secondary (anti)protons
743 TDatabasePDG *db = TDatabasePDG::Instance();
744 TParticlePDG *p = 0x0;
745
1c21299a 746 TH3F *gHistYPtPDGProtons = (TH3F *)listPDG->At(0);
747 TH3F *gHistYPtPDGAntiProtons = (TH3F *)listPDG->At(1);
748 readProcesses(listMCProcesses);
0008a5a6 749 Double_t nParticleCompositionProtonY[100], nParticleCompositionProtonPt[100];
750 Double_t nParticleCompositionAntiProtonY[100], nParticleCompositionAntiProtonPt[100];
751 Double_t gY[100], gPt[100];
752 for(Int_t iBins = 0; iBins < 100; iBins++) {
753 nParticleCompositionProtonY[iBins] = 0;
754 nParticleCompositionProtonPt[iBins] = 0;
755 nParticleCompositionAntiProtonY[iBins] = 0;
756 nParticleCompositionAntiProtonPt[iBins] = 0;
757 gY[iBins] = 0;
758 gPt[iBins] = 0;
759 }
760
761 TGraph *gParticleProtonY[14];
762 TGraph *gParticleProtonPt[14];
763 TGraph *gParticleAntiProtonY[14];
764 TGraph *gParticleAntiProtonPt[14];
765 for(Int_t iParticle = 0; iParticle < 14; iParticle++) {
766 GetComposition(iParticle,
767 gHistYPtPDGProtons,
768 nParticleCompositionProtonY,
769 gY, nParticleCompositionProtonPt, gPt);
770 gParticleProtonY[iParticle] = new TGraph(gHistYPtPDGProtons->GetNbinsX(),
771 gY,nParticleCompositionProtonY);
772 gParticleProtonY[iParticle]->SetMarkerStyle(iParticle+20);
773 gParticleProtonY[iParticle]->SetMarkerSize(1.2);
774
775 gParticleProtonPt[iParticle] = new TGraph(gHistYPtPDGProtons->GetNbinsY(),
776 gPt,nParticleCompositionProtonPt);
777 gParticleProtonPt[iParticle]->SetMarkerStyle(iParticle+20);
778 gParticleProtonPt[iParticle]->SetMarkerSize(1.2);
779
780 GetComposition(iParticle,
781 gHistYPtPDGAntiProtons,
782 nParticleCompositionAntiProtonY,
783 gY, nParticleCompositionAntiProtonPt, gPt);
784 gParticleAntiProtonY[iParticle] = new TGraph(gHistYPtPDGAntiProtons->GetNbinsX(),
785 gY,nParticleCompositionAntiProtonY);
786 gParticleAntiProtonY[iParticle]->SetMarkerStyle(iParticle+20);
787 gParticleAntiProtonY[iParticle]->SetMarkerSize(1.2);
788
789 gParticleAntiProtonPt[iParticle] = new TGraph(gHistYPtPDGAntiProtons->GetNbinsY(),
790 gPt,nParticleCompositionAntiProtonPt);
791 gParticleAntiProtonPt[iParticle]->SetMarkerStyle(iParticle+20);
792 gParticleAntiProtonPt[iParticle]->SetMarkerSize(1.2);
793 }
794
795 //_________________________________________________________//
796 char *fParticleName[14] = {"Primary","K_{L}","#pi","K_{S}","K",
797 "n","p","#Sigma^{-}","#Lambda","#Sigma^{+}",
5b8133c7 798 "#Xi^{-}","#Xi^{0}","#Omega^{-}"};
0008a5a6 799 TLatex *t1 = new TLatex();
800 t1->SetTextSize(0.04);
801
5b8133c7 802 TH2F *hEmptyY = new TH2F("hEmptyY","",100,-1.2,1.2,100,0,120);
0008a5a6 803 hEmptyY->SetStats(kFALSE);
804 hEmptyY->GetYaxis()->SetTitle("Particle composition [%]");
805 hEmptyY->GetXaxis()->SetTitle("y");
806
5b8133c7 807 TCanvas *c3 = new TCanvas("c3","MC secondary composition vs y - Protons",
1c21299a 808 350,350,650,550);
0008a5a6 809 c3->SetFillColor(10); c3->GetFrame()->SetFillColor(10);
810 c3->SetHighLightColor(10); c3->SetBottomMargin(0.15);
811 c3->SetGridx(); c3->SetGridy();
1c21299a 812 hEmptyY->DrawCopy();
0008a5a6 813 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
5b8133c7 814 //if((iParticle == 0)||(iParticle == 2)||(iParticle == 5)||(iParticle == 6)||(iParticle == 8))
815 if((iParticle == 0)||(iParticle == 2)||(iParticle == 6)||(iParticle == 8))
816 gParticleProtonY[iParticle]->Draw("P");
0008a5a6 817 if(iParticle < 5) {
5b8133c7 818 DrawMarker(-1.1, 115-5*iParticle, 20+iParticle, 1.2, 1);
819 t1->DrawLatex(-1.0,113-5*iParticle,fParticleName[iParticle]);
0008a5a6 820 }
821 else {
5b8133c7 822 DrawMarker(0.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
823 t1->DrawLatex(0.3,113-5*(iParticle-5),fParticleName[iParticle]);
0008a5a6 824 }
825 }
826
5b8133c7 827 TCanvas *c5 = new TCanvas("c5","MC secondary composition vs y - antiProtons",
1c21299a 828 400,400,650,550);
0008a5a6 829 c5->SetFillColor(10); c5->GetFrame()->SetFillColor(10);
830 c5->SetHighLightColor(10); c5->SetBottomMargin(0.15);
831 c5->SetGridx(); c5->SetGridy();
1c21299a 832 hEmptyY->DrawCopy();
0008a5a6 833 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
5b8133c7 834 if((iParticle == 0)||(iParticle == 6)||(iParticle == 8))
835 gParticleAntiProtonY[iParticle]->Draw("P");
0008a5a6 836 if(iParticle < 5) {
5b8133c7 837 DrawMarker(-1.1, 115-5*iParticle, 20+iParticle, 1.2, 1);
838 t1->DrawLatex(-1.0,113-5*iParticle,fParticleName[iParticle]);
0008a5a6 839 }
840 else {
5b8133c7 841 DrawMarker(0.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
842 t1->DrawLatex(0.3,113-5*(iParticle-5),fParticleName[iParticle]);
0008a5a6 843 }
844 }
845
5b8133c7 846 TH2F *hEmptyPt = new TH2F("hEmptyPt","",100,0.0,4.0,100,0,120);
0008a5a6 847 hEmptyPt->SetStats(kFALSE);
848 hEmptyPt->GetYaxis()->SetTitle("Particle composition [%]");
849 hEmptyPt->GetXaxis()->SetTitle("P_{T} [GeV/c]");
850
5b8133c7 851 TCanvas *c4 = new TCanvas("c4","MC secondary composition vs pT - Protons",
1c21299a 852 450,450,650,550);
0008a5a6 853 c4->SetFillColor(10); c4->GetFrame()->SetFillColor(10);
854 c4->SetHighLightColor(10); c4->SetBottomMargin(0.15);
855 c4->SetGridx(); c4->SetGridy();
1c21299a 856 hEmptyPt->DrawCopy();
0008a5a6 857 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
858 if(iParticle < 5) {
5b8133c7 859 DrawMarker(0.2, 115-5*iParticle, 20+iParticle, 1.2, 1);
860 t1->DrawLatex(0.3,113-5*iParticle,fParticleName[iParticle]);
0008a5a6 861 }
862 else {
5b8133c7 863 DrawMarker(2.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
864 t1->DrawLatex(2.3,113-5*(iParticle-5),fParticleName[iParticle]);
0008a5a6 865 }
5b8133c7 866 if((iParticle == 0)||(iParticle == 2)||(iParticle == 6)||(iParticle == 8))
867 gParticleProtonPt[iParticle]->Draw("P");
0008a5a6 868 }
869
1c21299a 870 TCanvas *c6 = new TCanvas("c6",
871 "MC secondary composition vs pT - AntiProtons",
872 500,500,650,550);
0008a5a6 873 c6->SetFillColor(10); c6->GetFrame()->SetFillColor(10);
874 c6->SetHighLightColor(10); c6->SetBottomMargin(0.15);
875 c6->SetGridx(); c6->SetGridy();
1c21299a 876 hEmptyPt->DrawCopy();
0008a5a6 877 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
878 if(iParticle < 5) {
5b8133c7 879 DrawMarker(0.2, 115-5*iParticle, 20+iParticle, 1.2, 1);
880 t1->DrawLatex(0.3,113-5*iParticle,fParticleName[iParticle]);
0008a5a6 881 }
882 else {
5b8133c7 883 DrawMarker(2.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
884 t1->DrawLatex(2.3,113-5*(iParticle-5),fParticleName[iParticle]);
0008a5a6 885 }
5b8133c7 886 if((iParticle == 0)||(iParticle == 6)||(iParticle == 8))
887 gParticleAntiProtonPt[iParticle]->Draw("P");
0008a5a6 888 }
889}
890
891//________________________________________//
892void GetComposition(Int_t iSpecies,
893 TH3F *gHist,
894 Double_t *nParticleCompositionY,
895 Double_t *gY,
896 Double_t *nParticleCompositionPt,
897 Double_t *gPt) {
898 //Returns the pT and y dependence of the MC composition
899 Double_t ymin = gHist->GetXaxis()->GetXmin();
900 Double_t ymax = gHist->GetXaxis()->GetXmax();
901 Double_t nybins = gHist->GetNbinsX();
902 Double_t ptmin = gHist->GetYaxis()->GetXmin();
903 Double_t ptmax = gHist->GetYaxis()->GetXmax();
904 Double_t nptbins = gHist->GetNbinsY();
905 Double_t nTotalY[100], nTotalPt[100];
906 for(Int_t iBins = 0; iBins < 100; iBins++) {
907 nParticleCompositionY[iBins] = 0;
908 nParticleCompositionPt[iBins] = 0;
909 nTotalY[iBins] = 0.0;
910 nTotalPt[iBins] = 0.0;
911 }
912
913 //rapidity dependence
914 //cout<<"Ymin: "<<ymin<<" - Ymax: "<<ymax<<" - Ybins: "<<nybins<<endl;
915 for(Int_t iXbins = 1; iXbins <= gHist->GetNbinsX(); iXbins++) {
916 for(Int_t iZbins = 1; iZbins <= gHist->GetNbinsZ(); iZbins++) {
917 for(Int_t iYbins = 1; iYbins <= gHist->GetNbinsY(); iYbins++) {
918 nTotalY[iXbins-1] += gHist->GetBinContent(iXbins,iYbins,iZbins);
919 }
920 }
921 }
922
923 for(Int_t iXbins = 1; iXbins <= gHist->GetNbinsX(); iXbins++) {
924 for(Int_t iYbins = 1; iYbins <= gHist->GetNbinsY(); iYbins++) {
925 nParticleCompositionY[iXbins-1] += 100.*gHist->GetBinContent(iXbins,iYbins,iSpecies+1)/nTotalY[iXbins-1];
5b8133c7 926 //if(nParticleCompositionY[iXbins-1] == 0)
927 //nParticleCompositionY[iXbins-1] = -10.0;
0008a5a6 928 }//pt loop
929 gY[iXbins-1] = ymin + (iXbins-1)*(ymax - ymin)/nybins + 0.5*(ymax - ymin)/nybins;
930 //cout<<"y: "<<gY[iXbins-1]<<
931 //" - test: "<<ymin + (iXbins-1)*(ymax - ymin)/nybins + 0.5*(ymax - ymin)/nybins<<
932 //" - Number of protons: "<<nY[iXbins-1]<<
933 //" - Total: "<<nTotalY[iXbins-1]<<
934 //" - Percentage: "<<nParticleCompositionY[iXbins-1]<<endl;
935 }//y loop
936
937 //pt dependence
938 //cout<<"Ptmin: "<<ptmin<<" - Ptmax: "<<ptmax<<" - Ptbins: "<<nptbins<<endl;
939 for(Int_t iYbins = 1; iYbins <= gHist->GetNbinsY(); iYbins++) {
940 for(Int_t iZbins = 1; iZbins <= gHist->GetNbinsZ(); iZbins++) {
941 for(Int_t iXbins = 1; iXbins <= gHist->GetNbinsX(); iXbins++) {
942 nTotalPt[iYbins-1] += gHist->GetBinContent(iXbins,iYbins,iZbins);
943 }
944 }
945 }
946
947 for(Int_t iYbins = 1; iYbins <= gHist->GetNbinsY(); iYbins++) {
948 for(Int_t iXbins = 1; iXbins <= gHist->GetNbinsX(); iXbins++) {
949 nParticleCompositionPt[iYbins-1] += 100.*gHist->GetBinContent(iXbins,iYbins,iSpecies+1)/nTotalPt[iYbins-1];
5b8133c7 950 //if(nParticleCompositionPt[iYbins-1] == 0)
951 //nParticleCompositionPt[iYbins-1] = -10.0;
0008a5a6 952 }//pt loop
953 gPt[iYbins-1] = ptmin + (iYbins-1)*(ptmax - ptmin)/nptbins + 0.5*(ptmax - ptmin)/nptbins;
954 //cout<<"Pt: "<<gPt[iYbins-1]<<
955 //" - test: "<<ptmin + (iYbins-1)*(ptmax - ptmin)/nptbins + 0.5*(ptmax - ptmin)/nptbins<<
956 //" - Number of protons: "<<nY[iXbins-1]<<
957 //" - Total: "<<nTotalPt[iYbins-1]<<
958 //" - Percentage: "<<nParticleCompositionPt[iYbins-1]<<endl;
959 }//pt loop
960}
961
5b8133c7 962//________________________________________//
963void readProcesses(TList *list) {
964 char *fParticleProtonName[12] = {"K_{L}","#pi","K_{S}","K",
965 "n","p","#Sigma^{-}","#Lambda","#Sigma^{+}",
966 "#Xi^{-}","#Xi^{0}","#Omega^{-}"};
967 char *fParticleAntiProtonName[8] = {"K_{L}","#pi","K_{S}","K",
1c21299a 968 "n","p","#Lambda","#Sigma^{+}"};
5b8133c7 969 Int_t iProtonCounter = 0, iAntiProtonCounter = 0;
970 TH1F *gMCProcesses;
971 for(Int_t iEntry = 0; iEntry < list->GetEntries(); iEntry++) {
972 gMCProcesses = (TH1F *)list->At(iEntry);
973 TString histName = gMCProcesses->GetName();
974 if(histName.Contains("gHistProtons")) {
975 cout<<"Protons coming from "<<fParticleProtonName[iProtonCounter]<<endl;
976
977 iProtonCounter += 1;
978 }
979 if(histName.Contains("gHistAntiProtons")) {
980 cout<<"Antiprotons coming from "<<fParticleAntiProtonName[iAntiProtonCounter]<<endl;
981
982 iAntiProtonCounter += 1;
983 }
984 for(Int_t iBin = 1; iBin < gMCProcesses->GetNbinsX(); iBin++) {
985 Double_t binContent = gMCProcesses->GetBinContent(iBin);
986 if(binContent > 0) {
987 Int_t processId = gMCProcesses->GetBinCenter(iBin);
988 cout<<"\t Process ID: "<<processId<<" - "<<
1c21299a 989 gMCProcessName[processId]<<" - "<<
5b8133c7 990 100.*binContent/gMCProcesses->GetEntries()<<"%"<<endl;
991 }
992 }
1c21299a 993 }
994}
5b8133c7 995
1c21299a 996//________________________________________________//
997void SetError(TH1D *hEff, TH1D *hGen) {
998 for(Int_t iBin = 1; iBin <= hEff->GetNbinsX(); iBin++) {
999 Double_t error = 0.0;
1000 if(hEff->GetBinContent(iBin) <= 100.)
1001 error = TMath::Sqrt(hEff->GetBinContent(iBin)*(100. - hEff->GetBinContent(iBin))/hGen->GetBinContent(iBin));
1002 hEff->SetBinError(iBin,error);
5b8133c7 1003 }
1004}
1005
cc0fbd97 1006//________________________________________________//
0008a5a6 1007void DrawMarker(Double_t x, Double_t y, Int_t style,
1008 Double_t size, Int_t color) {
cc0fbd97 1009 TMarker *m = new TMarker(x,y,style);
1010 m->SetMarkerSize(size);
1011 m->SetMarkerColor(color);
1012 m->Draw();
1013}
0008a5a6 1014
5b8133c7 1015//________________________________________________//
1c21299a 1016const char * const gMCProcessName[45] = {
5b8133c7 1017 "Primary particle emission",
1018 "Multiple scattering",
1019 "Energy loss",
1020 "Bending in magnetic field",
1021 "Decay",
1022 "Lepton pair production",
1023 "Compton scattering",
1024 "Photoelectric effect",
1025 "Bremstrahlung",
1026 "Delta ray",
1027 "Positron annihilation",
1028 "Positron annihilation at rest",
1029 "Positron annihilation in flight",
1030 "Hadronic interaction",
1031 "Nuclear evaporation",
1032 "Nuclear fission",
1033 "Nuclear absorbtion",
1034 "Antiproton annihilation",
1035 "Antineutron annihilation",
1036 "Neutron capture",
1037 "Hadronic elastic",
1038 "Hadronic incoherent elastic",
1039 "Hadronic coherent elastic",
1040 "Hadronic inelastic",
1041 "Photon inelastic",
1042 "Muon nuclear interaction",
1043 "Electron nuclear interaction",
1044 "Positron nuclear interaction",
1045 "Time of flight limit",
1046 "Nuclear photofission",
1047 "Rayleigh effect",
1048 "No active process",
1049 "Energy threshold",
1050 "Light absorption",
1051 "Light detection",
1052 "Light scattering",
1053 "Maximum allowed step",
1054 "Cerenkov production",
1055 "Cerenkov feed back photon",
1056 "Cerenkov photon reflection",
1057 "Cerenkov photon refraction",
1058 "Synchrotron radiation",
1059 "Scintillation",
1060 "Transportation",
1061 "Unknown process"
1c21299a 1062};