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 ] [ 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/G4FieldParameters.cc (Version 11.3.0) and /geometry/magneticfield/src/G4FieldParameters.cc (Version 9.3.p2)


  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 G4FieldParameters.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 "G4FieldParameters.hh"                   
 37 #include "G4FieldParametersMessenger.hh"          
 38                                                   
 39 #include "G4Exception.hh"                         
 40 #include "G4SystemOfUnits.hh"                     
 41                                                   
 42 //                                                
 43 // static methods                                 
 44 //                                                
 45                                                   
 46 //____________________________________________    
 47 G4String G4FieldParameters::FieldTypeName(G4Fi    
 48 {                                                 
 49   // Return the field type as a string            
 50                                                   
 51   switch (field) {                                
 52     case kMagnetic:                               
 53       return G4String("Magnetic");                
 54     case kElectroMagnetic:                        
 55       return G4String("ElectroMagnetic");         
 56     case kGravity:                                
 57       return G4String("Gravity");                 
 58   }                                               
 59                                                   
 60   G4Exception(                                    
 61     "G4FieldParameters::FieldTypeName:", "Geom    
 62     FatalErrorInArgument, "Unknown field value    
 63   return G4String();                              
 64 }                                                 
 65                                                   
 66 //____________________________________________    
 67 G4String G4FieldParameters::EquationTypeName(G    
 68 {                                                 
 69   // Return the equation type as a string         
 70                                                   
 71   switch (equation) {                             
 72     case kEqMagnetic:                             
 73       return G4String("EqMagnetic");              
 74     case kEqMagneticWithSpin:                     
 75       return G4String("EqMagneticWithSpin");      
 76     case kEqElectroMagnetic:                      
 77       return G4String("EqElectroMagnetic");       
 78     case kEqEMfieldWithSpin:                      
 79       return G4String("EqEMfieldWithSpin");       
 80     case kEqEMfieldWithEDM:                       
 81       return G4String("EqEMfieldWithEDM");        
 82     case kUserEquation:                           
 83       return G4String("UserDefinedEq");           
 84   }                                               
 85                                                   
 86   G4Exception(                                    
 87     "G4FieldParameters::EquationTypeName:", "G    
 88     FatalErrorInArgument, "Unknown equation va    
 89   return G4String();                              
 90 }                                                 
 91                                                   
 92 //____________________________________________    
 93 G4String G4FieldParameters::StepperTypeName(G4    
 94 {                                                 
 95   // Return the stepper type as a string          
 96                                                   
 97   switch (stepper) {                              
 98     case kBogackiShampine23:                      
 99       return G4String("BogackiShampine23");       
100     case kBogackiShampine45:                      
101       return G4String("BogackiShampine45");       
102     case kCashKarpRKF45:                          
103       return G4String("CashKarpRKF45");           
104     case kClassicalRK4:                           
105       return G4String("ClassicalRK4");            
106     case kDormandPrince745:                       
107       return G4String("DormandPrince745");        
108     case kDormandPrinceRK56:                      
109       return G4String("DormandPrinceRK56");       
110     case kDormandPrinceRK78:                      
111       return G4String("DormandPrinceRK78");       
112     case kExplicitEuler:                          
113       return G4String("ExplicitEuler");           
114     case kImplicitEuler:                          
115       return G4String("ImplicitEuler");           
116     case kSimpleHeum:                             
117       return G4String("SimpleHeum");              
118     case kSimpleRunge:                            
119       return G4String("SimpleRunge");             
120     case kConstRK4:                               
121       return G4String("ConstRK4");                
122     case kExactHelixStepper:                      
123       return G4String("ExactHelixStepper");       
124     case kHelixExplicitEuler:                     
125       return G4String("HelixExplicitEuler");      
126     case kHelixHeum:                              
127       return G4String("HelixHeum");               
128     case kHelixImplicitEuler:                     
129       return G4String("HelixImplicitEuler");      
130     case kHelixMixedStepper:                      
131       return G4String("HelixMixedStepper");       
132     case kHelixSimpleRunge:                       
133       return G4String("HelixSimpleRunge");        
134     case kNystromRK4:                             
135       return G4String("NystromRK4");              
136     case kRKG3Stepper:                            
137       return G4String("RKG3_Stepper");            
138     case kTsitourasRK45:                          
139       return G4String("TsitourasRK45");           
140     case kUserStepper:                            
141       return G4String("UserDefinedStepper");      
142     case kRK547FEq1:                              
143       return G4String("RK547FEq1");               
144     case kRK547FEq2:                              
145       return G4String("RK547FEq2");               
146     case kRK547FEq3:                              
147       return G4String("RK547FEq3");               
148   }                                               
149                                                   
150   G4Exception(                                    
151     "G4FieldParameters::StepperTypeName:", "Ge    
152     FatalErrorInArgument, "Unknown stepper val    
153   return G4String();                              
154 }                                                 
155                                                   
156 //____________________________________________    
157 G4FieldType G4FieldParameters::GetFieldType(co    
158 {                                                 
159   // Return the field type for given field typ    
160                                                   
161   if (name == FieldTypeName(kMagnetic)) return    
162   if (name == FieldTypeName(kElectroMagnetic))    
163   if (name == FieldTypeName(kGravity)) return     
164                                                   
165   G4Exception(                                    
166     "G4FieldParameters::GetFieldType:", "GeomF    
167     FatalErrorInArgument, "Unknown field name.    
168   return kMagnetic;                               
169 }                                                 
170                                                   
171 //____________________________________________    
172 G4EquationType G4FieldParameters::GetEquationT    
173 {                                                 
174   // Return the equation type for given equati    
175                                                   
176   if (name == EquationTypeName(kEqMagnetic)) r    
177   if (name == EquationTypeName(kEqMagneticWith    
178   if (name == EquationTypeName(kEqElectroMagne    
179   if (name == EquationTypeName(kEqEMfieldWithS    
180   if (name == EquationTypeName(kEqEMfieldWithE    
181   if (name == EquationTypeName(kUserEquation))    
182                                                   
183   G4Exception(                                    
184     "G4FieldParameters::GetEquationType:", "Ge    
185     FatalErrorInArgument, "Unknown equation na    
186   return kEqMagnetic;                             
187 }                                                 
188                                                   
189 //____________________________________________    
190 G4StepperType G4FieldParameters::GetStepperTyp    
191 {                                                 
192   // Return the stepper type for given stepper    
193   if (name == StepperTypeName(kBogackiShampine    
194   if (name == StepperTypeName(kBogackiShampine    
195   if (name == StepperTypeName(kCashKarpRKF45))    
196   if (name == StepperTypeName(kClassicalRK4))     
197   if (name == StepperTypeName(kDormandPrince74    
198   if (name == StepperTypeName(kDormandPrinceRK    
199   if (name == StepperTypeName(kDormandPrinceRK    
200   if (name == StepperTypeName(kExplicitEuler))    
201   if (name == StepperTypeName(kImplicitEuler))    
202   if (name == StepperTypeName(kSimpleHeum)) re    
203   if (name == StepperTypeName(kSimpleRunge)) r    
204   if (name == StepperTypeName(kConstRK4)) retu    
205   if (name == StepperTypeName(kExactHelixStepp    
206   if (name == StepperTypeName(kHelixExplicitEu    
207   if (name == StepperTypeName(kHelixHeum)) ret    
208   if (name == StepperTypeName(kHelixImplicitEu    
209   if (name == StepperTypeName(kHelixMixedStepp    
210   if (name == StepperTypeName(kHelixSimpleRung    
211   if (name == StepperTypeName(kNystromRK4)) re    
212   if (name == StepperTypeName(kRKG3Stepper)) r    
213   if (name == StepperTypeName(kRK547FEq1)) ret    
214   if (name == StepperTypeName(kRK547FEq2)) ret    
215   if (name == StepperTypeName(kRK547FEq3)) ret    
216   if (name == StepperTypeName(kTsitourasRK45))    
217   if (name == StepperTypeName(kUserStepper)) r    
218                                                   
219   G4Exception(                                    
220     "G4FieldParameters::GetStepperType:", "Geo    
221     FatalErrorInArgument, "Unknown stepper nam    
222   return kClassicalRK4;                           
223 }                                                 
224                                                   
225 //                                                
226 // ctors, dtor                                    
227 //                                                
228                                                   
229 //____________________________________________    
230 G4FieldParameters::G4FieldParameters(const G4S    
231   : fVolumeName(volumeName)                       
232 {                                                 
233   // Standard constructor                         
234                                                   
235   fMessenger = new G4FieldParametersMessenger(    
236 }                                                 
237                                                   
238 //____________________________________________    
239 G4FieldParameters::~G4FieldParameters()           
240 {                                                 
241   // Destructor                                   
242                                                   
243   delete fMessenger;                              
244 }                                                 
245                                                   
246 //                                                
247 // public methods                                 
248 //                                                
249                                                   
250 //____________________________________________    
251 void G4FieldParameters::PrintParameters() cons    
252 {                                                 
253   // Prints all customizable accuracy paramete    
254                                                   
255   G4cout << "Magnetic field parameters: " << G    
256   if (fVolumeName.size()) {                       
257     G4cout << "  volume name = " << fVolumeNam    
258   }                                               
259   G4cout << "  field type = " << FieldTypeName    
260          << "  equation type = " << EquationTy    
261          << "  stepper type = " << StepperType    
262          << "  minStep = " << fMinimumStep <<     
263          << "  constDistance = " << fConstDist    
264          << "  deltaChord = " << fDeltaChord <    
265          << "  deltaOneStep = " << fDeltaOneSt    
266          << "  deltaIntersection = " << fDelta    
267          << "  epsMin = " << fMinimumEpsilonSt    
268          << "  epsMax=  " << fMaximumEpsilonSt    
269 }                                                 
270                                                   
271 //____________________________________________    
272 void G4FieldParameters::SetUserEquationOfMotio    
273 {                                                 
274   // Set user defined equation of motion          
275                                                   
276   fUserEquation = equation;                       
277   fEquation = kUserEquation;                      
278 }                                                 
279                                                   
280 //____________________________________________    
281 void G4FieldParameters::SetUserStepper(G4MagIn    
282 {                                                 
283   // Set user defined integrator of particle's    
284                                                   
285   fUserStepper = stepper;                         
286   fStepper = kUserStepper;                        
287 }                                                 
288