59 #include "ParRunManager.hh"
61 #include "MarshaledG4HCofThisEvent.h"
67 using namespace CLHEP;
75 G4int ParRunManager::n_event;
76 G4int ParRunManager::n_select;
84 TOPC_BUF ParRunManager::MyDoEvent(
void *input_buf ) {
85 return myRunManager->DoEvent(input_buf);
87 TOPC_ACTION ParRunManager::MyCheckEventResult(
void * input_buf,
void *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;
180 TOPC_BUF ParRunManager::DoEvent(
void *input_buf )
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());
206 TOPC_ACTION ParRunManager::CheckEventResult(
void * input_buf,
void *output_buf )
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);
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()