Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04FieldMessenger.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 #include "F04FieldMessenger.hh"
31 
32 #include "F04GlobalField.hh"
33 #include "G4UIdirectory.hh"
34 #include "G4UIcmdWithAString.hh"
35 #include "G4UIcmdWithAnInteger.hh"
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 
42  : fGlobalField(pEMfield)
43 {
44  fDetDir = new G4UIdirectory("/field/");
45  fDetDir->SetGuidance(" Field tracking control ");
46 
47  fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType",this);
48  fStepperCMD->SetGuidance("Select stepper type for field");
49  fStepperCMD->SetParameterName("choice",true);
50  fStepperCMD->SetDefaultValue(4);
52 
53  fUpdateCMD = new G4UIcmdWithoutParameter("/field/update",this);
54  fUpdateCMD->SetGuidance("Update Field");
55  fUpdateCMD->SetGuidance("This command MUST be applied before \"beamOn\" ");
56  fUpdateCMD->SetGuidance("if you changed field settings.");
58 
59  fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
60  fMinStepCMD->SetGuidance("Define minimal step");
61  fMinStepCMD->SetParameterName("min step",false,false);
62  fMinStepCMD->SetDefaultUnit("mm");
64 
65  fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this);
66  fDeltaChordCMD->SetGuidance("Define delta chord");
67  fDeltaChordCMD->SetParameterName("delta chord",false,false);
68  fDeltaChordCMD->SetDefaultUnit("mm");
70 
71  fDeltaOneStepCMD =
72  new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
73  fDeltaOneStepCMD->SetGuidance("Define delta one step");
74  fDeltaOneStepCMD->SetParameterName("delta one step",false,false);
75  fDeltaOneStepCMD->SetDefaultUnit("mm");
77 
78  fDeltaIntersectionCMD =
79  new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this);
80  fDeltaIntersectionCMD->SetGuidance("Define delta intersection");
81  fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false);
82  fDeltaIntersectionCMD->SetDefaultUnit("mm");
83  fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
84 
85  fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this);
86  fEpsMinCMD->SetGuidance("Define eps min");
87  fEpsMinCMD->SetParameterName("eps min",false,false);
88  fEpsMinCMD->SetDefaultUnit("mm");
90 
91  fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this);
92  fEpsMaxCMD->SetGuidance("Define eps max");
93  fEpsMaxCMD->SetParameterName("eps max",false,false);
94  fEpsMaxCMD->SetDefaultUnit("mm");
96 }
97 
98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99 
101 {
102  delete fDetDir;
103 
104  delete fStepperCMD;
105  delete fMinStepCMD;
106  delete fDeltaChordCMD;
107  delete fDeltaOneStepCMD;
108  delete fDeltaIntersectionCMD;
109  delete fEpsMinCMD;
110  delete fEpsMaxCMD;
111  delete fUpdateCMD;
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
117 {
118  if( command == fStepperCMD )
119  {
120  fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue));
121  }
122  if( command == fUpdateCMD )
123  {
124  fGlobalField->UpdateField();
125  }
126  if( command == fMinStepCMD )
127  {
128  fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue));
129  }
130  if( command == fDeltaChordCMD )
131  {
132  fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue));
133  }
134  if( command == fDeltaOneStepCMD )
135  {
136  fGlobalField->
137  SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue));
138  }
139  if( command == fDeltaIntersectionCMD )
140  {
141  fGlobalField->
142  SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue));
143  }
144  if( command == fEpsMinCMD )
145  {
146  fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue));
147  }
148  if( command == fEpsMaxCMD )
149  {
150  fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue));
151  }
152 }