Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F02FieldMessenger.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 // $Id$
30 //
31 
32 #include "F02FieldMessenger.hh"
33 #include "F02ElectricFieldSetup.hh"
34 
35 #include "G4UIdirectory.hh"
36 #include "G4UIcmdWithAString.hh"
37 #include "G4UIcmdWithAnInteger.hh"
38 #include "G4UIcmdWithADouble.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43 
45  : G4UImessenger(),
46  fElFieldSetup(fieldSetup),
47  fFieldDir(0),
48  fStepperCmd(0),
49  fElFieldCmd(0),
50  fMinStepCmd(0),
51  fUpdateCmd(0)
52 {
53  fFieldDir = new G4UIdirectory("/field/");
54  fFieldDir->SetGuidance("F02 field tracking control.");
55 
56  fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
57  fStepperCmd->SetGuidance("Select stepper type for electric field");
58  fStepperCmd->SetParameterName("choice",true);
59  fStepperCmd->SetDefaultValue(4);
61 
62  fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
63  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
64  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
65  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
66  fUpdateCmd->AvailableForStates(G4State_Idle);
67 
68  fElFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
69  fElFieldCmd->SetGuidance("Define uniform Electric field.");
70  fElFieldCmd->SetGuidance("Electric field will be in Z direction.");
71  fElFieldCmd->SetGuidance("Value of Electric field has to be given in volt/m");
72  fElFieldCmd->SetParameterName("Ez",false,false);
73  fElFieldCmd->SetDefaultUnit("volt/m");
74  fElFieldCmd->AvailableForStates(G4State_Idle);
75 
76  fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
77  fMinStepCmd->SetGuidance("Define minimal step");
78  fMinStepCmd->SetParameterName("min step",false,false);
79  fMinStepCmd->SetDefaultUnit("mm");
80  fMinStepCmd->AvailableForStates(G4State_Idle);
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84 
86 {
87  delete fStepperCmd;
88  delete fElFieldCmd;
89  delete fMinStepCmd;
90  delete fFieldDir;
91  delete fUpdateCmd;
92 }
93 
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95 
97 {
98  if( command == fStepperCmd )
99  {
100  fElFieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
101  }
102  if( command == fUpdateCmd )
103  {
104  fElFieldSetup->UpdateField();
105  }
106  if( command == fElFieldCmd )
107  {
108  fElFieldSetup->SetFieldValue(fElFieldCmd->GetNewDoubleValue(newValue));
109  }
110  if( command == fMinStepCmd )
111  {
112  fElFieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
113  }
114 }
115