LDMX Software
PhotonuclearInteraction.cxx
1#include "SimCore/Event/PhotonuclearInteraction.h"
2
3#include <iostream>
4
7
8namespace ldmx {
9
20
21void PhotonuclearInteraction::setIncidentPhoton(int track_id, int pdg_id,
22 double energy, double px,
23 double py, double pz, double x,
24 double y, double z,
25 double time) {
26 incident_photon_.track_id_ = track_id;
30 incident_photon_.py_ = py;
31 incident_photon_.pz_ = pz;
33 incident_photon_.y_ = y;
34 incident_photon_.z_ = z;
36}
37
39 const std::string& material) {
40 target_z_ = Z;
41 target_a_ = A;
42 target_material_ = material;
43}
44
46 const ParticleInfo& particle) {
47 immediate_secondaries_.push_back(particle);
48}
49
50void PhotonuclearInteraction::addDescendant(int immediate_secondary_id,
51 int final_state_track_id) {
52 descendant_map_[immediate_secondary_id].push_back(final_state_track_id);
53}
54
56 int immediate_secondary_id) const {
57 auto it = descendant_map_.find(immediate_secondary_id);
58 if (it != descendant_map_.end()) {
59 return it->second;
60 }
61 return std::vector<int>();
62}
63
64std::ostream& operator<<(std::ostream& o, const PhotonuclearInteraction& pn) {
65 o << "PhotonuclearInteraction:" << " Process: " << pn.process_name_
66 << " Volume: " << pn.interaction_volume_
67 << " Incident photon: track_id=" << pn.incident_photon_.track_id_
68 << " pdg=" << pn.incident_photon_.pdg_id_
69 << " E=" << pn.incident_photon_.energy_ << " MeV"
70 << " Target: Z=" << pn.target_z_ << " A=" << pn.target_a_
71 << " material=" << pn.target_material_
72 << " Immediate secondaries: " << pn.immediate_secondaries_.size()
73 << std::endl;
74 for (const auto& sec : pn.immediate_secondaries_) {
75 o << " track_id=" << sec.track_id_ << " pdg=" << sec.pdg_id_
76 << " E=" << sec.energy_ << " MeV" << std::endl;
77 }
78 o << " Descendant map entries: " << pn.descendant_map_.size() << std::endl;
79 for (const auto& [sec_id, descendants] : pn.descendant_map_) {
80 o << " Secondary " << sec_id << " -> " << descendants.size()
81 << " descendants" << std::endl;
82 }
83 return o;
84}
85
86void PhotonuclearInteraction::print() const { std::cout << *this; }
87
88} // namespace ldmx
Stores detailed information about a photonuclear interaction.
std::string target_material_
Target material name.
void addDescendant(int immediate_secondary_id, int final_state_track_id)
Add a final state descendant track for an immediate secondary.
void print() const
Print information about this interaction.
ParticleInfo incident_photon_
Incident photon information.
void clear()
Clear the interaction data.
std::vector< int > getDescendants(int immediate_secondary_id) const
Get descendants for a specific immediate secondary.
void addImmediateSecondary(const ParticleInfo &particle)
Add an immediate secondary particle from the PN interaction.
std::string process_name_
Process name (e.g., "photonNuclear")
void setIncidentPhoton(int track_id, int pdg_id, double energy, double px, double py, double pz, double x, double y, double z, double time)
Set the incident photon information.
std::string interaction_volume_
Volume where interaction occurred.
void setTarget(int Z, int A, const std::string &material)
Set the target nucleus information.
std::vector< ParticleInfo > immediate_secondaries_
Immediate secondary particles from the cascade.
std::map< int, std::vector< int > > descendant_map_
Maps immediate secondary track ID -> final state track IDs.
Stores kinematic and identity information for a particle.