Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
26 /// \file electromagnetic/TestEm10/src/Em10RunMessenger.cc
27 /// \brief Implementation of the Em10RunMessenger class
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);
93  setElowGammaCmd->SetUnitCategory("Energy");
94 
95  setEhighGammaCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEhighGamma",this);
96  setEhighGammaCmd->SetGuidance("set upper limit for gamma spectrum plot ");
97  setEhighGammaCmd->SetParameterName("EhighGamma",false);
98  setEhighGammaCmd->SetUnitCategory("Energy");
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
265  ->SetnbinStep(setnbinStepCmd->GetNewIntValue(newValues));
266 
267  if( command == setSteplowCmd)
268  runAction
269  ->SetSteplow( setSteplowCmd->GetNewDoubleValue(newValues));
270 
271  if( command == setStephighCmd)
272  runAction
273  ->SetStephigh( setStephighCmd->GetNewDoubleValue(newValues));
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
289  ->SetnbinGamma(setnbinGammaCmd->GetNewIntValue(newValues));
290 
291  if( command == setElowGammaCmd)
292  runAction
293  ->SetElowGamma( setElowGammaCmd->GetNewDoubleValue(newValues));
294 
295  if( command == setEhighGammaCmd)
296  runAction
297  ->SetEhighGamma( setEhighGammaCmd->GetNewDoubleValue(newValues));
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
325  ->SetnbinTsec(setnbinTsecCmd->GetNewIntValue(newValues));
326 
327  if( command == setTseclowCmd)
328  runAction
329  ->SetTseclow( setTseclowCmd->GetNewDoubleValue(newValues));
330 
331  if( command == setTsechighCmd)
332  runAction
333  ->SetTsechigh( setTsechighCmd->GetNewDoubleValue(newValues));
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
349  ->Setnbinzvertex(setnbinzvertexCmd->GetNewIntValue(newValues));
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
373  ->SetnbinThBack(setnbinThbackCmd->GetNewIntValue(newValues));
374 
375  if( command == setThlowbackCmd)
376  runAction
377  ->SetThlowBack( setThlowbackCmd->GetNewDoubleValue(newValues));
378 
379  if( command == setThhighbackCmd)
380  runAction
381  ->SetThhighBack( setThhighbackCmd->GetNewDoubleValue(newValues));
382 
383  if (command == RndmSaveCmd)
384  runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
385 
386  if (command == RndmReadCmd)
387  { G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
390  }
391 }
392 
393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
394 
395 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetThhigh(G4double Thhigh)
void SetEnhigh(G4double Enhigh)
void SetRndmFreq(G4int val)
void SethistName(G4String name)
void SetnbinR(G4int nbin)
void SetNewValue(G4UIcommand *, G4String)
static void restoreEngineStatus(const char filename[]="Config.conf")
Definition: Random.cc:180
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)
Em10RunMessenger(Em10RunAction *)
void SetnbinGamma(G4int nbin)
void Setzlow(G4double z)
void SetnbinTt(G4int nbin)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetTtlow(G4double Ttlow)
void Setzhigh(G4double z)
G4GLOB_DLL std::ostream G4cout
void SetRlow(G4double Rlow)
void SetnbinTsec(G4int nbin)
Definition of the Em10RunMessenger class.
void SetTbhigh(G4double Tbhigh)
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)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
static void showEngineStatus()
Definition: Random.cc:203
void SetnbinThBack(G4int nbin)
void SetEnlow(G4double Elow)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetTthigh(G4double Tthigh)
void SetTseclow(G4double Tlow)
void SetTsechigh(G4double Thigh)
#define G4endl
Definition: G4ios.hh:61
void SetStephigh(G4double Shigh)
void Setnbinzvertex(G4int nbin)
void SetElowGamma(G4double Elow)
void SetThlowBack(G4double Thlow)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRhigh(G4double Rhigh)
void SetThhighBack(G4double Thhigh)
void SetThlow(G4double Thlow)