Skip to content

Commit 188605a

Browse files
authored
Merge pull request #100 from preghenella/rdev-dndneta
Multiple additions + forward parameterisation + mvl addons
2 parents 193c3e0 + bb9b798 commit 188605a

18 files changed

+1439
-201
lines changed

examples/smearing/draw_etadep.C

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#include "style.C"
2+
#include "lutRead_allres_vseta.C"
3+
4+
void
5+
draw_etadep()
6+
{
7+
8+
style();
9+
10+
//std::vector<std::string> name = {"el", "pi", "ka", "pr"};
11+
// std::vector<std::string> title = {"electron", "pion", "kaon", "proton"};
12+
//std::vector<std::string> title = {"e", "#pi", "K", "p"};
13+
14+
float ptvals[] = {1, 5, 10, 20};
15+
Color_t colors[] = {kRed+1, kRed+1, kRed+1, kRed+1};
16+
Color_t linestyles[] = {1, 2, 3, 4};
17+
18+
int nPtVals = 4;
19+
20+
TLatex latex;
21+
latex.SetTextAlign(33);
22+
23+
auto c1 = new TCanvas("c1", "c1: pt reso", 800, 600);
24+
c1->SetLogy();
25+
c1->DrawFrame(0, 1., 4, 200., ";#eta;momentum resolution (%)");
26+
27+
TLegend *leg = new TLegend(0.18,0.6,0.3,0.85);
28+
leg->SetBorderSize(0);
29+
auto c2 = new TCanvas("c2", "c2: dca xy", 800, 600);
30+
c2->SetLogy();
31+
c2->DrawFrame(0, 1., 4, 200., ";#eta;dca_{xy} resolution (#mum)");
32+
33+
auto c3 = new TCanvas("c3", "c3: dca z", 800, 600);
34+
c3->SetLogy();
35+
c3->DrawFrame(0, 1., 4, 200., ";#eta;dca_{z} resolution (#mum)");
36+
37+
auto c4 = new TCanvas("c4", "c4: sin phi", 800, 600);
38+
c4->SetLogy();
39+
c4->DrawFrame(0, 1e-5, 4, 1e-2, ";#eta;sin(#phi) resolution");
40+
41+
auto c5 = new TCanvas("c5", "c5: tan lambda", 800, 600);
42+
c5->SetLogy();
43+
c5->DrawFrame(0, 1e-5, 4, 1e-2, ";#eta;tan(#lambda) resolution");
44+
45+
46+
for (int i = 0; i < nPtVals; ++i) {
47+
48+
/*
49+
auto c = new TCanvas((std::string("c") + name[i]).c_str(),
50+
(std::string("c") + name[i]).c_str(),
51+
800, 800);
52+
c->SetLogx();
53+
c->SetLogy();
54+
c->DrawFrame(1.e-2, 1., 100., 100., ";#it{p}_{T} (GeV/#it{c});momentum resolution (%)");
55+
latex.DrawLatexNDC(0.9, 0.9, title[i].c_str());
56+
*/
57+
58+
//auto g2a = lutRead_pt((std::string("lutCovm.") + name[i] + std::string(".2kG.20cm.default.dat")).c_str());
59+
auto ptres = new TGraph();
60+
auto dca_xy = new TGraph();
61+
auto dca_z = new TGraph();
62+
auto sinp = new TGraph();
63+
auto tanl = new TGraph();
64+
lutRead_allres_vseta("luts/lutCovm.v12.dat",dca_xy,dca_z,sinp,tanl,ptres,ptvals[i]);
65+
ptres->SetLineColor(colors[i]);
66+
ptres->SetLineStyle(i+1);
67+
ptres->SetLineWidth(3);
68+
leg->AddEntry(ptres,Form("p_{T} = %.1f GeV",ptvals[i]));
69+
c1->cd();
70+
ptres->Draw("samel");
71+
72+
dca_xy->SetLineColor(colors[i]);
73+
dca_xy->SetLineStyle(i+1);
74+
dca_xy->SetLineWidth(3);
75+
c2->cd();
76+
dca_xy->Draw("samel");
77+
78+
dca_z->SetLineColor(colors[i]);
79+
dca_z->SetLineStyle(i+1);
80+
dca_z->SetLineWidth(3);
81+
c3->cd();
82+
dca_z->Draw("samel");
83+
84+
sinp->SetLineColor(colors[i]);
85+
sinp->SetLineStyle(i+1);
86+
sinp->SetLineWidth(3);
87+
c4->cd();
88+
sinp->Draw("samel");
89+
90+
tanl->SetLineColor(colors[i]);
91+
tanl->SetLineStyle(i+1);
92+
tanl->SetLineWidth(3);
93+
c5->cd();
94+
tanl->Draw("samel");
95+
}
96+
c1->cd();
97+
leg->Draw();
98+
c1->Print("ptres_etadep.pdf");
99+
c2->cd();
100+
leg->Draw();
101+
c2->Print("dcaxyres_etadep.pdf");
102+
c3->cd();
103+
leg->Draw();
104+
c3->Print("dcazres_etadep.pdf");
105+
c4->cd();
106+
leg->Draw();
107+
c4->Print("sinphires_etadep.pdf");
108+
c5->cd();
109+
leg->Draw();
110+
c5->Print("tanlres_etadep.pdf");
111+
}

examples/smearing/draw_mid_fwd.C

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#include "style.C"
2+
#include "lutRead_allres_vspt.C"
3+
4+
void
5+
draw_mid_fwd()
6+
{
7+
8+
style();
9+
10+
//std::vector<std::string> name = {"el", "pi", "ka", "pr"};
11+
// std::vector<std::string> title = {"electron", "pion", "kaon", "proton"};
12+
//std::vector<std::string> title = {"e", "#pi", "K", "p"};
13+
14+
float etavals[] = {0, 1, 2, 3, 4};
15+
Color_t colors[] = {kRed+1, kRed+1, kBlue, kBlue, kBlue};
16+
Color_t linestyles[] = {1, 2, 3, 4, 5};
17+
18+
int nEtaVals = 5;
19+
20+
TLatex latex;
21+
latex.SetTextAlign(33);
22+
23+
auto c1 = new TCanvas("c1", "c1: pt reso", 800, 600);
24+
//cc->Divide(2, 2);
25+
c1->SetLogx();
26+
c1->SetLogy();
27+
c1->DrawFrame(1.e-2, 1., 100., 200., ";#it{p}_{T} (GeV/#it{c});momentum resolution (%)");
28+
29+
TLegend *leg = new TLegend(0.18,0.18,0.3,0.35);
30+
leg->SetBorderSize(0);
31+
auto c2 = new TCanvas("c2", "c2: dca xy", 800, 600);
32+
c2->SetLogx();
33+
c2->SetLogy();
34+
c2->DrawFrame(1.e-2, 1., 100., 200., ";#it{p}_{T} (GeV/#it{c});dca_{xy} resolution (#mum)");
35+
36+
auto c3 = new TCanvas("c3", "c3: dca z", 800, 600);
37+
c3->SetLogx();
38+
c3->SetLogy();
39+
c3->DrawFrame(1.e-2, 1., 100., 200., ";#it{p}_{T} (GeV/#it{c});dca_{z} resolution (#mum)");
40+
41+
auto c4 = new TCanvas("c4", "c4: sin phi", 800, 600);
42+
c4->SetLogx();
43+
c4->SetLogy();
44+
c4->DrawFrame(1.e-2, 0.00001, 100., 5e-2, ";#it{p}_{T} (GeV/#it{c});sin(#phi) resolution");
45+
46+
auto c5 = new TCanvas("c5", "c5: tan lambda", 800, 600);
47+
c5->SetLogx();
48+
c5->SetLogy();
49+
c5->DrawFrame(1.e-2, 0.00001, 100., 5e-2, ";#it{p}_{T} (GeV/#it{c});tan(#lambda) resolution");
50+
51+
52+
for (int i = 0; i < nEtaVals; ++i) {
53+
54+
/*
55+
auto c = new TCanvas((std::string("c") + name[i]).c_str(),
56+
(std::string("c") + name[i]).c_str(),
57+
800, 800);
58+
c->SetLogx();
59+
c->SetLogy();
60+
c->DrawFrame(1.e-2, 1., 100., 100., ";#it{p}_{T} (GeV/#it{c});momentum resolution (%)");
61+
latex.DrawLatexNDC(0.9, 0.9, title[i].c_str());
62+
*/
63+
64+
//auto g2a = lutRead_pt((std::string("lutCovm.") + name[i] + std::string(".2kG.20cm.default.dat")).c_str());
65+
auto ptres = new TGraph();
66+
auto dca_xy = new TGraph();
67+
auto dca_z = new TGraph();
68+
auto sinp = new TGraph();
69+
auto tanl = new TGraph();
70+
lutRead_allres_vspt("luts/lutCovm.v12.dat",dca_xy,dca_z,sinp,tanl,ptres,etavals[i]);
71+
ptres->SetLineColor(colors[i]);
72+
ptres->SetLineStyle(i+1);
73+
ptres->SetLineWidth(3);
74+
leg->AddEntry(ptres,Form("#eta = %.1f",etavals[i]));
75+
c1->cd();
76+
ptres->Draw("samel");
77+
78+
dca_xy->SetLineColor(colors[i]);
79+
dca_xy->SetLineStyle(i+1);
80+
dca_xy->SetLineWidth(3);
81+
c2->cd();
82+
dca_xy->Draw("samel");
83+
84+
dca_z->SetLineColor(colors[i]);
85+
dca_z->SetLineStyle(i+1);
86+
dca_z->SetLineWidth(3);
87+
c3->cd();
88+
dca_z->Draw("samel");
89+
90+
sinp->SetLineColor(colors[i]);
91+
sinp->SetLineStyle(i+1);
92+
sinp->SetLineWidth(3);
93+
c4->cd();
94+
sinp->Draw("samel");
95+
96+
tanl->SetLineColor(colors[i]);
97+
tanl->SetLineStyle(i+1);
98+
tanl->SetLineWidth(3);
99+
c5->cd();
100+
tanl->Draw("samel");
101+
}
102+
c1->cd();
103+
leg->Draw();
104+
c1->Print("ptres_etabins.pdf");
105+
c2->cd();
106+
leg->Draw();
107+
c2->Print("dcaxyres_etabins.pdf");
108+
c3->cd();
109+
leg->Draw();
110+
c3->Print("dcazres_etabins.pdf");
111+
c4->cd();
112+
leg->Draw();
113+
c4->Print("sinphires_etabins.pdf");
114+
c5->cd();
115+
leg->Draw();
116+
c5->Print("tanlres_etabins.pdf");
117+
118+
//cc->SaveAs("draw_pt_mid_fwd.png");
119+
120+
}

examples/smearing/lutRead.C

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
enum EWhat {
2+
kEfficiency,
3+
kEfficiency2,
4+
kEfficiencyInnerTOF,
5+
kEfficiencyOuterTOF,
6+
kPtResolution,
7+
kRPhiResolution,
8+
kZResolution
9+
};
10+
11+
enum EVs {
12+
kNch,
13+
kEta,
14+
kPt
15+
};
16+
17+
TGraph *
18+
lutRead(int pdg, const char *filename, int what, int vs, float nch = 0., float radius = 0., float eta = 0., float pt = 0.)
19+
{
20+
o2::delphes::TrackSmearer smearer;
21+
smearer.loadTable(pdg, filename);
22+
auto lutHeader = smearer.getLUTHeader(pdg);
23+
map_t lutMap;
24+
if (vs == kNch) lutMap = lutHeader->nchmap;
25+
if (vs == kEta) lutMap = lutHeader->etamap;
26+
if (vs == kPt) lutMap = lutHeader->ptmap;
27+
auto nbins = lutMap.nbins;
28+
auto g = new TGraph();
29+
30+
bool canBeInvalid = true;
31+
for (int i = 0; i < nbins; ++i) {
32+
if (vs == kNch) nch = lutMap.eval(i);
33+
if (vs == kEta) eta = lutMap.eval(i);
34+
if (vs == kPt) pt = lutMap.eval(i);
35+
auto lutEntry = smearer.getLUTEntry(pdg, nch, radius, eta , pt);
36+
if (!lutEntry->valid || lutEntry->eff == 0.) {
37+
if (!canBeInvalid) std::cout << " --- warning: it cannot be invalid \n" << std::endl;
38+
continue;
39+
}
40+
canBeInvalid = false;
41+
42+
double cen = 0.;
43+
if (vs == kNch) cen = lutEntry->nch;
44+
if (vs == kEta) cen = lutEntry->eta;
45+
if (vs == kPt) cen = lutEntry->pt;
46+
double val = 0.;
47+
if (what == kEfficiency) val = lutEntry->eff * 100.; // efficiency (%)
48+
if (what == kEfficiency2) val = lutEntry->eff2 * 100.; // efficiency (%)
49+
if (what == kEfficiencyInnerTOF) val = lutEntry->itof * 100.; // efficiency (%)
50+
if (what == kEfficiencyOuterTOF) val = lutEntry->otof * 100.; // efficiency (%)
51+
if (what == kPtResolution) val = sqrt(lutEntry->covm[14]) * lutEntry->pt * 100.; // pt resolution (%)
52+
if (what == kRPhiResolution) val = sqrt(lutEntry->covm[0]) * 1.e4; // rphi resolution (um)
53+
if (what == kZResolution) val = sqrt(lutEntry->covm[1]) * 1.e4; // z resolution (um)
54+
if (val < 0.) continue;
55+
g->SetPoint(g->GetN(), cen, val);
56+
}
57+
58+
return g;
59+
60+
}
61+

0 commit comments

Comments
 (0)