20#ifndef ROOT_TMCManager
21#define ROOT_TMCManager
34#include "TGeoManager.h"
74 void GetEngines(std::vector<TVirtualMC *> &engines)
const;
101 void ForwardTrack(Int_t toBeDone, Int_t trackId, Int_t parentId, TParticle *particle, Int_t engineId);
107 void ForwardTrack(Int_t toBeDone, Int_t trackId, Int_t parentId, TParticle *particle);
126 template <
typename F>
140 template <
typename F>
156 void Run(Int_t nEvents);
170#if !defined(__CINT__)
183 std::vector<std::unique_ptr<TMCManagerStack>>
fStacks;
Storing and re-using geometry states of the TGeoManager in use by storing them as TGeoBranchArrays.
Concrete implementation of particles stack used by the TMCManager.
Singleton manager class for handling and steering a run with multiple TVirtualMC engines sharing even...
Int_t GetEngineId(const char *name) const
Get engine ID by its name.
Bool_t RestoreGeometryState()
Try to restore geometry for the track currently set.
TVirtualMC * GetCurrentEngine() const
Get the current engine pointer.
Bool_t fGeometryConstructed
void TerminateRun()
Terminate a run in all engines.
virtual ~TMCManager()
Destructor.
void ForwardTrack(Int_t toBeDone, Int_t trackId, Int_t parentId, TParticle *particle, Int_t engineId)
User interface to forward particle to specifiic engine.
std::vector< TParticle * > fParticles
All tracks (persistent)
std::vector< TVirtualMC ** > fConnectedEnginePointers
Connected engine pointers which will be updated everytime the current engine changes.
Int_t fTotalNPrimaries
Total number of primaries ever pushed.
void ConnectEnginePointer(TVirtualMC **mc)
Connect a pointer which is updated whenever the engine is changed.
void TransferTrack(Int_t engineTargetId)
Transfer track from current engine to engine with engineTargetId.
Bool_t GetNextEngine()
Find the next engine.
TVirtualMC * fCurrentEngine
Pointer to current engine.
TVirtualMC * GetEngine(Int_t id) const
Get an engine pointer by ID.
void UpdateEnginePointers(TVirtualMC *mc)
Update all engine pointers connected to the TMCManager.
void Apply(F engineLambda)
Apply something to all engines.
void Init()
Initialize engines.
Bool_t fIsInitializedUser
Flag if specific initialization for engines was done.
TVirtualMCApplication * fApplication
Pointer to user application.
void PrepareNewEvent()
Do necessary steps before an event is triggered.
std::vector< std::unique_ptr< TMCManagerStack > > fStacks
Stacks connected to engines.
TVirtualMCStack * fUserStack
Pointer to user stack.
static TMCThreadLocal TMCManager * fgInstance
Singleton instance.
static TMCManager * Instance()
Static access method.
Int_t fTotalNTracks
Total number of tracks ever pushed.
TMCManager()
Default constructor.
std::vector< std::unique_ptr< TMCParticleStatus > > fParticlesStatus
All particles' status (persistent)
void Run(Int_t nEvents)
Run the event loop.
std::vector< TVirtualMC * > fEngines
Collecting pointers to all instanciated TVirtualMCs.
Bool_t fIsInitialized
Flag if engines are initilaized.
void SetUserStack(TVirtualMCStack *stack)
Set user stack.
Int_t NEngines() const
Return the number of registered engines.
void Init(F initFunction)
Further specific initialization.
TGeoMCBranchArrayContainer fBranchArrayContainer
Pointer to cache with geometry states.
void Register(TVirtualMC *engine)
A TVirtualMC will register itself via this method during construction if a TMCManager was instanciate...
void GetEngines(std::vector< TVirtualMC * > &engines) const
Get registered engine pointers.
Interface to a user Monte Carlo application.
Interface to a user defined particles stack.
Abstract Monte Carlo interface.