SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
PluginManager Class Reference

Manages user sim plugins. More...

#include <PluginManager.hh>

Public Types

typedef std::vector< UserActionPlugin * > PluginVec
 

Public Member Functions

 PluginManager ()
 
virtual ~PluginManager ()
 
void beginEvent (const G4Event *anEvent)
 
void beginRun (const G4Run *aRun)
 
void create (const std::string &pluginName, const std::string &libName)
 
void destroy (const std::string &pluginName)
 
void endEvent (const G4Event *anEvent)
 
void endRun (const G4Run *aRun)
 
UserActionPlugin * findPlugin (const std::string &pluginName)
 
void generatePrimary (G4Event *anEvent)
 
void postTracking (const G4Track *aTrack)
 
void preTracking (const G4Track *aTrack)
 
std::ostream & print (std::ostream &os)
 
G4ClassificationOfNewTrack stackingClassifyNewTrack (const G4Track *aTrack)
 Return a track classification from the user plugins that have stacking actions. Activate the track classification hook of registered plugins. More...
 
void stackingNewStage ()
 
void stackingPrepareNewEvent ()
 
void stepping (const G4Step *aStep)
 

Private Member Functions

void deregisterPlugin (UserActionPlugin *plugin)
 
void destroy (UserActionPlugin *plugin)
 
void destroyPlugins ()
 
void registerPlugin (UserActionPlugin *plugin)
 

Private Attributes

PluginLoader pluginLoader_
 
PluginVec plugins_
 

Detailed Description

Manages user sim plugins.

Note
This class loads UserSimPlugin objects from dynamic libraries using a PluginLoader. It is also responsible for activating the user action hooks for all registered plugins. Only one instance of a given plugin can be loaded at a time.
See also
UserActionPlugin
PluginLoader

Definition at line 35 of file PluginManager.hh.

Member Typedef Documentation

◆ PluginVec

typedef std::vector<UserActionPlugin*> PluginVec

Vector of plugins.

Definition at line 42 of file PluginManager.hh.

Constructor & Destructor Documentation

◆ PluginManager()

PluginManager ( )
inline

Class constructor.

Definition at line 47 of file PluginManager.hh.

◆ ~PluginManager()

~PluginManager ( )
virtual

Class destructor. This will destroy all the currently registered plugins.

Definition at line 5 of file PluginManager.cc.

References PluginManager::destroyPlugins().

Member Function Documentation

◆ beginEvent()

void beginEvent ( const G4Event *  anEvent)

Activate the begin event hook of registered plugins.

Parameters
anEventThe Geant4 event.

Definition at line 49 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by EventAction::BeginOfEventAction().

◆ beginRun()

void beginRun ( const G4Run *  aRun)

Activate the begin run hook for registered plugins.

Parameters
aRunThe Geant4 run that is beginning.

Definition at line 9 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by RunAction::BeginOfRunAction().

◆ create()

void create ( const std::string &  pluginName,
const std::string &  libName 
)

Create a new plugin by name from the given library.

Parameters
pluginNameThe name of the plugin.
libNameThe name of the shared library.

Definition at line 124 of file PluginManager.cc.

References PluginLoader::create(), LOG::endl, PluginManager::findPlugin(), PluginManager::pluginLoader_, and PluginManager::registerPlugin().

Referenced by PluginMessenger::SetNewValue().

◆ deregisterPlugin()

void deregisterPlugin ( UserActionPlugin *  plugin)
private

De-register a plugin.

Parameters
pluginPointer to plugin that should be de-registered.

Definition at line 159 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by PluginManager::destroy().

◆ destroy() [1/2]

void destroy ( const std::string &  pluginName)

Destroy a plugin by name.

Parameters
pluginNameThe name of the plugin.

Definition at line 134 of file PluginManager.cc.

References PluginManager::findPlugin().

Referenced by PluginManager::destroyPlugins(), and PluginMessenger::SetNewValue().

◆ destroy() [2/2]

void destroy ( UserActionPlugin *  plugin)
private

Destroy a plugin.

Parameters
pluginPointer to plugin that should be destroyed.

Definition at line 141 of file PluginManager.cc.

References PluginManager::deregisterPlugin(), PluginLoader::destroy(), and PluginManager::pluginLoader_.

◆ destroyPlugins()

void destroyPlugins ( )
private

Destroy all registered plugins.

Definition at line 166 of file PluginManager.cc.

References PluginManager::destroy(), and PluginManager::plugins_.

Referenced by PluginManager::~PluginManager().

◆ endEvent()

void endEvent ( const G4Event *  anEvent)

Activate the end event hook of registered plugins.

Parameters
anEventThe Geant4 event.

Definition at line 57 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by EventAction::EndOfEventAction().

◆ endRun()

void endRun ( const G4Run *  aRun)

Activate the end run hook of registered plugins.

Parameters
aRunThe Geant4 run that is ending.

Definition at line 17 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by RunAction::EndOfRunAction().

◆ findPlugin()

UserActionPlugin * findPlugin ( const std::string &  pluginName)

Find a plugin by name.

Parameters
pluginNameThe name of the plugin.
Returns
The plugin with the name or nullptr if does not exist.

Definition at line 113 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by PluginManager::create(), and PluginManager::destroy().

◆ generatePrimary()

void generatePrimary ( G4Event *  anEvent)

Activate the generate primary hook of registered plugins.

Parameters
anEventThe Geant4 event.

Definition at line 65 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by PrimaryGeneratorAction::GeneratePrimaries().

◆ postTracking()

void postTracking ( const G4Track *  aTrack)

Activate the post-tracking hook of registered plugins.

Parameters
aTrackThe Geant4 track.

Definition at line 41 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by TrackingAction::PostUserTrackingAction().

◆ preTracking()

void preTracking ( const G4Track *  aTrack)

Activate the pre-tracking hook of registered plugins.

Parameters
aTrackThe Geant4 track.

Definition at line 33 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by TrackingAction::PreUserTrackingAction().

◆ print()

std::ostream & print ( std::ostream &  os)

Print out information about registered plugins.

Parameters
osThe output stream.
Returns
The same output stream.

Definition at line 148 of file PluginManager.cc.

References LOG::endl, and PluginManager::plugins_.

Referenced by PluginMessenger::SetNewValue().

◆ registerPlugin()

void registerPlugin ( UserActionPlugin *  plugin)
private

Register a plugin.

Parameters
pluginPointer to plugin that should be registered.

Definition at line 155 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by PluginManager::create().

◆ stackingClassifyNewTrack()

G4ClassificationOfNewTrack stackingClassifyNewTrack ( const G4Track *  aTrack)

Return a track classification from the user plugins that have stacking actions. Activate the track classification hook of registered plugins.

Parameters
aTrackThe Geant4 track.
Note
The current classification will only be updated if a plugin actually provides a different classification than the current one.

Definition at line 73 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by StackingAction::ClassifyNewTrack().

◆ stackingNewStage()

void stackingNewStage ( )

Activate the stacking new stage hook of registered plugins.

Definition at line 97 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by StackingAction::NewStage().

◆ stackingPrepareNewEvent()

void stackingPrepareNewEvent ( )

Activate the prepare new event stacking hook of registered plugins.

Definition at line 105 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by StackingAction::PrepareNewEvent().

◆ stepping()

void stepping ( const G4Step *  aStep)

Activate the stepping hook of registered plugins.

Parameters
aStepThe Geant4 step.

Definition at line 25 of file PluginManager.cc.

References PluginManager::plugins_.

Referenced by SteppingAction::UserSteppingAction().

Member Data Documentation

◆ pluginLoader_

PluginLoader pluginLoader_
private

The plugin loader for loading plugins from shared libraries.

Definition at line 183 of file PluginManager.hh.

Referenced by PluginManager::create(), and PluginManager::destroy().

◆ plugins_

PluginVec plugins_
private

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