VMC Version 2.0
|
Singleton manager class for handling and steering a run with multiple TVirtualMC engines sharing events. More...
#include <TMCManager.h>
Public Member Functions | |
TMCManager () | |
Default constructor. | |
virtual | ~TMCManager () |
Destructor. | |
void | Register (TVirtualMC *engine) |
A TVirtualMC will register itself via this method during construction if a TMCManager was instanciated before. | |
void | Register (TVirtualMCApplication *application) |
The user application will register itself via this method when the manager was requested. | |
Int_t | NEngines () const |
Return the number of registered engines. | |
void | GetEngines (std::vector< TVirtualMC * > &engines) const |
Get registered engine pointers. | |
TVirtualMC * | GetEngine (Int_t id) const |
Get an engine pointer by ID. | |
Int_t | GetEngineId (const char *name) const |
Get engine ID by its name. | |
TVirtualMC * | GetCurrentEngine () const |
Get the current engine pointer. | |
void | ConnectEnginePointer (TVirtualMC **mc) |
Connect a pointer which is updated whenever the engine is changed. | |
void | ConnectEnginePointer (TVirtualMC *&mc) |
Connect a pointer which is updated whenever the engine is changed. | |
void | SetUserStack (TVirtualMCStack *stack) |
Set user stack. | |
void | ForwardTrack (Int_t toBeDone, Int_t trackId, Int_t parentId, TParticle *particle, Int_t engineId) |
User interface to forward particle to specifiic engine. | |
void | ForwardTrack (Int_t toBeDone, Int_t trackId, Int_t parentId, TParticle *particle) |
User interface to forward particle to specifiic engine. | |
void | TransferTrack (Int_t engineTargetId) |
Transfer track from current engine to engine with engineTargetId. | |
void | TransferTrack (TVirtualMC *mc) |
Transfer track from current engine to target engine mc. | |
Bool_t | RestoreGeometryState (Int_t trackId, Bool_t checkTrackIdRange=kTRUE) |
Try to restore geometry for a given track. | |
Bool_t | RestoreGeometryState () |
Try to restore geometry for the track currently set. | |
template<typename F > | |
void | Apply (F engineLambda) |
Apply something to all engines. | |
void | Init () |
Initialize engines. | |
template<typename F > | |
void | Init (F initFunction) |
Further specific initialization. | |
void | Run (Int_t nEvents) |
Run the event loop. | |
Static Public Member Functions | |
static TMCManager * | Instance () |
Static access method. | |
Private Member Functions | |
void | PrepareNewEvent () |
Do necessary steps before an event is triggered. | |
Bool_t | GetNextEngine () |
Find the next engine. | |
void | UpdateEnginePointers (TVirtualMC *mc) |
Update all engine pointers connected to the TMCManager. | |
void | TerminateRun () |
Terminate a run in all engines. | |
Private Attributes | |
TVirtualMCApplication * | fApplication |
Pointer to user application. | |
TVirtualMC * | fCurrentEngine |
Pointer to current engine. | |
std::vector< TVirtualMC * > | fEngines |
Collecting pointers to all instanciated TVirtualMCs. | |
std::vector< std::unique_ptr< TMCManagerStack > > | fStacks |
Stacks connected to engines. | |
std::vector< TParticle * > | fParticles |
All tracks (persistent) | |
std::vector< std::unique_ptr< TMCParticleStatus > > | fParticlesStatus |
All particles' status (persistent) | |
Int_t | fTotalNPrimaries |
Total number of primaries ever pushed. | |
Int_t | fTotalNTracks |
Total number of tracks ever pushed. | |
std::vector< TVirtualMC ** > | fConnectedEnginePointers |
Connected engine pointers which will be updated everytime the current engine changes. | |
TVirtualMCStack * | fUserStack |
Pointer to user stack. | |
TGeoMCBranchArrayContainer | fBranchArrayContainer |
Pointer to cache with geometry states. | |
Bool_t | fIsInitialized |
Flag if engines are initilaized. | |
Bool_t | fIsInitializedUser |
Flag if specific initialization for engines was done. | |
Bool_t | fGeometryConstructed |
Static Private Attributes | |
static TMCThreadLocal TMCManager * | fgInstance = nullptr |
Singleton instance. | |
Friends | |
class | TVirtualMCApplication |
Singleton manager class for handling and steering a run with multiple TVirtualMC engines sharing events.
It provides interfaces to transfer tracks between engines and exposes the correct stacks to each running engine. A registered user stack is kept up-to-date automatically seeing a consistent history. Track objects (aka TParticle) are still owned by the user who must forward these to the manager after creation. Everything else is done automatically.
Definition at line 43 of file TMCManager.h.
TMCManager::TMCManager | ( | ) |
Default constructor.
Default and standard constructor.
Definition at line 53 of file TMCManager.cxx.
|
virtual |
Destructor.
Definition at line 68 of file TMCManager.cxx.
|
static |
Static access method.
Definition at line 81 of file TMCManager.cxx.
void TMCManager::Register | ( | TVirtualMC * | mc | ) |
A TVirtualMC will register itself via this method during construction if a TMCManager was instanciated before.
The TMCManager will assign an ID to the engines.
Definition at line 93 of file TMCManager.cxx.
Referenced by TVirtualMCApplication::Register(), and TVirtualMCApplication::RequestMCManager().
void TMCManager::Register | ( | TVirtualMCApplication * | application | ) |
The user application will register itself via this method when the manager was requested.
Definition at line 131 of file TMCManager.cxx.
Int_t TMCManager::NEngines | ( | ) | const |
Return the number of registered engines.
Definition at line 146 of file TMCManager.cxx.
void TMCManager::GetEngines | ( | std::vector< TVirtualMC * > & | engines | ) | const |
Get registered engine pointers.
Definition at line 156 of file TMCManager.cxx.
TVirtualMC * TMCManager::GetEngine | ( | Int_t | id | ) | const |
Get an engine pointer by ID.
Return the number of registered engines.
Definition at line 170 of file TMCManager.cxx.
Int_t TMCManager::GetEngineId | ( | const char * | name | ) | const |
Get engine ID by its name.
Definition at line 183 of file TMCManager.cxx.
TVirtualMC * TMCManager::GetCurrentEngine | ( | ) | const |
Get the current engine pointer.
Definition at line 199 of file TMCManager.cxx.
void TMCManager::ConnectEnginePointer | ( | TVirtualMC ** | mc | ) |
Connect a pointer which is updated whenever the engine is changed.
Definition at line 209 of file TMCManager.cxx.
Referenced by ConnectEnginePointer(), and TVirtualMCApplication::RequestMCManager().
void TMCManager::ConnectEnginePointer | ( | TVirtualMC *& | mc | ) |
Connect a pointer which is updated whenever the engine is changed.
Definition at line 222 of file TMCManager.cxx.
void TMCManager::SetUserStack | ( | TVirtualMCStack * | stack | ) |
Set user stack.
Definition at line 232 of file TMCManager.cxx.
void TMCManager::ForwardTrack | ( | Int_t | toBeDone, |
Int_t | trackId, | ||
Int_t | parentId, | ||
TParticle * | particle, | ||
Int_t | engineId | ||
) |
User interface to forward particle to specifiic engine.
It is assumed that the TParticle is owned by the user. It will not be modified by the TMCManager.
Definition at line 244 of file TMCManager.cxx.
Referenced by ForwardTrack().
void TMCManager::ForwardTrack | ( | Int_t | toBeDone, |
Int_t | trackId, | ||
Int_t | parentId, | ||
TParticle * | particle | ||
) |
User interface to forward particle to specifiic engine.
It is assumed that the TParticle is owned by the user. It will not be modified by the TMCManager. Assume current engine Id
Definition at line 280 of file TMCManager.cxx.
void TMCManager::TransferTrack | ( | Int_t | engineTargetId | ) |
Transfer track from current engine to engine with engineTargetId.
Definition at line 290 of file TMCManager.cxx.
Referenced by TransferTrack().
void TMCManager::TransferTrack | ( | TVirtualMC * | mc | ) |
Transfer track from current engine to target engine mc.
Definition at line 305 of file TMCManager.cxx.
Bool_t TMCManager::RestoreGeometryState | ( | Int_t | trackId, |
Bool_t | checkTrackIdRange = kTRUE |
||
) |
Try to restore geometry for a given track.
Definition at line 342 of file TMCManager.cxx.
Bool_t TMCManager::RestoreGeometryState | ( | ) |
Try to restore geometry for the track currently set.
Definition at line 364 of file TMCManager.cxx.
Referenced by RestoreGeometryState().
|
inline |
Apply something to all engines.
Definition at line 127 of file TMCManager.h.
void TMCManager::Init | ( | ) |
|
inline |
Further specific initialization.
Definition at line 141 of file TMCManager.h.
void TMCManager::Run | ( | Int_t | nEvents | ) |
Run the event loop.
Definition at line 418 of file TMCManager.cxx.
|
private |
Do necessary steps before an event is triggered.
Choose next engines to be run in the loop.
Definition at line 450 of file TMCManager.cxx.
Referenced by Run().
|
private |
Find the next engine.
Choose next engines to be run in the loop.
Definition at line 472 of file TMCManager.cxx.
Referenced by Run().
|
private |
Update all engine pointers connected to the TMCManager.
Definition at line 490 of file TMCManager.cxx.
Referenced by Apply(), GetNextEngine(), Init(), and Register().
|
private |
Terminate a run in all engines.
Terminate the run for all engines.
Definition at line 505 of file TMCManager.cxx.
Referenced by Run().
|
friend |
Definition at line 45 of file TMCManager.h.
|
staticprivate |
Singleton instance.
Definition at line 171 of file TMCManager.h.
Referenced by Instance(), TMCManager(), and ~TMCManager().
|
private |
Pointer to user application.
Definition at line 177 of file TMCManager.h.
Referenced by PrepareNewEvent(), Register(), and Run().
|
private |
Pointer to current engine.
Definition at line 179 of file TMCManager.h.
Referenced by ConnectEnginePointer(), ForwardTrack(), GetCurrentEngine(), RestoreGeometryState(), Run(), TransferTrack(), and UpdateEnginePointers().
|
private |
Collecting pointers to all instanciated TVirtualMCs.
Definition at line 181 of file TMCManager.h.
Referenced by Apply(), ForwardTrack(), GetEngine(), GetEngineId(), GetEngines(), GetNextEngine(), Init(), NEngines(), Register(), TerminateRun(), TransferTrack(), and ~TMCManager().
|
private |
Stacks connected to engines.
Definition at line 183 of file TMCManager.h.
Referenced by ForwardTrack(), GetNextEngine(), Init(), PrepareNewEvent(), Register(), RestoreGeometryState(), and TransferTrack().
|
private |
All tracks (persistent)
Definition at line 185 of file TMCManager.h.
Referenced by ForwardTrack(), Init(), PrepareNewEvent(), RestoreGeometryState(), and TransferTrack().
|
private |
All particles' status (persistent)
Definition at line 187 of file TMCManager.h.
Referenced by ForwardTrack(), Init(), PrepareNewEvent(), RestoreGeometryState(), and TransferTrack().
|
private |
Total number of primaries ever pushed.
Definition at line 189 of file TMCManager.h.
Referenced by ForwardTrack(), and Init().
|
private |
Total number of tracks ever pushed.
Definition at line 191 of file TMCManager.h.
Referenced by ForwardTrack(), and Init().
|
private |
Connected engine pointers which will be updated everytime the current engine changes.
Definition at line 194 of file TMCManager.h.
Referenced by ConnectEnginePointer(), and UpdateEnginePointers().
|
private |
Pointer to user stack.
Definition at line 196 of file TMCManager.h.
Referenced by Init(), and SetUserStack().
|
private |
Pointer to cache with geometry states.
Definition at line 198 of file TMCManager.h.
Referenced by Init(), PrepareNewEvent(), RestoreGeometryState(), and TransferTrack().
|
private |
Flag if engines are initilaized.
Definition at line 200 of file TMCManager.h.
|
private |
Flag if specific initialization for engines was done.
Definition at line 202 of file TMCManager.h.
|
private |
Definition at line 203 of file TMCManager.h.
Referenced by Register().