Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4EventManager Class Reference

#include <G4EventManager.hh>

Public Types

using ProfilerConfig = G4ProfilerConfig< G4ProfileType::Event >
 

Public Member Functions

 G4EventManager ()
 
 ~G4EventManager ()
 
 G4EventManager (const G4EventManager &right)=delete
 
G4EventManageroperator= (const G4EventManager &right)=delete
 
void ProcessOneEvent (G4Event *anEvent)
 
void ProcessOneEvent (G4TrackVector *trackVector, G4Event *anEvent=nullptr)
 
void StackTracks (G4TrackVector *trackVector, G4bool IDhasAlreadySet=false)
 
const G4EventGetConstCurrentEvent ()
 
G4EventGetNonconstCurrentEvent ()
 
void AbortCurrentEvent ()
 
void SetUserAction (G4UserEventAction *userAction)
 
void SetUserAction (G4UserStackingAction *userAction)
 
void SetUserAction (G4UserTrackingAction *userAction)
 
void SetUserAction (G4UserSteppingAction *userAction)
 
G4UserEventActionGetUserEventAction ()
 
G4UserStackingActionGetUserStackingAction ()
 
G4UserTrackingActionGetUserTrackingAction ()
 
G4UserSteppingActionGetUserSteppingAction ()
 
void SetNumberOfAdditionalWaitingStacks (G4int iAdd)
 
void KeepTheCurrentEvent ()
 
G4StackManagerGetStackManager () const
 
G4TrackingManagerGetTrackingManager () const
 
G4int GetVerboseLevel ()
 
void SetVerboseLevel (G4int value)
 
void SetUserInformation (G4VUserEventInformation *anInfo)
 
G4VUserEventInformationGetUserInformation ()
 
G4PrimaryTransformerGetPrimaryTransformer () const
 
void SetPrimaryTransformer (G4PrimaryTransformer *tf)
 
void StoreRandomNumberStatusToG4Event (G4int vl)
 

Static Public Member Functions

static G4EventManagerGetEventManager ()
 

Detailed Description

Definition at line 56 of file G4EventManager.hh.

Member Typedef Documentation

◆ ProfilerConfig

Constructor & Destructor Documentation

◆ G4EventManager() [1/2]

G4EventManager::G4EventManager ( )

Definition at line 58 of file G4EventManager.cc.

59{
60 if(fpEventManager != nullptr)
61 {
62 G4Exception("G4EventManager::G4EventManager", "Event0001", FatalException,
63 "G4EventManager::G4EventManager() has already been made.");
64 }
65 else
66 {
67 trackManager = new G4TrackingManager;
68 transformer = new G4PrimaryTransformer;
69 trackContainer = new G4StackManager;
70 theMessenger = new G4EvManMessenger(this);
72 stateManager = G4StateManager::GetStateManager();
73 fpEventManager = this;
74 }
75}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
static G4SDManager * GetSDMpointerIfExist()
Definition: G4SDManager.cc:47
static G4StateManager * GetStateManager()

◆ ~G4EventManager()

G4EventManager::~G4EventManager ( )

Definition at line 77 of file G4EventManager.cc.

78{
79 delete trackContainer;
80 delete transformer;
81 delete trackManager;
82 delete theMessenger;
83 delete userEventAction;
84 fpEventManager = nullptr;
85}

◆ G4EventManager() [2/2]

G4EventManager::G4EventManager ( const G4EventManager right)
delete

Member Function Documentation

◆ AbortCurrentEvent()

void G4EventManager::AbortCurrentEvent ( )

Definition at line 441 of file G4EventManager.cc.

442{
443 abortRequested = true;
444 trackContainer->clear();
445 if(tracking) trackManager->EventAborted();
446}

Referenced by G4RunManager::AbortEvent(), G4RunManager::AbortRun(), and G4EvManMessenger::SetNewValue().

◆ GetConstCurrentEvent()

const G4Event * G4EventManager::GetConstCurrentEvent ( )
inline

Definition at line 95 of file G4EventManager.hh.

96 { return currentEvent; }

Referenced by G4VisManager::Draw().

◆ GetEventManager()

◆ GetNonconstCurrentEvent()

G4Event * G4EventManager::GetNonconstCurrentEvent ( )
inline

Definition at line 97 of file G4EventManager.hh.

98 { return currentEvent; }

◆ GetPrimaryTransformer()

G4PrimaryTransformer * G4EventManager::GetPrimaryTransformer ( ) const
inline

Definition at line 153 of file G4EventManager.hh.

154 { return transformer; }

Referenced by G4RunManagerKernel::GetPrimaryTransformer().

◆ GetStackManager()

G4StackManager * G4EventManager::GetStackManager ( ) const
inline

Definition at line 132 of file G4EventManager.hh.

133 { return trackContainer; }

Referenced by G4RunManagerKernel::GetStackManager().

◆ GetTrackingManager()

G4TrackingManager * G4EventManager::GetTrackingManager ( ) const
inline

◆ GetUserEventAction()

G4UserEventAction * G4EventManager::GetUserEventAction ( )
inline

Definition at line 113 of file G4EventManager.hh.

114 { return userEventAction; }

Referenced by G4TheRayTracer::StoreUserActions().

◆ GetUserInformation()

G4VUserEventInformation * G4EventManager::GetUserInformation ( )

Definition at line 425 of file G4EventManager.cc.

426{
427 G4ApplicationState currentState = stateManager->GetCurrentState();
428 if(currentState != G4State_EventProc || currentEvent == nullptr)
429 {
430 return nullptr;
431 }
432
433 return currentEvent->GetUserInformation();
434}
G4ApplicationState
@ G4State_EventProc
G4VUserEventInformation * GetUserInformation() const
Definition: G4Event.hh:173
const G4ApplicationState & GetCurrentState() const

◆ GetUserStackingAction()

G4UserStackingAction * G4EventManager::GetUserStackingAction ( )
inline

Definition at line 115 of file G4EventManager.hh.

116 { return userStackingAction; }

Referenced by G4TheRayTracer::StoreUserActions().

◆ GetUserSteppingAction()

G4UserSteppingAction * G4EventManager::GetUserSteppingAction ( )
inline

Definition at line 119 of file G4EventManager.hh.

120 { return userSteppingAction; }

Referenced by G4TheRayTracer::StoreUserActions().

◆ GetUserTrackingAction()

G4UserTrackingAction * G4EventManager::GetUserTrackingAction ( )
inline

◆ GetVerboseLevel()

G4int G4EventManager::GetVerboseLevel ( )
inline

Definition at line 137 of file G4EventManager.hh.

138 { return verboseLevel; }

Referenced by G4EvManMessenger::GetCurrentValue().

◆ KeepTheCurrentEvent()

void G4EventManager::KeepTheCurrentEvent ( )

Definition at line 436 of file G4EventManager.cc.

437{
438 if(currentEvent != nullptr) { currentEvent->KeepTheEvent(); }
439}
void KeepTheEvent(G4bool vl=true)
Definition: G4Event.hh:100

Referenced by G4EvManMessenger::SetNewValue().

◆ operator=()

G4EventManager & G4EventManager::operator= ( const G4EventManager right)
delete

◆ ProcessOneEvent() [1/2]

void G4EventManager::ProcessOneEvent ( G4Event anEvent)

Definition at line 379 of file G4EventManager.cc.

380{
381 trackIDCounter = 0;
382 DoProcessing(anEvent);
383}

Referenced by G4TheRayTracer::CreateBitMap(), G4RunManager::ProcessOneEvent(), G4WorkerRunManager::ProcessOneEvent(), and G4WorkerTaskRunManager::ProcessOneEvent().

◆ ProcessOneEvent() [2/2]

void G4EventManager::ProcessOneEvent ( G4TrackVector trackVector,
G4Event anEvent = nullptr 
)

Definition at line 385 of file G4EventManager.cc.

387{
388 static G4ThreadLocal G4String* randStat = nullptr;
389 if (randStat == nullptr) randStat = new G4String;
390 trackIDCounter = 0;
391 G4bool tempEvent = false;
392 if(anEvent == nullptr)
393 {
394 anEvent = new G4Event();
395 tempEvent = true;
396 }
397 if (storetRandomNumberStatusToG4Event==1
398 || storetRandomNumberStatusToG4Event==3)
399 {
400 std::ostringstream oss;
402 (*randStat) = oss.str();
403 anEvent->SetRandomNumberStatus(*randStat);
404 }
405 StackTracks(trackVector,false);
406 DoProcessing(anEvent);
407 if(tempEvent) { delete anEvent; }
408}
bool G4bool
Definition: G4Types.hh:86
static std::ostream & saveFullState(std::ostream &os)
Definition: Random.cc:288
void StackTracks(G4TrackVector *trackVector, G4bool IDhasAlreadySet=false)
void SetRandomNumberStatus(G4String &st)
Definition: G4Event.hh:90
#define G4ThreadLocal
Definition: tls.hh:77

◆ SetNumberOfAdditionalWaitingStacks()

void G4EventManager::SetNumberOfAdditionalWaitingStacks ( G4int  iAdd)
inline

Definition at line 125 of file G4EventManager.hh.

126 { trackContainer->SetNumberOfAdditionalWaitingStacks(iAdd); }
void SetNumberOfAdditionalWaitingStacks(G4int iAdd)

Referenced by G4RunManager::SetNumberOfAdditionalWaitingStacks().

◆ SetPrimaryTransformer()

void G4EventManager::SetPrimaryTransformer ( G4PrimaryTransformer tf)
inline

Definition at line 155 of file G4EventManager.hh.

156 { transformer = tf; }

Referenced by G4RunManagerKernel::SetPrimaryTransformer().

◆ SetUserAction() [1/4]

void G4EventManager::SetUserAction ( G4UserEventAction userAction)

Definition at line 352 of file G4EventManager.cc.

353{
354 userEventAction = userAction;
355 if(userEventAction != nullptr)
356 {
357 userEventAction->SetEventManager(this);
358 }
359}
virtual void SetEventManager(G4EventManager *value)

Referenced by G4TheRayTracer::RestoreUserActions(), G4RunManager::SetUserAction(), G4ErrorPropagatorManager::SetUserAction(), G4ErrorRunManagerHelper::SetUserAction(), and G4TheRayTracer::StoreUserActions().

◆ SetUserAction() [2/4]

void G4EventManager::SetUserAction ( G4UserStackingAction userAction)

Definition at line 361 of file G4EventManager.cc.

362{
363 userStackingAction = userAction;
364 trackContainer->SetUserStackingAction(userAction);
365}
void SetUserStackingAction(G4UserStackingAction *value)

◆ SetUserAction() [3/4]

void G4EventManager::SetUserAction ( G4UserSteppingAction userAction)

Definition at line 373 of file G4EventManager.cc.

374{
375 userSteppingAction = userAction;
376 trackManager->SetUserAction(userAction);
377}
void SetUserAction(G4UserTrackingAction *apAction)

◆ SetUserAction() [4/4]

void G4EventManager::SetUserAction ( G4UserTrackingAction userAction)

Definition at line 367 of file G4EventManager.cc.

368{
369 userTrackingAction = userAction;
370 trackManager->SetUserAction(userAction);
371}

◆ SetUserInformation()

void G4EventManager::SetUserInformation ( G4VUserEventInformation anInfo)

Definition at line 410 of file G4EventManager.cc.

411{
412 G4ApplicationState currentState = stateManager->GetCurrentState();
413 if(currentState != G4State_EventProc || currentEvent == nullptr)
414 {
415 G4Exception("G4EventManager::SetUserInformation",
416 "Event0003", JustWarning,
417 "G4VUserEventInformation cannot be set because of absence "\
418 "of G4Event.");
419 return;
420 }
421
422 currentEvent->SetUserInformation(anInfo);
423}
@ JustWarning
void SetUserInformation(G4VUserEventInformation *anInfo)
Definition: G4Event.hh:171

◆ SetVerboseLevel()

void G4EventManager::SetVerboseLevel ( G4int  value)
inline

Definition at line 139 of file G4EventManager.hh.

140 {
141 verboseLevel = value;
142 trackContainer->SetVerboseLevel( value );
143 transformer->SetVerboseLevel( value );
144 }
void SetVerboseLevel(G4int vl)
void SetVerboseLevel(G4int const value)

Referenced by G4EvManMessenger::SetNewValue().

◆ StackTracks()

void G4EventManager::StackTracks ( G4TrackVector trackVector,
G4bool  IDhasAlreadySet = false 
)

Definition at line 317 of file G4EventManager.cc.

319{
320 if( trackVector != nullptr )
321 {
322 if( trackVector->empty() ) return;
323 for( auto newTrack : *trackVector )
324 {
325 ++trackIDCounter;
326 if(!IDhasAlreadySet)
327 {
328 newTrack->SetTrackID( trackIDCounter );
329 if(newTrack->GetDynamicParticle()->GetPrimaryParticle() != nullptr)
330 {
331 auto* pp
332 = (G4PrimaryParticle*)(newTrack->GetDynamicParticle()->GetPrimaryParticle());
333 pp->SetTrackID(trackIDCounter);
334 }
335 }
336 newTrack->SetOriginTouchableHandle(newTrack->GetTouchableHandle());
337 trackContainer->PushOneTrack( newTrack );
338#ifdef G4VERBOSE
339 if ( verboseLevel > 1 )
340 {
341 G4cout << "A new track " << newTrack
342 << " (trackID " << newTrack->GetTrackID()
343 << ", parentID " << newTrack->GetParentID()
344 << ") is passed to G4StackManager." << G4endl;
345 }
346#endif
347 }
348 trackVector->clear();
349 }
350}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int PushOneTrack(G4Track *newTrack, G4VTrajectory *newTrajectory=nullptr)

Referenced by ProcessOneEvent().

◆ StoreRandomNumberStatusToG4Event()

void G4EventManager::StoreRandomNumberStatusToG4Event ( G4int  vl)
inline

Definition at line 157 of file G4EventManager.hh.

158 { storetRandomNumberStatusToG4Event = vl; }

Referenced by G4RunManager::StoreRandomNumberStatusToG4Event().


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