1 void 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
4 gStyle->SetPalette(1,0);
6 TFile *fQA = TFile::Open(filename1);
7 TList *listGlobalQA = (TList *)fQA->Get("globalQAList");
8 drawCutStatistics(listGlobalQA);
10 TFile *fMC = TFile::Open(filename2);
11 TList *listPDG = (TList *)fMC->Get("pdgCodeList");
12 TList *listMCProcesses = (TList *)fMC->Get("mcProcessList");
13 drawMCQA(listPDG,listMCProcesses);
19 //________________________________________//
20 void drawCutStatistics(TList *list) {
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;
26 Double_t gEntriesQA2DList[10] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
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];
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;
43 TList *fQA2DList = (TList *)list->At(0);
44 GetQAEntries(fQA2DList,gEntriesQA2DList);
46 TList *fQAPrimaryProtonsAcceptedList = (TList *)list->At(1);
47 GetQAEntries(fQAPrimaryProtonsAcceptedList,gEntriesQAPrimaryProtonsAcceptedList);
49 TList *fQAPrimaryProtonsRejectedList = (TList *)list->At(2);
50 GetQAEntries(fQAPrimaryProtonsRejectedList,gEntriesQAPrimaryProtonsRejectedList);
52 TList *fQASecondaryProtonsAcceptedList = (TList *)list->At(3);
53 GetQAEntries(fQASecondaryProtonsAcceptedList,gEntriesQASecondaryProtonsAcceptedList);
55 TList *fQASecondaryProtonsRejectedList = (TList *)list->At(4);
56 GetQAEntries(fQASecondaryProtonsRejectedList,gEntriesQASecondaryProtonsRejectedList);
58 TList *fQAPrimaryAntiProtonsAcceptedList = (TList *)list->At(5);
59 GetQAEntries(fQAPrimaryAntiProtonsAcceptedList,gEntriesQAPrimaryAntiProtonsAcceptedList);
61 TList *fQAPrimaryAntiProtonsRejectedList = (TList *)list->At(6);
62 GetQAEntries(fQAPrimaryAntiProtonsRejectedList,gEntriesQAPrimaryAntiProtonsRejectedList);
64 TList *fQASecondaryAntiProtonsAcceptedList = (TList *)list->At(7);
65 GetQAEntries(fQASecondaryAntiProtonsAcceptedList,gEntriesQASecondaryAntiProtonsAcceptedList);
67 TList *fQASecondaryAntiProtonsRejectedList = (TList *)list->At(8);
68 GetQAEntries(fQASecondaryAntiProtonsRejectedList,gEntriesQASecondaryAntiProtonsRejectedList);
70 //_______________________________________________________//
71 //Create the histograms
73 char *fCutName[nx] = {"Tracks","",
75 "#chi^{2}/N_{ITS-Clusters}",
77 "#chi^{2}/N_{TPC-Clusters}",
84 "#sigma_{Vertex-TPC}",
94 "N_{Secondaries}/N_{total}","",""};
95 char *fCutITSName[6] = {"SPD_{1}","SPD_{2}",
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);
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]);
121 hPrimaryProtons->GetXaxis()->SetLabelOffset(0.01);
122 hPrimaryProtons->GetXaxis()->SetLabelSize(0.045);
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]);
136 hSecondaryProtons->GetXaxis()->SetLabelOffset(0.01);
137 hSecondaryProtons->GetXaxis()->SetLabelSize(0.045);
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]);
150 hPrimaryAntiProtons->GetXaxis()->SetLabelOffset(0.01);
151 hPrimaryAntiProtons->GetXaxis()->SetLabelSize(0.045);
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]);
165 hSecondaryAntiProtons->GetXaxis()->SetLabelOffset(0.01);
166 hSecondaryAntiProtons->GetXaxis()->SetLabelSize(0.045);
167 //_______________________________________________________//
169 //1D for primary protons
170 //cout<<"_____________________________________________________"<<endl;
171 //cout<<"_______________PRIMARY PROTONS_______________________"<<endl;
172 hPrimaryProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[0],gEntriesQA2DList[1]));
174 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
175 hPrimaryProtons->SetBinContent(i+1,GetPercentage(gEntriesQAPrimaryProtonsAcceptedList[i-2],
176 gEntriesQAPrimaryProtonsRejectedList[i-2]));
178 //1D for secondary protons
179 //cout<<"_____________________________________________________"<<endl;
180 //cout<<"_______________SECONDARY PROTONS_____________________"<<endl;
181 hSecondaryProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[2],gEntriesQA2DList[3]));
183 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
184 hSecondaryProtons->SetBinContent(i+1,GetPercentage(gEntriesQASecondaryProtonsAcceptedList[i-2],
185 gEntriesQASecondaryProtonsRejectedList[i-2]));
186 hSecondaryProtons->SetBinContent(24,GetPercentage(gEntriesQA2DList[0],gEntriesQA2DList[2]));
188 //1D for primary antiprotons
189 //cout<<"_________________________________________________________"<<endl;
190 //cout<<"_______________PRIMARY ANTIPROTONS_______________________"<<endl;
191 hPrimaryAntiProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[4],gEntriesQA2DList[5]));
193 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
194 hPrimaryAntiProtons->SetBinContent(i+1,GetPercentage(gEntriesQAPrimaryAntiProtonsAcceptedList[i-2],
195 gEntriesQAPrimaryAntiProtonsRejectedList[i-2]));
197 //1D for secondary antiprotons
198 //cout<<"_________________________________________________________"<<endl;
199 //cout<<"_______________SECONDARY ANTIPROTONS_____________________"<<endl;
200 hSecondaryAntiProtons->SetBinContent(1,GetPercentage(gEntriesQA2DList[6],gEntriesQA2DList[7]));
202 for(Int_t i = 2; i < NQAHISTOSPERLIST-4; i++)
203 hSecondaryAntiProtons->SetBinContent(i+1,GetPercentage(gEntriesQASecondaryAntiProtonsAcceptedList[i-2],
204 gEntriesQASecondaryAntiProtonsRejectedList[i-2]));
205 hSecondaryAntiProtons->SetBinContent(24,GetPercentage(gEntriesQA2DList[4],gEntriesQA2DList[6]));
207 TLatex *t1 = new TLatex();
208 t1->SetTextSize(0.04);
209 //_________________________________________________________//
210 TCanvas *c1 = new TCanvas("c1","Cut Influence - Protons",0,0,950,550);
211 c1->SetFillColor(10); c1->GetFrame()->SetFillColor(10);
212 c1->SetHighLightColor(10); c1->SetBottomMargin(0.15);
213 c1->SetGridx(); c1->SetGridy();
215 for(Int_t i = 1; i <= nx; i++) {
216 hPrimaryProtons->SetBinError(i,1.0);
217 hSecondaryProtons->SetBinError(i,1.0);
220 hPrimaryProtons->DrawCopy("EHISTSAME");
221 hSecondaryProtons->DrawCopy("EHISTSAME");
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");
227 c1->SaveAs("CutInfluence-Protons.gif");
229 //_________________________________________________________//
230 TCanvas *c2 = new TCanvas("c2","Cut Influence - AntiProtons",50,50,950,550);
231 c2->SetFillColor(10); c2->GetFrame()->SetFillColor(10);
232 c2->SetHighLightColor(10); c2->SetBottomMargin(0.15);
233 c2->SetGridx(); c2->SetGridy();
235 for(Int_t i = 1; i <= nx; i++) {
236 hPrimaryAntiProtons->SetBinError(i,1.0);
237 hSecondaryAntiProtons->SetBinError(i,1.0);
240 hPrimaryAntiProtons->DrawCopy("EHISTSAME");
241 hSecondaryAntiProtons->DrawCopy("EHISTSAME");
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}");
247 c2->SaveAs("CutInfluence-AntiProtons.gif");
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);
262 //_________________________________________________________//
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]);
274 hPrimaryProtonsITS->GetXaxis()->SetLabelOffset(0.01);
275 hPrimaryProtonsITS->GetXaxis()->SetLabelSize(0.045);
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]);
289 hSecondaryProtonsITS->GetXaxis()->SetLabelOffset(0.01);
290 hSecondaryProtonsITS->GetXaxis()->SetLabelSize(0.045);
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]);
303 hPrimaryAntiProtonsITS->GetXaxis()->SetLabelOffset(0.01);
304 hPrimaryAntiProtonsITS->GetXaxis()->SetLabelSize(0.045);
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]);
318 hSecondaryAntiProtonsITS->GetXaxis()->SetLabelOffset(0.01);
319 hSecondaryAntiProtonsITS->GetXaxis()->SetLabelSize(0.045);
321 //_______________________________________________________//
322 TCanvas *c9 = new TCanvas("c9","ITS cluster map - (anti)protons",
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);
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();
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]));
344 hPrimaryProtonsITS->DrawCopy("EHISTSAME");
345 hSecondaryProtonsITS->DrawCopy("EHISTSAME");
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");
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]));
362 hPrimaryAntiProtonsITS->DrawCopy("EHISTSAME");
363 hSecondaryAntiProtonsITS->DrawCopy("EHISTSAME");
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}");
369 c9->SaveAs("CutInfluence-ITS.gif");
371 //Contamination plots
372 DrawContamination(fQA2DList);
373 DrawEfficiency(fQA2DList);
376 //________________________________________________//
377 void 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;
385 TLatex *t1 = new TLatex();
386 t1->SetTextSize(0.04);
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);
393 //rapidity dependence
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);
400 TH1D *gYPrimaryProtonsPercentage = new TH1D("gYPrimaryProtonsPercentage",
402 hPrimaryProtons->GetXaxis()->GetNbins(),
403 hPrimaryProtons->GetXaxis()->GetXmin(),
404 hPrimaryProtons->GetXaxis()->GetXmax());
405 gYPrimaryProtonsPercentage->Divide(gYPrimaryProtons,
406 gYTotalProtons,100.,1.0);
407 SetError(gYPrimaryProtonsPercentage,gYTotalProtons);
408 gYPrimaryProtonsPercentage->SetMarkerStyle(kFullCircle);
410 TH1D *gYSecondaryProtonsPercentage = new TH1D("gYSecondaryProtonsPercentage",
412 hSecondaryProtons->GetXaxis()->GetNbins(),
413 hSecondaryProtons->GetXaxis()->GetXmin(),
414 hSecondaryProtons->GetXaxis()->GetXmax());
415 gYSecondaryProtonsPercentage->Divide(gYSecondaryProtons,
416 gYTotalProtons,100.,1.0);
417 SetError(gYSecondaryProtonsPercentage,gYTotalProtons);
418 gYSecondaryProtonsPercentage->SetMarkerStyle(kOpenCircle);
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);
427 TH1D *gYPrimaryAntiProtonsPercentage = new TH1D("gYPrimaryAntiProtonsPercentage",
429 hPrimaryAntiProtons->GetXaxis()->GetNbins(),
430 hPrimaryAntiProtons->GetXaxis()->GetXmin(),
431 hPrimaryAntiProtons->GetXaxis()->GetXmax());
432 gYPrimaryAntiProtonsPercentage->Divide(gYPrimaryAntiProtons,
433 gYTotalAntiProtons,100.,1.0);
434 SetError(gYPrimaryAntiProtonsPercentage,gYTotalAntiProtons);
435 gYPrimaryAntiProtonsPercentage->SetMarkerStyle(kFullCircle);
437 TH1D *gYSecondaryAntiProtonsPercentage = new TH1D("gYSecondaryAntiProtonsPercentage",
439 hSecondaryAntiProtons->GetXaxis()->GetNbins(),
440 hSecondaryAntiProtons->GetXaxis()->GetXmin(),
441 hSecondaryAntiProtons->GetXaxis()->GetXmax());
442 gYSecondaryAntiProtonsPercentage->Divide(gYSecondaryAntiProtons,
443 gYTotalAntiProtons,100.,1.0);
444 SetError(gYSecondaryAntiProtonsPercentage,gYTotalAntiProtons);
445 gYSecondaryAntiProtonsPercentage->SetMarkerStyle(kOpenCircle);
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");
455 TCanvas *c7 = new TCanvas("c7","(Anti)Proton contamination vs y",
457 c7->SetFillColor(10); c7->GetFrame()->SetFillColor(10);
458 c7->SetHighLightColor(10); c7->Divide(2,1);
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");
465 gYPrimaryProtonsPercentage->DrawCopy("ESAME");
466 gYSecondaryProtonsPercentage->DrawCopy("ESAME");
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");
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");
478 gYPrimaryAntiProtonsPercentage->DrawCopy("ESAME");
479 gYSecondaryAntiProtonsPercentage->DrawCopy("ESAME");
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");
486 c7->SaveAs("Contamination-Protons-Rapidity.gif");
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);
495 TH1D *gPtPrimaryProtonsPercentage = new TH1D("gPtPrimaryProtonsPercentage",
497 hPrimaryProtons->GetYaxis()->GetNbins(),
498 hPrimaryProtons->GetYaxis()->GetXmin(),
499 hPrimaryProtons->GetYaxis()->GetXmax());
500 gPtPrimaryProtonsPercentage->Divide(gPtPrimaryProtons,
501 gPtTotalProtons,100.,1.0);
502 SetError(gPtPrimaryProtonsPercentage,gPtTotalProtons);
503 gPtPrimaryProtonsPercentage->SetMarkerStyle(kFullCircle);
505 TH1D *gPtSecondaryProtonsPercentage = new TH1D("gPtSecondaryProtonsPercentage",
507 hSecondaryProtons->GetYaxis()->GetNbins(),
508 hSecondaryProtons->GetYaxis()->GetXmin(),
509 hSecondaryProtons->GetYaxis()->GetXmax());
510 gPtSecondaryProtonsPercentage->Divide(gPtSecondaryProtons,
511 gPtTotalProtons,100.,1.0);
512 SetError(gPtSecondaryProtonsPercentage,gPtTotalProtons);
513 gPtSecondaryProtonsPercentage->SetMarkerStyle(kOpenCircle);
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);
522 TH1D *gPtPrimaryAntiProtonsPercentage = new TH1D("gPtPrimaryAntiProtonsPercentage",
524 hPrimaryAntiProtons->GetYaxis()->GetNbins(),
525 hPrimaryAntiProtons->GetYaxis()->GetXmin(),
526 hPrimaryAntiProtons->GetYaxis()->GetXmax());
527 gPtPrimaryAntiProtonsPercentage->Divide(gPtPrimaryAntiProtons,
528 gPtTotalAntiProtons,100.,1.0);
529 SetError(gPtPrimaryAntiProtonsPercentage,gPtTotalAntiProtons);
530 gPtPrimaryAntiProtonsPercentage->SetMarkerStyle(kFullCircle);
532 TH1D *gPtSecondaryAntiProtonsPercentage = new TH1D("gPtSecondaryAntiProtonsPercentage",
534 hSecondaryAntiProtons->GetYaxis()->GetNbins(),
535 hSecondaryAntiProtons->GetYaxis()->GetXmin(),
536 hSecondaryAntiProtons->GetYaxis()->GetXmax());
537 gPtSecondaryAntiProtonsPercentage->Divide(gPtSecondaryAntiProtons,
538 gPtTotalAntiProtons,100.,1.0);
539 SetError(gPtSecondaryAntiProtonsPercentage,gPtTotalAntiProtons);
540 gPtSecondaryAntiProtonsPercentage->SetMarkerStyle(kOpenCircle);
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]");
549 TCanvas *c8 = new TCanvas("c8","(Anti)Proton comtamination vs pT",
551 c8->SetFillColor(10); c8->GetFrame()->SetFillColor(10);
552 c8->SetHighLightColor(10); c8->Divide(2,1);
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();
559 gPtPrimaryProtonsPercentage->DrawCopy("ESAME");
560 gPtSecondaryProtonsPercentage->DrawCopy("ESAME");
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");
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();
572 gPtPrimaryAntiProtonsPercentage->DrawCopy("ESAME");
573 gPtSecondaryAntiProtonsPercentage->DrawCopy("ESAME");
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");
580 c8->SaveAs("Contamination-Protons-Pt.gif");
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();
594 //________________________________________________//
595 void 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;
603 TLatex *t1 = new TLatex();
604 t1->SetTextSize(0.04);
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);
611 //rapidity dependence
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);
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);
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");
635 TCanvas *c10 = new TCanvas("c10","(Anti)Proton efficiency vs y",
637 c10->SetFillColor(10); c10->GetFrame()->SetFillColor(10);
638 c10->SetHighLightColor(10); c10->Divide(2,1);
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");
645 gYPrimaryESDProtons->DrawCopy("ESAME");
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");
652 gYPrimaryESDAntiProtons->DrawCopy("ESAME");
654 c10->SaveAs("Efficiency-Protons-Rapidity.gif");
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);
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);
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]");
680 TCanvas *c11 = new TCanvas("c11","(Anti)Proton efficiency vs pT",
682 c11->SetFillColor(10); c11->GetFrame()->SetFillColor(10);
683 c11->SetHighLightColor(10); c11->Divide(2,1);
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");
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");
699 c11->SaveAs("Efficiency-Protons-Pt.gif");
701 TFile *fout = TFile::Open("Efficiency.root","recreate");
702 gYPrimaryESDProtons->Write();
703 gYPrimaryESDAntiProtons->Write();
704 gPtPrimaryESDProtons->Write();
705 gPtPrimaryESDAntiProtons->Write();
709 //________________________________________________//
710 void GetQAEntries(TList *inputList, Double_t *entries) {
711 //loops over the list entries
712 //extracts the entries for each histogram
713 //cout<<"Extracting the entries for the histograms in the list: "<<
714 //inputList->GetName()<<"..."<<endl;
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;
725 //________________________________________________//
726 Double_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;
731 if(nTotalEntries == 0)
734 return 100.*nRejectEntries/nTotalEntries;
737 //________________________________________//
738 void drawMCQA(TList *listPDG, TList *listMCProcesses) {
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;
746 TH3F *gHistYPtPDGProtons = (TH3F *)listPDG->At(0);
747 TH3F *gHistYPtPDGAntiProtons = (TH3F *)listPDG->At(1);
748 readProcesses(listMCProcesses);
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;
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,
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);
775 gParticleProtonPt[iParticle] = new TGraph(gHistYPtPDGProtons->GetNbinsY(),
776 gPt,nParticleCompositionProtonPt);
777 gParticleProtonPt[iParticle]->SetMarkerStyle(iParticle+20);
778 gParticleProtonPt[iParticle]->SetMarkerSize(1.2);
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);
789 gParticleAntiProtonPt[iParticle] = new TGraph(gHistYPtPDGAntiProtons->GetNbinsY(),
790 gPt,nParticleCompositionAntiProtonPt);
791 gParticleAntiProtonPt[iParticle]->SetMarkerStyle(iParticle+20);
792 gParticleAntiProtonPt[iParticle]->SetMarkerSize(1.2);
795 //_________________________________________________________//
796 char *fParticleName[14] = {"Primary","K_{L}","#pi","K_{S}","K",
797 "n","p","#Sigma^{-}","#Lambda","#Sigma^{+}",
798 "#Xi^{-}","#Xi^{0}","#Omega^{-}"};
799 TLatex *t1 = new TLatex();
800 t1->SetTextSize(0.04);
802 TH2F *hEmptyY = new TH2F("hEmptyY","",100,-1.2,1.2,100,0,120);
803 hEmptyY->SetStats(kFALSE);
804 hEmptyY->GetYaxis()->SetTitle("Particle composition [%]");
805 hEmptyY->GetXaxis()->SetTitle("y");
807 TCanvas *c3 = new TCanvas("c3","MC secondary composition vs y - Protons",
809 c3->SetFillColor(10); c3->GetFrame()->SetFillColor(10);
810 c3->SetHighLightColor(10); c3->SetBottomMargin(0.15);
811 c3->SetGridx(); c3->SetGridy();
813 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
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");
818 DrawMarker(-1.1, 115-5*iParticle, 20+iParticle, 1.2, 1);
819 t1->DrawLatex(-1.0,113-5*iParticle,fParticleName[iParticle]);
822 DrawMarker(0.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
823 t1->DrawLatex(0.3,113-5*(iParticle-5),fParticleName[iParticle]);
827 TCanvas *c5 = new TCanvas("c5","MC secondary composition vs y - antiProtons",
829 c5->SetFillColor(10); c5->GetFrame()->SetFillColor(10);
830 c5->SetHighLightColor(10); c5->SetBottomMargin(0.15);
831 c5->SetGridx(); c5->SetGridy();
833 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
834 if((iParticle == 0)||(iParticle == 6)||(iParticle == 8))
835 gParticleAntiProtonY[iParticle]->Draw("P");
837 DrawMarker(-1.1, 115-5*iParticle, 20+iParticle, 1.2, 1);
838 t1->DrawLatex(-1.0,113-5*iParticle,fParticleName[iParticle]);
841 DrawMarker(0.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
842 t1->DrawLatex(0.3,113-5*(iParticle-5),fParticleName[iParticle]);
846 TH2F *hEmptyPt = new TH2F("hEmptyPt","",100,0.0,4.0,100,0,120);
847 hEmptyPt->SetStats(kFALSE);
848 hEmptyPt->GetYaxis()->SetTitle("Particle composition [%]");
849 hEmptyPt->GetXaxis()->SetTitle("P_{T} [GeV/c]");
851 TCanvas *c4 = new TCanvas("c4","MC secondary composition vs pT - Protons",
853 c4->SetFillColor(10); c4->GetFrame()->SetFillColor(10);
854 c4->SetHighLightColor(10); c4->SetBottomMargin(0.15);
855 c4->SetGridx(); c4->SetGridy();
856 hEmptyPt->DrawCopy();
857 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
859 DrawMarker(0.2, 115-5*iParticle, 20+iParticle, 1.2, 1);
860 t1->DrawLatex(0.3,113-5*iParticle,fParticleName[iParticle]);
863 DrawMarker(2.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
864 t1->DrawLatex(2.3,113-5*(iParticle-5),fParticleName[iParticle]);
866 if((iParticle == 0)||(iParticle == 2)||(iParticle == 6)||(iParticle == 8))
867 gParticleProtonPt[iParticle]->Draw("P");
870 TCanvas *c6 = new TCanvas("c6",
871 "MC secondary composition vs pT - AntiProtons",
873 c6->SetFillColor(10); c6->GetFrame()->SetFillColor(10);
874 c6->SetHighLightColor(10); c6->SetBottomMargin(0.15);
875 c6->SetGridx(); c6->SetGridy();
876 hEmptyPt->DrawCopy();
877 for(Int_t iParticle = 0; iParticle < 10; iParticle++) {
879 DrawMarker(0.2, 115-5*iParticle, 20+iParticle, 1.2, 1);
880 t1->DrawLatex(0.3,113-5*iParticle,fParticleName[iParticle]);
883 DrawMarker(2.2, 115-5*(iParticle-5), 20+iParticle, 1.2, 1);
884 t1->DrawLatex(2.3,113-5*(iParticle-5),fParticleName[iParticle]);
886 if((iParticle == 0)||(iParticle == 6)||(iParticle == 8))
887 gParticleAntiProtonPt[iParticle]->Draw("P");
891 //________________________________________//
892 void GetComposition(Int_t iSpecies,
894 Double_t *nParticleCompositionY,
896 Double_t *nParticleCompositionPt,
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;
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);
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];
926 //if(nParticleCompositionY[iXbins-1] == 0)
927 //nParticleCompositionY[iXbins-1] = -10.0;
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;
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);
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];
950 //if(nParticleCompositionPt[iYbins-1] == 0)
951 //nParticleCompositionPt[iYbins-1] = -10.0;
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;
962 //________________________________________//
963 void 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",
968 "n","p","#Lambda","#Sigma^{+}"};
969 Int_t iProtonCounter = 0, iAntiProtonCounter = 0;
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;
979 if(histName.Contains("gHistAntiProtons")) {
980 cout<<"Antiprotons coming from "<<fParticleAntiProtonName[iAntiProtonCounter]<<endl;
982 iAntiProtonCounter += 1;
984 for(Int_t iBin = 1; iBin < gMCProcesses->GetNbinsX(); iBin++) {
985 Double_t binContent = gMCProcesses->GetBinContent(iBin);
987 Int_t processId = gMCProcesses->GetBinCenter(iBin);
988 cout<<"\t Process ID: "<<processId<<" - "<<
989 gMCProcessName[processId]<<" - "<<
990 100.*binContent/gMCProcesses->GetEntries()<<"%"<<endl;
996 //________________________________________________//
997 void 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);
1006 //________________________________________________//
1007 void DrawMarker(Double_t x, Double_t y, Int_t style,
1008 Double_t size, Int_t color) {
1009 TMarker *m = new TMarker(x,y,style);
1010 m->SetMarkerSize(size);
1011 m->SetMarkerColor(color);
1015 //________________________________________________//
1016 const char * const gMCProcessName[45] = {
1017 "Primary particle emission",
1018 "Multiple scattering",
1020 "Bending in magnetic field",
1022 "Lepton pair production",
1023 "Compton scattering",
1024 "Photoelectric effect",
1027 "Positron annihilation",
1028 "Positron annihilation at rest",
1029 "Positron annihilation in flight",
1030 "Hadronic interaction",
1031 "Nuclear evaporation",
1033 "Nuclear absorbtion",
1034 "Antiproton annihilation",
1035 "Antineutron annihilation",
1038 "Hadronic incoherent elastic",
1039 "Hadronic coherent elastic",
1040 "Hadronic inelastic",
1042 "Muon nuclear interaction",
1043 "Electron nuclear interaction",
1044 "Positron nuclear interaction",
1045 "Time of flight limit",
1046 "Nuclear photofission",
1048 "No active process",
1053 "Maximum allowed step",
1054 "Cerenkov production",
1055 "Cerenkov feed back photon",
1056 "Cerenkov photon reflection",
1057 "Cerenkov photon refraction",
1058 "Synchrotron radiation",