WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimRandomMessenger.cc
Go to the documentation of this file.
3 
4 #include "G4UIdirectory.hh"
5 #include "G4ios.hh"
6 #include "G4UIcmdWithAString.hh"
7 #include "G4UIcmdWithAnInteger.hh"
8 
9 WCSimRandomMessenger::WCSimRandomMessenger(WCSimRandomParameters* WCRandomPars):WCSimRandomParams(WCRandomPars)
10 {
11  WCSimDir = new G4UIdirectory("/WCSim/random/");
12  WCSimDir->SetGuidance("Commands to set the random number generator parameters");
13 
14  Rangen = new G4UIcmdWithAString("/WCSim/random/generator",this);
15  Rangen->SetGuidance("Sets the random number generator. Possible values are: RANLUX, RANECU, and HEPJAMES (the G4 default)");
16  Rangen->SetParameterName("generator",true);
17  Rangen->SetDefaultValue("HEPJAMES");
18 
19  Ranseed = new G4UIcmdWithAnInteger("/WCSim/random/seed",this);
20  Ranseed->SetGuidance("Sets the random number seed (integer)");
21  Ranseed->SetParameterName("Ranseed",true);
22  Ranseed->SetDefaultValue(31415);
23 }
24 
26 {
27  delete Ranseed;
28  delete WCSimDir;
29 }
30 
31 void WCSimRandomMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
32 {
33  if (command == Rangen)
34  {
35  if (newValue == "RANLUX") WCSimRandomParams->SetGenerator(RANDOM_E_RANLUX);
36  if (newValue == "RANECU") WCSimRandomParams->SetGenerator(RANDOM_E_RANECU);
37  if (newValue == "HEPJAMES") WCSimRandomParams->SetGenerator(RANDOM_E_HEPJAMES);
38  }
39  else if (command == Ranseed)
40  {
41  WCSimRandomParams->SetSeed(Ranseed->GetNewIntValue(newValue));
42  }
43 }
44 
void SetGenerator(WCSimRandomGenerator_t rng)
WCSimRandomParameters * WCSimRandomParams
WCSimRandomMessenger(WCSimRandomParameters *)
G4UIcmdWithAString * Rangen
void SetNewValue(G4UIcommand *command, G4String newValue)
G4UIcmdWithAnInteger * Ranseed