1#include "DQM/CascadeHistoryDQM.h"
9CascadeHistoryDQM::CascadeHistoryDQM(
const std::string& name,
14 cascade_coll_name_ = parameters.
get<std::string>(
15 "cascade_coll_name",
"PhotonuclearCascadeHistories");
16 cascade_pass_name_ = parameters.
get<std::string>(
"cascade_pass_name",
"");
20 if (!event.
exists(cascade_coll_name_, cascade_pass_name_)) {
25 cascade_coll_name_, cascade_pass_name_);
26 if (cascade_map.empty()) {
30 histograms_.fill(
"n_cascades", cascade_map.size());
32 for (
const auto& [trackId, history] : cascade_map) {
33 analyzeCascade(history);
38 const auto& steps = history.getSteps();
44 histograms_.fill(
"cascade_n_steps", steps.size());
45 histograms_.fill(
"cascade_target_A", history.getTargetA());
46 histograms_.fill(
"cascade_target_Z", history.getTargetZ());
48 double incident_energy = history.getIncidentEnergy();
49 if (incident_energy > 0) {
50 histograms_.fill(
"incident_photon_energy", incident_energy);
54 int n_protons = 0, n_neutrons = 0, n_pions = 0, n_kaons = 0, n_other = 0;
55 int n_interacted = 0, n_escaped = 0;
56 int max_generation = 0;
59 int primary_n_protons = 0, primary_n_neutrons = 0;
60 int primary_n_piplus = 0, primary_n_piminus = 0, primary_n_pizero = 0;
61 int primary_n_kaons = 0, primary_n_other = 0;
62 double primary_total_ke = 0;
63 double primary_max_ke = 0;
66 int n_deexcitation = 0;
67 int n_deexcitation_neutrons = 0, n_deexcitation_protons = 0;
68 int n_deexcitation_gammas = 0, n_deexcitation_alphas = 0;
69 double deexcitation_total_energy = 0;
71 for (
const auto& step : steps) {
72 int pdg = step.getPdgId();
73 int abs_pdg = std::abs(pdg);
74 int category = getParticleCategory(pdg);
75 double ke = step.getKineticEnergy();
97 histograms_.fill(
"step_pdg_category", category);
98 histograms_.fill(
"step_generation", step.getGeneration());
99 histograms_.fill(
"step_stage", step.getStageInt());
100 histograms_.fill(
"step_ke", ke);
101 histograms_.fill(
"step_zone", step.getZone());
104 double x = step.getX();
105 double y = step.getY();
106 double z = step.getZ();
107 double radius = std::sqrt(x * x + y * y + z * z);
108 histograms_.fill(
"step_radius", radius);
109 histograms_.fill(
"step_x", x);
110 histograms_.fill(
"step_y", y);
111 histograms_.fill(
"step_z", z);
113 if (step.getGeneration() > max_generation) {
114 max_generation = step.getGeneration();
117 if (step.didInteract()) {
120 if (step.didEscape()) {
122 histograms_.fill(
"escaped_pdg_category", category);
123 histograms_.fill(
"escaped_ke", ke);
128 if (step.getStage() == ldmx::CascadeStage::PRIMARY) {
129 histograms_.fill(
"primary_daughter_pdg", category);
130 histograms_.fill(
"primary_daughter_ke", ke);
131 primary_total_ke += ke;
132 if (ke > primary_max_ke) primary_max_ke = ke;
136 else if (pdg == 2112)
137 primary_n_neutrons++;
140 else if (pdg == -211)
144 else if (abs_pdg == 321 || abs_pdg == 311 || abs_pdg == 310 ||
152 if (step.getStage() == ldmx::CascadeStage::DEEXCITATION) {
154 deexcitation_total_energy += ke;
155 histograms_.fill(
"deexcitation_pdg", category);
156 histograms_.fill(
"deexcitation_ke", ke);
159 n_deexcitation_neutrons++;
160 histograms_.fill(
"deexcitation_neutron_ke", ke);
161 }
else if (pdg == 2212) {
162 n_deexcitation_protons++;
163 histograms_.fill(
"deexcitation_proton_ke", ke);
164 }
else if (pdg == 22) {
165 n_deexcitation_gammas++;
166 histograms_.fill(
"deexcitation_gamma_energy", ke);
167 }
else if (abs_pdg == 1000020040) {
168 n_deexcitation_alphas++;
169 histograms_.fill(
"deexcitation_alpha_ke", ke);
175 histograms_.fill(
"cascade_n_protons", n_protons);
176 histograms_.fill(
"cascade_n_neutrons", n_neutrons);
177 histograms_.fill(
"cascade_n_pions", n_pions);
178 histograms_.fill(
"cascade_n_kaons", n_kaons);
179 histograms_.fill(
"cascade_n_other", n_other);
180 histograms_.fill(
"cascade_n_interacted", n_interacted);
181 histograms_.fill(
"cascade_n_escaped", n_escaped);
182 histograms_.fill(
"cascade_max_generation", max_generation);
185 int primary_n_daughters =
186 primary_n_protons + primary_n_neutrons + primary_n_piplus +
187 primary_n_piminus + primary_n_pizero + primary_n_kaons + primary_n_other;
188 int primary_n_pions = primary_n_piplus + primary_n_piminus + primary_n_pizero;
190 histograms_.fill(
"primary_n_daughters", primary_n_daughters);
191 histograms_.fill(
"primary_n_protons", primary_n_protons);
192 histograms_.fill(
"primary_n_neutrons", primary_n_neutrons);
193 histograms_.fill(
"primary_n_piplus", primary_n_piplus);
194 histograms_.fill(
"primary_n_piminus", primary_n_piminus);
195 histograms_.fill(
"primary_n_pizero", primary_n_pizero);
196 histograms_.fill(
"primary_n_pions", primary_n_pions);
197 histograms_.fill(
"primary_n_kaons", primary_n_kaons);
198 histograms_.fill(
"primary_n_other", primary_n_other);
199 histograms_.fill(
"primary_total_daughter_ke", primary_total_ke);
200 histograms_.fill(
"primary_max_daughter_ke", primary_max_ke);
203 histograms_.fill(
"n_deexcitation", n_deexcitation);
204 histograms_.fill(
"n_deexcitation_neutrons", n_deexcitation_neutrons);
205 histograms_.fill(
"n_deexcitation_protons", n_deexcitation_protons);
206 histograms_.fill(
"n_deexcitation_gammas", n_deexcitation_gammas);
207 histograms_.fill(
"n_deexcitation_alphas", n_deexcitation_alphas);
208 histograms_.fill(
"deexcitation_total_energy", deexcitation_total_energy);
211 histograms_.fill(
"excitation_energy", history.getExcitationEnergy());
212 histograms_.fill(
"residual_A", history.getResidualA());
213 histograms_.fill(
"residual_Z", history.getResidualZ());
216int CascadeHistoryDQM::getParticleCategory(
int pdgId)
const {
217 int abs_pdg = std::abs(pdgId);
218 if (pdgId == 2212)
return 0;
219 if (pdgId == 2112)
return 1;
220 if (pdgId == 211)
return 2;
221 if (pdgId == -211)
return 3;
222 if (pdgId == 111)
return 4;
223 if (abs_pdg == 321 || abs_pdg == 311 || abs_pdg == 310 || abs_pdg == 130)
Data class representing a single step in the Bertini intranuclear cascade.
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
DQM analyzer for Bertini cascade history data.
Implements an event buffer system for storing event data.
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
All CascadeSteps from a single photonuclear interaction.
All classes in the ldmx-sw project use this namespace.