47 {
return fpEventManager; }
50 :currentEvent(nullptr),trajectoryContainer(nullptr),
51 verboseLevel(0),tracking(false),abortRequested(false),
52 storetRandomNumberStatusToG4Event(false)
57 "G4EventManager::G4EventManager() has already been made.");
67 fpEventManager =
this;
68 userEventAction =
nullptr;
69 userStackingAction =
nullptr;
70 userTrackingAction =
nullptr;
71 userSteppingAction =
nullptr;
83 delete trackContainer;
87 delete userEventAction;
98 void G4EventManager::DoProcessing(
G4Event* anEvent)
100 abortRequested =
false;
106 "IllegalApplicationState -- Geometry is not closed : cannot process an event.");
109 currentEvent = anEvent;
111 if(storetRandomNumberStatusToG4Event>1)
113 std::ostringstream oss;
115 randomNumberStatusToG4Event = oss.str();
130 if ( verboseLevel > 0 )
132 G4cout <<
"=====================================" <<
G4endl;
133 G4cout <<
" G4EventManager::ProcessOneEvent() " <<
G4endl;
134 G4cout <<
"=====================================" <<
G4endl;
140 #ifdef G4_STORE_TRAJECTORY
141 trajectoryContainer =
nullptr;
151 if ( verboseLevel > 1 )
154 <<
" vertices passed from G4Event." <<
G4endl;
159 { StackTracks( transformer->
GimmePrimaries( currentEvent, trackIDCounter ),true ); }
162 if ( verboseLevel > 0 )
165 <<
"are passed from G4EventTransformer." <<
G4endl;
166 G4cout <<
"!!!!!!! Now start processing an event !!!!!!!" <<
G4endl;
171 while( ( track = trackContainer->
PopNextTrack(&previousTrajectory) ) != 0 )
175 if ( verboseLevel > 1 )
179 <<
") is passed to G4TrackingManager." <<
G4endl;
189 if ( verboseLevel > 0 )
193 <<
") is processed with stopping code " << istop <<
G4endl;
198 #ifdef G4_STORE_TRAJECTORY
201 if(previousTrajectory)
205 aTrajectory = previousTrajectory;
209 if(!trajectoryContainer)
212 trajectoryContainer->
insert(aTrajectory);
222 StackTracks( secondaries );
227 StackTracks( secondaries );
231 StackTracks( secondaries );
236 G4cout <<
"Illeagal TrackStatus returned from G4TrackingManager!"
242 for(
size_t i=0;i<secondaries->size();i++)
243 {
delete (*secondaries)[i]; }
244 secondaries->clear();
252 if ( verboseLevel > 0 )
254 G4cout <<
"NULL returned from G4StackManager." <<
G4endl;
255 G4cout <<
"Terminate current event processing." <<
G4endl;
265 currentEvent =
nullptr;
266 abortRequested =
false;
278 if( trackVector->size() == 0 )
return;
279 for(
auto newTrack : *trackVector )
284 newTrack->SetTrackID( trackIDCounter );
285 if(newTrack->GetDynamicParticle()->GetPrimaryParticle())
292 newTrack->SetOriginTouchableHandle(newTrack->GetTouchableHandle());
295 if ( verboseLevel > 1 )
297 G4cout <<
"A new track " << newTrack
298 <<
" (trackID " << newTrack->GetTrackID()
299 <<
", parentID " << newTrack->GetParentID()
300 <<
") is passed to G4StackManager." <<
G4endl;
304 trackVector->clear();
310 userEventAction = userAction;
316 userStackingAction = userAction;
322 userTrackingAction = userAction;
328 userSteppingAction = userAction;
335 DoProcessing(anEvent);
341 if (!randStat) randStat =
new G4String;
349 if(storetRandomNumberStatusToG4Event==1 || storetRandomNumberStatusToG4Event==3)
351 std::ostringstream oss;
355 StackTracks(trackVector,
false);
356 DoProcessing(anEvent);
368 "G4VUserEventInformation cannot be set because of ansense of G4Event.");
389 abortRequested =
true;
390 trackContainer->
clear();
G4int GetParentID() const
G4VTrajectory * GimmeTrajectory() const
G4VUserEventInformation * GetUserInformation() const
void ProcessOneTrack(G4Track *apValueG4Track)
virtual void EndOfEventAction(const G4Event *anEvent)
G4int GetNumberOfPrimaryVertex() const
G4int GetNTotalTrack() const
G4TrackStatus GetTrackStatus() const
G4Navigator * GetNavigatorForTracking() const
void SetRandomNumberStatusForProcessing(G4String &st)
void SetHCofThisEvent(G4HCofThisEvent *value)
virtual void BeginOfEventAction(const G4Event *anEvent)
G4Track * PopNextTrack(G4VTrajectory **newTrajectory)
void TerminateCurrentEvent(G4HCofThisEvent *HCE)
virtual void SetEventManager(G4EventManager *value)
virtual void MergeTrajectory(G4VTrajectory *secondTrajectory)=0
static G4StateManager * GetStateManager()
void SetUserInformation(G4VUserEventInformation *anInfo)
void SetUserStackingAction(G4UserStackingAction *value)
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
G4TrackVector * GimmeSecondaries() const
void SetUserInformation(G4VUserEventInformation *anInfo)
void SetTrackID(G4int id)
G4int PushOneTrack(G4Track *newTrack, G4VTrajectory *newTrajectory=0)
G4ApplicationState GetCurrentState() const
void SetUserAction(G4UserTrackingAction *apAction)
G4bool insert(G4VTrajectory *p)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetRandomNumberStatus(G4String &st)
static G4TransportationManager * GetTransportationManager()
G4HCofThisEvent * PrepareNewEvent()
std::vector< G4Track * > G4TrackVector
void SetUserAction(G4UserEventAction *userAction)
static G4EventManager * GetEventManager()
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=0, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
void ProcessOneEvent(G4Event *anEvent)
static std::ostream & saveFullState(std::ostream &os)
G4HCofThisEvent * GetHCofThisEvent() const
void SetTrajectoryContainer(G4TrajectoryContainer *value)
void KeepTheEvent(G4bool vl=true)
void KeepTheCurrentEvent()
static G4SDManager * GetSDMpointerIfExist()
G4VUserEventInformation * GetUserInformation()