Geant4  10.01.p02
Em10RunMessenger.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 // $Id: Em10RunMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
37 #include "Em10RunMessenger.hh"
38 
39 #include "Em10RunAction.hh"
40 #include "G4UIdirectory.hh"
41 #include "G4UIcmdWithAnInteger.hh"
43 #include "G4UIcmdWithADouble.hh"
44 #include "G4UIcmdWithAString.hh"
45 #include "G4ios.hh"
46 #include "globals.hh"
47 #include "Randomize.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
52 :G4UImessenger(),runAction (RA)
53 {
54  plotDir = new G4UIdirectory("/plots/");
55  plotDir->SetGuidance("plot control");
56 
57  sethistNameCmd = new G4UIcmdWithAString("/plots/sethistName",this);
58  sethistNameCmd->SetGuidance("set name for the histogram file");
59 
60  setnbinStepCmd = new G4UIcmdWithAnInteger("/plots/setnbinStep",this);
61  setnbinStepCmd->SetGuidance("set nb of bins in #step plot");
62  setnbinStepCmd->SetParameterName("nbinStep",false);
63 
64  setSteplowCmd = new G4UIcmdWithADouble("/plots/setSteplow",this);
65  setSteplowCmd->SetGuidance("set lower limit for #step plot ");
66  setSteplowCmd->SetParameterName("Steplow",false);
67 
68  setStephighCmd = new G4UIcmdWithADouble("/plots/setStephigh",this);
69  setStephighCmd->SetGuidance("set upper limit for #step plot ");
70  setStephighCmd->SetParameterName("Stephigh",false);
71 
72  setnbinEnCmd = new G4UIcmdWithAnInteger("/plots/setnbinEn",this);
73  setnbinEnCmd->SetGuidance("set nb of bins in Edep plot");
74  setnbinEnCmd->SetParameterName("nbinE",false);
75 
76  setEnlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEnlow",this);
77  setEnlowCmd->SetGuidance("set lower limit for Edep plot ");
78  setEnlowCmd->SetParameterName("Elow",false);
79  setEnlowCmd->SetUnitCategory("Energy");
80 
81  setEnhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEnhigh",this);
82  setEnhighCmd->SetGuidance("set upper limit for Edep plot ");
83  setEnhighCmd->SetParameterName("Ehigh",false);
84  setEnhighCmd->SetUnitCategory("Energy");
85 
86  setnbinGammaCmd = new G4UIcmdWithAnInteger("/plots/setnbinGamma",this);
87  setnbinGammaCmd->SetGuidance("set nb of bins in gamma spectrum plot");
88  setnbinGammaCmd->SetParameterName("nbinGamma",false);
89 
90  setElowGammaCmd = new G4UIcmdWithADoubleAndUnit("/plots/setElowGamma",this);
91  setElowGammaCmd->SetGuidance("set lower limit for gamma spectrum plot ");
92  setElowGammaCmd->SetParameterName("ElowGamma",false);
94 
95  setEhighGammaCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEhighGamma",this);
96  setEhighGammaCmd->SetGuidance("set upper limit for gamma spectrum plot ");
97  setEhighGammaCmd->SetParameterName("EhighGamma",false);
99 
100  setnbinTtCmd = new G4UIcmdWithAnInteger("/plots/setnbinTt",this);
101  setnbinTtCmd->SetGuidance("set nb of bins in Etransmitted plot");
102  setnbinTtCmd->SetParameterName("nbinTt",false);
103 
104  setTtlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTtlow",this);
105  setTtlowCmd->SetGuidance("set lower limit for Etransmitted plot ");
106  setTtlowCmd->SetParameterName("Ttlow",false);
107 
108  setTthighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTthigh",this);
109  setTthighCmd->SetGuidance("set upper limit for Etransmitted plot ");
110  setTthighCmd->SetParameterName("Tthigh",false);
111 
112  setnbinTbCmd = new G4UIcmdWithAnInteger("/plots/setnbinTb",this);
113  setnbinTbCmd->SetGuidance("set nb of bins in Ebackscattering plot");
114  setnbinTbCmd->SetParameterName("nbinTb",false);
115 
116  setTblowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTblow",this);
117  setTblowCmd->SetGuidance("set lower limit for Ebackscattered plot ");
118  setTblowCmd->SetParameterName("Tblow",false);
119 
120  setTbhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTbhigh",this);
121  setTbhighCmd->SetGuidance("set upper limit for Ebackscattered plot ");
122  setTbhighCmd->SetParameterName("Tbhigh",false);
123 
124  setnbinTsecCmd = new G4UIcmdWithAnInteger("/plots/setnbinTsec",this);
125  setnbinTsecCmd->SetGuidance("set nb of bins in charged Tsecondary plot");
126  setnbinTsecCmd->SetParameterName("nbinTsec",false);
127 
128  setTseclowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTseclow",this);
129  setTseclowCmd->SetGuidance("set lower limit for charged Tsecondary plot ");
130  setTseclowCmd->SetParameterName("Tseclow",false);
131 
132  setTsechighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTsechigh",this);
133  setTsechighCmd->SetGuidance("set upper limit for charged Tsecondary plot ");
134  setTsechighCmd->SetParameterName("Tsechigh",false);
135 
136  setnbinRCmd = new G4UIcmdWithAnInteger("/plots/setnbinR",this);
137  setnbinRCmd->SetGuidance("set nb of bins in R plot");
138  setnbinRCmd->SetParameterName("nbinR",false);
139 
140  setRlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRlow",this);
141  setRlowCmd->SetGuidance("set lower limit for R plot ");
142  setRlowCmd->SetParameterName("Rlow",false);
143 
144  setRhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRhigh",this);
145  setRhighCmd->SetGuidance("set upper limit for R plot ");
146  setRhighCmd->SetParameterName("Rhigh",false);
147 
148  setnbinzvertexCmd = new G4UIcmdWithAnInteger("/plots/setnbinzvertex",this);
149  setnbinzvertexCmd->SetGuidance("set nb of bins in Z vertex plot");
150  setnbinzvertexCmd->SetParameterName("nbinZ",false);
151 
152  setzlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzlow",this);
153  setzlowCmd->SetGuidance("set lower limit for Z vertex plot ");
154  setzlowCmd->SetParameterName("zlow",false);
155 
156  setzhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzhigh",this);
157  setzhighCmd->SetGuidance("set upper limit for Z vertex plot ");
158  setzhighCmd->SetParameterName("zhigh",false);
159 
160  setnbinThCmd = new G4UIcmdWithAnInteger("/plots/setnbinTh",this);
161  setnbinThCmd->SetGuidance("set nb of bins in Theta transmitted plot");
162  setnbinThCmd->SetParameterName("nbinTh",false);
163 
164  setThlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlow",this);
165  setThlowCmd->SetGuidance("set lower limit for Theta transmitted plot ");
166  setThlowCmd->SetParameterName("Thlow",false);
167 
168  setThhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhigh",this);
169  setThhighCmd->SetGuidance("set upper limit for Theta transmitted plot ");
170  setThhighCmd->SetParameterName("Thhigh",false);
171 
172  setnbinThbackCmd = new G4UIcmdWithAnInteger("/plots/setnbinThback",this);
173  setnbinThbackCmd->SetGuidance("set nb of bins in backscattering Theta plot");
174  setnbinThbackCmd->SetParameterName("nbinThback",false);
175 
176  setThlowbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlowback",this);
177  setThlowbackCmd->SetGuidance("set lower limit for backscattering Theta plot ");
178  setThlowbackCmd->SetParameterName("Thlowback",false);
179 
180  setThhighbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhighback",this);
181  setThhighbackCmd->SetGuidance("set upper limit for backscattering Theta plot ");
182  setThhighbackCmd->SetParameterName("Thhighback",false);
183 
184  RndmDir = new G4UIdirectory("/rndm/");
185  RndmDir->SetGuidance("Rndm status control.");
186 
187  RndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
188  RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
189  RndmSaveCmd->SetGuidance("freq = 0 not saved");
190  RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
191  RndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
192  RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
193  RndmSaveCmd->SetParameterName("frequency",false);
194  RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
196 
197  RndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
198  RndmReadCmd->SetGuidance("get rndm status from an external file.");
199  RndmReadCmd->SetParameterName("fileName",true);
200  RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
202 }
203 
204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
205 
207 {
208  delete sethistNameCmd;
209 
210  delete setnbinStepCmd;
211  delete setSteplowCmd;
212  delete setStephighCmd;
213 
214  delete setnbinEnCmd;
215  delete setEnlowCmd;
216  delete setEnhighCmd;
217 
218  delete setnbinGammaCmd;
219  delete setElowGammaCmd;
220  delete setEhighGammaCmd;
221 
222  delete setnbinTtCmd;
223  delete setTtlowCmd;
224  delete setTthighCmd;
225 
226  delete setnbinTbCmd;
227  delete setTblowCmd;
228  delete setTbhighCmd;
229 
230  delete setnbinTsecCmd;
231  delete setTseclowCmd;
232  delete setTsechighCmd;
233 
234  delete setnbinRCmd;
235  delete setRlowCmd;
236  delete setRhighCmd;
237 
238  delete setnbinzvertexCmd;
239  delete setzlowCmd;
240  delete setzhighCmd;
241 
242  delete setnbinThCmd;
243  delete setThlowCmd;
244  delete setThhighCmd;
245 
246  delete setnbinThbackCmd;
247  delete setThlowbackCmd;
248  delete setThhighbackCmd;
249 
250  delete plotDir;
251 
252  delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
253 }
254 
255 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
256 
258 {
259  if( command == sethistNameCmd)
260  runAction
261  ->SethistName(newValues) ;
262 
263  if( command == setnbinStepCmd)
264  runAction
266 
267  if( command == setSteplowCmd)
268  runAction
270 
271  if( command == setStephighCmd)
272  runAction
274 
275  if( command == setnbinEnCmd)
276  runAction
277  ->SetnbinEn(setnbinEnCmd->GetNewIntValue(newValues));
278 
279  if( command == setEnlowCmd)
280  runAction
281  ->SetEnlow( setEnlowCmd->GetNewDoubleValue(newValues));
282 
283  if( command == setEnhighCmd)
284  runAction
285  ->SetEnhigh( setEnhighCmd->GetNewDoubleValue(newValues));
286 
287  if( command == setnbinGammaCmd)
288  runAction
290 
291  if( command == setElowGammaCmd)
292  runAction
294 
295  if( command == setEhighGammaCmd)
296  runAction
298 
299  if( command == setnbinTtCmd)
300  runAction
301  ->SetnbinTt(setnbinTtCmd->GetNewIntValue(newValues));
302 
303  if( command == setTtlowCmd)
304  runAction
305  ->SetTtlow( setTtlowCmd->GetNewDoubleValue(newValues));
306 
307  if( command == setTthighCmd)
308  runAction
309  ->SetTthigh( setTthighCmd->GetNewDoubleValue(newValues));
310 
311  if( command == setnbinTbCmd)
312  runAction
313  ->SetnbinTb(setnbinTbCmd->GetNewIntValue(newValues));
314 
315  if( command == setTblowCmd)
316  runAction
317  ->SetTblow( setTblowCmd->GetNewDoubleValue(newValues));
318 
319  if( command == setTbhighCmd)
320  runAction
321  ->SetTbhigh( setTbhighCmd->GetNewDoubleValue(newValues));
322 
323  if( command == setnbinTsecCmd)
324  runAction
326 
327  if( command == setTseclowCmd)
328  runAction
330 
331  if( command == setTsechighCmd)
332  runAction
334 
335  if( command == setnbinRCmd)
336  runAction
337  ->SetnbinR(setnbinRCmd->GetNewIntValue(newValues));
338 
339  if( command == setRlowCmd)
340  runAction
341  ->SetRlow( setRlowCmd->GetNewDoubleValue(newValues));
342 
343  if( command == setRhighCmd)
344  runAction
345  ->SetRhigh( setRhighCmd->GetNewDoubleValue(newValues));
346 
347  if( command == setnbinzvertexCmd)
348  runAction
350 
351  if( command == setzlowCmd)
352  runAction
353  ->Setzlow( setzlowCmd->GetNewDoubleValue(newValues));
354 
355  if( command == setzhighCmd)
356  runAction
357  ->Setzhigh( setzhighCmd->GetNewDoubleValue(newValues));
358 
359  if( command == setnbinThCmd)
360  runAction
361  ->SetnbinTh(setnbinThCmd->GetNewIntValue(newValues));
362 
363  if( command == setThlowCmd)
364  runAction
365  ->SetThlow( setThlowCmd->GetNewDoubleValue(newValues));
366 
367  if( command == setThhighCmd)
368  runAction
369  ->SetThhigh( setThhighCmd->GetNewDoubleValue(newValues));
370 
371  if( command == setnbinThbackCmd)
372  runAction
374 
375  if( command == setThlowbackCmd)
376  runAction
378 
379  if( command == setThhighbackCmd)
380  runAction
382 
383  if (command == RndmSaveCmd)
385 
386  if (command == RndmReadCmd)
387  { G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
388  CLHEP::HepRandom::restoreEngineStatus(newValues);
389  CLHEP::HepRandom::showEngineStatus();
390  }
391 }
392 
393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
394 
395 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetThhigh(G4double Thhigh)
G4UIcmdWithAString * RndmReadCmd
void SetEnhigh(G4double Enhigh)
G4UIcmdWithADoubleAndUnit * setThhighbackCmd
void SetRndmFreq(G4int val)
void SethistName(G4String name)
void SetnbinR(G4int nbin)
void SetNewValue(G4UIcommand *, G4String)
void SetTblow(G4double Tblow)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
Definition of the Em10RunAction class.
void SetnbinTh(G4int nbin)
void SetEhighGamma(G4double Ehigh)
static G4int GetNewIntValue(const char *paramString)
G4UIcmdWithADoubleAndUnit * setEnhighCmd
G4UIcmdWithADoubleAndUnit * setTbhighCmd
G4UIcmdWithADoubleAndUnit * setThhighCmd
Em10RunMessenger(Em10RunAction *)
void SetnbinGamma(G4int nbin)
void Setzlow(G4double z)
G4UIcmdWithADoubleAndUnit * setTtlowCmd
G4UIcmdWithADoubleAndUnit * setRhighCmd
G4UIcmdWithADoubleAndUnit * setThlowbackCmd
void SetnbinTt(G4int nbin)
void SetUnitCategory(const char *unitCategory)
G4UIcmdWithAnInteger * setnbinRCmd
static G4double GetNewDoubleValue(const char *paramString)
G4UIcmdWithADoubleAndUnit * setTsechighCmd
void SetTtlow(G4double Ttlow)
G4UIcmdWithADoubleAndUnit * setElowGammaCmd
Em10RunAction * runAction
G4UIcmdWithADoubleAndUnit * setTseclowCmd
G4UIcmdWithAnInteger * setnbinTsecCmd
G4UIcmdWithADoubleAndUnit * setzhighCmd
void Setzhigh(G4double z)
G4UIcmdWithADoubleAndUnit * setRlowCmd
G4UIcmdWithAnInteger * setnbinTbCmd
G4GLOB_DLL std::ostream G4cout
G4UIcmdWithAnInteger * RndmSaveCmd
void SetRlow(G4double Rlow)
G4UIcmdWithAnInteger * setnbinEnCmd
void SetnbinTsec(G4int nbin)
Definition of the Em10RunMessenger class.
void SetTbhigh(G4double Tbhigh)
G4UIcmdWithAnInteger * setnbinStepCmd
void SetnbinEn(G4int nbin)
static G4double GetNewDoubleValue(const char *paramString)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetnbinTb(G4int nbin)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetSteplow(G4double Slow)
void SetnbinStep(G4int nbin)
G4UIcmdWithADoubleAndUnit * setTblowCmd
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
G4UIcmdWithADouble * setSteplowCmd
G4UIcmdWithAString * sethistNameCmd
G4UIdirectory * plotDir
void SetnbinThBack(G4int nbin)
G4UIcmdWithAnInteger * setnbinThCmd
void SetEnlow(G4double Elow)
G4UIcmdWithADoubleAndUnit * setEhighGammaCmd
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetTthigh(G4double Tthigh)
G4UIcmdWithAnInteger * setnbinTtCmd
void SetTseclow(G4double Tlow)
void SetTsechigh(G4double Thigh)
G4UIdirectory * RndmDir
G4UIcmdWithAnInteger * setnbinzvertexCmd
#define G4endl
Definition: G4ios.hh:61
void SetStephigh(G4double Shigh)
void Setnbinzvertex(G4int nbin)
G4UIcmdWithADoubleAndUnit * setzlowCmd
G4UIcmdWithADoubleAndUnit * setEnlowCmd
G4UIcmdWithAnInteger * setnbinGammaCmd
void SetElowGamma(G4double Elow)
void SetThlowBack(G4double Thlow)
G4UIcmdWithADoubleAndUnit * setTthighCmd
G4UIcmdWithAnInteger * setnbinThbackCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRhigh(G4double Rhigh)
G4UIcmdWithADouble * setStephighCmd
void SetThhighBack(G4double Thhigh)
G4UIcmdWithADoubleAndUnit * setThlowCmd
void SetThlow(G4double Thlow)