LDMX Software
PhotonuclearTracker.h
Go to the documentation of this file.
1
7#ifndef SIMCORE_G4USER_PHOTONUCLEARTRACKER_H_
8#define SIMCORE_G4USER_PHOTONUCLEARTRACKER_H_
9
10/*~~~~~~~~~~~~~~~~*/
11/* C++ StdLib */
12/*~~~~~~~~~~~~~~~~*/
13#include <map>
14#include <memory>
15#include <vector>
16
17/*~~~~~~~~~~~~*/
18/* Geant4 */
19/*~~~~~~~~~~~~*/
20#include "G4Step.hh"
21#include "G4Track.hh"
22
23/*~~~~~~~~~~~~~*/
24/* SimCore */
25/*~~~~~~~~~~~~~*/
26#include "SimCore/Event/PhotonuclearInteraction.h"
28
29namespace simcore {
30
53 public:
60 PhotonuclearTracker(const std::string& name,
62
66 virtual ~PhotonuclearTracker() = default;
67
73 std::vector<TYPE> getTypes() override {
74 return {TYPE::EVENT, TYPE::STEPPING, TYPE::TRACKING};
75 }
76
84 void BeginOfEventAction(const G4Event* event) override;
85
93 void EndOfEventAction(const G4Event* event) override;
94
104 void stepping(const G4Step* step) override;
105
113 void PreUserTrackingAction(const G4Track* track) override;
114
123 void PostUserTrackingAction(const G4Track* track) override;
124
130 std::vector<ldmx::PhotonuclearInteraction> getInteractions() const {
131 return pn_interactions_;
132 }
133
139 static PhotonuclearTracker* get() { return instance; }
140
141 private:
150 void extractTargetInfo(const G4Step* step, int& Z, int& A,
151 std::string& material);
152
160 const G4Track* track);
161
162 private:
164 std::vector<ldmx::PhotonuclearInteraction> pn_interactions_;
165
168 std::map<int, int> secondary_to_pn_index_;
169
173 std::map<int, int> descendant_ancestry_;
174
177
178}; // PhotonuclearTracker
179
180} // namespace simcore
181
182#endif // SIMCORE_G4USER_PHOTONUCLEARTRACKER_H_
File holding UserAction prototype and supporting macro.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Tracks detailed information about photonuclear interactions.
static PhotonuclearTracker * instance
Static pointer to the current instance.
void BeginOfEventAction(const G4Event *event) override
Called at the beginning of each event.
ldmx::PhotonuclearInteraction::ParticleInfo createParticleInfo(const G4Track *track)
Create a ParticleInfo struct from a G4Track.
std::map< int, int > descendant_ancestry_
Maps descendant track ID -> immediate secondary track ID Propagates through the genealogy to trace ba...
void PreUserTrackingAction(const G4Track *track) override
Called before tracking a new track.
virtual ~PhotonuclearTracker()=default
Destructor.
PhotonuclearTracker(const std::string &name, framework::config::Parameters &parameters)
Constructor.
std::map< int, int > secondary_to_pn_index_
Maps secondary track ID -> index in pn_interactions_ Used to quickly find which PN interaction a seco...
static PhotonuclearTracker * get()
Get the current PhotonuclearTracker instance.
void extractTargetInfo(const G4Step *step, int &Z, int &A, std::string &material)
Extract target nucleus information from the current step.
void PostUserTrackingAction(const G4Track *track) override
Called after tracking a track.
std::vector< TYPE > getTypes() override
Get the types of actions this class handles.
void EndOfEventAction(const G4Event *event) override
Called at the end of each event.
void stepping(const G4Step *step) override
Called after each simulation step.
std::vector< ldmx::PhotonuclearInteraction > getInteractions() const
Get the collection of PN interactions for this event.
std::vector< ldmx::PhotonuclearInteraction > pn_interactions_
Collection of PN interactions in this event.
Interface that defines a user action.
Definition UserAction.h:47
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...
Stores kinematic and identity information for a particle.