22 #include "G4HCofThisEvent.hh"
25 using namespace DD4hep::Simulation;
26 using namespace DD4hep;
59 G4HCofThisEvent* hce = evt->GetHCofThisEvent();
61 int nCol = hce->GetNumberOfCollections();
67 "Is a Particle handler installed ?",evt->GetEventID());
71 for (
int i = 0; i < nCol; ++i) {
76 catch(
const exception&
e) {
78 evt->GetEventID(),e.what());
88 catch(
const exception&
e) {
90 evt->GetEventID(),e.what());
102 "+++ The value of G4HCofThisEvent is NULL. No collections saved!");
Geant4Event & event() const
Access the geant4 event – valid only between BeginEvent() and EndEvent()!
virtual void saveRun(const G4Run *run)
Callback to store the Geant4 event.
virtual void configureFiber(Geant4Context *ctxt)
Set or update client for the use in a new thread fiber.
virtual void end(const G4Event *event)
End-of-event callback.
void callAtEnd(Q *p, void(T::*f)(const G4Run *))
Register end-of-run callback. Types Q and T must be polymorph!
virtual void saveEvent(OutputContext< G4Event > &ctxt)
Callback to store the Geant4 event.
virtual void begin(const G4Event *event)
begin-of-event callback
static void decrement(T *)
Decrement count according to type information.
virtual void commit(OutputContext< G4Event > &ctxt)
Commit data at end of filling procedure.
Geant4OutputAction(Geant4Context *c, const std::string &nam)
Standard constructor.
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Concrete basic implementation of the Geant4 event action.
virtual ~Geant4OutputAction()
Default destructor.
Geant4Context * context() const
Access the context.
const std::string & name() const
Access name of the action.
Geant4RunActionSequence & runAction() const
Access to the main run action sequence from the kernel object.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
Geant4ParticleMap * m_truth
Reference to MC truth object.
Data structure to map particles produced during the generation and the simulation.
void callAtBegin(Q *p, void(T::*f)(const G4Run *))
Register begin-of-run callback. Types Q and T must be polymorph!
T * extension(bool alert=true)
Access to type safe extension object. Exception is thrown if the object is invalid.
virtual void beginRun(const G4Run *run)
Callback to initialize storing the Geant4 information.
virtual void saveCollection(OutputContext< G4Event > &ctxt, G4VHitsCollection *collection)
Callback to store each Geant4 hit collection.
virtual void endRun(const G4Run *run)
Callback to store the Geant4 run information.
static void increment(T *)
Increment count according to type information.
Generic context to extend user, run and event information.
bool isValid() const
Check if the particle map was ever filled (ie. some particle handler was present) ...
Helper class for thread savety.
bool m_errorFatal
Property: "HandleErrorsAsFatal" Handle errors as fatal and rethrow eventual exceptions.
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Geant4Action & declareProperty(const std::string &nam, T &val)
Declare property.
std::string m_output
Property: "Output" output destination.