62 if (track->GetDynamicParticle()->GetPrimaryParticle() !=
nullptr) {
63 G4VUserPrimaryParticleInformation* primary_info =
64 track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation();
65 if (primary_info !=
nullptr) {
66 particle.setGenStatus(
71 auto particle_def{track->GetDefinition()};
73 particle.setPdgID(particle_def->GetPDGEncoding());
74 particle.setCharge(particle_def->GetPDGCharge());
75 particle.setMass(track->GetDynamicParticle()->GetMass());
76 particle.setEnergy(track->GetVertexKineticEnergy() +
77 track->GetDynamicParticle()->GetMass());
80 particle.setVertexVolume(track_info->getVertexVolume());
81 particle.setInteractionMaterial(track->GetMaterial()->GetName());
83 auto vert{track->GetVertexPosition()};
84 particle.setVertex(vert.x(), vert.y(), vert.z());
85 particle.setTime(track_info->getVertexTime());
87 auto init_momentum{track_info->getInitialMomentum()};
88 particle.setMomentum(init_momentum.x(), init_momentum.y(), init_momentum.z());
90 const G4VProcess* process{track->GetCreatorProcess()};
92 const G4String& name{process->GetProcessName()};
95 if (track->GetParentID() == 0) {
96 particle.setProcessType(ldmx::SimParticle::ProcessType::Primary);
98 particle.setProcessType(ldmx::SimParticle::ProcessType::unknown);
105 auto momentum{track->GetMomentum()};
106 particle.setEndPointMomentum(momentum.x(), momentum.y(), momentum.z());
108 auto end_pt{track->GetPosition()};
109 particle.setEndPoint(end_pt.x(), end_pt.y(), end_pt.z());
Class representing a simulated particle.
static ProcessType findProcessType(std::string processName)
Get the process type enum from a G4VProcess name.
void setGenStatus(const int &gen_status)
Set the generator status of this particle.
bool isDescendant(int trackID, int ancestorID, int maximum_depth) const
Check if the track with the given ID is a descendant of the track with the given ancestor ID up to a ...