WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimPrimaryGeneratorMessenger.cc
Go to the documentation of this file.
3 #include "G4UIdirectory.hh"
4 #include "G4UIcmdWithAString.hh"
5 #include "G4ios.hh"
6 
8 :myAction(pointerToAction)
9 {
10  mydetDirectory = new G4UIdirectory("/mygen/");
11  mydetDirectory->SetGuidance("WCSim detector control commands.");
12 
13  genCmd = new G4UIcmdWithAString("/mygen/generator",this);
14  genCmd->SetGuidance("Select primary generator.");
15  //T. Akiri: Addition of laser
16  genCmd->SetGuidance(" Available generators : muline, gun, laser, gps, radioactive, radon");
17  genCmd->SetParameterName("generator",true);
18  genCmd->SetDefaultValue("muline");
19  //T. Akiri: Addition of laser
20  genCmd->SetCandidates("muline gun laser gps radioactive radon");
21 
22  fileNameCmd = new G4UIcmdWithAString("/mygen/vecfile",this);
23  fileNameCmd->SetGuidance("Select the file of vectors.");
24  fileNameCmd->SetGuidance(" Enter the file name of the vector file");
25  fileNameCmd->SetParameterName("fileName",true);
26  fileNameCmd->SetDefaultValue("inputvectorfile");
27 
28  timeUnitCmd = new G4UIcmdWithAString("/mygen/time_unit",this);
29  timeUnitCmd->SetGuidance("Define the units used for tme in the input file.");
30  timeUnitCmd->SetGuidance("Can be picosecond, ps, ns, nanosecond, ms, millisecond, s, sec or second");
31  timeUnitCmd->SetGuidance("Default if not set is nanosecond");
32  timeUnitCmd->SetParameterName("unit",true);
33  timeUnitCmd->SetDefaultValue("ns");
34 
35  radioactive_time_window_Cmd = new G4UIcmdWithADouble("/mygen/radioactive_time_window",this);
36  radioactive_time_window_Cmd->SetGuidance("Select time window for radioactivity");
37  radioactive_time_window_Cmd->SetParameterName("radioactive_time_window",true);
38  radioactive_time_window_Cmd->SetDefaultValue(0.);
39 
40  isotopeCmd = new G4UIcmdWithAString("/mygen/isotope",this);
41  isotopeCmd->SetGuidance("Select properties of radioactive isotope");
42  isotopeCmd->SetGuidance("[usage] /mygen/isotope ISOTOPE LOCATION ACTIVITY");
43  isotopeCmd->SetGuidance(" ISOTOPE : Tl208, Bi214, K40");
44  isotopeCmd->SetGuidance(" LOCATION : water PMT");
45  isotopeCmd->SetGuidance(" ACTIVITY : (int) activity of isotope (Bq) ");
46  G4UIparameter* param;
47  param = new G4UIparameter("ISOTOPE",'s',true);
48  param->SetDefaultValue("Tl208");
49  isotopeCmd->SetParameter(param);
50  param = new G4UIparameter("LOCATION",'s',true);
51  param->SetDefaultValue("water");
52  isotopeCmd->SetParameter(param);
53  param = new G4UIparameter("ACTIVITY",'d',true);
54  param->SetDefaultValue("0");
55  isotopeCmd->SetParameter(param);
56 
57  radonScalingCmd = new G4UIcmdWithAString("/mygen/radon_scaling",this);
58  radonScalingCmd->SetGuidance("Select scalling scenario");
59  radonScalingCmd->SetGuidance("[usage] /mygen/radon SCENARIO ");
60  radonScalingCmd->SetGuidance(" SCENARIO : A, B, C");
61  radonScalingCmd->SetCandidates("A B C");
62  param = new G4UIparameter("SCENARIO",'s',true);
63  param->SetDefaultValue("C");
64  radonScalingCmd->SetParameter(param);
65 
66  radonGeoSymCmd = new G4UIcmdWithAnInteger("/mygen/radon_symmetry",this);
67  radonGeoSymCmd->SetGuidance("Select scalling scenario");
68  radonGeoSymCmd->SetGuidance("[usage] /mygen/radon SCENARIO ");
69  radonGeoSymCmd->SetGuidance(" SYMMETRY : 1 ... ");
70  param = new G4UIparameter("SYMMETRY",'d',true);
71  param->SetDefaultValue("1");
72  radonScalingCmd->SetParameter(param);
73 }
74 
76 {
77  delete genCmd;
78  delete mydetDirectory;
79 }
80 
81 void WCSimPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
82 {
83  if( command==genCmd )
84  {
85  if (newValue == "muline")
86  {
93  }
94  else if ( newValue == "gun")
95  {
102  }
103  else if ( newValue == "laser") //T. Akiri: Addition of laser
104  {
111  }
112  else if ( newValue == "gps")
113  {
120  }
121  else if ( newValue == "radioactive") //G. Pronost: Addition of Radioactivity (from F. Nova code)
122  {
129  }
130  else if ( newValue == "radon" ) //G. Pronost: Addition of Radon generator (based on F. Nova's radioactive generator but dedicated to radioactive events in water)
131  {
138  }
139  }
140 
141  if( command == fileNameCmd )
142  {
143  myAction->OpenVectorFile(newValue);
144  G4cout << "Input vector file set to " << newValue << G4endl;
145  }
146 
147  if( command==isotopeCmd )
148  {
149  IsotopeCommand(newValue);
150  }
151 
152  if( command==radioactive_time_window_Cmd )
153  {
154  myAction->SetRadioactiveTimeWindow(StoD(newValue));
155  }
156 
157  if ( command==radonScalingCmd )
158  {
159  RadonScalingCommand(newValue);
160  }
161 
162  if ( command==radonGeoSymCmd )
163  {
164  myAction->SetRadonSymmetry(radonGeoSymCmd->GetNewIntValue(newValue));
165  }
166 
167  if ( command==timeUnitCmd)
168  {
169  myAction->SetTimeUnit(newValue);
170  G4cout << "Time unit set to " << newValue << G4endl;
171  }
172 
173 }
174 
176 {
177  G4String cv;
178 
179  if( command==genCmd )
180  {
182  { cv = "muline"; }
183  else if(myAction->IsUsingGunEvtGenerator())
184  { cv = "gun"; }
186  { cv = "laser"; } //T. Akiri: Addition of laser
187  else if(myAction->IsUsingGPSEvtGenerator())
188  { cv = "gps"; }
190  { cv = "radon"; }
191  }
192 
193  return cv;
194 }
195 
196 
198 {
199  G4Tokenizer next( newValue );
200 
201  G4String isotope = next();
202  G4String location = next();
203  G4double activity = StoD(next());
204 
205  myAction->AddRadioactiveSource(isotope, location, activity);
206 }
207 
209 {
210  G4Tokenizer next( newValue );
211 
212  G4String scenario = next();
213  G4int iScenario = 0;
214 
215  if ( scenario == "A" ) iScenario = 1; // Relative scaling with respect to full ID volume (Pessimistic)
216  if ( scenario == "B" ) iScenario = 2; // Relative scaling with respect to fiducial volume
217  if ( scenario == "C" ) iScenario = 3; // Absolute scaling with respect to ID border (Optimistic)
218 
219  myAction->SetRadonScenario(iScenario);
220 }
void SetNewValue(G4UIcommand *command, G4String newValues)
WCSimPrimaryGeneratorMessenger(WCSimPrimaryGeneratorAction *mpga)
G4String GetCurrentValue(G4UIcommand *command)
void AddRadioactiveSource(G4String IsotopeName, G4String IsotopeLocation, G4double IsotopeActivity)
void SetRadioactiveTimeWindow(G4double choice)