DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
User event context for DDG4. More...
#include <Geant4Context.h>
Public Member Functions | |
Geant4Event (const G4Event *run, Geant4Random *rndm) | |
Intializing constructor. More... | |
virtual | ~Geant4Event () |
Default destructor. More... | |
operator const G4Event & () const | |
Access the G4Event directly: Automatic type conversion. More... | |
const G4Event & | event () const |
Access the G4Event directly: Explicit G4Event accessor. More... | |
Geant4Random & | random () const |
Access the random number generator. More... | |
void * | addExtension (unsigned long long int k, ExtensionEntry *e) |
Add an extension object to the detector element. More... | |
template<typename T > | |
T * | addExtension (T *ptr, bool take_ownership=true) |
Add user extension object. Ownership is transferred and object deleted at the end of the event. More... | |
template<typename T > | |
T * | extension (bool alert=true) |
Access to type safe extension object. Exception is thrown if the object is invalid. More... | |
Public Member Functions inherited from dd4hep::ObjectExtensions | |
ObjectExtensions (const std::type_info &parent_type) | |
Default constructor. More... | |
ObjectExtensions (const ObjectExtensions ©)=delete | |
Copy constructor. More... | |
virtual | ~ObjectExtensions () |
Default destructor. More... | |
ObjectExtensions & | operator= (const ObjectExtensions ©)=delete |
Assignment operator. More... | |
void | initialize () |
Initialize non-persistent object containers (e.g. after loading from ROOT file) More... | |
void | move (ObjectExtensions ©) |
Move extensions to target object. More... | |
void | clear (bool destroy=true) |
Clear all extensions. More... | |
void | copyFrom (const std::map< unsigned long long int, ExtensionEntry * > &ext, void *arg) |
Copy object extensions from another object. Hosting type must be identical! More... | |
void * | addExtension (unsigned long long int key, ExtensionEntry *entry) |
Add an extension object to the detector element. More... | |
void * | removeExtension (unsigned long long int key, bool destroy) |
Remove an existing extension object from the instance. More... | |
void * | extension (unsigned long long int key, bool alert) const |
Access an existing extension object from the detector element. More... | |
void * | extension (unsigned long long int key) const |
Access an existing extension object from the detector element. More... | |
Private Attributes | |
const G4Event * | m_event { nullptr } |
Reference to the original Geant4 event object. More... | |
Geant4Random * | m_random { nullptr } |
Reference to the main random number generator. More... | |
Additional Inherited Members | |
Public Attributes inherited from dd4hep::ObjectExtensions | |
std::map< unsigned long long int, ExtensionEntry * > | extensions |
The extensions object. More... | |
User event context for DDG4.
The context is accessible from the Geant4Context pointer, which is present in every Geant4Action. The event context is only valid however, if there is actually an event being procesed ie. only during the lifetime of the corresponding G4Event objects.
Please note: Extensions are only valid within the hosting event and are INVALID across different events. Hence: They are only useful to extend data of an event.
Any random numbers used to process one event should be accessed from this location. The framework ensures that the same seeded sequence is used throughout the processing of one single event.
Definition at line 121 of file Geant4Context.h.
Geant4Event::Geant4Event | ( | const G4Event * | run, |
Geant4Random * | rndm | ||
) |
Intializing constructor.
Definition at line 38 of file Geant4Context.cpp.
|
virtual |
Default destructor.
Definition at line 45 of file Geant4Context.cpp.
|
inline |
Add user extension object. Ownership is transferred and object deleted at the end of the event.
Definition at line 144 of file Geant4Context.h.
|
inline |
Add an extension object to the detector element.
Definition at line 140 of file Geant4Context.h.
|
inline |
Access the G4Event directly: Explicit G4Event accessor.
Definition at line 135 of file Geant4Context.h.
|
inline |
Access to type safe extension object. Exception is thrown if the object is invalid.
Definition at line 151 of file Geant4Context.h.
|
inline |
Access the G4Event directly: Automatic type conversion.
Definition at line 133 of file Geant4Context.h.
|
inline |
Access the random number generator.
Definition at line 137 of file Geant4Context.h.
|
private |
Reference to the original Geant4 event object.
Definition at line 123 of file Geant4Context.h.
|
private |
Reference to the main random number generator.
Definition at line 125 of file Geant4Context.h.