58 #include "ParRunManager.hh"
60 #include "MarshaledG4HCofThisEvent.h"
66 using namespace CLHEP;
84 return myRunManager->DoEvent(input_buf);
87 return myRunManager->CheckEventResult(input_buf, buf);
91 static void trace_event_input(
void * ) {
101 TOPC_OPT_trace_input = trace_event_input;
106 cout <<
"ParRunManager::DoEventLoop" << endl;
117 if(n_select<0) n_select = n_event;
118 msg =
"/control/execute ";
133 if ( eventManager->GetUserEventAction() ) {
134 origUserEventAction = eventManager->GetUserEventAction();
139 ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
143 g_Seeds = (
long*)calloc(n_event,
sizeof(
long));
145 for(
G4int i_event=0; i_event<n_event; i_event++ )
151 TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
153 if(TOPC_is_master()){
154 for(
G4int i_event=0; i_event<n_event; i_event++ )
156 TOPC_raw_submit_task_input(TOPC_MSG( &i_event,
sizeof(
G4int)));
157 if (runAborted)
break;
160 TOPC_raw_end_master_slave();
164 if ( verboseLevel > 0 ) {
171 G4cout <<
" Number of events processed : " << n_event <<
G4endl;
183 memcpy(&i_event, input_buf,
sizeof(
G4int));
189 currentEvent = GenerateEvent(i_event);
190 eventManager->ProcessOneEvent(currentEvent);
194 if(aMarshaledObj)
delete aMarshaledObj;
199 StackPreviousEvent( currentEvent );
201 return TOPC_MSG( aMarshaledObj->getBuffer(), aMarshaledObj->getBufferSize());
208 memcpy(&i_event, input_buf,
sizeof(
G4int));
215 if ( !userPrimaryGeneratorAction ) {
216 G4Exception(
"ParRunManager::CheckEventResult",
"InvalidSetup",
218 "G4VUserPrimaryGeneratorAction is not defined.");
222 currentEvent =
new G4Event( i_event );
230 eventManager->ProcessOneEvent( currentEvent );
238 marshaledObj.unmarshalTo(HCE);
239 if(oldCE)
delete(oldCE);
241 currentEvent->SetHCofThisEvent(HCE);
245 if ( origUserEventAction )
246 origUserEventAction->BeginOfEventAction( currentEvent );
248 if ( origUserEventAction )
249 origUserEventAction->EndOfEventAction( currentEvent );
251 AnalyzeEvent(currentEvent);
256 StackPreviousEvent(currentEvent);