58 const auto& particle_map{
61 for (
const auto& [track_id, particle] : particle_map) {
62 if (track_id == 1) beam = &particle;
63 if (particle.getProcessType() ==
64 ldmx::SimParticle::ProcessType::eDarkBrem) {
65 if (particle.getPdgID() == 622) {
66 if (aprime !=
nullptr) {
67 EXCEPTION_RAISE(
"BadEvent",
"Found multiple A' in event.");
76 if (recoil ==
nullptr and aprime ==
nullptr) {
92 if (recoil ==
nullptr or aprime ==
nullptr or beam ==
nullptr) {
95 std::stringstream err_msg;
97 <<
"Unable to find all necessary particles for DarkBrem interaction."
98 <<
" Missing: [ " << (recoil ==
nullptr ?
"recoil " :
"")
99 << (aprime ==
nullptr ?
"aprime " :
"")
100 << (beam ==
nullptr ?
"beam " :
"") <<
"]" << std::endl;
101 EXCEPTION_RAISE(
"BadEvent", err_msg.str());
105 const auto& recoil_p = recoil->getMomentum();
106 const auto& aprime_p = aprime->getMomentum();
108 std::vector<double> incident_p = recoil_p;
109 for (std::size_t i{0}; i < recoil_p.size(); ++i)
110 incident_p[i] += aprime_p.at(i);
112 double incident_energy = energy(incident_p, recoil->getMass());
113 double recoil_energy = energy(recoil_p, recoil->getMass());
115 std::vector<double> ap_vertex{aprime->getVertex()};
116 std::string ap_vertex_volume{aprime->getVertexVolume()};
117 auto ap_vertex_material_it = std::find_if(
119 [&](
const auto& mat_pair) {
120 return ap_vertex_volume.find(mat_pair.first) != std::string::npos;
123 ? ap_vertex_material_it->second
126 int ap_parent_id{-1};
127 if (aprime->getParents().size() > 0) {
128 ap_parent_id = aprime->getParents().at(0);
130 ldmx_log(error) <<
"Found A' without a parent ID!";
133 float aprime_energy = energy(aprime_p, aprime->getMass());
134 int aprime_genstatus = aprime->getGenStatus();
135 double aprime_px{aprime_p.at(0)}, aprime_py{aprime_p.at(1)},
136 aprime_pz{aprime_p.at(2)};
137 event.add(
"APrimeEnergy", aprime_energy);
138 event.add(
"APrimePx", aprime_px);
139 event.add(
"APrimePy", aprime_py);
140 event.add(
"APrimePz", aprime_pz);
141 event.add(
"APrimeParentID", ap_parent_id);
142 event.add(
"APrimeGenStatus", aprime_genstatus);
147 int recoil_genstatus = recoil->getGenStatus();
148 double recoil_px{recoil_p.at(0)}, recoil_py{recoil_p.at(1)},
149 recoil_pz{recoil_p.at(2)};
150 event.add(
"RecoilEnergy", recoil_energy);
151 event.add(
"RecoilPx", recoil_px);
152 event.add(
"RecoilPy", recoil_py);
153 event.add(
"RecoilPz", recoil_pz);
154 event.add(
"RecoilGenStatus", recoil_genstatus);
159 event.add(
"IncidentEnergy", incident_energy);
160 double incident_px{incident_p.at(0)}, incident_py{incident_p.at(1)},
161 incident_pz{incident_p.at(2)};
162 event.add(
"IncidentPx", incident_px);
163 event.add(
"IncidentPy", incident_py);
164 event.add(
"IncidentPz", incident_pz);
169 double vtx_x{aprime->getVertex().at(0)}, vtx_y{aprime->getVertex().at(1)},
170 vtx_z{aprime->getVertex().at(2)};
171 event.add(
"DarkBremX", vtx_x);
172 event.add(
"DarkBremY", vtx_y);
173 event.add(
"DarkBremZ", vtx_z);
174 event.add(
"DarkBremVertexMaterial", ap_vertex_material);
175 float db_material_z =
176 event.getEventHeader().getFloatParameter(
"db_material_z");
177 event.add(
"DarkBremVertexMaterialZ", db_material_z);
182 if (db_material_z > 0) {
Class representing a simulated particle.