59 #include "ParRunManager.hh"
61 #include "MarshaledG4HCofThisEvent.h"
67 using namespace CLHEP;
85 return myRunManager->DoEvent(input_buf);
88 return myRunManager->CheckEventResult(input_buf, buf);
92 static void trace_event_input(
void * ) {
102 TOPC_OPT_trace_input = trace_event_input;
107 cout <<
"ParRunManager::DoEventLoop" << endl;
118 if(n_select<0) n_select = n_event;
119 msg =
"/control/execute ";
134 if ( eventManager->GetUserEventAction() ) {
135 origUserEventAction = eventManager->GetUserEventAction();
140 ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
144 g_Seeds = (
long*)calloc(n_event,
sizeof(
long));
146 for(
G4int i_event=0; i_event<n_event; i_event++ )
152 TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
154 if(TOPC_is_master()){
155 for(
G4int i_event=0; i_event<n_event; i_event++ )
157 TOPC_raw_submit_task_input(TOPC_MSG( &i_event,
sizeof(
G4int)));
158 if (runAborted)
break;
161 TOPC_raw_end_master_slave();
165 if ( verboseLevel > 0 ) {
172 G4cout <<
" Number of events processed : " << n_event <<
G4endl;
184 memcpy(&i_event, input_buf,
sizeof(
G4int));
190 currentEvent = GenerateEvent(i_event);
191 eventManager->ProcessOneEvent(currentEvent);
195 if(aMarshaledObj)
delete aMarshaledObj;
200 StackPreviousEvent( currentEvent );
202 return TOPC_MSG( aMarshaledObj->getBuffer(), aMarshaledObj->getBufferSize());
209 memcpy(&i_event, input_buf,
sizeof(
G4int));
216 if ( !userPrimaryGeneratorAction ) {
217 G4Exception(
"ParRunManager::CheckEventResult",
"InvalidSetup",
219 "G4VUserPrimaryGeneratorAction is not defined.");
223 currentEvent =
new G4Event( i_event );
231 eventManager->ProcessOneEvent( currentEvent );
239 marshaledObj.unmarshalTo(HCE);
240 if(oldCE)
delete(oldCE);
242 currentEvent->SetHCofThisEvent(HCE);
246 if ( origUserEventAction )
247 origUserEventAction->BeginOfEventAction( currentEvent );
249 if ( origUserEventAction )
250 origUserEventAction->EndOfEventAction( currentEvent );
252 AnalyzeEvent(currentEvent);
257 StackPreviousEvent(currentEvent);
G4bool SetNewState(G4ApplicationState requestedState)
static void setTheSeed(long seed, int lux=3)
G4int ApplyCommand(const char *aCommand)
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
static G4UImanager * GetUIpointer()
static HepRandom * getTheGenerator()
static TOPC_ACTION MyCheckEventResult(void *input_buf, void *ignore)
static G4StateManager * stateManager
static constexpr double L
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
TOPC_ACTION CheckEventResult(void *input_buf, void *ignore)
G4int GetNumberOfCollections()
static TOPC_BUF MyDoEvent(void *input_buf)
static ParRunManager * myRunManager
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
TOPC_BUF DoEvent(void *input_buf)
static G4StateManager * GetStateManager()