47 {
return fpEventManager; }
50 :currentEvent(0),trajectoryContainer(0),
51 verboseLevel(0),tracking(false),abortRequested(false),
52 storetRandomNumberStatusToG4Event(false)
57 "G4EventManager::G4EventManager() has already been made.");
66 fpEventManager =
this;
68 userStackingAction = 0;
69 userTrackingAction = 0;
70 userSteppingAction = 0;
81 delete trackContainer;
85 if(userEventAction)
delete userEventAction;
98 void G4EventManager::DoProcessing(
G4Event* anEvent)
100 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 = 0;
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 );
237 G4cout <<
"Illeagal TrackStatus returned from G4TrackingManager!"
243 for(
size_t i=0;i<secondaries->size();i++)
244 {
delete (*secondaries)[i]; }
245 secondaries->clear();
253 if ( verboseLevel > 0 )
255 G4cout <<
"NULL returned from G4StackManager." <<
G4endl;
256 G4cout <<
"Terminate current event processing." <<
G4endl;
267 abortRequested =
false;
277 size_t n_passedTrack = trackVector->size();
278 if( n_passedTrack == 0 )
return;
279 for(
size_t i = 0; i < n_passedTrack; i++ )
281 newTrack = (*trackVector)[ i ];
296 if ( verboseLevel > 1 )
298 G4cout <<
"A new track " << newTrack
301 <<
") is passed to G4StackManager." <<
G4endl;
305 trackVector->clear();
311 userEventAction = userAction;
317 userStackingAction = userAction;
323 userTrackingAction = userAction;
329 userSteppingAction = userAction;
336 DoProcessing(anEvent);
349 if(storetRandomNumberStatusToG4Event==1 || storetRandomNumberStatusToG4Event==3)
351 std::ostringstream oss;
355 StackTracks(trackVector,
false);
356 DoProcessing(anEvent);
369 "G4VUserEventInformation cannot be set because of ansense of G4Event.");
391 abortRequested =
true;
392 trackContainer->
clear();