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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/magneticfield/src/G4FieldParametersMessenger.cc (Version 11.3.0) and /geometry/magneticfield/src/G4FieldParametersMessenger.cc (Version 5.0)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26                                                   
 27 /// \file G4FieldParametersMessenger.cc           
 28 /// \brief Implementation of the G4FieldParame    
 29 ///                                               
 30 /// This code was initially developed in Geant    
 31 /// (https://github.com/vmc-project)              
 32 /// and adapted to Geant4.                        
 33 ///                                               
 34 /// \author I. Hrivnacova; IJCLab, Orsay          
 35                                                   
 36 #include "G4FieldParametersMessenger.hh"          
 37 #include "G4FieldParameters.hh"                   
 38                                                   
 39 #include "G4UIcmdWithABool.hh"                    
 40 #include "G4UIcmdWithADouble.hh"                  
 41 #include "G4UIcmdWithADoubleAndUnit.hh"           
 42 #include "G4UIcmdWithAString.hh"                  
 43 #include "G4UIcmdWithoutParameter.hh"             
 44 #include "G4UIdirectory.hh"                       
 45                                                   
 46 //____________________________________________    
 47 G4FieldParametersMessenger::G4FieldParametersM    
 48   G4FieldParameters* fieldParameters)             
 49   : fFieldParameters(fieldParameters)             
 50 {                                                 
 51   // Standard constructor                         
 52                                                   
 53   G4String directoryName = "/field/";             
 54   if (fieldParameters->GetVolumeName() != "")     
 55     directoryName.append(fieldParameters->GetV    
 56     directoryName.append("/");                    
 57     fDirectory = new G4UIdirectory(directoryNa    
 58     fDirectory->SetGuidance("Magnetic field co    
 59   }                                               
 60                                                   
 61   G4String commandName = directoryName;           
 62   commandName.append("fieldType");                
 63   fFieldTypeCmd = new G4UIcmdWithAString(comma    
 64   G4String guidance = "Select type of the fiel    
 65   fFieldTypeCmd->SetGuidance(guidance);           
 66   fFieldTypeCmd->SetParameterName("FieldType",    
 67   G4String candidates;                            
 68   for (G4int i = kMagnetic; i <= kGravity; i++    
 69     G4FieldType ft = (G4FieldType)i;              
 70     candidates += G4FieldParameters::FieldType    
 71     candidates += " ";                            
 72   }                                               
 73   fFieldTypeCmd->SetCandidates(candidates);       
 74   fFieldTypeCmd->AvailableForStates(              
 75     G4State_PreInit, G4State_Init, G4State_Idl    
 76                                                   
 77   commandName = directoryName;                    
 78   commandName.append("equationType");             
 79   fEquationTypeCmd = new G4UIcmdWithAString(co    
 80   guidance = "Select type of the equation of m    
 81   fEquationTypeCmd->SetGuidance(guidance);        
 82   fEquationTypeCmd->SetParameterName("Equation    
 83   candidates = "";                                
 84   for (G4int i = kEqMagnetic; i <= kEqEMfieldW    
 85     G4EquationType et = (G4EquationType)i;        
 86     candidates += G4FieldParameters::EquationT    
 87     candidates += " ";                            
 88   }                                               
 89   fEquationTypeCmd->SetCandidates(candidates);    
 90   fEquationTypeCmd->AvailableForStates(           
 91     G4State_PreInit, G4State_Init, G4State_Idl    
 92                                                   
 93   commandName = directoryName;                    
 94   commandName.append("stepperType");              
 95   fStepperTypeCmd = new G4UIcmdWithAString(com    
 96   guidance =                                      
 97     "Select type of the the integrator of part    
 98     "field";                                      
 99   fStepperTypeCmd->SetGuidance(guidance);         
100   fStepperTypeCmd->SetParameterName("StepperTy    
101   candidates = "";                                
102   for (G4int i = kCashKarpRKF45; i <= kRK547FE    
103     G4StepperType st = (G4StepperType)i;          
104     if (st == kUserStepper) continue;             
105     candidates += G4FieldParameters::StepperTy    
106     candidates += " ";                            
107   }                                               
108   fStepperTypeCmd->SetCandidates(candidates);     
109   fStepperTypeCmd->AvailableForStates(            
110     G4State_PreInit, G4State_Init, G4State_Idl    
111                                                   
112   commandName = directoryName;                    
113   commandName.append("setMinimumStep");           
114   fSetMinimumStepCmd = new G4UIcmdWithADoubleA    
115   fSetMinimumStepCmd->SetGuidance("Set minimum    
116   fSetMinimumStepCmd->SetParameterName("StepMi    
117   fSetMinimumStepCmd->SetDefaultUnit("mm");       
118   fSetMinimumStepCmd->SetUnitCategory("Length"    
119   fSetMinimumStepCmd->AvailableForStates(         
120     G4State_PreInit, G4State_Init, G4State_Idl    
121                                                   
122   commandName = directoryName;                    
123   commandName.append("setDeltaChord");            
124   fSetDeltaChordCmd = new G4UIcmdWithADoubleAn    
125   fSetDeltaChordCmd->SetGuidance("Set delta ch    
126   fSetDeltaChordCmd->SetParameterName("DeltaCh    
127   fSetDeltaChordCmd->SetDefaultUnit("mm");        
128   fSetDeltaChordCmd->SetUnitCategory("Length")    
129   fSetDeltaChordCmd->AvailableForStates(          
130     G4State_PreInit, G4State_Init, G4State_Idl    
131                                                   
132   commandName = directoryName;                    
133   commandName.append("setDeltaOneStep");          
134   fSetDeltaOneStepCmd = new G4UIcmdWithADouble    
135   fSetDeltaOneStepCmd->SetGuidance(               
136     "Set delta one step in global field manage    
137   fSetDeltaOneStepCmd->SetParameterName("Delta    
138   fSetDeltaOneStepCmd->SetDefaultUnit("mm");      
139   fSetDeltaOneStepCmd->SetUnitCategory("Length    
140   fSetDeltaOneStepCmd->AvailableForStates(        
141     G4State_PreInit, G4State_Init, G4State_Idl    
142                                                   
143   commandName = directoryName;                    
144   commandName.append("setDeltaIntersection");     
145   fSetDeltaIntersectionCmd = new G4UIcmdWithAD    
146   fSetDeltaIntersectionCmd->SetGuidance(          
147     "Set delta intersection in global field ma    
148   fSetDeltaIntersectionCmd->SetParameterName("    
149   fSetDeltaIntersectionCmd->SetDefaultUnit("mm    
150   fSetDeltaIntersectionCmd->SetUnitCategory("L    
151   fSetDeltaIntersectionCmd->AvailableForStates    
152     G4State_PreInit, G4State_Init, G4State_Idl    
153                                                   
154   commandName = directoryName;                    
155   commandName.append("setMinimumEpsilonStep");    
156   fSetMinimumEpsilonStepCmd = new G4UIcmdWithA    
157   fSetMinimumEpsilonStepCmd->SetGuidance(         
158     "Set minimum epsilon step in global field     
159   fSetMinimumEpsilonStepCmd->SetParameterName(    
160   fSetMinimumEpsilonStepCmd->AvailableForState    
161     G4State_PreInit, G4State_Init, G4State_Idl    
162                                                   
163   commandName = directoryName;                    
164   commandName.append("setMaximumEpsilonStep");    
165   fSetMaximumEpsilonStepCmd = new G4UIcmdWithA    
166   fSetMaximumEpsilonStepCmd->SetGuidance(         
167     "Set maximum epsilon step in global field     
168   fSetMaximumEpsilonStepCmd->SetParameterName(    
169   fSetMaximumEpsilonStepCmd->AvailableForState    
170     G4State_PreInit, G4State_Init, G4State_Idl    
171                                                   
172   commandName = directoryName;                    
173   commandName.append("setConstDistance");         
174   fSetConstDistanceCmd = new G4UIcmdWithADoubl    
175   fSetConstDistanceCmd->SetGuidance(              
176     "Set the distance within which the field i    
177   fSetConstDistanceCmd->SetGuidance(              
178     "Non-zero value will trigger creating a ca    
179   fSetConstDistanceCmd->SetParameterName("Cons    
180   fSetConstDistanceCmd->SetDefaultUnit("mm");     
181   fSetConstDistanceCmd->SetUnitCategory("Lengt    
182   fSetConstDistanceCmd->SetRange("ConstDistanc    
183   fSetConstDistanceCmd->AvailableForStates(G4S    
184                                                   
185   commandName = std::move(directoryName);         
186   commandName.append("printParameters");          
187   fPrintParametersCmd = new G4UIcmdWithoutPara    
188   fPrintParametersCmd->SetGuidance("Prints all    
189   fPrintParametersCmd->AvailableForStates(        
190     G4State_PreInit, G4State_Init, G4State_Idl    
191 }                                                 
192                                                   
193 //____________________________________________    
194 G4FieldParametersMessenger::~G4FieldParameters    
195 {                                                 
196   // Destructor                                   
197                                                   
198   delete fDirectory;                              
199   delete fFieldTypeCmd;                           
200   delete fEquationTypeCmd;                        
201   delete fStepperTypeCmd;                         
202   delete fSetMinimumStepCmd;                      
203   delete fSetDeltaChordCmd;                       
204   delete fSetDeltaOneStepCmd;                     
205   delete fSetDeltaIntersectionCmd;                
206   delete fSetMinimumEpsilonStepCmd;               
207   delete fSetMaximumEpsilonStepCmd;               
208   delete fSetConstDistanceCmd;                    
209 }                                                 
210                                                   
211 //                                                
212 // public methods                                 
213 //                                                
214                                                   
215 //____________________________________________    
216 void G4FieldParametersMessenger::SetNewValue(     
217   G4UIcommand* command, G4String newValues)       
218 {                                                 
219   // Apply command to the associated object.      
220                                                   
221   if (command == fFieldTypeCmd) {                 
222     for (G4int i = kMagnetic; i <= kGravity; i    
223       G4FieldType ft = (G4FieldType)i;            
224       if (newValues == G4FieldParameters::Fiel    
225         fFieldParameters->SetFieldType(ft);       
226         break;                                    
227       }                                           
228     }                                             
229     return;                                       
230   }                                               
231                                                   
232   if (command == fEquationTypeCmd) {              
233     for (G4int i = kEqMagnetic; i <= kEqEMfiel    
234       G4EquationType et = (G4EquationType)i;      
235       if (newValues == G4FieldParameters::Equa    
236         fFieldParameters->SetEquationType(et);    
237         break;                                    
238       }                                           
239     }                                             
240     return;                                       
241   }                                               
242                                                   
243   if (command == fStepperTypeCmd) {               
244     for (G4int i = kCashKarpRKF45; i <= kRK547    
245       G4StepperType st = (G4StepperType)i;        
246       if (newValues == G4FieldParameters::Step    
247         fFieldParameters->SetStepperType(st);     
248         break;                                    
249       }                                           
250     }                                             
251     return;                                       
252   }                                               
253                                                   
254   if (command == fSetMinimumStepCmd) {            
255     fFieldParameters->SetMinimumStep(             
256       fSetMinimumStepCmd->GetNewDoubleValue(ne    
257     return;                                       
258   }                                               
259                                                   
260   if (command == fSetDeltaChordCmd) {             
261     fFieldParameters->SetDeltaChord(              
262       fSetDeltaChordCmd->GetNewDoubleValue(new    
263     return;                                       
264   }                                               
265                                                   
266   if (command == fSetDeltaOneStepCmd) {           
267     fFieldParameters->SetDeltaOneStep(            
268       fSetDeltaOneStepCmd->GetNewDoubleValue(n    
269     return;                                       
270   }                                               
271                                                   
272   if (command == fSetDeltaIntersectionCmd) {      
273     fFieldParameters->SetDeltaIntersection(       
274       fSetDeltaIntersectionCmd->GetNewDoubleVa    
275     return;                                       
276   }                                               
277                                                   
278   if (command == fSetMinimumEpsilonStepCmd) {     
279     fFieldParameters->SetMinimumEpsilonStep(      
280       fSetMinimumEpsilonStepCmd->GetNewDoubleV    
281     return;                                       
282   }                                               
283                                                   
284   if (command == fSetMaximumEpsilonStepCmd) {     
285     fFieldParameters->SetMaximumEpsilonStep(      
286       fSetMaximumEpsilonStepCmd->GetNewDoubleV    
287     return;                                       
288   }                                               
289                                                   
290   if (command == fSetConstDistanceCmd) {          
291     fFieldParameters->SetConstDistance(           
292       fSetConstDistanceCmd->GetNewDoubleValue(    
293     return;                                       
294   }                                               
295                                                   
296   if (command == fPrintParametersCmd) {           
297     fFieldParameters->PrintParameters();          
298     return;                                       
299   }                                               
300 }                                                 
301