DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4UIManager.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDG4_GEANT4UIMANAGER_H
14 #define DDG4_GEANT4UIMANAGER_H
15 
16 // Framework include files
17 #include <DDG4/Geant4Call.h>
18 #include <DDG4/Geant4Action.h>
19 
21 class G4VisManager;
22 class G4UImanager;
23 class G4UIExecutive;
24 
25 
27 namespace dd4hep {
28 
30  namespace sim {
31 
33 
53  class Geant4UIManager : public Geant4Action, virtual public Geant4Call {
54  protected:
56  std::string m_sessionType;
58  std::string m_uiSetup;
60  std::string m_visSetup;
62  std::vector<std::string> m_configureCommands;
64  std::vector<std::string> m_initializeCommands;
66  std::vector<std::string> m_terminateCommands;
68  std::vector<std::string> m_preRunCommands;
70  std::vector<std::string> m_postRunCommands;
72  std::vector<std::string> m_macros;
74  std::string m_prompt;
76  bool m_haveVis;
78  bool m_haveUI;
80  G4VisManager* m_vis;
82  G4UIExecutive* m_ui;
83 
84  public:
86  Geant4UIManager(Geant4Context* context, const std::string& name);
88  virtual ~Geant4UIManager();
89 
91  void configure();
93  void initialize();
95  void terminate();
96 
100  G4VisManager* startVis();
102  G4UIExecutive* startUI();
104  void start();
106  void stop();
108  void forceExit();
110  void regularExit();
112  void applyCommand(const std::string& command);
114  virtual void operator()(void* param);
115  };
116 
117  } // End namespace sim
118 } // End namespace dd4hep
119 #endif // DDG4_GEANT4UIMANAGER_H
dd4hep::sim::Geant4UIManager::terminate
void terminate()
Callback on terminate. Callback registered to the Geant4Kernel.
Definition: Geant4UIManager.cpp:101
dd4hep::sim::Geant4UIManager::m_haveUI
bool m_haveUI
Property: Flag to instantiate UI (default=true)
Definition: Geant4UIManager.h:78
dd4hep::sim::Geant4Call
Callback interface class with argument.
Definition: Geant4Call.h:29
dd4hep::sim::Geant4UIManager::m_initializeCommands
std::vector< std::string > m_initializeCommands
Property: List of commands to be executed when the Geant4Kernel gets initialized.
Definition: Geant4UIManager.h:64
dd4hep::sim::Geant4UIManager::~Geant4UIManager
virtual ~Geant4UIManager()
Default destructor.
Definition: Geant4UIManager.cpp:65
dd4hep::sim::Geant4UIManager::m_vis
G4VisManager * m_vis
Reference to Geant4 visualtion manager.
Definition: Geant4UIManager.h:80
dd4hep::sim::Geant4UIManager::start
void start()
Start manager & session.
Definition: Geant4UIManager.cpp:181
dd4hep::sim::Geant4UIManager::m_macros
std::vector< std::string > m_macros
Property: Array of commands to be chained.
Definition: Geant4UIManager.h:72
dd4hep::sim::Geant4UIManager::m_ui
G4UIExecutive * m_ui
Reference to Geant4 UI manager.
Definition: Geant4UIManager.h:82
dd4hep::sim::Geant4UIManager::forceExit
void forceExit()
Force exiting this process without calling atexit handlers.
Definition: Geant4UIManager.cpp:138
dd4hep::sim::Geant4UIManager::m_terminateCommands
std::vector< std::string > m_terminateCommands
Property: List of commands to be executed when the Geant4Kernel gets terminated.
Definition: Geant4UIManager.h:66
dd4hep::sim::Geant4UIManager::m_visSetup
std::string m_visSetup
Property: Name of the visualization macro file.
Definition: Geant4UIManager.h:60
dd4hep::sim::Geant4UIManager::initialize
void initialize()
Initialize the object. Callback registered to the Geant4Kernel.
Definition: Geant4UIManager.cpp:87
dd4hep::sim::Geant4UIManager::startUI
G4UIExecutive * startUI()
Start UI.
Definition: Geant4UIManager.cpp:159
dd4hep::sim::Geant4UIManager::m_haveVis
bool m_haveVis
Property: Flag to instantiate Vis manager (default=false, unless m_visSetup set)
Definition: Geant4UIManager.h:76
dd4hep::sim::Geant4UIManager::stop
void stop()
Stop and release resources.
Definition: Geant4UIManager.cpp:262
dd4hep::sim::Geant4UIManager::m_uiSetup
std::string m_uiSetup
Property: Name of the UI macro file.
Definition: Geant4UIManager.h:58
dd4hep::sim::Geant4UIManager::installCommandMessenger
void installCommandMessenger()
Install command control messenger to write GDML file from command prompt.
Definition: Geant4UIManager.cpp:130
dd4hep::sim::Geant4UIManager::regularExit
void regularExit()
Regularly exiting this process without calling atexit handlers.
Definition: Geant4UIManager.cpp:143
dd4hep::sim::Geant4Action
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:113
dd4hep::sim::Geant4Action::name
const std::string & name() const
Access name of the action.
Definition: Geant4Action.h:280
dd4hep::sim::Geant4UIManager::applyCommand
void applyCommand(const std::string &command)
Apply single command.
Definition: Geant4UIManager.cpp:115
dd4hep::sim::Geant4UIManager::configure
void configure()
Configure the object. Callback registered to the Geant4Kernel.
Definition: Geant4UIManager.cpp:69
dd4hep::sim::Geant4UIManager::startVis
G4VisManager * startVis()
Start visualization.
Definition: Geant4UIManager.cpp:150
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4UIManager::operator()
virtual void operator()(void *param)
Run UI.
Definition: Geant4UIManager.cpp:175
dd4hep::sim::Geant4UIManager::m_sessionType
std::string m_sessionType
Name of the default session type (="cmd")
Definition: Geant4UIManager.h:56
dd4hep::sim::Geant4UIManager::m_preRunCommands
std::vector< std::string > m_preRunCommands
Property: List of commands to be executed BEFORE running.
Definition: Geant4UIManager.h:68
dd4hep::sim::Geant4UIManager::m_configureCommands
std::vector< std::string > m_configureCommands
Property: List of commands to be executed when the Geant4Kernel gets configured.
Definition: Geant4UIManager.h:62
dd4hep::sim::Geant4UIManager
Standard UI interface implementation with configuration using property options.
Definition: Geant4UIManager.h:53
dd4hep::sim::Geant4UIManager::m_postRunCommands
std::vector< std::string > m_postRunCommands
Property: List of commands to be executed AFTER running.
Definition: Geant4UIManager.h:70
Geant4Call.h
dd4hep::sim::Geant4UIManager::m_prompt
std::string m_prompt
Property: New prompt if the user wants to change it. (Default is do nothing)
Definition: Geant4UIManager.h:74
Geant4Action.h
dd4hep::sim::Geant4UIManager::Geant4UIManager
Geant4UIManager(Geant4Context *context, const std::string &name)
Initializing constructor.
Definition: Geant4UIManager.cpp:42
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:270