LDMX Software
UserTrackInformation.cxx
1#include "SimCore/G4User/UserTrackInformation.h"
2
3/*~~~~~~~~~~~~~~~~*/
4/* C++ StdLib */
5/*~~~~~~~~~~~~~~~~*/
6#include <iostream>
7
8namespace simcore {
9
11 if (!track->GetUserInformation()) {
12 const_cast<G4Track*>(track)->SetUserInformation(new UserTrackInformation);
13 }
14 return dynamic_cast<UserTrackInformation*>(track->GetUserInformation());
15}
16
17void UserTrackInformation::initialize(const G4Track* track) {
18 initial_momentum_ = track->GetMomentum();
19 vertex_volume_ = track->GetLogicalVolumeAtVertex()->GetName();
20 vertex_time_ = track->GetGlobalTime();
21}
23 std::cout << "Saving track: " << save_flag_ << "\n"
24 << "Is brem candidate: " << is_brem_candidate_ << "\n"
25 << std::endl;
26}
27} // namespace simcore
Provides user defined information to associate with a Geant4 track.
static UserTrackInformation * get(const G4Track *track)
get
bool save_flag_
Flag for saving the track as a Trajectory.
void Print() const override
Print the information associated with the track.
bool is_brem_candidate_
Flag indicating whether this track is a brem candidate.
std::string vertex_volume_
Volume the track was created in.
void initialize(const G4Track *track)
Initialize the track information with the passed track.
G4ThreeVector initial_momentum_
The initial momentum of the track.
double vertex_time_
Global Time of Creation.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...