38 #include "DetectorConstruction.hh"
39 #include "PhysicsList.hh"
40 #include "ActionInitialization.hh"
42 #ifdef G4MULTITHREADED
53 #include "CommandLineParser.hh"
66 using namespace G4DNAPARSER;
73 void Parse(
int& argc,
char** argv);
77 int main(
int argc,
char** argv)
86 #ifdef G4MULTITHREADED
104 G4cout <<
"**************************************************************"
105 <<
"******\n===== Chem4 is started with "
108 <<
" available threads =====\n\n*************************************"
109 <<
"*******************************"
172 G4String command =
"/control/execute ";
230 noice = labs((
long)
noise());
232 const char * env = getenv(
"PBS_JOBID");
237 G4String jobID_string = buffer.substr(0, buffer.find(
"."));
238 jobID_string.erase(std::remove_if(jobID_string.begin(),
242 jobID_int = atoi(jobID_string.c_str());
246 env = getenv(
"SGE_TASK_ID");
247 if(env) jobID_int = atoi(env);
252 seed = ((long) time(NULL)) + jobID_int + noice;
257 G4Random::setTheSeed(
seed);
267 #if defined(WIN32)|| defined(_WIN32)|| defined(__WIN32)&&!defined(__CYGWIN__)
271 unsigned int random_seed, random_seed_a, random_seed_b;
272 std::ifstream
file (
"/dev/urandom", std::ios::binary);
276 int size =
sizeof(
int);
277 memblock =
new char [size];
278 file.read (memblock, size);
280 random_seed_a = *
reinterpret_cast<int*
>(memblock);
287 random_seed_b = std::time(0);
288 random_seed = random_seed_a xor random_seed_b;
295 void Parse(
int& argc,
char** argv)
303 "Select geant4 UI or just launch a geant4 terminal"
312 "Give a seed value in argument to be tested",
"seed");
314 #ifdef G4MULTITHREADED
316 "Launch in MT mode (events computed in parallel,"
317 " NOT RECOMMANDED WITH CHEMISTRY)",
"2");
321 "Deactivate chemistry");
324 "Select a visualization driver",
"OGL 600x600-0+0");
327 "Deactivate visualization when using GUI");
330 "Launch the code on a cluster, avoid dupplicated seeds");
void Parse(int &argc, char **argv)
virtual const G4String & GetOption()
void SetNumberOfThreads(G4int n)
static CommandLineParser * GetParser()
G4int ApplyCommand(const char *aCommand)
int Parse(int &argc, char **argv)
G4int G4GetNumberOfCores()
static G4UImanager * GetUIpointer()
G4int GetNumberOfThreads() const
static G4int ConvertToInt(const char *st)
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Action initialization class.
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
CommandLineParser * parser(0)
int main(int argc, char **argv)
Command * GetCommandIfActive(const G4String &marker)
static void DeleteInstance()
G4GLOB_DLL std::ostream G4cout
bool CheckIfNotHandledOptionsExists(int &argc, char **argv)
void AddCommand(const G4String &marker, Command::Type, const G4String &description="", const G4String &defaultOption="", const G4String &optionName="")
virtual void Initialize()
Simple detector construction with a box volume placed in a world.