Geant4.10
 All Data Structures 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 //
26 /// \file field/field02/src/F02FieldMessenger.cc
27 /// \brief Implementation of the F02FieldMessenger class
28 //
29 //
30 // $Id: F02FieldMessenger.cc 76247 2013-11-08 11:18:52Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 #include "F02FieldMessenger.hh"
37 
38 #include "F02ElectricFieldSetup.hh"
39 #include "G4UIcmdWithAnInteger.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
46  : G4UImessenger(),
47  fElFieldSetup(fieldSetup),
48  fFieldDir(0),
49  fStepperCmd(0),
50  fElFieldCmd(0),
51  fMinStepCmd(0),
52  fUpdateCmd(0)
53 {
54  fFieldDir = new G4UIdirectory("/field/");
55  fFieldDir->SetGuidance("F02 field tracking control.");
56 
57  fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
58  fStepperCmd->SetGuidance("Select stepper type for electric field");
59  fStepperCmd->SetParameterName("choice",true);
60  fStepperCmd->SetDefaultValue(4);
62 
63  fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
64  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
65  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
66  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
67  fUpdateCmd->AvailableForStates(G4State_Idle);
68 
69  fElFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
70  fElFieldCmd->SetGuidance("Define uniform Electric field.");
71  fElFieldCmd->SetGuidance("Electric field will be in Z direction.");
72  fElFieldCmd->SetGuidance("Value of Electric field has to be given in volt/m");
73  fElFieldCmd->SetParameterName("Ez",false,false);
74  fElFieldCmd->SetDefaultUnit("volt/m");
75  fElFieldCmd->AvailableForStates(G4State_Idle);
76 
77  fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
78  fMinStepCmd->SetGuidance("Define minimal step");
79  fMinStepCmd->SetParameterName("min step",false,false);
80  fMinStepCmd->SetDefaultUnit("mm");
81  fMinStepCmd->AvailableForStates(G4State_Idle);
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
88  delete fStepperCmd;
89  delete fElFieldCmd;
90  delete fMinStepCmd;
91  delete fFieldDir;
92  delete fUpdateCmd;
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
98 {
99  if( command == fStepperCmd )
100  fElFieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
101  if( command == fUpdateCmd )
102  fElFieldSetup->UpdateField();
103  if( command == fElFieldCmd )
104  fElFieldSetup->SetFieldValue(fElFieldCmd->GetNewDoubleValue(newValue));
105  if( command == fMinStepCmd )
106  fElFieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Definition of the F02ElectricFieldSetup class.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
Definition of the F02FieldMessenger class.
void SetFieldValue(G4ThreeVector fieldVector)
static G4double GetNewDoubleValue(const char *paramString)
virtual void SetNewValue(G4UIcommand *, G4String)
F02FieldMessenger(F02ElectricFieldSetup *)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetDefaultUnit(const char *defUnit)
void SetDefaultValue(G4int defVal)
virtual ~F02FieldMessenger()
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)