Geant4  9.6.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$
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
37 #include "F01FieldMessenger.hh"
38 
39 #include "F01FieldSetup.hh"
40 #include "G4UIdirectory.hh"
41 #include "G4UIcmdWithAString.hh"
42 #include "G4UIcmdWithAnInteger.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47 
49  : G4UImessenger(),
50  fEMfieldSetup(fieldSetup),
51  fFieldDir(0),
52  fStepperCmd(0),
53  fMagFieldCmd(0),
54  fMinStepCmd(0),
55  fUpdateCmd(0)
56 {
57  fFieldDir = new G4UIdirectory("/field/");
58  fFieldDir->SetGuidance("F01 field tracking control.");
59 
60  fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
61  fStepperCmd->SetGuidance("Select stepper type for magnetic field");
62  fStepperCmd->SetParameterName("choice",true);
63  fStepperCmd->SetDefaultValue(4);
65 
66 
67  fUpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
68  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
69  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
70  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
71  fUpdateCmd->AvailableForStates(G4State_Idle);
72 
73  fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
74  fMagFieldCmd->SetGuidance("Define magnetic field.");
75  fMagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
76  fMagFieldCmd->SetParameterName("Bz",false,false);
77  fMagFieldCmd->SetDefaultUnit("tesla");
78  fMagFieldCmd->AvailableForStates(G4State_Idle);
79 
80  fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
81  fMinStepCmd->SetGuidance("Define minimal step");
82  fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
83  fMinStepCmd->SetParameterName("min step",false,false);
84  fMinStepCmd->SetDefaultUnit("mm");
85  fMinStepCmd->AvailableForStates(G4State_Idle);
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
89 
91 {
92  delete fStepperCmd;
93  delete fMagFieldCmd;
94  delete fMinStepCmd;
95  delete fFieldDir;
96  delete fUpdateCmd;
97 }
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
100 
102 {
103  if( command == fStepperCmd )
104  {
105  fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
106  }
107  if( command == fUpdateCmd )
108  {
109  fEMfieldSetup->CreateStepperAndChordFinder();
110  }
111  if( command == fMagFieldCmd )
112  {
113  fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNewDoubleValue(newValue));
114  }
115  if( command == fMinStepCmd )
116  {
117  fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
118  }
119 }
120 
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....