Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F01FieldMessenger.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: F01FieldMessenger.cc 76248 2013-11-08 11:19:52Z gcosmo $
31 //
32 //
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
36 #include "F01FieldMessenger.hh"
37 
38 #include "F01FieldSetup.hh"
39 #include "G4UIcmdWithAnInteger.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
46  : G4UImessenger(),
47  fEMfieldSetup(fieldSetup),
48  fFieldDir(0),
49  fStepperCmd(0),
50  fMagFieldCmd(0),
51  fMinStepCmd(0),
52  fUpdateCmd(0)
53 {
54  fFieldDir = new G4UIdirectory("/field/");
55  fFieldDir->SetGuidance("F01 field tracking control.");
56 
57  fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
58  fStepperCmd->SetGuidance("Select stepper type for magnetic 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  fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
70  fMagFieldCmd->SetGuidance("Define magnetic field.");
71  fMagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
72  fMagFieldCmd->SetParameterName("Bz",false,false);
73  fMagFieldCmd->SetDefaultUnit("tesla");
74  fMagFieldCmd->AvailableForStates(G4State_Idle);
75 
76  fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
77  fMinStepCmd->SetGuidance("Define minimal step");
78  fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
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 fMagFieldCmd;
90  delete fMinStepCmd;
91  delete fFieldDir;
92  delete fUpdateCmd;
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
98 {
99  if( command == fStepperCmd )
100  fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
101  if( command == fUpdateCmd )
102  fEMfieldSetup->CreateStepperAndChordFinder();
103  if( command == fMagFieldCmd )
104  fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNewDoubleValue(newValue));
105  if( command == fMinStepCmd )
106  fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
Definition of the F01FieldMessenger class.
static G4double GetNewDoubleValue(const char *paramString)
virtual ~F01FieldMessenger()
void SetMinStep(G4double s)
Definition of the F01FieldSetup class.
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
F01FieldMessenger(F01FieldSetup *)
void SetStepperType(G4int i)
virtual void SetNewValue(G4UIcommand *, G4String)
void SetDefaultUnit(const char *defUnit)
void CreateStepperAndChordFinder()
void SetDefaultValue(G4int defVal)
void SetFieldValue(G4ThreeVector fieldVector)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)