24 #include "G4UIdirectory.hh"
30 using namespace DD4hep;
31 using namespace DD4hep::Simulation;
33 TypeName TypeName::split(
const string& type_name,
const string& delim) {
34 size_t idx = type_name.find(delim);
35 string typ = type_name, nam = type_name;
36 if (idx != string::npos) {
37 typ = type_name.substr(0, idx);
38 nam = type_name.substr(idx + 1);
43 TypeName TypeName::split(
const string& type_name) {
44 return split(type_name,
"/");
47 void Geant4Action::ContextUpdate::operator()(
Geant4Action* action)
const {
51 cout <<
"EERIOR" << endl;
56 Geant4Action::Geant4Action(
Geant4Context* ctxt,
const string& nam)
58 : m_context(ctxt), m_control(0), m_outputLevel(
INFO), m_needsControl(false), m_name(nam),
63 declareProperty(
"Name", m_name);
64 declareProperty(
"name", m_name);
65 declareProperty(
"OutputLevel", m_outputLevel);
66 declareProperty(
"Control", m_needsControl);
83 printM1(
"Geant4Action: Deleting object %s of type %s Pointer:%p",
118 path +=
name() +
"/";
139 except(
"No control was installed for this action item.");
264 throw runtime_error(err);
269 string desc, typ =
typeName(
typeid(*
this));
270 string issuer =
name()+
" ["+typ+
"]";
275 G4Exception(issuer.c_str(),exception.c_str(),RunMustBeAborted,desc.c_str());
virtual void enableUI()
Enable and install UI messenger.
PrintLevel outputLevel() const
Access the output level.
long m_refCount
Reference count. Initial value: 1.
The property class to assign options to actions.
void printM1(const char *fmt,...) const
Support for messages with variable output level using output level-1.
Concrete implementation of the Geant4 stepping action sequence.
long release()
Decrease reference count. Implicit destruction.
Geant4TrackingActionSequence & trackingAction() const
Access to the main tracking action sequence from the kernel object.
Geant4Kernel & kernel() const
Access to the kernel object.
Geant4SteppingActionSequence * steppingAction(bool create)
Access stepping action sequence.
Helper class to handle strings of the format "type/name".
Geant4GeneratorActionSequence & generatorAction() const
Access to the main generator action sequence from the kernel object.
Geant4TrackingActionSequence * trackingAction(bool create)
Access tracking action sequence.
static void decrement(T *)
Decrement count according to type information.
void exportProperties(PropertyManager &mgr)
Export all properties to the Geant4 UI.
virtual void installPropertyMessenger()
Install property control messenger if wanted.
std::string typeName(const std::type_info &type)
ABI information about type names.
Geant4UIMessenger * control() const
Access to the UI messenger.
Geant4StackingActionSequence * stackingAction(bool create)
Access stacking action sequence.
void warning(const char *fmt,...) const
Support of warning messages.
const std::string & directoryName() const
Access the command directory.
Concrete implementation of the Geant4 event action sequence.
PrintLevel printLevel()
Access the current printer level.
void error(const char *fmt,...) const
Support of error messages.
void set(const std::string &component_name, PropertyConfigurator &setup)
Bulk set of all properties.
Geant4Context * context() const
Access the context.
Concrete implementation of the Geant4 tracking action sequence.
void printP2(const char *fmt,...) const
Support for messages with variable output level using output level+2.
const std::string & name() const
Access name of the action.
Geant4Context * m_context
Reference to the Geant4 context.
void print(const char *fmt,...) const
Support for messages with variable output level using output level.
void except(const char *fmt,...) const
Support of exceptions: Print fatal message and throw runtime_error.
std::string format(const std::string &src, const std::string &fmt,...)
Build formatted string.
int m_outputLevel
Default property: Output level.
Concrete implementation of the Geant4 stacking action sequence.
PropertyManager & properties()
Access to the properties of the object.
Geant4Action & setProperties(PropertyConfigurator &setup)
Set object properties.
bool hasProperty(const std::string &name) const
Check property for existence.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
Geant4EventActionSequence * eventAction(bool create)
Access run action sequence.
long addRef()
Increase reference count.
Property & property(const std::string &name)
Access single property.
Geant4StackingActionSequence & stackingAction() const
Access to the main stacking action sequence from the kernel object.
Geant4SteppingActionSequence & steppingAction() const
Access to the main stepping action sequence from the kernel object.
bool return_error(bool return_value, const char *fmt,...) const
Action to support error messages.
virtual void installCommandMessenger()
Install command control messenger if wanted.
virtual ~Geant4Action()
Default destructor.
Geant4GeneratorActionSequence * generatorAction(bool create)
Access generator action sequence.
Concrete implementation of the Geant4 generator action sequence.
bool m_needsControl
Default property: Flag to create control instance.
Concrete basic implementation of the Geant4 run action sequencer.
static void increment(T *)
Increment count according to type information.
Heler class to configure properties.
bool exists(const std::string &name) const
Check for existence.
PrintLevel setOutputLevel(PrintLevel new_level)
Set the output level; returns previous value.
virtual void installMessengers()
Install property control messenger if wanted.
Geant4RunActionSequence & runAction() const
Access to the main run action sequence from the kernel object.
void fatal(const char *fmt,...) const
Support of fatal messages. Throws exception.
Generic context to extend user, run and event information.
PropertyManager m_properties
Property pool.
std::string m_name
Action name.
void abortRun(const std::string &exception, const char *fmt,...) const
Abort Geant4 Run by throwing a G4Exception with type RunMustBeAborted.
void info(const char *fmt,...) const
Support of info messages.
Geant4EventActionSequence & eventAction() const
Access to the main event action sequence from the kernel object.
Generic implementation to export properties and actions to the Geant4 command prompt.
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Default base class for all Geant 4 actions and derivates thereof.
void printP1(const char *fmt,...) const
Support for messages with variable output level using output level+1.
Geant4RunActionSequence * runAction(bool create)
Access run action sequence.
void debug(const char *fmt,...) const
Support of debug messages.
Geant4UIMessenger * m_control
Control directory of this action.
void printM2(const char *fmt,...) const
Support for messages with variable output level using output level-2.
PrintLevel getOutputLevel(const std::string object) const
Retrieve the global output level of a named object.