DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Public Member Functions | Protected Attributes | List of all members
dd4hep::sim::Geant4UIManager Class Reference

Standard UI interface implementation with configuration using property options. More...

#include <Geant4UIManager.h>

Inheritance diagram for dd4hep::sim::Geant4UIManager:
dd4hep::sim::Geant4Action dd4hep::sim::Geant4Call

Public Member Functions

 Geant4UIManager (Geant4Context *context, const std::string &name)
 Initializing constructor. More...
 
virtual ~Geant4UIManager ()
 Default destructor. More...
 
void configure ()
 Configure the object. Callback registered to the Geant4Kernel. More...
 
void initialize ()
 Initialize the object. Callback registered to the Geant4Kernel. More...
 
void terminate ()
 Callback on terminate. Callback registered to the Geant4Kernel. More...
 
void installCommandMessenger ()
 Install command control messenger to write GDML file from command prompt. More...
 
G4VisManager * startVis ()
 Start visualization. More...
 
G4UIExecutive * startUI ()
 Start UI. More...
 
void start ()
 Start manager & session. More...
 
void stop ()
 Stop and release resources. More...
 
void forceExit ()
 Force exiting this process without calling atexit handlers. More...
 
void regularExit ()
 Regularly exiting this process without calling atexit handlers. More...
 
void applyCommand (const std::string &command)
 Apply single command. More...
 
virtual void operator() (void *param)
 Run UI. More...
 
- Public Member Functions inherited from dd4hep::sim::Geant4Action
 Geant4Action (Geant4Context *context, const std::string &nam)
 Standard constructor. More...
 
long addRef ()
 Increase reference count. More...
 
long release ()
 Decrease reference count. Implicit destruction. More...
 
Geant4Contextcontext () const
 Access the context. More...
 
virtual void updateContext (Geant4Context *ctxt)
 Set or update client context. More...
 
virtual void configureFiber (Geant4Context *thread_context)
 Set or update client for the use in a new thread fiber. More...
 
const std::string & name () const
 Access name of the action. More...
 
const char * c_name () const
 Access name of the action. More...
 
void setName (const std::string &new_name)
 Set the object name. More...
 
PropertyManagerproperties ()
 Access to the properties of the object. More...
 
PrintLevel outputLevel () const
 Access the output level. More...
 
PrintLevel setOutputLevel (PrintLevel new_level)
 Set the output level; returns previous value. More...
 
Geant4UIMessengercontrol () const
 Access to the UI messenger. More...
 
virtual void enableUI ()
 Enable and install UI messenger. More...
 
template<typename T >
Geant4ActiondeclareProperty (const std::string &nam, T &val)
 Declare property. More...
 
template<typename T >
Geant4ActiondeclareProperty (const char *nam, T &val)
 Declare property. More...
 
bool hasProperty (const std::string &name) const
 Check property for existence. More...
 
Propertyproperty (const std::string &name)
 Access single property. More...
 
virtual void installMessengers ()
 Install property control messenger if wanted. More...
 
virtual void installPropertyMessenger ()
 Install property control messenger if wanted. More...
 
void print (const char *fmt,...) const
 Support for messages with variable output level using output level. More...
 
void printM1 (const char *fmt,...) const
 Support for messages with variable output level using output level-1. More...
 
void printM2 (const char *fmt,...) const
 Support for messages with variable output level using output level-2. More...
 
void printP1 (const char *fmt,...) const
 Support for messages with variable output level using output level+1. More...
 
void printP2 (const char *fmt,...) const
 Support for messages with variable output level using output level+2. More...
 
void always (const char *fmt,...) const
 Support of always printed messages. More...
 
void debug (const char *fmt,...) const
 Support of debug messages. More...
 
void info (const char *fmt,...) const
 Support of info messages. More...
 
void warning (const char *fmt,...) const
 Support of warning messages. More...
 
void error (const char *fmt,...) const
 Support of error messages. More...
 
bool return_error (bool return_value, const char *fmt,...) const
 Action to support error messages. More...
 
void fatal (const char *fmt,...) const
 Support of fatal messages. Throws exception. More...
 
void except (const char *fmt,...) const
 Support of exceptions: Print fatal message and throw runtime_error. More...
 
void abortRun (const std::string &exception, const char *fmt,...) const
 Abort Geant4 Run by throwing a G4Exception with type RunMustBeAborted. More...
 
Geant4RunActionSequencerunAction () const
 Access to the main run action sequence from the kernel object. More...
 
Geant4EventActionSequenceeventAction () const
 Access to the main event action sequence from the kernel object. More...
 
Geant4SteppingActionSequencesteppingAction () const
 Access to the main stepping action sequence from the kernel object. More...
 
Geant4TrackingActionSequencetrackingAction () const
 Access to the main tracking action sequence from the kernel object. More...
 
Geant4StackingActionSequencestackingAction () const
 Access to the main stacking action sequence from the kernel object. More...
 
Geant4GeneratorActionSequencegeneratorAction () const
 Access to the main generator action sequence from the kernel object. More...
 
- Public Member Functions inherited from dd4hep::sim::Geant4Call
virtual ~Geant4Call ()
 Default destructor. More...
 

Protected Attributes

std::string m_sessionType
 Name of the default session type (="cmd") More...
 
std::string m_uiSetup
 Property: Name of the UI macro file. More...
 
std::string m_visSetup
 Property: Name of the visualization macro file. More...
 
std::vector< std::string > m_configureCommands
 Property: List of commands to be executed when the Geant4Kernel gets configured. More...
 
std::vector< std::string > m_initializeCommands
 Property: List of commands to be executed when the Geant4Kernel gets initialized. More...
 
std::vector< std::string > m_terminateCommands
 Property: List of commands to be executed when the Geant4Kernel gets terminated. More...
 
std::vector< std::string > m_preRunCommands
 Property: List of commands to be executed BEFORE running. More...
 
std::vector< std::string > m_postRunCommands
 Property: List of commands to be executed AFTER running. More...
 
std::vector< std::string > m_macros
 Property: Array of commands to be chained. More...
 
std::string m_prompt
 Property: New prompt if the user wants to change it. (Default is do nothing) More...
 
bool m_haveVis
 Property: Flag to instantiate Vis manager (default=false, unless m_visSetup set) More...
 
bool m_haveUI
 Property: Flag to instantiate UI (default=true) More...
 
G4VisManager * m_vis
 Reference to Geant4 visualtion manager. More...
 
G4UIExecutive * m_ui
 Reference to Geant4 UI manager. More...
 
- Protected Attributes inherited from dd4hep::sim::Geant4Action
Geant4Contextm_context { nullptr }
 Reference to the Geant4 context. More...
 
Geant4UIMessengerm_control { nullptr }
 Control directory of this action. More...
 
int m_outputLevel { 3 }
 Default property: Output level. More...
 
bool m_needsControl { false }
 Default property: Flag to create control instance. More...
 
std::string m_name { }
 Action name. More...
 
PropertyManager m_properties { }
 Property pool. More...
 
long m_refCount { 1 }
 Reference count. Initial value: 1. More...
 

Additional Inherited Members

- Protected Member Functions inherited from dd4hep::sim::Geant4Action
 DDG4_DEFINE_ACTION_CONSTRUCTORS (Geant4Action)
 Define standard assignments and constructors. More...
 
virtual ~Geant4Action ()
 Default destructor. More...
 

Detailed Description

Standard UI interface implementation with configuration using property options.

The {\tt{Geant4UIManager}} is a component attached to the {\tt{Geant4Kernel}} object.

All properties of all {\tt{Geant4Action}} instances may be exported to Geant4 messengers and {{may}} hence be accessible directly from the Geant4 prompt. To export properties from any action, call the {\tt{enableUI()}} method of the action.

Please note:

Any type of commands may be put together, but the overall execution order is as follows:

  1. Execution of the visualization setup (Property: SetupVIS)
  2. Execution of the user interface setup (Property: SetupUI)
  3. Execution of the macro file list (Property: Macros)
  4. Execution of the command list (Property: Commands)
Author
M.Frank
Version
1.0

Definition at line 53 of file Geant4UIManager.h.

Constructor & Destructor Documentation

◆ Geant4UIManager()

Geant4UIManager::Geant4UIManager ( Geant4Context context,
const std::string &  name 
)

Initializing constructor.

Definition at line 42 of file Geant4UIManager.cpp.

◆ ~Geant4UIManager()

Geant4UIManager::~Geant4UIManager ( )
virtual

Default destructor.

Definition at line 65 of file Geant4UIManager.cpp.

Member Function Documentation

◆ applyCommand()

void Geant4UIManager::applyCommand ( const std::string &  command)

Apply single command.

Get the pointer to the User Interface manager

Definition at line 115 of file Geant4UIManager.cpp.

◆ configure()

void Geant4UIManager::configure ( )

Configure the object. Callback registered to the Geant4Kernel.

Configure the object.

Get the pointer to the User Interface manager

Start UI instance

Execute the chained command statements

Definition at line 69 of file Geant4UIManager.cpp.

◆ forceExit()

void Geant4UIManager::forceExit ( )

Force exiting this process without calling atexit handlers.

Definition at line 138 of file Geant4UIManager.cpp.

◆ initialize()

void Geant4UIManager::initialize ( )

Initialize the object. Callback registered to the Geant4Kernel.

Initialize the object.

Get the pointer to the User Interface manager

Execute the chained command statements

Definition at line 87 of file Geant4UIManager.cpp.

◆ installCommandMessenger()

void Geant4UIManager::installCommandMessenger ( )
virtual

Install command control messenger to write GDML file from command prompt.

Reimplemented from dd4hep::sim::Geant4Action.

Definition at line 130 of file Geant4UIManager.cpp.

◆ operator()()

void Geant4UIManager::operator() ( void *  param)
virtual

Run UI.

Implements dd4hep::sim::Geant4Call.

Definition at line 175 of file Geant4UIManager.cpp.

◆ regularExit()

void Geant4UIManager::regularExit ( )

Regularly exiting this process without calling atexit handlers.

Definition at line 143 of file Geant4UIManager.cpp.

◆ start()

void Geant4UIManager::start ( )

Start manager & session.

Get the pointer to the User Interface manager

Start visualization

If graphics setup, vis is always true

No graphics without UI!

Configure visualization instance

Configure UI instance

Execute the chained macro files

Execute the chained pre-run command statements

Start UI session if present

Execute the chained post-run command statements

Execute the chained post-run command statements

No UI. Pure batch mode: Simply execute requested number of events

Definition at line 181 of file Geant4UIManager.cpp.

◆ startUI()

G4UIExecutive * Geant4UIManager::startUI ( )

Start UI.

Definition at line 159 of file Geant4UIManager.cpp.

◆ startVis()

G4VisManager * Geant4UIManager::startVis ( )

Start visualization.

Initialize visualization

Definition at line 150 of file Geant4UIManager.cpp.

◆ stop()

void Geant4UIManager::stop ( )

Stop and release resources.

Definition at line 262 of file Geant4UIManager.cpp.

◆ terminate()

void Geant4UIManager::terminate ( )

Callback on terminate. Callback registered to the Geant4Kernel.

Callback on terminate.

Get the pointer to the User Interface manager

Execute the chained command statements

Definition at line 101 of file Geant4UIManager.cpp.

Member Data Documentation

◆ m_configureCommands

std::vector<std::string> dd4hep::sim::Geant4UIManager::m_configureCommands
protected

Property: List of commands to be executed when the Geant4Kernel gets configured.

Definition at line 62 of file Geant4UIManager.h.

◆ m_haveUI

bool dd4hep::sim::Geant4UIManager::m_haveUI
protected

Property: Flag to instantiate UI (default=true)

Definition at line 78 of file Geant4UIManager.h.

◆ m_haveVis

bool dd4hep::sim::Geant4UIManager::m_haveVis
protected

Property: Flag to instantiate Vis manager (default=false, unless m_visSetup set)

Definition at line 76 of file Geant4UIManager.h.

◆ m_initializeCommands

std::vector<std::string> dd4hep::sim::Geant4UIManager::m_initializeCommands
protected

Property: List of commands to be executed when the Geant4Kernel gets initialized.

Definition at line 64 of file Geant4UIManager.h.

◆ m_macros

std::vector<std::string> dd4hep::sim::Geant4UIManager::m_macros
protected

Property: Array of commands to be chained.

Definition at line 72 of file Geant4UIManager.h.

◆ m_postRunCommands

std::vector<std::string> dd4hep::sim::Geant4UIManager::m_postRunCommands
protected

Property: List of commands to be executed AFTER running.

Definition at line 70 of file Geant4UIManager.h.

◆ m_preRunCommands

std::vector<std::string> dd4hep::sim::Geant4UIManager::m_preRunCommands
protected

Property: List of commands to be executed BEFORE running.

Definition at line 68 of file Geant4UIManager.h.

◆ m_prompt

std::string dd4hep::sim::Geant4UIManager::m_prompt
protected

Property: New prompt if the user wants to change it. (Default is do nothing)

Definition at line 74 of file Geant4UIManager.h.

◆ m_sessionType

std::string dd4hep::sim::Geant4UIManager::m_sessionType
protected

Name of the default session type (="cmd")

Definition at line 56 of file Geant4UIManager.h.

◆ m_terminateCommands

std::vector<std::string> dd4hep::sim::Geant4UIManager::m_terminateCommands
protected

Property: List of commands to be executed when the Geant4Kernel gets terminated.

Definition at line 66 of file Geant4UIManager.h.

◆ m_ui

G4UIExecutive* dd4hep::sim::Geant4UIManager::m_ui
protected

Reference to Geant4 UI manager.

Definition at line 82 of file Geant4UIManager.h.

◆ m_uiSetup

std::string dd4hep::sim::Geant4UIManager::m_uiSetup
protected

Property: Name of the UI macro file.

Definition at line 58 of file Geant4UIManager.h.

◆ m_vis

G4VisManager* dd4hep::sim::Geant4UIManager::m_vis
protected

Reference to Geant4 visualtion manager.

Definition at line 80 of file Geant4UIManager.h.

◆ m_visSetup

std::string dd4hep::sim::Geant4UIManager::m_visSetup
protected

Property: Name of the visualization macro file.

Definition at line 60 of file Geant4UIManager.h.


The documentation for this class was generated from the following files: