23#include <G4Version.hh>
24#if G4VERSION_NUMBER == 1100
30#include <G4Trajectory.hh>
31#include <G4TrajectoryContainer.hh>
32#include <G4UImanager.hh>
33#include <G4VVisManager.hh>
34#include <Randomize.hh>
38#include <TVirtualMC.h>
39#include <TVirtualMCApplication.h>
40#include <TVirtualMCSensitiveDetector.h>
41#include <TVirtualMCStack.h>
56 fSaveRandomStatus(false),
57 fIsInterruptibleEvent(false)
88#if G4VERSION_NUMBER == 1100
90 static G4ThreadLocal
auto applyCerenkovFix =
true;
91 if (applyCerenkovFix) {
93 applyCerenkovFix =
false;
103 G4cout <<
"Filling VMC stack with primaries" << G4endl;
105 for (G4int iv = 0; iv <
event->GetNumberOfPrimaryVertex(); iv++) {
106 G4PrimaryVertex* vertex =
event->GetPrimaryVertex(iv);
108 for (G4int ip = 0; ip < vertex->GetNumberOfParticle(); ip++) {
109 G4PrimaryParticle* particle = vertex->GetPrimary(ip);
117 G4UImanager::GetUIpointer()->ApplyCommand(
"/random/saveThisEvent");
118 if (
VerboseLevel() > 0) G4cout <<
"Saving random status: " << G4endl;
119 CLHEP::HepRandom::showEngineStatus();
124 G4cout <<
">>> Event " <<
event->GetEventID() << G4endl;
140 G4cout <<
">>> End of Event " <<
event->GetEventID() << G4endl;
144 G4int nofPrimaryTracks =
fMCStack->GetNprimary();
145 G4int nofSavedTracks =
fMCStack->GetNtrack();
147 G4cout <<
" " << nofPrimaryTracks <<
" primary tracks processed."
149 G4cout <<
" " << nofSavedTracks <<
" tracks saved." << G4endl;
152 G4cout <<
" " << nofAllTracks <<
" all tracks processed." << G4endl;
155#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 18, 0)
163 userSD->EndOfEvent();
181 gSystem->GetProcInfo(&procInfo);
182 G4cout <<
"Current memory usage: resident " << procInfo.fMemResident
183 <<
", virtual " << procInfo.fMemVirtual << G4endl;
Definition of the TG4EventAction class.
Definition of the TG4Globals class and basic container types.
Definition of the TG4ParticlesManager class.
Definition of the TG4PhysicsManager class.
Definition of the TG4SDServices class.
Definition of the TG4StateManager class.
Definition of the TG4TrackManager class.
Definition of the TG4TrackingAction class.
G4bool fIsInterruptibleEvent
virtual void BeginOfEventAction(const G4Event *event)
G4bool fSaveRandomStatus
Control for saving random engine status for each event.
TG4TrackingAction * fTrackingAction
Cached pointer to thread-local tracking action.
TVirtualMCApplication * fMCApplication
Cached pointer to thread-local VMC application.
G4bool fPrintMemory
Control for printing memory usage.
TVirtualMCStack * fMCStack
Cached pointer to thread-local VMC stack.
TG4StateManager * fStateManager
Cached pointer to thread-local state manager.
virtual void EndOfEventAction(const G4Event *event)
TG4TrackManager * fTrackManager
Cached pointer to thread-local track manager.
virtual ~TG4EventAction()
static TG4PhysicsManager * Instance()
static TG4SDServices * Instance()
void SetNewState(TG4ApplicationState state)
static TG4StateManager * Instance()
G4int GetNofTracks() const
static TG4TrackManager * Instance()
void PrimaryToStack(const G4PrimaryVertex *vertex, const G4PrimaryParticle *particle)
void FinishPrimaryTrack()
virtual void PrepareNewEvent()
static TG4TrackingAction * Instance()
Base class for defining the verbose level and a common messenger.
virtual G4int VerboseLevel() const
@ kNotInApplication
not in VMC application