29 if (!event.
exists(pn_collection_name_, pn_pass_name_)) {
35 const auto& pn_interactions =
44 int n_interactions = pn_interactions.size();
45 histograms_.fill(
"pn_interaction_count", n_interactions);
47 for (
const auto& interaction : pn_interactions) {
49 histograms_.fill(
"pn_target_z", interaction.getTargetZ());
50 histograms_.fill(
"pn_target_a", interaction.getTargetA());
51 histograms_.fill(
"pn_target_z:target_a", interaction.getTargetZ(),
52 interaction.getTargetA());
55 int n_cascade_secondaries = interaction.getNumImmediateSecondaries();
56 histograms_.fill(
"pn_cascade_multiplicity", n_cascade_secondaries);
61 auto descendant_map = interaction.getDescendantMap();
62 int total_descendants = 0;
63 for (
const auto& [secondary_id, descendants] : descendant_map) {
64 int n_desc = descendants.size();
65 total_descendants += n_desc;
68 histograms_.fill(
"pn_descendants_per_cascade_particle", n_desc);
70 histograms_.fill(
"pn_total_final_state_descendants", total_descendants);
78 if (total_descendants > 0) {
79 double compactness_ratio =
80 static_cast<double>(n_cascade_secondaries) / total_descendants;
81 histograms_.fill(
"pn_cascade_evolution_ratio", compactness_ratio);
90 sim_particles_coll_name_, sim_particles_passname_)};
91 if (particle_map.empty())
return;
94 auto [trackID, recoil] = analysis::getRecoil(particle_map);
95 findRecoilProperties(recoil);
99 auto pn_gamma{analysis::getPNGamma(particle_map, recoil, 2500.)};
100 if (pn_gamma ==
nullptr) {
101 ldmx_log(warn) <<
"PN Daughter is lost, skipping";
105 const auto pn_daughters{findDaughters(particle_map, pn_gamma)};
107 if (!pn_daughters.empty()) {
108 auto pn_vertex_volume{pn_daughters[0]->getVertexVolume()};
109 auto pn_interaction_material{pn_daughters[0]->getInteractionMaterial()};
112 if (pn_vertex_volume.find(
"W_cooling") != std::string::npos) {
114 histograms_.fill(
"pn_vertex_volume", 2);
115 }
else if (pn_vertex_volume.find(
"C_volume") != std::string::npos) {
117 histograms_.fill(
"pn_vertex_volume", 3);
118 }
else if (pn_vertex_volume.find(
"PCB_volume") != std::string::npos) {
119 histograms_.fill(
"pn_vertex_volume", 4);
120 }
else if (pn_vertex_volume.find(
"CarbonBasePlate") != std::string::npos) {
122 histograms_.fill(
"pn_vertex_volume", 5);
123 }
else if (pn_vertex_volume.find(
"W_front") != std::string::npos) {
125 histograms_.fill(
"pn_vertex_volume", 6);
126 }
else if (pn_vertex_volume.find(
"Si_volume") != std::string::npos) {
127 histograms_.fill(
"pn_vertex_volume", 7);
128 }
else if (pn_vertex_volume.find(
"Glue") != std::string::npos) {
129 histograms_.fill(
"pn_vertex_volume", 8);
130 }
else if (pn_vertex_volume.find(
"motherboard") != std::string::npos) {
131 histograms_.fill(
"pn_vertex_volume", 9);
133 ldmx_log(debug) <<
" Else pn_vertex_volume = " << pn_vertex_volume
134 <<
" with pn_interaction_material = "
135 << pn_interaction_material;
136 histograms_.fill(
"pn_vertex_volume", 1);
140 if (pn_interaction_material.find(
"Silicon") != std::string::npos ||
141 pn_interaction_material.find(
"G4_Si") != std::string::npos) {
142 histograms_.fill(
"pn_interaction_material", 2);
143 }
else if (pn_interaction_material.find(
"Tungsten") != std::string::npos ||
144 pn_interaction_material.find(
"G4_W") != std::string::npos) {
145 histograms_.fill(
"pn_interaction_material", 3);
146 }
else if (pn_interaction_material.find(
"FR4") != std::string::npos) {
148 histograms_.fill(
"pn_interaction_material", 4);
149 }
else if (pn_interaction_material.find(
"Steel") != std::string::npos) {
150 histograms_.fill(
"pn_interaction_material", 5);
151 }
else if (pn_interaction_material.find(
"Epoxy") != std::string::npos) {
153 histograms_.fill(
"pn_interaction_material", 6);
154 }
else if (pn_interaction_material.find(
"Scintillator") !=
157 histograms_.fill(
"pn_interaction_material", 7);
158 }
else if (pn_interaction_material.find(
"Glue") != std::string::npos) {
160 histograms_.fill(
"pn_interaction_material", 8);
161 }
else if (pn_interaction_material.find(
"Air") != std::string::npos ||
162 pn_interaction_material.find(
"G4_AIR") != std::string::npos) {
164 histograms_.fill(
"pn_interaction_material", 9);
166 ldmx_log(debug) <<
" Else pn_interaction_material = "
167 << pn_interaction_material
168 <<
" with pn_vertex_volume = " << pn_vertex_volume;
169 histograms_.fill(
"pn_interaction_material", 1);
172 histograms_.fill(
"pn_vertex_volume", 0);
173 histograms_.fill(
"pn_interaction_material", 0);
176 findParticleKinematics(pn_daughters,
"pn");
178 histograms_.fill(
"pn_particle_mult", pn_gamma->getDaughters().size());
179 histograms_.fill(
"pn_gamma_energy", pn_gamma->getEnergy());
180 histograms_.fill(
"pn_gamma_int_x", pn_gamma->getEndPoint()[0]);
181 histograms_.fill(
"pn_gamma_int_y", pn_gamma->getEndPoint()[1]);
182 histograms_.fill(
"pn_gamma_int_x:pn_gamma_int_y", pn_gamma->getEndPoint()[0],
183 pn_gamma->getEndPoint()[1]);
184 histograms_.fill(
"pn_gamma_int_z", pn_gamma->getEndPoint()[2]);
185 histograms_.fill(
"pn_gamma_vertex_x", pn_gamma->getVertex()[0]);
186 histograms_.fill(
"pn_gamma_vertex_y", pn_gamma->getVertex()[1]);
187 histograms_.fill(
"pn_gamma_vertex_z", pn_gamma->getVertex()[2]);
190 auto event_type{classifyEvent(pn_daughters, 200)};
191 auto event_type500_mev{classifyEvent(pn_daughters, 500)};
192 auto event_type2000_mev{classifyEvent(pn_daughters, 2000)};
194 auto event_type_comp{classifyCompactEvent(pn_gamma, pn_daughters, 200)};
195 auto event_type_comp500_mev{
196 classifyCompactEvent(pn_gamma, pn_daughters, 500)};
197 auto event_type_comp2000_mev{
198 classifyCompactEvent(pn_gamma, pn_daughters, 2000)};
200 histograms_.fill(
"event_type",
static_cast<int>(event_type));
201 histograms_.fill(
"event_type_500mev",
static_cast<int>(event_type500_mev));
202 histograms_.fill(
"event_type_2000mev",
static_cast<int>(event_type2000_mev));
203 histograms_.fill(
"event_type_compact",
static_cast<int>(event_type_comp));
204 histograms_.fill(
"event_type_compact_500mev",
205 static_cast<int>(event_type_comp500_mev));
206 histograms_.fill(
"event_type_compact_2000mev",
207 static_cast<int>(event_type_comp2000_mev));
209 switch (event_type) {
210 case EventType::single_neutron:
211 if (pn_daughters.size() > 1) {
212 auto second_hardest_pdg{std::abs(pn_daughters[1]->getPdgID())};
213 int n_event_type{-10};
214 if (second_hardest_pdg == 2112)
216 else if (second_hardest_pdg == 2212)
218 else if (second_hardest_pdg == 211)
220 else if (second_hardest_pdg == 111)
224 histograms_.fill(
"1n_event_type", n_event_type);
227 case EventType::two_neutrons:
228 case EventType::charged_kaon:
229 case EventType::klong:
230 case EventType::kshort:
231 findSubleadingKinematics(pn_gamma, pn_daughters, event_type);
238 analyzeInteractionDetails(event);
Class representing a simulated particle.
std::vector< double > getVertex() const
Get a vector containing the vertex of this particle in mm.