Skip to content

Commit b254e4e

Browse files
committed
Merge remote-tracking branch 'mvl/fwdpara' into rdev-dndneta
2 parents 85e1502 + 81358fb commit b254e4e

File tree

10 files changed

+723
-45
lines changed

10 files changed

+723
-45
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+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#include "lutCovm.hh"
2+
3+
void lutRead_allres_vseta(const char *filename = "lutCovm.dat",
4+
TGraph *dca_xy = 0, TGraph *dca_z = 0, TGraph *sinp = 0, TGraph *tanl = 0, TGraph* ptres = 0, double pt = 1.)
5+
{
6+
7+
// input file
8+
ifstream lutFile(filename, std::ofstream::binary);
9+
10+
// read header
11+
lutHeader_t lutHeader;
12+
lutFile.read(reinterpret_cast<char *>(&lutHeader), sizeof(lutHeader));
13+
lutHeader.print();
14+
15+
// entries
16+
const int nnch = lutHeader.nchmap.nbins;
17+
const int nrad = lutHeader.radmap.nbins;
18+
const int neta = lutHeader.etamap.nbins;
19+
const int npt = lutHeader.ptmap.nbins;
20+
21+
auto nchbin = lutHeader.nchmap.find(0.);
22+
auto radbin = lutHeader.radmap.find(0.);
23+
auto ptbin = lutHeader.ptmap.find(pt);
24+
25+
lutEntry_t lutTable[neta];
26+
27+
// read entries
28+
for (int inch = 0; inch < nnch; ++inch) {
29+
for (int irad = 0; irad < nrad; ++irad) {
30+
for (int ieta = 0; ieta < neta; ++ieta) {
31+
for (int ipt = 0; ipt < npt; ++ipt) {
32+
if (inch==nchbin && irad==radbin && ipt == ptbin) {
33+
lutFile.read(reinterpret_cast<char *>(&lutTable[ieta]), sizeof(lutEntry_t));
34+
//lutTable[ieta].print();
35+
}
36+
else {
37+
lutEntry_t dummy;
38+
lutFile.read(reinterpret_cast<char *>(&dummy), sizeof(lutEntry_t));
39+
}
40+
}
41+
}
42+
}
43+
}
44+
45+
lutFile.close();
46+
47+
if (ptres) {
48+
ptres->SetName(filename);
49+
ptres->SetTitle(filename);
50+
ptres->GetXaxis()->SetTitle("#eta");
51+
ptres->GetYaxis()->SetTitle("momentum resolution (%)");
52+
}
53+
54+
if (dca_xy) {
55+
dca_xy->SetName(filename);
56+
dca_xy->SetTitle(filename);
57+
dca_xy->GetXaxis()->SetTitle("#eta");
58+
dca_xy->GetYaxis()->SetTitle("#sigma(d_{xy}) (#mum)");
59+
}
60+
61+
if (dca_z) {
62+
dca_z->SetName(filename);
63+
dca_z->SetTitle(filename);
64+
dca_z->GetXaxis()->SetTitle("#eta");
65+
dca_z->GetYaxis()->SetTitle("#sigma(d_{z}) (#mum)");
66+
}
67+
68+
if (sinp) {
69+
sinp->SetName(filename);
70+
sinp->SetTitle(filename);
71+
sinp->GetXaxis()->SetTitle("#eta");
72+
sinp->GetYaxis()->SetTitle("#sigma(sin(#phi))");
73+
}
74+
75+
if (tanl) {
76+
tanl->SetName(filename);
77+
tanl->SetTitle(filename);
78+
tanl->GetXaxis()->SetTitle("#eta");
79+
tanl->GetYaxis()->SetTitle("#sigma(tam(#lambda))");
80+
}
81+
for (int ieta = 0; ieta < neta/2; ++ieta) {
82+
auto lutEntry = &lutTable[neta/2+ieta];
83+
if (!lutEntry->valid) continue;
84+
auto cen = lutEntry->eta;
85+
if (ptres) {
86+
auto val = sqrt(lutEntry->covm[14]) * lutEntry->pt * 100.;
87+
ptres->SetPoint(ptres->GetN(), cen, val);
88+
}
89+
if (dca_xy) {
90+
auto val = sqrt(lutEntry->covm[0]) * 1e4;
91+
dca_xy->SetPoint(dca_xy->GetN(), cen, val);
92+
}
93+
if (dca_z) {
94+
auto val = sqrt(lutEntry->covm[2]) * 1e4;
95+
dca_z->SetPoint(dca_z->GetN(), cen, val);
96+
}
97+
if (sinp) {
98+
auto val = sqrt(lutEntry->covm[5]);
99+
sinp->SetPoint(sinp->GetN(), cen, val);
100+
}
101+
if (tanl) {
102+
auto val = sqrt(lutEntry->covm[9]);
103+
tanl->SetPoint(tanl->GetN(), cen, val);
104+
}
105+
}
106+
}

0 commit comments

Comments
 (0)