47 {
return fpEventManager; }
50 :currentEvent(nullptr),trajectoryContainer(nullptr),
52 verboseLevel(0),tracking(false),abortRequested(false),
53 storetRandomNumberStatusToG4Event(false)
58 "G4EventManager::G4EventManager() has already been made.");
68 fpEventManager =
this;
69 userEventAction =
nullptr;
70 userStackingAction =
nullptr;
71 userTrackingAction =
nullptr;
72 userSteppingAction =
nullptr;
84 delete trackContainer;
88 delete userEventAction;
99 void G4EventManager::DoProcessing(
G4Event* anEvent)
101 abortRequested =
false;
107 "IllegalApplicationState -- Geometry is not closed : cannot process an event.");
110 currentEvent = anEvent;
112 if(storetRandomNumberStatusToG4Event>1)
114 std::ostringstream oss;
116 randomNumberStatusToG4Event = oss.str();
131 if ( verboseLevel > 0 )
133 G4cout <<
"=====================================" <<
G4endl;
134 G4cout <<
" G4EventManager::ProcessOneEvent() " <<
G4endl;
135 G4cout <<
"=====================================" <<
G4endl;
141 #ifdef G4_STORE_TRAJECTORY
142 trajectoryContainer =
nullptr;
152 if ( verboseLevel > 1 )
155 <<
" vertices passed from G4Event." <<
G4endl;
160 { StackTracks( transformer->
GimmePrimaries( currentEvent, trackIDCounter ),true ); }
163 if ( verboseLevel > 0 )
166 <<
"are passed from G4EventTransformer." <<
G4endl;
167 G4cout <<
"!!!!!!! Now start processing an event !!!!!!!" <<
G4endl;
172 while( ( track = trackContainer->
PopNextTrack(&previousTrajectory) ) != 0 )
176 if ( verboseLevel > 1 )
180 <<
") is passed to G4TrackingManager." <<
G4endl;
190 if ( verboseLevel > 0 )
194 <<
") is processed with stopping code " << istop <<
G4endl;
199 #ifdef G4_STORE_TRAJECTORY
202 if(previousTrajectory)
206 aTrajectory = previousTrajectory;
210 if(!trajectoryContainer)
213 trajectoryContainer->
insert(aTrajectory);
223 StackTracks( secondaries );
228 StackTracks( secondaries );
232 StackTracks( secondaries );
238 "Illegal trackstatus returned from G4TrackingManager. Continue with"\
245 for(
size_t i=0;i<secondaries->size();i++)
246 {
delete (*secondaries)[i]; }
247 secondaries->clear();
255 if ( verboseLevel > 0 )
257 G4cout <<
"NULL returned from G4StackManager." <<
G4endl;
258 G4cout <<
"Terminate current event processing." <<
G4endl;
268 currentEvent =
nullptr;
269 abortRequested =
false;
281 if( trackVector->size() == 0 )
return;
282 for(
auto newTrack : *trackVector )
287 newTrack->SetTrackID( trackIDCounter );
288 if(newTrack->GetDynamicParticle()->GetPrimaryParticle())
295 newTrack->SetOriginTouchableHandle(newTrack->GetTouchableHandle());
298 if ( verboseLevel > 1 )
300 G4cout <<
"A new track " << newTrack
301 <<
" (trackID " << newTrack->GetTrackID()
302 <<
", parentID " << newTrack->GetParentID()
303 <<
") is passed to G4StackManager." <<
G4endl;
307 trackVector->clear();
313 userEventAction = userAction;
319 userStackingAction = userAction;
325 userTrackingAction = userAction;
331 userSteppingAction = userAction;
338 DoProcessing(anEvent);
344 if (!randStat) randStat =
new G4String;
352 if(storetRandomNumberStatusToG4Event==1 || storetRandomNumberStatusToG4Event==3)
354 std::ostringstream oss;
358 StackTracks(trackVector,
false);
359 DoProcessing(anEvent);
371 "G4VUserEventInformation cannot be set because of ansense of G4Event.");
392 abortRequested =
true;
393 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()