57 #include "ParRunManager.hh"
59 #include "MarshaledG4HCofThisEvent.h"
65 using namespace CLHEP;
73 G4int ParRunManager::n_event;
74 G4int ParRunManager::n_select;
82 TOPC_BUF ParRunManager::MyDoEvent(
void *input_buf ) {
83 return myRunManager->DoEvent(input_buf);
85 TOPC_ACTION ParRunManager::MyCheckEventResult(
void * input_buf,
void *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;
178 TOPC_BUF ParRunManager::DoEvent(
void *input_buf )
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());
204 TOPC_ACTION ParRunManager::CheckEventResult(
void * input_buf,
void *output_buf )
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);
static HepRandom * getTheGenerator()
static void setTheSeed(long seed, int lux=3)
static G4UImanager * GetUIpointer()
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4bool SetNewState(G4ApplicationState requestedState)
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void DoEventLoop(G4int n_event, const char *macroFile=0, G4int n_select=-1)
static constexpr double L
G4int ApplyCommand(const char *aCommand)
G4int GetNumberOfCollections()