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 <vector>
15
16/*~~~~~~~~~~~~*/
17/* Geant4 */
18/*~~~~~~~~~~~~*/
19#include "G4Step.hh"
20#include "G4Track.hh"
21
22/*~~~~~~~~~~~~~*/
23/* SimCore */
24/*~~~~~~~~~~~~~*/
25#include "SimCore/Event/PhotonuclearInteraction.h"
27
28namespace simcore {
29
52 public:
59 PhotonuclearTracker(const std::string& name,
61
65 virtual ~PhotonuclearTracker() = default;
66
72 std::vector<TYPE> getTypes() override {
73 return {TYPE::EVENT, TYPE::STEPPING, TYPE::TRACKING};
74 }
75
83 void beginOfEventAction(const G4Event* event) override;
84
92 void endOfEventAction(const G4Event* event) override;
93
103 void stepping(const G4Step* step) override;
104
112 void preUserTrackingAction(const G4Track* track) override;
113
122 void postUserTrackingAction(const G4Track* track) override;
123
129 std::vector<ldmx::PhotonuclearInteraction> getInteractions() const {
130 return pn_interactions_;
131 }
132
138 static PhotonuclearTracker* get() { return instance; }
139
140 private:
149 void extractTargetInfo(const G4Step* step, int& Z, int& A,
150 std::string& material);
151
159 const G4Track* track);
160
161 private:
163 std::vector<ldmx::PhotonuclearInteraction> pn_interactions_;
164
167 std::map<int, int> secondary_to_pn_index_;
168
172 std::map<int, int> descendant_ancestry_;
173
176
177}; // PhotonuclearTracker
178
179} // namespace simcore
180
181#endif // SIMCORE_G4USER_PHOTONUCLEARTRACKER_H_
File holding UserAction prototype and supporting macro.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
Tracks detailed information about photonuclear interactions.
static PhotonuclearTracker * instance
Static pointer to the current instance.
void preUserTrackingAction(const G4Track *track) override
Called before tracking a new track.
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 endOfEventAction(const G4Event *event) override
Called at the end of each event.
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...
void postUserTrackingAction(const G4Track *track) override
Called after tracking a track.
void beginOfEventAction(const G4Event *event) override
Called at the beginning of each event.
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.
std::vector< TYPE > getTypes() override
Get the types of actions this class handles.
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:46
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...
Stores kinematic and identity information for a particle.