Public Member Functions | |
BLCMDrandomseed () | |
G4String | commandName () |
int | command (BLArgumentVector &argv, BLArgumentMap &namedArgs) |
void | defineNamedArgs () |
BLCMDrandomseed::BLCMDrandomseed | ( | ) |
References BLCMDTYPE_CONTROL, BLCommand::registerCommand(), BLCommand::setDescription(), and BLCommand::setSynopsis().
00039 { 00040 registerCommand(BLCMDTYPE_CONTROL); 00041 setSynopsis("control pseudo random number generator seeds"); 00042 setDescription("This randomseed command controls the pseudo random " 00043 "number generator seed at the start of each event.\n" 00044 "The unnamed argument can be any of (case insensitive):\n" 00045 " EventNumber\n" 00046 " None\n" 00047 " Time\n" 00048 " Now\n" 00049 "EventNumber is the default and " 00050 "permits events to be re-run; None does not re-seed the " 00051 "PRNG at each event, and Time is like None after seeding " 00052 "with the time of day in microseconds; Now seeds the generator " 00053 "immediately with the value of the second argument (a long), " 00054 "and then acts like None."); 00055 }
G4String BLCMDrandomseed::commandName | ( | ) | [inline, virtual] |
int BLCMDrandomseed::command | ( | BLArgumentVector & | argv, | |
BLArgumentMap & | namedArgs | |||
) | [virtual] |
Implements BLCommand.
References EVENT_NUMBER, BLManager::getObject(), NO_SEED, BLCommand::printError(), BLManager::setPRNGSeedMethod(), and TIME_US.
00058 { 00059 if(argv.size() < 1) { 00060 printError("randomseed: invalid command -- need method"); 00061 return -1; 00062 } 00063 00064 G4String method = argv[0]; 00065 for(unsigned i=0; i<method.size(); ++i) 00066 method[i] = tolower(method[i]); 00067 00068 if(method == "now") { 00069 long seed = strtol(argv[1].c_str(),0,0); 00070 CLHEP::HepRandom::setTheSeed(seed); 00071 CLHEP::RandGauss::setFlag(false); 00072 BLManager::getObject()->setPRNGSeedMethod(NO_SEED); 00073 return 0; 00074 } 00075 00076 if(method =="eventnumber") 00077 BLManager::getObject()->setPRNGSeedMethod(EVENT_NUMBER); 00078 else if(method =="none") 00079 BLManager::getObject()->setPRNGSeedMethod(NO_SEED); 00080 else if(method =="time") 00081 BLManager::getObject()->setPRNGSeedMethod(TIME_US); 00082 else 00083 printError("randomseed: invalid method"); 00084 00085 return 0; 00086 }
void BLCMDrandomseed::defineNamedArgs | ( | ) | [virtual] |