Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions 111 examples/smearing/draw_etadep.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#include "style.C"
#include "lutRead_allres_vseta.C"

void
draw_etadep()
{

style();

//std::vector<std::string> name = {"el", "pi", "ka", "pr"};
// std::vector<std::string> title = {"electron", "pion", "kaon", "proton"};
//std::vector<std::string> title = {"e", "#pi", "K", "p"};

float ptvals[] = {1, 5, 10, 20};
Color_t colors[] = {kRed+1, kRed+1, kRed+1, kRed+1};
Color_t linestyles[] = {1, 2, 3, 4};

int nPtVals = 4;

TLatex latex;
latex.SetTextAlign(33);

auto c1 = new TCanvas("c1", "c1: pt reso", 800, 600);
c1->SetLogy();
c1->DrawFrame(0, 1., 4, 200., ";#eta;momentum resolution (%)");

TLegend *leg = new TLegend(0.18,0.6,0.3,0.85);
leg->SetBorderSize(0);
auto c2 = new TCanvas("c2", "c2: dca xy", 800, 600);
c2->SetLogy();
c2->DrawFrame(0, 1., 4, 200., ";#eta;dca_{xy} resolution (#mum)");

auto c3 = new TCanvas("c3", "c3: dca z", 800, 600);
c3->SetLogy();
c3->DrawFrame(0, 1., 4, 200., ";#eta;dca_{z} resolution (#mum)");

auto c4 = new TCanvas("c4", "c4: sin phi", 800, 600);
c4->SetLogy();
c4->DrawFrame(0, 1e-5, 4, 1e-2, ";#eta;sin(#phi) resolution");

auto c5 = new TCanvas("c5", "c5: tan lambda", 800, 600);
c5->SetLogy();
c5->DrawFrame(0, 1e-5, 4, 1e-2, ";#eta;tan(#lambda) resolution");


for (int i = 0; i < nPtVals; ++i) {

/*
auto c = new TCanvas((std::string("c") + name[i]).c_str(),
(std::string("c") + name[i]).c_str(),
800, 800);
c->SetLogx();
c->SetLogy();
c->DrawFrame(1.e-2, 1., 100., 100., ";#it{p}_{T} (GeV/#it{c});momentum resolution (%)");
latex.DrawLatexNDC(0.9, 0.9, title[i].c_str());
*/

//auto g2a = lutRead_pt((std::string("lutCovm.") + name[i] + std::string(".2kG.20cm.default.dat")).c_str());
auto ptres = new TGraph();
auto dca_xy = new TGraph();
auto dca_z = new TGraph();
auto sinp = new TGraph();
auto tanl = new TGraph();
lutRead_allres_vseta("luts/lutCovm.v12.dat",dca_xy,dca_z,sinp,tanl,ptres,ptvals[i]);
ptres->SetLineColor(colors[i]);
ptres->SetLineStyle(i+1);
ptres->SetLineWidth(3);
leg->AddEntry(ptres,Form("p_{T} = %.1f GeV",ptvals[i]));
c1->cd();
ptres->Draw("samel");

dca_xy->SetLineColor(colors[i]);
dca_xy->SetLineStyle(i+1);
dca_xy->SetLineWidth(3);
c2->cd();
dca_xy->Draw("samel");

dca_z->SetLineColor(colors[i]);
dca_z->SetLineStyle(i+1);
dca_z->SetLineWidth(3);
c3->cd();
dca_z->Draw("samel");

sinp->SetLineColor(colors[i]);
sinp->SetLineStyle(i+1);
sinp->SetLineWidth(3);
c4->cd();
sinp->Draw("samel");

tanl->SetLineColor(colors[i]);
tanl->SetLineStyle(i+1);
tanl->SetLineWidth(3);
c5->cd();
tanl->Draw("samel");
}
c1->cd();
leg->Draw();
c1->Print("ptres_etadep.pdf");
c2->cd();
leg->Draw();
c2->Print("dcaxyres_etadep.pdf");
c3->cd();
leg->Draw();
c3->Print("dcazres_etadep.pdf");
c4->cd();
leg->Draw();
c4->Print("sinphires_etadep.pdf");
c5->cd();
leg->Draw();
c5->Print("tanlres_etadep.pdf");
}
120 changes: 120 additions & 0 deletions 120 examples/smearing/draw_mid_fwd.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#include "style.C"
#include "lutRead_allres_vspt.C"

void
draw_mid_fwd()
{

style();

//std::vector<std::string> name = {"el", "pi", "ka", "pr"};
// std::vector<std::string> title = {"electron", "pion", "kaon", "proton"};
//std::vector<std::string> title = {"e", "#pi", "K", "p"};

float etavals[] = {0, 1, 2, 3, 4};
Color_t colors[] = {kRed+1, kRed+1, kBlue, kBlue, kBlue};
Color_t linestyles[] = {1, 2, 3, 4, 5};

int nEtaVals = 5;

TLatex latex;
latex.SetTextAlign(33);

auto c1 = new TCanvas("c1", "c1: pt reso", 800, 600);
//cc->Divide(2, 2);
c1->SetLogx();
c1->SetLogy();
c1->DrawFrame(1.e-2, 1., 100., 200., ";#it{p}_{T} (GeV/#it{c});momentum resolution (%)");

TLegend *leg = new TLegend(0.18,0.18,0.3,0.35);
leg->SetBorderSize(0);
auto c2 = new TCanvas("c2", "c2: dca xy", 800, 600);
c2->SetLogx();
c2->SetLogy();
c2->DrawFrame(1.e-2, 1., 100., 200., ";#it{p}_{T} (GeV/#it{c});dca_{xy} resolution (#mum)");

auto c3 = new TCanvas("c3", "c3: dca z", 800, 600);
c3->SetLogx();
c3->SetLogy();
c3->DrawFrame(1.e-2, 1., 100., 200., ";#it{p}_{T} (GeV/#it{c});dca_{z} resolution (#mum)");

auto c4 = new TCanvas("c4", "c4: sin phi", 800, 600);
c4->SetLogx();
c4->SetLogy();
c4->DrawFrame(1.e-2, 0.00001, 100., 5e-2, ";#it{p}_{T} (GeV/#it{c});sin(#phi) resolution");

auto c5 = new TCanvas("c5", "c5: tan lambda", 800, 600);
c5->SetLogx();
c5->SetLogy();
c5->DrawFrame(1.e-2, 0.00001, 100., 5e-2, ";#it{p}_{T} (GeV/#it{c});tan(#lambda) resolution");


for (int i = 0; i < nEtaVals; ++i) {

/*
auto c = new TCanvas((std::string("c") + name[i]).c_str(),
(std::string("c") + name[i]).c_str(),
800, 800);
c->SetLogx();
c->SetLogy();
c->DrawFrame(1.e-2, 1., 100., 100., ";#it{p}_{T} (GeV/#it{c});momentum resolution (%)");
latex.DrawLatexNDC(0.9, 0.9, title[i].c_str());
*/

//auto g2a = lutRead_pt((std::string("lutCovm.") + name[i] + std::string(".2kG.20cm.default.dat")).c_str());
auto ptres = new TGraph();
auto dca_xy = new TGraph();
auto dca_z = new TGraph();
auto sinp = new TGraph();
auto tanl = new TGraph();
lutRead_allres_vspt("luts/lutCovm.v12.dat",dca_xy,dca_z,sinp,tanl,ptres,etavals[i]);
ptres->SetLineColor(colors[i]);
ptres->SetLineStyle(i+1);
ptres->SetLineWidth(3);
leg->AddEntry(ptres,Form("#eta = %.1f",etavals[i]));
c1->cd();
ptres->Draw("samel");

dca_xy->SetLineColor(colors[i]);
dca_xy->SetLineStyle(i+1);
dca_xy->SetLineWidth(3);
c2->cd();
dca_xy->Draw("samel");

dca_z->SetLineColor(colors[i]);
dca_z->SetLineStyle(i+1);
dca_z->SetLineWidth(3);
c3->cd();
dca_z->Draw("samel");

sinp->SetLineColor(colors[i]);
sinp->SetLineStyle(i+1);
sinp->SetLineWidth(3);
c4->cd();
sinp->Draw("samel");

tanl->SetLineColor(colors[i]);
tanl->SetLineStyle(i+1);
tanl->SetLineWidth(3);
c5->cd();
tanl->Draw("samel");
}
c1->cd();
leg->Draw();
c1->Print("ptres_etabins.pdf");
c2->cd();
leg->Draw();
c2->Print("dcaxyres_etabins.pdf");
c3->cd();
leg->Draw();
c3->Print("dcazres_etabins.pdf");
c4->cd();
leg->Draw();
c4->Print("sinphires_etabins.pdf");
c5->cd();
leg->Draw();
c5->Print("tanlres_etabins.pdf");

//cc->SaveAs("draw_pt_mid_fwd.png");

}
61 changes: 61 additions & 0 deletions 61 examples/smearing/lutRead.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
enum EWhat {
kEfficiency,
kEfficiency2,
kEfficiencyInnerTOF,
kEfficiencyOuterTOF,
kPtResolution,
kRPhiResolution,
kZResolution
};

enum EVs {
kNch,
kEta,
kPt
};

TGraph *
lutRead(int pdg, const char *filename, int what, int vs, float nch = 0., float radius = 0., float eta = 0., float pt = 0.)
{
o2::delphes::TrackSmearer smearer;
smearer.loadTable(pdg, filename);
auto lutHeader = smearer.getLUTHeader(pdg);
map_t lutMap;
if (vs == kNch) lutMap = lutHeader->nchmap;
if (vs == kEta) lutMap = lutHeader->etamap;
if (vs == kPt) lutMap = lutHeader->ptmap;
auto nbins = lutMap.nbins;
auto g = new TGraph();

bool canBeInvalid = true;
for (int i = 0; i < nbins; ++i) {
if (vs == kNch) nch = lutMap.eval(i);
if (vs == kEta) eta = lutMap.eval(i);
if (vs == kPt) pt = lutMap.eval(i);
auto lutEntry = smearer.getLUTEntry(pdg, nch, radius, eta , pt);
if (!lutEntry->valid || lutEntry->eff == 0.) {
if (!canBeInvalid) std::cout << " --- warning: it cannot be invalid \n" << std::endl;
continue;
}
canBeInvalid = false;

double cen = 0.;
if (vs == kNch) cen = lutEntry->nch;
if (vs == kEta) cen = lutEntry->eta;
if (vs == kPt) cen = lutEntry->pt;
double val = 0.;
if (what == kEfficiency) val = lutEntry->eff * 100.; // efficiency (%)
if (what == kEfficiency2) val = lutEntry->eff2 * 100.; // efficiency (%)
if (what == kEfficiencyInnerTOF) val = lutEntry->itof * 100.; // efficiency (%)
if (what == kEfficiencyOuterTOF) val = lutEntry->otof * 100.; // efficiency (%)
if (what == kPtResolution) val = sqrt(lutEntry->covm[14]) * lutEntry->pt * 100.; // pt resolution (%)
if (what == kRPhiResolution) val = sqrt(lutEntry->covm[0]) * 1.e4; // rphi resolution (um)
if (what == kZResolution) val = sqrt(lutEntry->covm[1]) * 1.e4; // z resolution (um)
if (val < 0.) continue;
g->SetPoint(g->GetN(), cen, val);
}

return g;

}

Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.