source: trunk/source/geometry/magneticfield/test/field02/src/F02RunMessenger.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

File size: 15.2 KB
Line 
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//
27// $Id: F02RunMessenger.cc,v 1.4 2006/06/29 18:28:15 gunter Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30//
31
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34
35#include "F02RunMessenger.hh"
36
37#include "F02RunAction.hh"
38#include "G4UIdirectory.hh"
39#include "G4UIcmdWithAnInteger.hh"
40#include "G4UIcmdWithADoubleAndUnit.hh"
41#include "G4UIcmdWithADouble.hh"
42#include "G4UIcmdWithAString.hh"
43#include "G4ios.hh"
44#include "globals.hh"
45#include "Randomize.hh"
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48
49F02RunMessenger::F02RunMessenger(F02RunAction* RA)
50:runAction (RA)
51{
52  plotDir = new G4UIdirectory("/plots/");
53  plotDir->SetGuidance("plot control");
54
55  sethistNameCmd = new G4UIcmdWithAString("/plots/sethistName",this);
56  sethistNameCmd->SetGuidance("set name for the histogram file"); 
57
58  setnbinStepCmd = new G4UIcmdWithAnInteger("/plots/setnbinStep",this);
59  setnbinStepCmd->SetGuidance("set nb of bins in #step plot");
60  setnbinStepCmd->SetParameterName("nbinStep",false);
61
62  setSteplowCmd = new G4UIcmdWithADouble("/plots/setSteplow",this);
63  setSteplowCmd->SetGuidance("set lower limit for #step plot ");
64  setSteplowCmd->SetParameterName("Steplow",false);
65
66  setStephighCmd = new G4UIcmdWithADouble("/plots/setStephigh",this);
67  setStephighCmd->SetGuidance("set upper limit for #step plot ");
68  setStephighCmd->SetParameterName("Stephigh",false);
69
70  setnbinEnCmd = new G4UIcmdWithAnInteger("/plots/setnbinEn",this);
71  setnbinEnCmd->SetGuidance("set nb of bins in Edep plot");
72  setnbinEnCmd->SetParameterName("nbinE",false);
73
74  setEnlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEnlow",this);
75  setEnlowCmd->SetGuidance("set lower limit for Edep plot ");
76  setEnlowCmd->SetParameterName("Elow",false);
77  setEnlowCmd->SetUnitCategory("Energy");
78 
79  setEnhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEnhigh",this);
80  setEnhighCmd->SetGuidance("set upper limit for Edep plot ");
81  setEnhighCmd->SetParameterName("Ehigh",false);
82  setEnhighCmd->SetUnitCategory("Energy");
83
84  setnbinGammaCmd = new G4UIcmdWithAnInteger("/plots/setnbinGamma",this);
85  setnbinGammaCmd->SetGuidance("set nb of bins in gamma spectrum plot");
86  setnbinGammaCmd->SetParameterName("nbinGamma",false);
87
88  setElowGammaCmd = new G4UIcmdWithADoubleAndUnit("/plots/setElowGamma",this);
89  setElowGammaCmd->SetGuidance("set lower limit for gamma spectrum plot ");
90  setElowGammaCmd->SetParameterName("ElowGamma",false);
91  setElowGammaCmd->SetUnitCategory("Energy");
92
93  setEhighGammaCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEhighGamma",this);
94  setEhighGammaCmd->SetGuidance("set upper limit for gamma spectrum plot ");
95  setEhighGammaCmd->SetParameterName("EhighGamma",false);
96  setEhighGammaCmd->SetUnitCategory("Energy");
97
98  setnbinTtCmd = new G4UIcmdWithAnInteger("/plots/setnbinTt",this);
99  setnbinTtCmd->SetGuidance("set nb of bins in Etransmitted plot");
100  setnbinTtCmd->SetParameterName("nbinTt",false);
101
102  setTtlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTtlow",this);
103  setTtlowCmd->SetGuidance("set lower limit for Etransmitted plot ");
104  setTtlowCmd->SetParameterName("Ttlow",false);
105
106  setTthighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTthigh",this);
107  setTthighCmd->SetGuidance("set upper limit for Etransmitted plot ");
108  setTthighCmd->SetParameterName("Tthigh",false);
109
110  setnbinTbCmd = new G4UIcmdWithAnInteger("/plots/setnbinTb",this);
111  setnbinTbCmd->SetGuidance("set nb of bins in Ebackscattering plot");
112  setnbinTbCmd->SetParameterName("nbinTb",false);
113
114  setTblowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTblow",this);
115  setTblowCmd->SetGuidance("set lower limit for Ebackscattered plot ");
116  setTblowCmd->SetParameterName("Tblow",false);
117
118  setTbhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTbhigh",this);
119  setTbhighCmd->SetGuidance("set upper limit for Ebackscattered plot ");
120  setTbhighCmd->SetParameterName("Tbhigh",false);
121
122  setnbinTsecCmd = new G4UIcmdWithAnInteger("/plots/setnbinTsec",this);
123  setnbinTsecCmd->SetGuidance("set nb of bins in charged Tsecondary plot");
124  setnbinTsecCmd->SetParameterName("nbinTsec",false);
125
126  setTseclowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTseclow",this);
127  setTseclowCmd->SetGuidance("set lower limit for charged Tsecondary plot ");
128  setTseclowCmd->SetParameterName("Tseclow",false);
129
130  setTsechighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTsechigh",this);
131  setTsechighCmd->SetGuidance("set upper limit for charged Tsecondary plot ");
132  setTsechighCmd->SetParameterName("Tsechigh",false);
133
134  setnbinTglobCmd = new G4UIcmdWithAnInteger("/plots/setnbinTglob",this);
135  setnbinTglobCmd->SetGuidance("set nb of bins in charged Tglobondary plot");
136  setnbinTglobCmd->SetParameterName("nbinTglob",false);
137
138  setTgloblowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTgloblow",this);
139  setTgloblowCmd->SetGuidance("set lower limit for charged Tglobondary plot ");
140  setTgloblowCmd->SetParameterName("Tgloblow",false);
141
142  setTglobhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTglobhigh",this);
143  setTglobhighCmd->SetGuidance("set upper limit for charged Tglobondary plot ");
144  setTglobhighCmd->SetParameterName("Tglobhigh",false);
145
146  setnbinRCmd = new G4UIcmdWithAnInteger("/plots/setnbinR",this);
147  setnbinRCmd->SetGuidance("set nb of bins in R plot");
148  setnbinRCmd->SetParameterName("nbinR",false);
149
150  setRlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRlow",this);
151  setRlowCmd->SetGuidance("set lower limit for R plot ");
152  setRlowCmd->SetParameterName("Rlow",false);
153
154  setRhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRhigh",this);
155  setRhighCmd->SetGuidance("set upper limit for R plot ");
156  setRhighCmd->SetParameterName("Rhigh",false);
157
158  setnbinzvertexCmd = new G4UIcmdWithAnInteger("/plots/setnbinzvertex",this);
159  setnbinzvertexCmd->SetGuidance("set nb of bins in Z vertex plot");
160  setnbinzvertexCmd->SetParameterName("nbinZ",false);
161
162  setzlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzlow",this);
163  setzlowCmd->SetGuidance("set lower limit for Z vertex plot ");
164  setzlowCmd->SetParameterName("zlow",false);
165
166  setzhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzhigh",this);
167  setzhighCmd->SetGuidance("set upper limit for Z vertex plot ");
168  setzhighCmd->SetParameterName("zhigh",false);
169
170  setnbinThCmd = new G4UIcmdWithAnInteger("/plots/setnbinTh",this);
171  setnbinThCmd->SetGuidance("set nb of bins in Theta transmitted plot");
172  setnbinThCmd->SetParameterName("nbinTh",false);
173
174  setThlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlow",this);
175  setThlowCmd->SetGuidance("set lower limit for Theta transmitted plot ");
176  setThlowCmd->SetParameterName("Thlow",false);
177
178  setThhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhigh",this);
179  setThhighCmd->SetGuidance("set upper limit for Theta transmitted plot ");
180  setThhighCmd->SetParameterName("Thhigh",false);
181
182  setnbinThbackCmd = new G4UIcmdWithAnInteger("/plots/setnbinThback",this);
183  setnbinThbackCmd->SetGuidance("set nb of bins in backscattering Theta plot");
184  setnbinThbackCmd->SetParameterName("nbinThback",false);
185
186  setThlowbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlowback",this);
187  setThlowbackCmd->SetGuidance("set lower limit for backscattering Theta plot ");
188  setThlowbackCmd->SetParameterName("Thlowback",false);
189
190  setThhighbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhighback",this);
191  setThhighbackCmd->SetGuidance("set upper limit for backscattering Theta plot ");
192  setThhighbackCmd->SetParameterName("Thhighback",false);
193   
194  RndmDir = new G4UIdirectory("/rndm/");
195  RndmDir->SetGuidance("Rndm status control.");
196 
197  RndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
198  RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
199  RndmSaveCmd->SetGuidance("freq = 0 not saved");
200  RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
201  RndmSaveCmd->SetGuidance("freq = 1 saved on:   endOfRun.rndm");
202  RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");   
203  RndmSaveCmd->SetParameterName("frequency",false);
204  RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
205  RndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 
206         
207  RndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
208  RndmReadCmd->SetGuidance("get rndm status from an external file.");
209  RndmReadCmd->SetParameterName("fileName",true);
210  RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
211  RndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 
212}
213
214//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
215
216F02RunMessenger::~F02RunMessenger()
217{
218  delete sethistNameCmd;
219
220  delete setnbinStepCmd;
221  delete setSteplowCmd;
222  delete setStephighCmd;
223
224  delete setnbinEnCmd;
225  delete setEnlowCmd;
226  delete setEnhighCmd;
227
228  delete setnbinGammaCmd;
229  delete setElowGammaCmd;
230  delete setEhighGammaCmd;
231
232  delete setnbinTtCmd;
233  delete setTtlowCmd;
234  delete setTthighCmd;
235
236  delete setnbinTbCmd;
237  delete setTblowCmd;
238  delete setTbhighCmd;
239
240  delete setnbinTsecCmd;
241  delete setTseclowCmd;
242  delete setTsechighCmd;
243
244  delete setnbinTglobCmd;
245  delete setTgloblowCmd;
246  delete setTglobhighCmd;
247
248  delete setnbinRCmd;
249  delete setRlowCmd;
250  delete setRhighCmd;
251
252  delete setnbinzvertexCmd;
253  delete setzlowCmd;
254  delete setzhighCmd;
255
256  delete setnbinThCmd;
257  delete setThlowCmd;
258  delete setThhighCmd;
259
260  delete setnbinThbackCmd;
261  delete setThlowbackCmd;
262  delete setThhighbackCmd;
263
264  delete plotDir;
265 
266  delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir; 
267}
268
269//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
270
271void F02RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
272{
273  if( command == sethistNameCmd)
274    runAction
275    ->SethistName(newValues) ;
276   
277  if( command == setnbinStepCmd)
278    runAction
279    ->SetnbinStep(setnbinStepCmd->GetNewIntValue(newValues));
280
281  if( command == setSteplowCmd)
282    runAction
283    ->SetSteplow( setSteplowCmd->GetNewDoubleValue(newValues));
284
285  if( command == setStephighCmd)
286    runAction
287    ->SetStephigh( setStephighCmd->GetNewDoubleValue(newValues));
288
289  if( command == setnbinEnCmd)
290    runAction
291    ->SetnbinEn(setnbinEnCmd->GetNewIntValue(newValues));
292
293  if( command == setEnlowCmd)
294    runAction
295    ->SetEnlow( setEnlowCmd->GetNewDoubleValue(newValues));
296
297  if( command == setEnhighCmd)
298    runAction
299    ->SetEnhigh( setEnhighCmd->GetNewDoubleValue(newValues));
300
301  if( command == setnbinGammaCmd)
302    runAction
303    ->SetnbinGamma(setnbinGammaCmd->GetNewIntValue(newValues));
304
305  if( command == setElowGammaCmd)
306    runAction
307    ->SetElowGamma( setElowGammaCmd->GetNewDoubleValue(newValues));
308
309  if( command == setEhighGammaCmd)
310    runAction
311    ->SetEhighGamma( setEhighGammaCmd->GetNewDoubleValue(newValues));
312
313  if( command == setnbinTtCmd)
314    runAction
315    ->SetnbinTt(setnbinTtCmd->GetNewIntValue(newValues));
316
317  if( command == setTtlowCmd)
318    runAction
319    ->SetTtlow( setTtlowCmd->GetNewDoubleValue(newValues));
320
321  if( command == setTthighCmd)
322    runAction
323    ->SetTthigh( setTthighCmd->GetNewDoubleValue(newValues));
324
325  if( command == setnbinTbCmd)
326    runAction
327    ->SetnbinTb(setnbinTbCmd->GetNewIntValue(newValues));
328
329  if( command == setTblowCmd)
330    runAction
331    ->SetTblow( setTblowCmd->GetNewDoubleValue(newValues));
332
333  if( command == setTbhighCmd)
334    runAction
335    ->SetTbhigh( setTbhighCmd->GetNewDoubleValue(newValues));
336
337  if( command == setnbinTsecCmd)
338    runAction
339    ->SetnbinTsec(setnbinTsecCmd->GetNewIntValue(newValues));
340
341  if( command == setTseclowCmd)
342    runAction
343    ->SetTseclow( setTseclowCmd->GetNewDoubleValue(newValues));
344
345  if( command == setTsechighCmd)
346    runAction
347    ->SetTsechigh( setTsechighCmd->GetNewDoubleValue(newValues));
348
349  if( command == setnbinTglobCmd)
350    runAction
351    ->SetnbinTglob(setnbinTglobCmd->GetNewIntValue(newValues));
352
353  if( command == setTgloblowCmd)
354    runAction
355    ->SetTgloblow( setTgloblowCmd->GetNewDoubleValue(newValues));
356
357  if( command == setTglobhighCmd)
358    runAction
359    ->SetTglobhigh( setTglobhighCmd->GetNewDoubleValue(newValues));
360
361  if( command == setnbinRCmd)
362    runAction
363    ->SetnbinR(setnbinRCmd->GetNewIntValue(newValues));
364
365  if( command == setRlowCmd)
366    runAction
367    ->SetRlow( setRlowCmd->GetNewDoubleValue(newValues));
368
369  if( command == setRhighCmd)
370    runAction
371    ->SetRhigh( setRhighCmd->GetNewDoubleValue(newValues));
372
373  if( command == setnbinzvertexCmd)
374    runAction
375    ->Setnbinzvertex(setnbinzvertexCmd->GetNewIntValue(newValues));
376
377  if( command == setzlowCmd)
378    runAction
379    ->Setzlow( setzlowCmd->GetNewDoubleValue(newValues));
380
381  if( command == setzhighCmd)
382    runAction
383    ->Setzhigh( setzhighCmd->GetNewDoubleValue(newValues));
384
385  if( command == setnbinThCmd)
386    runAction
387    ->SetnbinTh(setnbinThCmd->GetNewIntValue(newValues));
388
389  if( command == setThlowCmd)
390    runAction
391    ->SetThlow( setThlowCmd->GetNewDoubleValue(newValues));
392
393  if( command == setThhighCmd)
394    runAction
395    ->SetThhigh( setThhighCmd->GetNewDoubleValue(newValues));
396
397  if( command == setnbinThbackCmd)
398    runAction
399    ->SetnbinThBack(setnbinThbackCmd->GetNewIntValue(newValues));
400
401  if( command == setThlowbackCmd)
402    runAction
403    ->SetThlowBack( setThlowbackCmd->GetNewDoubleValue(newValues));
404
405  if( command == setThhighbackCmd)
406    runAction
407    ->SetThhighBack( setThhighbackCmd->GetNewDoubleValue(newValues));
408 
409  if (command == RndmSaveCmd)
410      runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
411                 
412  if (command == RndmReadCmd)
413    { G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
414      HepRandom::restoreEngineStatus(newValues);
415      HepRandom::showEngineStatus();
416    }   
417}
418
419//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
420
421   
Note: See TracBrowser for help on using the repository browser.