LDMX Software
UserAction.cxx
1
3
5
6/*~~~~~~~~~~~~*/
7/* Geant4 */
8/*~~~~~~~~~~~~*/
9#include "G4Event.hh"
10#include "G4Run.hh"
11
12namespace simcore {
13
14UserAction::UserAction(const std::string& name,
16 : name_{name},
17 parameters_{parameters},
18 the_log_{::framework::logging::makeLogger(name)} {}
19
21 return static_cast<UserEventInformation*>(
22 G4EventManager::GetEventManager()->GetUserInformation());
23}
24
25const std::map<int, ldmx::SimParticle>& UserAction::getCurrentParticleMap()
26 const {
28}
29
30void UserAction::abortEvent(const std::string& reason) const {
31 ldmx_log(trace)
32 << "("
33 << G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID()
34 << ") " << reason << " Aborting event.";
35
36 G4RunManager::GetRunManager()->AbortEvent();
37 return;
38}
39
41
42} // namespace simcore
#define DEFINE_FACTORY(classtype)
This should go into an implementation file for your prototype class.
Definition Factory.h:408
Class which implements the user tracking action.
File holding UserAction prototype and supporting macro.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
std::map< int, ldmx::SimParticle > & getParticleMap()
Get the map of particles to be stored in output event.
Definition TrackMap.h:98
Interface that defines a user action.
Definition UserAction.h:46
UserAction(const std::string &name, framework::config::Parameters &parameters)
Constructor.
const std::map< int, ldmx::SimParticle > & getCurrentParticleMap() const
Get the current particle map.
UserEventInformation * getEventInfo() const
Get a handle to the event information.
void abortEvent(const std::string &reason) const
Helper to abort an event with a message.
Encapsulates user defined information associated with a Geant4 event.
TrackMap & getTrackMap()
Get a handle to the current TrackMap for the event.
static TrackingAction * get()
Get a pointer to the current UserTrackingAction from the G4RunManager.
All classes in the ldmx-sw project use this namespace.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...