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
+ 27
5
Compare changes
  • Side-by-side
  • Inline
@@ -95,14 +95,36 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
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("nhits", nhits, {"EcalBarrelHits"})
.Define("Esim", Esim, {"EcalBarrelHits"})
//.Define("fsam", fsam, {"Esim","Ethr"})
.Define("fsam", fsam2, {"Esim","Ethr"})
.Define("dE", "Ethr-Esim")
.Define("dE_rel", "(Ethr - Esim)/Esim")
.Define("fsam", fsam2, {"Esim","Ethr"})
.Define("dE", eResol, {"Esim", "Ethr"})
.Define("dE_rel", eResol_rel, {"Esim", "Ethr"})
;
// Define Histograms
Loading