Skip to content
Snippets Groups Projects

Resolve "pi0 resolution for ECal barrel"

Merged Marshall Scott requested to merge 19-pi0-resolution-for-ecal-barrel into master
Compare and Show latest version
1 file
+ 41
7
Compare changes
  • Side-by-side
  • Inline
@@ -84,13 +84,47 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
return result;
};
// Sampling fraction = Esampling / Ethrown, revised
auto fsam2 = [](const std::vector<double>& sampled, const std::vector<double>& thrown) {
std::vector<double> result;
auto it_sam = sampled.cbegin();
auto it_thr = thrown.cbegin();
for (; it_sam != sampled.end() && it_thr != thrown.end(); ++it_sam, ++it_thr) {
result.push_back(*it_sam / *it_thr);
}
return result;
};
// Energy Resolution = Esampling - Ethrown
auto eResol = [](const std::vector<double>& sampled, const std::vector<double>& thrown) {
std::vector<double> result;
auto it_sam = sampled.cbegin();
auto it_thr = thrown.cbegin();
for (; it_sam != sampled.end() && it_thr != thrown.end(); ++it_sam, ++it_thr) {
result.push_back(*it_sam - *it_thr);
}
return result;
};
// Relative Energy Resolution = (Esampling - Ethrown)/Ethrown
auto eResol_rel = [](const std::vector<double>& sampled, const std::vector<double>& thrown) {
std::vector<double> result;
auto it_sam = sampled.cbegin();
auto it_thr = thrown.cbegin();
for (; it_sam != sampled.end() && it_thr != thrown.end(); ++it_sam, ++it_thr) {
result.push_back((*it_sam - *it_thr) / *it_sam);
}
return result;
};
// Define variables
auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"})
.Define("nhits", nhits, {"EcalBarrelHits"})
.Define("Esim", Esim, {"EcalBarrelHits"})
.Define("fsam", fsam, {"Esim","Ethr"})
.Define("dE", "Ethr-Esim")
.Define("dE_rel", "(Ethr - Esim)/Esim")
.Define("nhits", nhits, {"EcalBarrelHits"})
.Define("Esim", Esim, {"EcalBarrelHits"})
//.Define("fsam", fsam, {"Esim","Ethr"})
.Define("fsam", fsam2, {"Esim","Ethr"})
.Define("dE", eResol, {"Esim", "Ethr"})
.Define("dE_rel", eResol_rel, {"Esim", "Ethr"})
;
// Define Histograms
@@ -144,8 +178,8 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
c4->SaveAs("results/emcal_barrel_pions_fsam.pdf");
//Energy Resolution Work
auto hdE = d1.Histo1D({"hdE", "dE; dE[GeV]; Events", 100, -7.5, 7.5}, "dE");
auto hdE_rel = d1.Histo1D({"hdE_rel", "dE Relative; dE Relative; Events", 100, -7.5, 7.5}, "dE_rel");
auto hdE = d1.Histo1D({"hdE", "dE; dE[GeV]; Events", 20, -7.5, 7.5}, "dE");//changed from 100
auto hdE_rel = d1.Histo1D({"hdE_rel", "dE Relative; dE Relative; Events", 20, -7.5, 7.5}, "dE_rel");//changed from 100
TFitResultPtr f1 = hdE_rel->Fit("gaus", "S");
const double* res = f1->GetParams();
auto tf1 = new TF1("", "TMath::Gaus(x, [0], [1], [2])", -7.5, 7.5);
Loading