Skip to content
Snippets Groups Projects

Restructuring repo

Merged Whitney Armstrong requested to merge restructure2 into master
Compare and Show latest version
5 files
+ 74
56
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -52,73 +52,90 @@ void emcal_barrel_electrons_analysis(const char* input_fname = "sim_output/sim_e
for (const auto& i: evt)
total_edep += i.energyDeposit;
result.push_back(total_edep);
return result;
return result;
};
// Sampling fraction = Esampling / Ethrown
auto fsam = [](const std::vector<double>& sampled, const std::vector<double>& thrown) {
auto fsam = [](const std::vector<double>& sampled,
const std::vector<double>& thrown) {
std::vector<double> result;
for (const auto& E1 : thrown) {
for (const auto& E2 : sampled)
result.push_back(E2/E1);
result.push_back(E2 / E1);
}
return result;
};
// Define variables
auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"})
.Define("nhits", nhits, {"EcalBarrelAstroPixHits"})
.Define("Esim", Esim, {"EcalBarrelAstroPixHits"})
.Define("fsam", fsam, {"Esim","Ethr"})
;
auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"})
.Define("nhits", nhits, {"EcalBarrelHits"})
.Define("Esim", Esim, {"EcalBarrelHits"})
.Define("fsam", fsam, {"Esim", "Ethr"});
// Define Histograms
auto hEthr = d1.Histo1D({"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, 7.5}, "Ethr");
auto hNhits = d1.Histo1D({"hNhits", "Number of hits per events; Number of hits; Events", 100, 0.0, 2000.0}, "nhits");
auto hEsim = d1.Histo1D({"hEsim", "Energy Deposit; Energy Deposit [GeV]; Events", 100, 0.0, 1.0}, "Esim");
auto hfsam = d1.Histo1D({"hfsam", "Sampling Fraction; Sampling Fraction; Events", 100, 0.0, 0.1}, "fsam");
auto hEthr = d1.Histo1D(
{"hEthr", "Thrown Energy; Thrown Energy [GeV]; Events", 100, 0.0, 7.5},
"Ethr");
auto hNhits =
d1.Histo1D({"hNhits", "Number of hits per events; Number of hits; Events",
100, 0.0, 2000.0},
"nhits");
auto hEsim = d1.Histo1D(
{"hEsim", "Energy Deposit; Energy Deposit [GeV]; Events", 100, 0.0, 1.0},
"Esim");
auto hfsam = d1.Histo1D(
{"hfsam", "Sampling Fraction; Sampling Fraction; Events", 100, 0.0, 0.1},
"fsam");
// Event Counts
auto nevents_thrown = d1.Count();
auto nevents_thrown = d1.Count();
std::cout << "Number of Thrown Events: " << (*nevents_thrown) << "\n";
// Draw Histograms
TCanvas *c1 = new TCanvas("c1", "c1", 700, 500);
c1->SetLogy(1);
hEthr->GetYaxis()->SetTitleOffset(1.4);
hEthr->SetLineWidth(2);
hEthr->SetLineColor(kBlue);
hEthr->DrawClone();
c1->SaveAs("results/emcal_barrel_electrons_Ethr.png");
c1->SaveAs("results/emcal_barrel_electrons_Ethr.pdf");
TCanvas *c2 = new TCanvas("c2", "c2", 700, 500);
c2->SetLogy(1);
hNhits->GetYaxis()->SetTitleOffset(1.4);
hNhits->SetLineWidth(2);
hNhits->SetLineColor(kBlue);
hNhits->DrawClone();
c2->SaveAs("results/emcal_barrel_electrons_nhits.png");
c2->SaveAs("results/emcal_barrel_electrons_nhits.pdf");
TCanvas *c3 = new TCanvas("c3", "c3", 700, 500);
c3->SetLogy(1);
hEsim->GetYaxis()->SetTitleOffset(1.4);
hEsim->SetLineWidth(2);
hEsim->SetLineColor(kBlue);
hEsim->DrawClone();
c3->SaveAs("results/emcal_barrel_electrons_Esim.png");
c3->SaveAs("results/emcal_barrel_electrons_Esim.pdf");
TCanvas *c4 = new TCanvas("c4", "c4", 700, 500);
c4->SetLogy(1);
hfsam->GetYaxis()->SetTitleOffset(1.4);
hfsam->SetLineWidth(2);
hfsam->SetLineColor(kBlue);
hfsam->Fit("gaus","","",0.01,0.1);
hfsam->GetFunction("gaus")->SetLineWidth(2);
hfsam->GetFunction("gaus")->SetLineColor(kRed);
hfsam->DrawClone();
c4->SaveAs("results/emcal_barrel_electrons_fsam.png");
c4->SaveAs("results/emcal_barrel_electrons_fsam.pdf");
{
TCanvas* c1 = new TCanvas("c1", "c1", 700, 500);
c1->SetLogy(1);
auto h = hEthr->DrawCopy();
h->GetYaxis()->SetTitleOffset(1.4);
h->SetLineWidth(2);
h->SetLineColor(kBlue);
c1->SaveAs("results/emcal_barrel_electrons_Ethr.png");
c1->SaveAs("results/emcal_barrel_electrons_Ethr.pdf");
}
{
TCanvas* c2 = new TCanvas("c2", "c2", 700, 500);
c2->SetLogy(1);
auto h = hNhits->DrawCopy();
h->GetYaxis()->SetTitleOffset(1.4);
h->SetLineWidth(2);
h->SetLineColor(kBlue);
c2->SaveAs("results/emcal_barrel_electrons_nhits.png");
c2->SaveAs("results/emcal_barrel_electrons_nhits.pdf");
}
{
TCanvas* c3 = new TCanvas("c3", "c3", 700, 500);
c3->SetLogy(1);
auto h = hEsim->DrawCopy();
h->GetYaxis()->SetTitleOffset(1.4);
h->SetLineWidth(2);
h->SetLineColor(kBlue);
c3->SaveAs("results/emcal_barrel_electrons_Esim.png");
c3->SaveAs("results/emcal_barrel_electrons_Esim.pdf");
}
{
TCanvas* c4 = new TCanvas("c4", "c4", 700, 500);
c4->SetLogy(1);
auto h = hfsam->DrawCopy();
h->GetYaxis()->SetTitleOffset(1.4);
h->SetLineWidth(2);
h->SetLineColor(kBlue);
h->Fit("gaus", "", "", 0.01, 0.1);
h->GetFunction("gaus")->SetLineWidth(2);
h->GetFunction("gaus")->SetLineColor(kRed);
c4->SaveAs("results/emcal_barrel_electrons_fsam.png");
c4->SaveAs("results/emcal_barrel_electrons_fsam.pdf");
}
}
Loading