LDMX Software
UserTrackInformation.cxx
1#include "SimCore/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 initialMomentum_ = track->GetMomentum();
19 vertexVolume_ = track->GetLogicalVolumeAtVertex()->GetName();
20 vertex_time_ = track->GetGlobalTime();
21}
23 std::cout << "Saving track: " << saveFlag_ << "\n"
24 << "Is brem candidate: " << isBremCandidate_ << "\n"
25 << std::endl;
26}
27} // namespace simcore
Provides user defined information to associate with a Geant4 track.
std::string vertexVolume_
Volume the track was created in.
static UserTrackInformation * get(const G4Track *track)
get
void Print() const override
Print the information associated with the track.
bool saveFlag_
Flag for saving the track as a Trajectory.
void initialize(const G4Track *track)
Initialize the track information with the passed track.
G4ThreeVector initialMomentum_
The initial momentum of the track.
double vertex_time_
Global Time of Creation.
bool isBremCandidate_
Flag indicating whether this track is a brem candidate.