Geant4  10.00.p03
F03FieldMessenger.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 //
30 // $Id: F03FieldMessenger.cc 76602 2013-11-13 08:33:35Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 #include "F03FieldMessenger.hh"
37 
38 #include "F03FieldSetup.hh"
39 #include "G4UIcmdWithAnInteger.hh"
42 
43 #include "G4SystemOfUnits.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48  : G4UImessenger(),
49  fEMfieldSetup(fieldSetup),
50  fFieldDir(0),
51  fStepperCmd(0),
52  fMagFieldCmd(0),
53  fMinStepCmd(0),
54  fUpdateCmd(0)
55 {
56  fFieldDir = new G4UIdirectory("/field/");
57  fFieldDir->SetGuidance("F03 field tracking control.");
58 
59  fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
60  fStepperCmd->SetGuidance("Select stepper type for magnetic field");
61  fStepperCmd->SetParameterName("choice",true);
64 
65  fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
66  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
67  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
68  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
70 
71  fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
72  fMagFieldCmd->SetGuidance("Define magnetic field.");
73  fMagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
74  fMagFieldCmd->SetParameterName("Bz",false,false);
75  fMagFieldCmd->SetDefaultUnit("tesla");
77 
78  fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
79  fMinStepCmd->SetGuidance("Define minimal step");
80  fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
81  fMinStepCmd->SetParameterName("min step",false,false);
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
89 {
90  delete fStepperCmd;
91  delete fMagFieldCmd;
92  delete fMinStepCmd;
93  delete fFieldDir;
94  delete fUpdateCmd;
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98 
100 {
101  if( command == fStepperCmd )
103  if( command == fUpdateCmd )
105  if( command == fMagFieldCmd )
107  // Check the value
108  G4cout << "Set field value to " <<
109  fEMfieldSetup->GetConstantFieldValue() / gauss << " Gauss " << G4endl;
110  if( command == fMinStepCmd )
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4UIcmdWithADoubleAndUnit * fMagFieldCmd
void SetFieldValue(G4ThreeVector fieldVector)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
F03FieldSetup * fEMfieldSetup
G4ThreeVector GetConstantFieldValue()
Definition of the F03FieldMessenger class.
static G4int GetNewIntValue(const char *paramString)
G4UIcmdWithAnInteger * fStepperCmd
void SetStepperType(G4int i)
G4UIcmdWithoutParameter * fUpdateCmd
virtual void SetNewValue(G4UIcommand *, G4String)
static G4double GetNewDoubleValue(const char *paramString)
virtual ~F03FieldMessenger()
G4GLOB_DLL std::ostream G4cout
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
A class for setting up the Magnetic Field.
void SetMinStep(G4double s)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetDefaultUnit(const char *defUnit)
static const double gauss
Definition: G4SIunits.hh:249
#define G4endl
Definition: G4ios.hh:61
G4UIdirectory * fFieldDir
void SetDefaultValue(G4int defVal)
G4UIcmdWithADoubleAndUnit * fMinStepCmd
Definition of the F03FieldSetup class.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
F03FieldMessenger(F03FieldSetup *)