Public Member Functions | |
BLCMDtest () | |
Constructor. | |
virtual G4String | commandName () |
commandName() returns "test". | |
virtual int | command (BLArgumentVector &argv, BLArgumentMap &namedArgs) |
command() implements the test command. | |
virtual void | defineNamedArgs () |
defineNamedArgs() defines the named arguments for this command. | |
Private Member Functions | |
G4double | myrand (G4double mean, G4double sigma) |
BLCMDtest::BLCMDtest | ( | ) |
Constructor.
References BLCMDTYPE_OTHER, BLCommand::registerCommand(), BLCommand::setDescription(), and BLCommand::setSynopsis().
00051 { 00052 registerCommand(BLCMDTYPE_OTHER); 00053 setSynopsis("test random number seeds."); 00054 setDescription("Test"); 00055 }
G4double BLCMDtest::myrand | ( | G4double | mean, | |
G4double | sigma | |||
) | [inline, private] |
Referenced by command().
00030 { 00031 if(sigma >= 0.0) return sigma*CLHEP::RandGauss::shoot() + mean; 00032 return mean+sigma-2.0*sigma*G4UniformRand(); 00033 }
virtual G4String BLCMDtest::commandName | ( | ) | [inline, virtual] |
int BLCMDtest::command | ( | BLArgumentVector & | argv, | |
BLArgumentMap & | namedArgs | |||
) | [virtual] |
command() implements the test command.
Implements BLCommand.
References myrand(), and BLCommand::printError().
00058 { 00059 if(argv.size() != 1) { 00060 printError("Invalid test command -- need seed"); 00061 return -1; 00062 } 00063 00064 G4int seed = atoi(argv[0]); 00065 if(seed >= 0) { 00066 CLHEP::HepRandom::setTheSeed(seed); 00067 CLHEP::RandGauss::setFlag(false); 00068 printf("seed=%6d %8.4f",seed,myrand(0.0,1.0)); 00069 for(int i=0; i<6; ++i) { 00070 for(int j=0; j<1000; ++j) 00071 myrand(0.0,1.0); 00072 printf(" %8.4f",myrand(0.0,1.0)); 00073 } 00074 printf("\n"); 00075 } else { 00076 printf(" %.4f,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f\n", 00077 myrand(0.0,1.0),myrand(0.0,1.0),myrand(0.0,1.0), 00078 myrand(0.0,1.0),myrand(0.0,1.0),myrand(0.0,1.0),myrand(0.0,1.0)); 00079 } 00080 00081 return 0; 00082 }
void BLCMDtest::defineNamedArgs | ( | ) | [virtual] |