Geant4_10
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 //
26 // $Id: F04FieldMessenger.cc 76690 2013-11-14 08:45:07Z gcosmo $
27 //
30 //
31 
32 #include "F04FieldMessenger.hh"
33 
34 #include "F04GlobalField.hh"
35 #include "G4UIdirectory.hh"
36 #include "G4UIcmdWithAString.hh"
37 #include "G4UIcmdWithAnInteger.hh"
40 
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
46  F04DetectorConstruction* detector)
47  : fGlobalField(pEMfield)
48 {
49  fDetector = detector;
50 
51  fDetDir = new G4UIdirectory("/field/");
52  fDetDir->SetGuidance(" Field tracking control ");
53 
54  fCaptureB1Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB1",this);
55  fCaptureB1Cmd->SetGuidance("Set B1 of the Capture Magnet");
56  fCaptureB1Cmd->SetParameterName("CSizeB1",false,false);
57  fCaptureB1Cmd->SetDefaultUnit("tesla");
58  fCaptureB1Cmd->SetRange("CSizeB1>0.");
60 
61  fCaptureB2Cmd = new G4UIcmdWithADoubleAndUnit("/field/SetCaptureB2",this);
62  fCaptureB2Cmd->SetGuidance("Set B2 of the Capture Magnet");
63  fCaptureB2Cmd->SetParameterName("CSizeB2",false,false);
64  fCaptureB2Cmd->SetDefaultUnit("tesla");
65  fCaptureB2Cmd->SetRange("CSizeB2>0.");
67 
68  fTransferBCmd = new G4UIcmdWithADoubleAndUnit("/field/SetTransferB",this);
69  fTransferBCmd->SetGuidance("Set B of the Transfer Magnet");
70  fTransferBCmd->SetParameterName("TSizeB",false,false);
71  fTransferBCmd->SetDefaultUnit("tesla");
72  fTransferBCmd->SetRange("TSizeB>0.");
74 
75  fStepperCMD = new G4UIcmdWithAnInteger("/field/setStepperType",this);
76  fStepperCMD->SetGuidance("Select stepper type for field");
77  fStepperCMD->SetParameterName("choice",true);
78  fStepperCMD->SetDefaultValue(4);
80 
81  fUpdateCMD = new G4UIcmdWithoutParameter("/field/update",this);
82  fUpdateCMD->SetGuidance("Update Field");
83  fUpdateCMD->SetGuidance("This command MUST be applied before \"beamOn\" ");
84  fUpdateCMD->SetGuidance("if you changed field settings.");
86 
87  fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
88  fMinStepCMD->SetGuidance("Define minimal step");
89  fMinStepCMD->SetParameterName("min step",false,false);
90  fMinStepCMD->SetDefaultUnit("mm");
92 
93  fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this);
94  fDeltaChordCMD->SetGuidance("Define delta chord");
95  fDeltaChordCMD->SetParameterName("delta chord",false,false);
96  fDeltaChordCMD->SetDefaultUnit("mm");
98 
99  fDeltaOneStepCMD =
100  new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
101  fDeltaOneStepCMD->SetGuidance("Define delta one step");
102  fDeltaOneStepCMD->SetParameterName("delta one step",false,false);
103  fDeltaOneStepCMD->SetDefaultUnit("mm");
105 
106  fDeltaIntersectionCMD =
107  new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this);
108  fDeltaIntersectionCMD->SetGuidance("Define delta intersection");
109  fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false);
110  fDeltaIntersectionCMD->SetDefaultUnit("mm");
111  fDeltaIntersectionCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
112 
113  fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this);
114  fEpsMinCMD->SetGuidance("Define eps min");
115  fEpsMinCMD->SetParameterName("eps min",false,false);
116  fEpsMinCMD->SetDefaultUnit("mm");
118 
119  fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this);
120  fEpsMaxCMD->SetGuidance("Define eps max");
121  fEpsMaxCMD->SetParameterName("eps max",false,false);
122  fEpsMaxCMD->SetDefaultUnit("mm");
124 }
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127 
129 {
130  delete fDetDir;
131 
132  delete fCaptureB1Cmd;
133  delete fCaptureB2Cmd;
134  delete fTransferBCmd;
135 
136  delete fStepperCMD;
137  delete fMinStepCMD;
138  delete fDeltaChordCMD;
139  delete fDeltaOneStepCMD;
140  delete fDeltaIntersectionCMD;
141  delete fEpsMinCMD;
142  delete fEpsMaxCMD;
143  delete fUpdateCMD;
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147 
149 {
150 
151  if( command == fCaptureB1Cmd )
152  fDetector->SetCaptureMgntB1(fCaptureB1Cmd->GetNewDoubleValue(newValue));
153 
154  if( command == fCaptureB2Cmd )
155  fDetector->SetCaptureMgntB2(fCaptureB2Cmd->GetNewDoubleValue(newValue));
156 
157  if( command == fTransferBCmd )
158  fDetector->SetTransferMgntB(fTransferBCmd->GetNewDoubleValue(newValue));
159 
160  if( command == fStepperCMD )
161  {
162  fGlobalField->SetStepperType(fStepperCMD->GetNewIntValue(newValue));
163  }
164  if( command == fUpdateCMD )
165  {
166  fGlobalField->UpdateField();
167  }
168  if( command == fMinStepCMD )
169  {
170  fGlobalField->SetMinStep(fMinStepCMD->GetNewDoubleValue(newValue));
171  }
172  if( command == fDeltaChordCMD )
173  {
174  fGlobalField->SetDeltaChord(fDeltaChordCMD->GetNewDoubleValue(newValue));
175  }
176  if( command == fDeltaOneStepCMD )
177  {
178  fGlobalField->
179  SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue));
180  }
181  if( command == fDeltaIntersectionCMD )
182  {
183  fGlobalField->
184  SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue));
185  }
186  if( command == fEpsMinCMD )
187  {
188  fGlobalField->SetEpsMin(fEpsMinCMD->GetNewDoubleValue(newValue));
189  }
190  if( command == fEpsMaxCMD )
191  {
192  fGlobalField->SetEpsMax(fEpsMaxCMD->GetNewDoubleValue(newValue));
193  }
194 }
void SetEpsMax(G4double eps)
Set the maximum eps length.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
Definition of the F04GlobalField class.
Definition of the F04FieldMessenger class.
void SetEpsMin(G4double eps)
Set the minimum eps length.
void UpdateField()
updates all field tracking objects and Clear()
static G4double GetNewDoubleValue(const char *paramString)
Definition of the F04DetectorConstruction class.
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetDeltaChord(G4double dcr)
Set the delta chord length.
void SetDefaultUnit(const char *defUnit)
virtual void SetNewValue(G4UIcommand *, G4String)
void SetMinStep(G4double stp)
Set the minimum step length.
void SetDefaultValue(G4int defVal)
F04FieldMessenger(F04GlobalField *, F04DetectorConstruction *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetStepperType(G4int i)
Set the Stepper types.