source: trunk/source/geometry/magneticfield/test/field03/src/F03RunMessenger.cc @ 1347

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

geant4 tag 9.4

File size: 14.1 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: F03RunMessenger.cc,v 1.3 2006/06/29 18:30:25 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 "F03RunMessenger.hh"
36
37#include "F03RunAction.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
49F03RunMessenger::F03RunMessenger(F03RunAction* 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  setnbinRCmd = new G4UIcmdWithAnInteger("/plots/setnbinR",this);
135  setnbinRCmd->SetGuidance("set nb of bins in R plot");
136  setnbinRCmd->SetParameterName("nbinR",false);
137
138  setRlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRlow",this);
139  setRlowCmd->SetGuidance("set lower limit for R plot ");
140  setRlowCmd->SetParameterName("Rlow",false);
141
142  setRhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRhigh",this);
143  setRhighCmd->SetGuidance("set upper limit for R plot ");
144  setRhighCmd->SetParameterName("Rhigh",false);
145
146  setnbinzvertexCmd = new G4UIcmdWithAnInteger("/plots/setnbinzvertex",this);
147  setnbinzvertexCmd->SetGuidance("set nb of bins in Z vertex plot");
148  setnbinzvertexCmd->SetParameterName("nbinZ",false);
149
150  setzlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzlow",this);
151  setzlowCmd->SetGuidance("set lower limit for Z vertex plot ");
152  setzlowCmd->SetParameterName("zlow",false);
153
154  setzhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzhigh",this);
155  setzhighCmd->SetGuidance("set upper limit for Z vertex plot ");
156  setzhighCmd->SetParameterName("zhigh",false);
157
158  setnbinThCmd = new G4UIcmdWithAnInteger("/plots/setnbinTh",this);
159  setnbinThCmd->SetGuidance("set nb of bins in Theta transmitted plot");
160  setnbinThCmd->SetParameterName("nbinTh",false);
161
162  setThlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlow",this);
163  setThlowCmd->SetGuidance("set lower limit for Theta transmitted plot ");
164  setThlowCmd->SetParameterName("Thlow",false);
165
166  setThhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhigh",this);
167  setThhighCmd->SetGuidance("set upper limit for Theta transmitted plot ");
168  setThhighCmd->SetParameterName("Thhigh",false);
169
170  setnbinThbackCmd = new G4UIcmdWithAnInteger("/plots/setnbinThback",this);
171  setnbinThbackCmd->SetGuidance("set nb of bins in backscattering Theta plot");
172  setnbinThbackCmd->SetParameterName("nbinThback",false);
173
174  setThlowbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlowback",this);
175  setThlowbackCmd->SetGuidance("set lower limit for backscattering Theta plot ");
176  setThlowbackCmd->SetParameterName("Thlowback",false);
177
178  setThhighbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhighback",this);
179  setThhighbackCmd->SetGuidance("set upper limit for backscattering Theta plot ");
180  setThhighbackCmd->SetParameterName("Thhighback",false);
181   
182  RndmDir = new G4UIdirectory("/rndm/");
183  RndmDir->SetGuidance("Rndm status control.");
184 
185  RndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
186  RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
187  RndmSaveCmd->SetGuidance("freq = 0 not saved");
188  RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
189  RndmSaveCmd->SetGuidance("freq = 1 saved on:   endOfRun.rndm");
190  RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");   
191  RndmSaveCmd->SetParameterName("frequency",false);
192  RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
193  RndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 
194         
195  RndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
196  RndmReadCmd->SetGuidance("get rndm status from an external file.");
197  RndmReadCmd->SetParameterName("fileName",true);
198  RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
199  RndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 
200}
201
202//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
203
204F03RunMessenger::~F03RunMessenger()
205{
206  delete sethistNameCmd;
207
208  delete setnbinStepCmd;
209  delete setSteplowCmd;
210  delete setStephighCmd;
211
212  delete setnbinEnCmd;
213  delete setEnlowCmd;
214  delete setEnhighCmd;
215
216  delete setnbinGammaCmd;
217  delete setElowGammaCmd;
218  delete setEhighGammaCmd;
219
220  delete setnbinTtCmd;
221  delete setTtlowCmd;
222  delete setTthighCmd;
223
224  delete setnbinTbCmd;
225  delete setTblowCmd;
226  delete setTbhighCmd;
227
228  delete setnbinTsecCmd;
229  delete setTseclowCmd;
230  delete setTsechighCmd;
231
232  delete setnbinRCmd;
233  delete setRlowCmd;
234  delete setRhighCmd;
235
236  delete setnbinzvertexCmd;
237  delete setzlowCmd;
238  delete setzhighCmd;
239
240  delete setnbinThCmd;
241  delete setThlowCmd;
242  delete setThhighCmd;
243
244  delete setnbinThbackCmd;
245  delete setThlowbackCmd;
246  delete setThhighbackCmd;
247
248  delete plotDir;
249 
250  delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir; 
251}
252
253//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
254
255void F03RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
256{
257  if( command == sethistNameCmd)
258    runAction
259    ->SethistName(newValues) ;
260   
261  if( command == setnbinStepCmd)
262    runAction
263    ->SetnbinStep(setnbinStepCmd->GetNewIntValue(newValues));
264
265  if( command == setSteplowCmd)
266    runAction
267    ->SetSteplow( setSteplowCmd->GetNewDoubleValue(newValues));
268
269  if( command == setStephighCmd)
270    runAction
271    ->SetStephigh( setStephighCmd->GetNewDoubleValue(newValues));
272
273  if( command == setnbinEnCmd)
274    runAction
275    ->SetnbinEn(setnbinEnCmd->GetNewIntValue(newValues));
276
277  if( command == setEnlowCmd)
278    runAction
279    ->SetEnlow( setEnlowCmd->GetNewDoubleValue(newValues));
280
281  if( command == setEnhighCmd)
282    runAction
283    ->SetEnhigh( setEnhighCmd->GetNewDoubleValue(newValues));
284
285  if( command == setnbinGammaCmd)
286    runAction
287    ->SetnbinGamma(setnbinGammaCmd->GetNewIntValue(newValues));
288
289  if( command == setElowGammaCmd)
290    runAction
291    ->SetElowGamma( setElowGammaCmd->GetNewDoubleValue(newValues));
292
293  if( command == setEhighGammaCmd)
294    runAction
295    ->SetEhighGamma( setEhighGammaCmd->GetNewDoubleValue(newValues));
296
297  if( command == setnbinTtCmd)
298    runAction
299    ->SetnbinTt(setnbinTtCmd->GetNewIntValue(newValues));
300
301  if( command == setTtlowCmd)
302    runAction
303    ->SetTtlow( setTtlowCmd->GetNewDoubleValue(newValues));
304
305  if( command == setTthighCmd)
306    runAction
307    ->SetTthigh( setTthighCmd->GetNewDoubleValue(newValues));
308
309  if( command == setnbinTbCmd)
310    runAction
311    ->SetnbinTb(setnbinTbCmd->GetNewIntValue(newValues));
312
313  if( command == setTblowCmd)
314    runAction
315    ->SetTblow( setTblowCmd->GetNewDoubleValue(newValues));
316
317  if( command == setTbhighCmd)
318    runAction
319    ->SetTbhigh( setTbhighCmd->GetNewDoubleValue(newValues));
320
321  if( command == setnbinTsecCmd)
322    runAction
323    ->SetnbinTsec(setnbinTsecCmd->GetNewIntValue(newValues));
324
325  if( command == setTseclowCmd)
326    runAction
327    ->SetTseclow( setTseclowCmd->GetNewDoubleValue(newValues));
328
329  if( command == setTsechighCmd)
330    runAction
331    ->SetTsechigh( setTsechighCmd->GetNewDoubleValue(newValues));
332
333  if( command == setnbinRCmd)
334    runAction
335    ->SetnbinR(setnbinRCmd->GetNewIntValue(newValues));
336
337  if( command == setRlowCmd)
338    runAction
339    ->SetRlow( setRlowCmd->GetNewDoubleValue(newValues));
340
341  if( command == setRhighCmd)
342    runAction
343    ->SetRhigh( setRhighCmd->GetNewDoubleValue(newValues));
344
345  if( command == setnbinzvertexCmd)
346    runAction
347    ->Setnbinzvertex(setnbinzvertexCmd->GetNewIntValue(newValues));
348
349  if( command == setzlowCmd)
350    runAction
351    ->Setzlow( setzlowCmd->GetNewDoubleValue(newValues));
352
353  if( command == setzhighCmd)
354    runAction
355    ->Setzhigh( setzhighCmd->GetNewDoubleValue(newValues));
356
357  if( command == setnbinThCmd)
358    runAction
359    ->SetnbinTh(setnbinThCmd->GetNewIntValue(newValues));
360
361  if( command == setThlowCmd)
362    runAction
363    ->SetThlow( setThlowCmd->GetNewDoubleValue(newValues));
364
365  if( command == setThhighCmd)
366    runAction
367    ->SetThhigh( setThhighCmd->GetNewDoubleValue(newValues));
368
369  if( command == setnbinThbackCmd)
370    runAction
371    ->SetnbinThBack(setnbinThbackCmd->GetNewIntValue(newValues));
372
373  if( command == setThlowbackCmd)
374    runAction
375    ->SetThlowBack( setThlowbackCmd->GetNewDoubleValue(newValues));
376
377  if( command == setThhighbackCmd)
378    runAction
379    ->SetThhighBack( setThhighbackCmd->GetNewDoubleValue(newValues));
380 
381  if (command == RndmSaveCmd)
382      runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
383                 
384  if (command == RndmReadCmd)
385    { G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
386      HepRandom::restoreEngineStatus(newValues);
387      HepRandom::showEngineStatus();
388    }   
389}
390
391//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
392
393   
Note: See TracBrowser for help on using the repository browser.