Skip to content
Snippets Groups Projects
Commit 63267210 authored by Marshall Scott's avatar Marshall Scott
Browse files

New dE and dE_res functions

parent 110d4774
Branches
No related tags found
No related merge requests found
...@@ -95,14 +95,36 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal ...@@ -95,14 +95,36 @@ void emcal_barrel_pions_analysis(const char* input_fname = "sim_output/sim_emcal
return result; 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 // Define variables
auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"}) auto d1 = d0.Define("Ethr", Ethr, {"mcparticles"})
.Define("nhits", nhits, {"EcalBarrelHits"}) .Define("nhits", nhits, {"EcalBarrelHits"})
.Define("Esim", Esim, {"EcalBarrelHits"}) .Define("Esim", Esim, {"EcalBarrelHits"})
//.Define("fsam", fsam, {"Esim","Ethr"}) //.Define("fsam", fsam, {"Esim","Ethr"})
.Define("fsam", fsam2, {"Esim","Ethr"}) .Define("fsam", fsam2, {"Esim","Ethr"})
.Define("dE", "Ethr-Esim") .Define("dE", eResol, {"Esim", "Ethr"})
.Define("dE_rel", "(Ethr - Esim)/Esim") .Define("dE_rel", eResol_rel, {"Esim", "Ethr"})
; ;
// Define Histograms // Define Histograms
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment