Geant4  10.02.p01
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 78551 2014-01-07 09:45:08Z 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);
80 
81  fMinStepCMD = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
82  fMinStepCMD->SetGuidance("Define minimal step");
83  fMinStepCMD->SetParameterName("min step",false,false);
86 
87  fDeltaChordCMD = new G4UIcmdWithADoubleAndUnit("/field/setDeltaChord",this);
88  fDeltaChordCMD->SetGuidance("Define delta chord");
89  fDeltaChordCMD->SetParameterName("delta chord",false,false);
92 
94  new G4UIcmdWithADoubleAndUnit("/field/setDeltaOneStep",this);
95  fDeltaOneStepCMD->SetGuidance("Define delta one step");
96  fDeltaOneStepCMD->SetParameterName("delta one step",false,false);
99 
101  new G4UIcmdWithADoubleAndUnit("/field/setDeltaIntersection",this);
102  fDeltaIntersectionCMD->SetGuidance("Define delta intersection");
103  fDeltaIntersectionCMD->SetParameterName("delta intersection",false,false);
106 
107  fEpsMinCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMin",this);
108  fEpsMinCMD->SetGuidance("Define eps min");
109  fEpsMinCMD->SetParameterName("eps min",false,false);
110  fEpsMinCMD->SetDefaultUnit("mm");
112 
113  fEpsMaxCMD = new G4UIcmdWithADoubleAndUnit("/field/setEpsMax",this);
114  fEpsMaxCMD->SetGuidance("Define eps max");
115  fEpsMaxCMD->SetParameterName("eps max",false,false);
116  fEpsMaxCMD->SetDefaultUnit("mm");
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121 
123 {
124  delete fDetDir;
125 
126  delete fCaptureB1Cmd;
127  delete fCaptureB2Cmd;
128  delete fTransferBCmd;
129 
130  delete fStepperCMD;
131  delete fMinStepCMD;
132  delete fDeltaChordCMD;
133  delete fDeltaOneStepCMD;
134  delete fDeltaIntersectionCMD;
135  delete fEpsMinCMD;
136  delete fEpsMaxCMD;
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140 
142 {
143 
144  if( command == fCaptureB1Cmd )
146 
147  if( command == fCaptureB2Cmd )
149 
150  if( command == fTransferBCmd )
152 
153  if( command == fStepperCMD )
154  {
156  }
157  if( command == fMinStepCMD )
158  {
160  }
161  if( command == fDeltaChordCMD )
162  {
164  }
165  if( command == fDeltaOneStepCMD )
166  {
167  fGlobalField->
168  SetDeltaOneStep(fDeltaOneStepCMD->GetNewDoubleValue(newValue));
169  }
170  if( command == fDeltaIntersectionCMD )
171  {
172  fGlobalField->
173  SetDeltaIntersection(fDeltaIntersectionCMD->GetNewDoubleValue(newValue));
174  }
175  if( command == fEpsMinCMD )
176  {
178  }
179  if( command == fEpsMaxCMD )
180  {
182  }
183 }
G4UIcmdWithADoubleAndUnit * fCaptureB1Cmd
void SetEpsMax(G4double eps)
Set the maximum eps length.
G4UIcmdWithADoubleAndUnit * fDeltaOneStepCMD
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithADoubleAndUnit * fDeltaChordCMD
static G4int GetNewIntValue(const char *paramString)
Definition of the F04GlobalField class.
G4UIcmdWithADoubleAndUnit * fDeltaIntersectionCMD
F04DetectorConstruction * fDetector
Definition of the F04FieldMessenger class.
G4UIcmdWithADoubleAndUnit * fCaptureB2Cmd
void SetEpsMin(G4double eps)
Set the minimum eps length.
F04GlobalField * fGlobalField
G4UIdirectory * fDetDir
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
G4UIcmdWithADoubleAndUnit * fEpsMaxCMD
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
void SetDeltaChord(G4double dcr)
Set the delta chord length.
G4UIcmdWithADoubleAndUnit * fTransferBCmd
G4UIcmdWithADoubleAndUnit * fEpsMinCMD
void SetDefaultUnit(const char *defUnit)
virtual void SetNewValue(G4UIcommand *, G4String)
void SetMinStep(G4double stp)
Set the minimum step length.
void SetDefaultValue(G4int defVal)
G4UIcmdWithADoubleAndUnit * fMinStepCMD
G4UIcmdWithAnInteger * fStepperCMD
F04FieldMessenger(F04GlobalField *, F04DetectorConstruction *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetStepperType(G4int i)
Set the Stepper types.