57 #include "ParRunManager.hh"
59 #include "MarshaledG4HCofThisEvent.h"
65 using namespace CLHEP;
83 return myRunManager->DoEvent(input_buf);
86 return myRunManager->CheckEventResult(input_buf, buf);
90 static void trace_event_input(
void * ) {
100 TOPC_OPT_trace_input = trace_event_input;
105 cout <<
"ParRunManager::DoEventLoop" << endl;
116 if(n_select<0) n_select = n_event;
117 msg =
"/control/execute ";
132 if ( eventManager->GetUserEventAction() ) {
133 origUserEventAction = eventManager->GetUserEventAction();
138 ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
142 g_Seeds = (
long*)calloc(n_event,
sizeof(
long));
144 for(
G4int i_event=0; i_event<n_event; i_event++ )
150 TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
152 if(TOPC_is_master()){
153 for(
G4int i_event=0; i_event<n_event; i_event++ )
155 TOPC_raw_submit_task_input(TOPC_MSG( &i_event,
sizeof(
G4int)));
156 if (runAborted)
break;
159 TOPC_raw_end_master_slave();
163 if ( verboseLevel > 0 ) {
170 G4cout <<
" Number of events processed : " << n_event <<
G4endl;
182 memcpy(&i_event, input_buf,
sizeof(
G4int));
188 currentEvent = GenerateEvent(i_event);
189 eventManager->ProcessOneEvent(currentEvent);
193 if(aMarshaledObj)
delete aMarshaledObj;
198 StackPreviousEvent( currentEvent );
200 return TOPC_MSG( aMarshaledObj->getBuffer(), aMarshaledObj->getBufferSize());
207 memcpy(&i_event, input_buf,
sizeof(
G4int));
214 if ( !userPrimaryGeneratorAction ) {
215 G4Exception(
"ParRunManager::CheckEventResult",
"InvalidSetup",
217 "G4VUserPrimaryGeneratorAction is not defined.");
221 currentEvent =
new G4Event( i_event );
229 eventManager->ProcessOneEvent( currentEvent );
237 marshaledObj.unmarshalTo(HCE);
238 if(oldCE)
delete(oldCE);
240 currentEvent->SetHCofThisEvent(HCE);
244 if ( origUserEventAction )
245 origUserEventAction->BeginOfEventAction( currentEvent );
247 if ( origUserEventAction )
248 origUserEventAction->EndOfEventAction( currentEvent );
250 AnalyzeEvent(currentEvent);
255 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()