56 #include "ParRunManager.hh"
58 #include "MarshaledG4HCofThisEvent.h"
64 using namespace CLHEP;
82 return myRunManager->DoEvent(input_buf);
85 return myRunManager->CheckEventResult(input_buf, buf);
89 static void trace_event_input(
void * ) {
99 TOPC_OPT_trace_input = trace_event_input;
104 cout <<
"ParRunManager::DoEventLoop" << endl;
115 if(n_select<0) n_select = n_event;
116 msg =
"/control/execute ";
131 if ( eventManager->GetUserEventAction() ) {
132 origUserEventAction = eventManager->GetUserEventAction();
137 ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
141 g_Seeds = (
long*)calloc(n_event,
sizeof(
long));
143 for(
G4int i_event=0; i_event<n_event; i_event++ )
149 TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
151 if(TOPC_is_master()){
152 for(
G4int i_event=0; i_event<n_event; i_event++ )
154 TOPC_raw_submit_task_input(TOPC_MSG( &i_event,
sizeof(
G4int)));
155 if (runAborted)
break;
158 TOPC_raw_end_master_slave();
162 if ( verboseLevel > 0 ) {
169 G4cout <<
" Number of events processed : " << n_event <<
G4endl;
181 memcpy(&i_event, input_buf,
sizeof(
G4int));
187 currentEvent = GenerateEvent(i_event);
188 eventManager->ProcessOneEvent(currentEvent);
192 if(aMarshaledObj)
delete aMarshaledObj;
197 StackPreviousEvent( currentEvent );
199 return TOPC_MSG( aMarshaledObj->getBuffer(), aMarshaledObj->getBufferSize());
206 memcpy(&i_event, input_buf,
sizeof(
G4int));
213 if ( !userPrimaryGeneratorAction ) {
214 G4Exception(
"ParRunManager::CheckEventResult",
"InvalidSetup",
216 "G4VUserPrimaryGeneratorAction is not defined.");
220 currentEvent =
new G4Event( i_event );
228 eventManager->ProcessOneEvent( currentEvent );
236 marshaledObj.unmarshalTo(HCE);
237 if(oldCE)
delete(oldCE);
239 currentEvent->SetHCofThisEvent(HCE);
243 if ( origUserEventAction )
244 origUserEventAction->BeginOfEventAction( currentEvent );
246 if ( origUserEventAction )
247 origUserEventAction->EndOfEventAction( currentEvent );
249 AnalyzeEvent(currentEvent);
254 StackPreviousEvent(currentEvent);