forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_secondary.macro
More file actions
55 lines (41 loc) · 1.14 KB
/
plot_secondary.macro
File metadata and controls
55 lines (41 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "style.macro"
int rebinx = 10;
int rebiny = 10;
void plot_secondary(const char *fname, int pdg);
void plot_secondary(const char *fname)
{
std::vector<int> pdgs = {11, 13, 22, 211, 321, 2112, 2212};
for (int pdg : pdgs)
plot_secondary(fname, pdg);
}
void
plot_secondary(const char *fname, int pdg)
{
style();
gStyle->SetPalette(1);
auto c = new TCanvas("c", "c", 800, 400);
c->Divide(2, 1);
auto fin = TFile::Open(fname);
auto hgen = (TH2*)fin->Get(Form("hZRGen_%d", pdg));
hgen->SetTitle(";z (cm);R (cm)");
hgen->RebinX(rebinx);
hgen->RebinY(rebiny);
auto hhit = (TH2*)fin->Get(Form("hZRHit_%d", pdg));
hhit->SetTitle(";z (cm);R (cm)");
hhit->RebinX(rebinx);
hhit->RebinY(rebiny);
c->cd(1)->SetLogz();
hgen->Draw("col");
c->cd(2)->SetLogz();
hhit->Draw("col");
c->cd(2)->SetLogz();
auto heff = (TH2*)hhit->Clone("heff");
heff->Divide(hhit, hgen, 1., 1., "B");
heff->SetMinimum(1.e-3);
heff->SetMaximum(1.);
heff->Draw("col");
std::string fnameout = fname;
fnameout.erase(fnameout.find("root"), 4);
fnameout += std::to_string(pdg) + ".png";
c->SaveAs(fnameout.c_str());
}