38 #include "DetectorConstruction.hh"
39 #include "PhysicsList.hh"
40 #include "ActionInitialization.hh"
42 #ifdef G4MULTITHREADED
53 #include "CommandLineParser.hh"
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;
256 G4Random::setTheEngine(
new CLHEP::MixMaxRng());
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;
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 void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int Parse(int &argc, char **argv)
void SetNumberOfThreads(G4int n)
void AddCommand(const G4String &marker, Command::Type, const G4String &description="", const G4String &defaultOption="", const G4String &optionName="")
Command * GetCommandIfActive(const G4String &marker)
bool CheckIfNotHandledOptionsExists(int &argc, char **argv)
static CommandLineParser * GetParser()
static void DeleteInstance()
static G4UImanager * GetUIpointer()
G4GLOB_DLL std::ostream G4cout
G4int G4GetNumberOfCores()
G4int GetNumberOfThreads() const
CommandLineParser * parser(0)
static G4int ConvertToInt(const char *st)
Action initialization class.
int main(int argc, char **argv)
virtual void Initialize()
Detector construction class to demonstrate various ways of placement.
virtual const G4String & GetOption()
G4int ApplyCommand(const char *aCommand)