Geant4-11
Public Member Functions | Protected Member Functions | Private Attributes | Friends
G4ChordFinder Class Reference

#include <G4ChordFinder.hh>

Public Member Functions

G4double AdvanceChordLimited (G4FieldTrack &yCurrent, G4double stepInitial, G4double epsStep_Relative, const G4ThreeVector &latestSafetyOrigin, G4double lasestSafetyRadius)
 
G4FieldTrack ApproxCurvePointS (const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4FieldTrack &ApproxCurveV, const G4ThreeVector &currentEPoint, const G4ThreeVector &currentFPoint, const G4ThreeVector &PointG, G4bool first, G4double epsStep)
 
G4FieldTrack ApproxCurvePointV (const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4ThreeVector &currentEPoint, G4double epsStep)
 
 G4ChordFinder (const G4ChordFinder &)=delete
 
 G4ChordFinder (G4MagneticField *itsMagField, G4double stepMinimum=1.0e-2, G4MagIntegratorStepper *pItsStepper=nullptr, G4int stepperDriverChoice=2)
 
 G4ChordFinder (G4VIntegrationDriver *pIntegrationDriver)
 
G4double GetDeltaChord () const
 
G4VIntegrationDriverGetIntegrationDriver ()
 
G4double InvParabolic (const G4double xa, const G4double ya, const G4double xb, const G4double yb, const G4double xc, const G4double yc)
 
void OnComputeStep ()
 
G4ChordFinderoperator= (const G4ChordFinder &)=delete
 
void ResetStepEstimate ()
 
void SetDeltaChord (G4double newval)
 
void SetIntegrationDriver (G4VIntegrationDriver *IntegrationDriver)
 
G4int SetVerbose (G4int newvalue=1)
 
virtual ~G4ChordFinder ()
 

Protected Member Functions

void PrintDchordTrial (G4int noTrials, G4double stepTrial, G4double oldStepTrial, G4double dChordStep)
 

Private Attributes

G4CachedMagneticFieldfCachedField = nullptr
 
const G4double fDefaultDeltaChord
 
G4double fDeltaChord
 
G4EquationOfMotionfEquation = nullptr
 
G4VIntegrationDriverfIntgrDriver = nullptr
 
std::unique_ptr< G4HelixHeumfLongStepper
 
G4MagIntegratorStepperfNewFSALStepperOwned = nullptr
 
G4MagIntegratorStepperfRegularStepperOwned = nullptr
 
G4int fStatsVerbose = 0
 

Friends

std::ostream & operator<< (std::ostream &os, const G4ChordFinder &cf)
 

Detailed Description

Definition at line 50 of file G4ChordFinder.hh.

Constructor & Destructor Documentation

◆ G4ChordFinder() [1/3]

G4ChordFinder::G4ChordFinder ( G4VIntegrationDriver pIntegrationDriver)
explicit

Definition at line 73 of file G4ChordFinder.cc.

74 : fDefaultDeltaChord(0.25 * mm), fIntgrDriver(pIntegrationDriver)
75{
76 // Simple constructor -- it does not create equation
77 if( gVerboseCtor )
78 G4cout << "G4ChordFinder: Simple constructor -- it uses pre-existing driver." << G4endl;
79
80 fDeltaChord = fDefaultDeltaChord; // Parameters
81}
static G4bool gVerboseCtor
static constexpr double mm
Definition: G4SIunits.hh:95
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4double fDefaultDeltaChord
G4double fDeltaChord
G4VIntegrationDriver * fIntgrDriver

References fDefaultDeltaChord, fDeltaChord, G4cout, G4endl, and gVerboseCtor.

◆ G4ChordFinder() [2/3]

G4ChordFinder::G4ChordFinder ( G4MagneticField itsMagField,
G4double  stepMinimum = 1.0e-2,
G4MagIntegratorStepper pItsStepper = nullptr,
G4int  stepperDriverChoice = 2 
)

Definition at line 86 of file G4ChordFinder.cc.

90 : fDefaultDeltaChord(0.25 * mm)
91{
92 // Construct the Chord Finder
93 // by creating in inverse order the Driver, the Stepper and EqRhs ...
94 constexpr G4int nVar6 = 6; // Components integrated in Usual Equation of motion
95
96 fDeltaChord = fDefaultDeltaChord; // Parameters
97
98 // stepperDriverId = 2;
99
100 G4bool useFSALstepper= (stepperDriverId == 1);
101 G4bool useTemplatedStepper= (stepperDriverId == 2);
102 G4bool useRegularStepper = (stepperDriverId == 3);
103 // G4bool useBFieldDriver = !useRegularStepper && !useFSALstepper && !useTemplatedStepper;
104
105 // G4bool useRegularStepper = !stepperDriverId != 3) && !useFSALStepper && !useTemplatedStepper;
106 // If it's not 0, 1 or 2 then 'BFieldDriver' which combines DoPri5 (short) and helix is used.
107
108 using EquationType = G4Mag_UsualEqRhs;
109
110 using TemplatedStepperType =
111 G4TDormandPrince45<EquationType,nVar6>; // 5th order embedded method. High efficiency.
112 const char* TemplatedStepperName =
113 "G4TDormandPrince745 (templated Dormand-Prince45, aka DoPri5): 5th/4th Order 7-stage embedded";
114
115 using RegularStepperType =
116 G4DormandPrince745; // 5th order embedded method. High efficiency.
117 // G4ClassicalRK4; // The old default
118 // G4CashKarpRKF45; // First embedded method in G4
119 // G4BogackiShampine45; // High efficiency 5th order embedded method
120 // G4NystromRK4; // Nystrom stepper 4th order
121 // G4RK547FEq1; // or 2 or 3
122 const char* RegularStepperName =
123 "G4DormandPrince745 (aka DOPRI5): 5th/4th Order 7-stage embedded";
124 // "BogackiShampine 45 (Embedded 5th/4th Order, 7-stage)";
125 // "Nystrom stepper 4th order";
126
127 using NewFsalStepperType = G4DormandPrince745; // Now works -- 2020.10.08
128 // Was G4RK547FEq1; // or 2 or 3
129 const char* NewFSALStepperName =
130 "G4RK574FEq1> FSAL 4th/5th order 7-stage 'Equilibrium-type' #1.";
131
132#ifdef G4DEBUG_FIELD
133 static G4bool verboseDebug = true;
134 if( verboseDebug )
135 {
136 G4cout << "G4ChordFinder 2nd Constructor called. " << G4endl;
137 G4cout << " Arguments: " << G4endl
138 << " - min step = " << stepMinimum << G4endl
139 << " - stepper ptr provided : "
140 << ( pItsStepper==nullptr ? " no " : " yes " ) << G4endl;
141 if( pItsStepper==nullptr )
142 G4cout << " - stepper/driver Id = " << stepperDriverId << " i.e. "
143 << " useFSAL = " << useFSALstepper
144 << " , useTemplated = " << useTemplatedStepper
145 << " , useRegular = " << useRegularStepper
146 << " , useFSAL = " << useFSALstepper
147 << G4endl;
148 }
149#endif
150
151 // useHigherStepper = forceHigherEffiencyStepper || useHigherStepper;
152
153 EquationType* pEquation = new G4Mag_UsualEqRhs(theMagField);
154 fEquation = pEquation;
155
156 // G4MagIntegratorStepper* regularStepper = nullptr;
157 // G4VFSALIntegrationStepper* fsalStepper = nullptr; // for FSAL steppers only
158 // G4MagIntegratorStepper* oldFSALStepper = nullptr;
159
160 G4bool errorInStepperCreation = false;
161
162 std::ostringstream message; // In case of failure, load with description !
163
164 if( pItsStepper != nullptr )
165 {
166 if( gVerboseCtor )
167 G4cout << " G4ChordFinder: Creating G4IntegrationDriver<G4MagIntegratorStepper> with "
168 << " stepMinimum = " << stepMinimum
169 << " numVar= " << pItsStepper->GetNumberOfVariables() << G4endl;
170 // Stepper type is not known - so must use base class G4MagIntegratorStepper
172 stepMinimum, pItsStepper, pItsStepper->GetNumberOfVariables());
173
174 // -- Older:
175 // G4cout << " G4ChordFinder: Creating G4MagInt_Driver with " ...
176 // Type is not known - so must use old class
177 // fIntgrDriver = new G4MagInt_Driver( stepMinimum, pItsStepper,
178 // pItsStepper->GetNumberOfVariables());
179 }
180 else if ( useTemplatedStepper )
181 {
182 if( gVerboseCtor )
183 G4cout << " G4ChordFinder: Creating Templated Stepper of type> "
184 << TemplatedStepperName << G4endl;
185 // RegularStepperType* regularStepper = nullptr; // To check the exception
186 auto templatedStepper = new TemplatedStepperType(pEquation);
187 // *** ******************
188 //
189 // Alternative - for G4NystromRK4:
190 // = new G4NystromRK4(pEquation, 0.1*mm );
191 fRegularStepperOwned = templatedStepper;
192 if( templatedStepper == nullptr )
193 {
194 message << "Templated Stepper instantiation FAILED." << G4endl;
195 message << "G4ChordFinder: Attempted to instantiate "
196 << TemplatedStepperName << " type stepper " << G4endl;
197 errorInStepperCreation = true;
198 }
199 else
200 {
202 stepMinimum, templatedStepper, nVar6 );
203 if( gVerboseCtor )
204 G4cout << " G4ChordFinder: Using G4IntegrationDriver. " << G4endl;
205 }
206
207 }
208 else if ( useRegularStepper ) // Plain stepper -- not double ...
209 {
210 auto regularStepper = new RegularStepperType(pEquation);
211 // *** ******************
212 fRegularStepperOwned = regularStepper;
213
214 if( gVerboseCtor )
215 G4cout << " G4ChordFinder: Creating Driver for regular stepper.";
216
217 if( regularStepper == nullptr )
218 {
219 message << "Regular Stepper instantiation FAILED." << G4endl;
220 message << "G4ChordFinder: Attempted to instantiate "
221 << RegularStepperName << " type stepper " << G4endl;
222 errorInStepperCreation = true;
223 }
224 else
225 {
226 auto dp5= dynamic_cast<G4DormandPrince745*>(regularStepper);
227 if( dp5 ) {
229 stepMinimum, dp5, nVar6 );
230 if( gVerboseCtor )
231 G4cout << " Using InterpolationDriver<DoPri5> " << G4endl;
232 } else {
234 stepMinimum, regularStepper, nVar6 );
235 if( gVerboseCtor )
236 G4cout << " Using IntegrationDriver<DoPri5> " << G4endl;
237 }
238 }
239 }
240 else if ( !useFSALstepper )
241 {
242 auto regularStepper = new G4DormandPrince745(pEquation);
243 // *** ******************
244 //
245 fRegularStepperOwned = regularStepper;
246
247 {
248 using SmallStepDriver = G4InterpolationDriver<G4DormandPrince745>;
249 using LargeStepDriver = G4IntegrationDriver<G4HelixHeum>;
250
251 fLongStepper = std::unique_ptr<G4HelixHeum>(new G4HelixHeum(pEquation));
252
254 std::unique_ptr<SmallStepDriver>(new SmallStepDriver(stepMinimum,
255 regularStepper, regularStepper->GetNumberOfVariables())),
256 std::unique_ptr<LargeStepDriver>(new LargeStepDriver(stepMinimum,
257 fLongStepper.get(), regularStepper->GetNumberOfVariables())) );
258
259 if( fIntgrDriver == nullptr)
260 {
261 message << "Using G4BFieldIntegrationDriver with "
262 << RegularStepperName << " type stepper " << G4endl;
263 message << "Driver instantiation FAILED." << G4endl;
264 G4Exception("G4ChordFinder::G4ChordFinder()",
265 "GeomField1001", JustWarning, message);
266 }
267 }
268 }
269 else
270 {
271 auto fsalStepper= new NewFsalStepperType(pEquation);
272 // *** ******************
273 fNewFSALStepperOwned = fsalStepper;
274
275 if( fsalStepper == nullptr )
276 {
277 message << "Stepper instantiation FAILED." << G4endl;
278 message << "Attempted to instantiate "
279 << NewFSALStepperName << " type stepper " << G4endl;
280 G4Exception("G4ChordFinder::G4ChordFinder()",
281 "GeomField1001", JustWarning, message);
282 errorInStepperCreation = true;
283 }
284 else
285 {
286 fIntgrDriver = new
287 G4FSALIntegrationDriver<NewFsalStepperType>(stepMinimum, fsalStepper,
288 fsalStepper->GetNumberOfVariables() );
289 // ==== Create the driver which knows the class type
290
291 if( fIntgrDriver == nullptr )
292 {
293 message << "Using G4FSALIntegrationDriver with stepper type: "
294 << NewFSALStepperName << G4endl;
295 message << "Integration Driver instantiation FAILED." << G4endl;
296 G4Exception("G4ChordFinder::G4ChordFinder()",
297 "GeomField1001", JustWarning, message);
298 }
299 }
300 }
301
302 // -- Main work is now done
303
304 // Now check that no error occured, and report it if one did.
305
306 // To test failure to create driver
307 // delete fIntgrDriver;
308 // fIntgrDriver = nullptr;
309
310 // Detect and report Error conditions
311 //
312 if( errorInStepperCreation || (fIntgrDriver == nullptr ))
313 {
314 std::ostringstream errmsg;
315
316 if( errorInStepperCreation )
317 {
318 errmsg << "ERROR> Failure to create Stepper object." << G4endl
319 << " --------------------------------" << G4endl;
320 }
321 if (fIntgrDriver == nullptr )
322 {
323 errmsg << "ERROR> Failure to create Integration-Driver object."
324 << G4endl
325 << " -------------------------------------------"
326 << G4endl;
327 }
328 const std::string BoolName[2]= { "False", "True" };
329 errmsg << " Configuration: (constructor arguments) " << G4endl
330 << " provided Stepper = " << pItsStepper << G4endl
331 << " stepper/driver Id = " << stepperDriverId << " i.e. "
332 << " useTemplated = " << BoolName[useTemplatedStepper]
333 << " useRegular = " << BoolName[useRegularStepper]
334 << " useFSAL = " << BoolName[useFSALstepper]
335 << " using combo BField Driver = " <<
336 BoolName[ ! (useFSALstepper||useTemplatedStepper
337 || useRegularStepper ) ]
338 << G4endl;
339 errmsg << message.str();
340 errmsg << "Aborting.";
341 G4Exception("G4ChordFinder::G4ChordFinder() - constructor 2",
342 "GeomField0003", FatalException, errmsg);
343 }
344
345 assert( ( pItsStepper != nullptr )
346 || ( fRegularStepperOwned != nullptr )
347 || ( fNewFSALStepperOwned != nullptr )
348 );
349 assert( fIntgrDriver != nullptr );
350}
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4EquationOfMotion * fEquation
std::unique_ptr< G4HelixHeum > fLongStepper
G4MagIntegratorStepper * fNewFSALStepperOwned
G4MagIntegratorStepper * fRegularStepperOwned

References FatalException, fDefaultDeltaChord, fDeltaChord, fEquation, fIntgrDriver, fLongStepper, fNewFSALStepperOwned, fRegularStepperOwned, G4cout, G4endl, G4Exception(), G4MagIntegratorStepper::GetNumberOfVariables(), gVerboseCtor, and JustWarning.

◆ ~G4ChordFinder()

G4ChordFinder::~G4ChordFinder ( )
virtual

Definition at line 355 of file G4ChordFinder.cc.

356{
357 delete fEquation;
360 delete fCachedField;
361 delete fIntgrDriver;
362}
G4CachedMagneticField * fCachedField

References fCachedField, fEquation, fIntgrDriver, fNewFSALStepperOwned, and fRegularStepperOwned.

◆ G4ChordFinder() [3/3]

G4ChordFinder::G4ChordFinder ( const G4ChordFinder )
delete

Member Function Documentation

◆ AdvanceChordLimited()

G4double G4ChordFinder::AdvanceChordLimited ( G4FieldTrack yCurrent,
G4double  stepInitial,
G4double  epsStep_Relative,
const G4ThreeVector latestSafetyOrigin,
G4double  lasestSafetyRadius 
)
inline

◆ ApproxCurvePointS()

G4FieldTrack G4ChordFinder::ApproxCurvePointS ( const G4FieldTrack curveAPointVelocity,
const G4FieldTrack curveBPointVelocity,
const G4FieldTrack ApproxCurveV,
const G4ThreeVector currentEPoint,
const G4ThreeVector currentFPoint,
const G4ThreeVector PointG,
G4bool  first,
G4double  epsStep 
)

Definition at line 367 of file G4ChordFinder.cc.

374{
375 // ApproxCurvePointS is 2nd implementation of ApproxCurvePoint.
376 // Use Brent Algorithm (or InvParabolic) when possible.
377 // Given a starting curve point A (CurveA_PointVelocity), curve point B
378 // (CurveB_PointVelocity), a point E which is (generally) not on the curve
379 // and a point F which is on the curve (first approximation), find new
380 // point S on the curve closer to point E.
381 // While advancing towards S utilise 'eps_step' as a measure of the
382 // relative accuracy of each Step.
383
384 G4FieldTrack EndPoint(CurveA_PointVelocity);
385 if(!first) { EndPoint = ApproxCurveV; }
386
387 G4ThreeVector Point_A,Point_B;
388 Point_A=CurveA_PointVelocity.GetPosition();
389 Point_B=CurveB_PointVelocity.GetPosition();
390
391 G4double xa,xb,xc,ya,yb,yc;
392
393 // InverseParabolic. AF Intersects (First Part of Curve)
394
395 if(first)
396 {
397 xa=0.;
398 ya=(PointG-Point_A).mag();
399 xb=(Point_A-CurrentF_Point).mag();
400 yb=-(PointG-CurrentF_Point).mag();
401 xc=(Point_A-Point_B).mag();
402 yc=-(CurrentE_Point-Point_B).mag();
403 }
404 else
405 {
406 xa=0.;
407 ya=(Point_A-CurrentE_Point).mag();
408 xb=(Point_A-CurrentF_Point).mag();
409 yb=(PointG-CurrentF_Point).mag();
410 xc=(Point_A-Point_B).mag();
411 yc=-(Point_B-PointG).mag();
412 if(xb==0.)
413 {
414 EndPoint = ApproxCurvePointV(CurveA_PointVelocity, CurveB_PointVelocity,
415 CurrentE_Point, eps_step);
416 return EndPoint;
417 }
418 }
419
420 const G4double tolerance = 1.e-12;
421 if(std::abs(ya)<=tolerance||std::abs(yc)<=tolerance)
422 {
423 ; // What to do for the moment: return the same point as at start
424 // then PropagatorInField will take care
425 }
426 else
427 {
428 G4double test_step = InvParabolic(xa,ya,xb,yb,xc,yc);
429 G4double curve;
430 if(first)
431 {
432 curve=std::abs(EndPoint.GetCurveLength()
433 -ApproxCurveV.GetCurveLength());
434 }
435 else
436 {
437 test_step = test_step - xb;
438 curve=std::abs(EndPoint.GetCurveLength()
439 -CurveB_PointVelocity.GetCurveLength());
440 xb = (CurrentF_Point-Point_B).mag();
441 }
442
443 if(test_step<=0) { test_step=0.1*xb; }
444 if(test_step>=xb) { test_step=0.5*xb; }
445 if(test_step>=curve){ test_step=0.5*curve; }
446
447 if(curve*(1.+eps_step)<xb) // Similar to ReEstimate Step from
448 { // G4VIntersectionLocator
449 test_step=0.5*curve;
450 }
451
452 fIntgrDriver->AccurateAdvance(EndPoint,test_step, eps_step);
453
454#ifdef G4DEBUG_FIELD
455 // Printing Brent and Linear Approximation
456 //
457 G4cout << "G4ChordFinder::ApproxCurvePointS() - test-step ShF = "
458 << test_step << " EndPoint = " << EndPoint << G4endl;
459
460 // Test Track
461 //
462 G4FieldTrack TestTrack( CurveA_PointVelocity);
463 TestTrack = ApproxCurvePointV( CurveA_PointVelocity,
464 CurveB_PointVelocity,
465 CurrentE_Point, eps_step );
466 G4cout.precision(14);
467 G4cout << "G4ChordFinder::BrentApprox = " << EndPoint << G4endl;
468 G4cout << "G4ChordFinder::LinearApprox= " << TestTrack << G4endl;
469#endif
470 }
471 return EndPoint;
472}
double G4double
Definition: G4Types.hh:83
G4double InvParabolic(const G4double xa, const G4double ya, const G4double xb, const G4double yb, const G4double xc, const G4double yc)
G4FieldTrack ApproxCurvePointV(const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4ThreeVector &currentEPoint, G4double epsStep)
G4double GetCurveLength() const
virtual G4bool AccurateAdvance(G4FieldTrack &track, G4double hstep, G4double eps, G4double hinitial=0)=0

References G4VIntegrationDriver::AccurateAdvance(), ApproxCurvePointV(), fIntgrDriver, G4cout, G4endl, G4FieldTrack::GetCurveLength(), G4FieldTrack::GetPosition(), and InvParabolic().

Referenced by G4BrentLocator::EstimateIntersectionPoint().

◆ ApproxCurvePointV()

G4FieldTrack G4ChordFinder::ApproxCurvePointV ( const G4FieldTrack curveAPointVelocity,
const G4FieldTrack curveBPointVelocity,
const G4ThreeVector currentEPoint,
G4double  epsStep 
)

Definition at line 477 of file G4ChordFinder.cc.

482{
483 // If r=|AE|/|AB|, and s=true path lenght (AB)
484 // return the point that is r*s along the curve!
485
486 G4FieldTrack Current_PointVelocity = CurveA_PointVelocity;
487
488 G4ThreeVector CurveA_Point= CurveA_PointVelocity.GetPosition();
489 G4ThreeVector CurveB_Point= CurveB_PointVelocity.GetPosition();
490
491 G4ThreeVector ChordAB_Vector= CurveB_Point - CurveA_Point;
492 G4ThreeVector ChordAE_Vector= CurrentE_Point - CurveA_Point;
493
494 G4double ABdist= ChordAB_Vector.mag();
495 G4double curve_length; // A curve length of AB
496 G4double AE_fraction;
497
498 curve_length= CurveB_PointVelocity.GetCurveLength()
499 - CurveA_PointVelocity.GetCurveLength();
500
501 G4double integrationInaccuracyLimit= std::max( perMillion, 0.5*eps_step );
502 if( curve_length < ABdist * (1. - integrationInaccuracyLimit) )
503 {
504#ifdef G4DEBUG_FIELD
505 G4cerr << " Warning in G4ChordFinder::ApproxCurvePoint: "
506 << G4endl
507 << " The two points are further apart than the curve length "
508 << G4endl
509 << " Dist = " << ABdist
510 << " curve length = " << curve_length
511 << " relativeDiff = " << (curve_length-ABdist)/ABdist
512 << G4endl;
513 if( curve_length < ABdist * (1. - 10*eps_step) )
514 {
515 std::ostringstream message;
516 message << "Unphysical curve length." << G4endl
517 << "The size of the above difference exceeds allowed limits."
518 << G4endl
519 << "Aborting.";
520 G4Exception("G4ChordFinder::ApproxCurvePointV()", "GeomField0003",
521 FatalException, message);
522 }
523#endif
524 // Take default corrective action: adjust the maximum curve length.
525 // NOTE: this case only happens for relatively straight paths.
526 // curve_length = ABdist;
527 }
528
529 G4double new_st_length;
530
531 if ( ABdist > 0.0 )
532 {
533 AE_fraction = ChordAE_Vector.mag() / ABdist;
534 }
535 else
536 {
537 AE_fraction = 0.5; // Guess .. ?;
538#ifdef G4DEBUG_FIELD
539 G4cout << "Warning in G4ChordFinder::ApproxCurvePointV():"
540 << " A and B are the same point!" << G4endl
541 << " Chord AB length = " << ChordAE_Vector.mag() << G4endl
542 << G4endl;
543#endif
544 }
545
546 if( (AE_fraction> 1.0 + perMillion) || (AE_fraction< 0.) )
547 {
548#ifdef G4DEBUG_FIELD
549 G4cerr << " G4ChordFinder::ApproxCurvePointV() - Warning:"
550 << " Anomalous condition:AE > AB or AE/AB <= 0 " << G4endl
551 << " AE_fraction = " << AE_fraction << G4endl
552 << " Chord AE length = " << ChordAE_Vector.mag() << G4endl
553 << " Chord AB length = " << ABdist << G4endl << G4endl;
554 G4cerr << " OK if this condition occurs after a recalculation of 'B'"
555 << G4endl << " Otherwise it is an error. " << G4endl ;
556#endif
557 // This course can now result if B has been re-evaluated,
558 // without E being recomputed (1 July 99).
559 // In this case this is not a "real error" - but it is undesired
560 // and we cope with it by a default corrective action ...
561 //
562 AE_fraction = 0.5; // Default value
563 }
564
565 new_st_length = AE_fraction * curve_length;
566
567 if ( AE_fraction > 0.0 )
568 {
569 fIntgrDriver->AccurateAdvance(Current_PointVelocity,
570 new_st_length, eps_step );
571 //
572 // In this case it does not matter if it cannot advance the full distance
573 }
574
575 // If there was a memory of the step_length actually required at the start
576 // of the integration Step, this could be re-used ...
577
578 G4cout.precision(14);
579
580 return Current_PointVelocity;
581}
static constexpr double perMillion
Definition: G4SIunits.hh:327
G4GLOB_DLL std::ostream G4cerr
double mag() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments

References G4VIntegrationDriver::AccurateAdvance(), FatalException, fIntgrDriver, G4cerr, G4cout, G4endl, G4Exception(), G4FieldTrack::GetCurveLength(), G4FieldTrack::GetPosition(), CLHEP::Hep3Vector::mag(), G4INCL::Math::max(), and perMillion.

Referenced by ApproxCurvePointS(), G4BrentLocator::EstimateIntersectionPoint(), G4MultiLevelLocator::EstimateIntersectionPoint(), and G4SimpleLocator::EstimateIntersectionPoint().

◆ GetDeltaChord()

G4double G4ChordFinder::GetDeltaChord ( ) const
inline

◆ GetIntegrationDriver()

G4VIntegrationDriver * G4ChordFinder::GetIntegrationDriver ( )
inline

◆ InvParabolic()

G4double G4ChordFinder::InvParabolic ( const G4double  xa,
const G4double  ya,
const G4double  xb,
const G4double  yb,
const G4double  xc,
const G4double  yc 
)
inline

Referenced by ApproxCurvePointS().

◆ OnComputeStep()

void G4ChordFinder::OnComputeStep ( )

◆ operator=()

G4ChordFinder & G4ChordFinder::operator= ( const G4ChordFinder )
delete

◆ PrintDchordTrial()

void G4ChordFinder::PrintDchordTrial ( G4int  noTrials,
G4double  stepTrial,
G4double  oldStepTrial,
G4double  dChordStep 
)
protected

◆ ResetStepEstimate()

void G4ChordFinder::ResetStepEstimate ( )
inline

◆ SetDeltaChord()

void G4ChordFinder::SetDeltaChord ( G4double  newval)
inline

◆ SetIntegrationDriver()

void G4ChordFinder::SetIntegrationDriver ( G4VIntegrationDriver IntegrationDriver)
inline

◆ SetVerbose()

G4int G4ChordFinder::SetVerbose ( G4int  newvalue = 1)
inline

Referenced by export_G4ChordFinder().

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const G4ChordFinder cf 
)
friend

Definition at line 585 of file G4ChordFinder.cc.

586{
587 // Dumping the state of G4ChordFinder
588 os << "State of G4ChordFinder : " << std::endl;
589 os << " delta_chord = " << cf.fDeltaChord;
590 os << " Default d_c = " << cf.fDefaultDeltaChord;
591
592 os << " stats-verbose = " << cf.fStatsVerbose;
593
594 return os;
595}

Field Documentation

◆ fCachedField

G4CachedMagneticField* G4ChordFinder::fCachedField = nullptr
private

Definition at line 146 of file G4ChordFinder.hh.

Referenced by ~G4ChordFinder().

◆ fDefaultDeltaChord

const G4double G4ChordFinder::fDefaultDeltaChord
private

Definition at line 132 of file G4ChordFinder.hh.

Referenced by G4ChordFinder().

◆ fDeltaChord

G4double G4ChordFinder::fDeltaChord
private

Definition at line 136 of file G4ChordFinder.hh.

Referenced by G4ChordFinder().

◆ fEquation

G4EquationOfMotion* G4ChordFinder::fEquation = nullptr
private

Definition at line 148 of file G4ChordFinder.hh.

Referenced by G4ChordFinder(), and ~G4ChordFinder().

◆ fIntgrDriver

G4VIntegrationDriver* G4ChordFinder::fIntgrDriver = nullptr
private

◆ fLongStepper

std::unique_ptr<G4HelixHeum> G4ChordFinder::fLongStepper
private

Definition at line 145 of file G4ChordFinder.hh.

Referenced by G4ChordFinder().

◆ fNewFSALStepperOwned

G4MagIntegratorStepper* G4ChordFinder::fNewFSALStepperOwned = nullptr
private

Definition at line 144 of file G4ChordFinder.hh.

Referenced by G4ChordFinder(), and ~G4ChordFinder().

◆ fRegularStepperOwned

G4MagIntegratorStepper* G4ChordFinder::fRegularStepperOwned = nullptr
private

Definition at line 143 of file G4ChordFinder.hh.

Referenced by G4ChordFinder(), and ~G4ChordFinder().

◆ fStatsVerbose

G4int G4ChordFinder::fStatsVerbose = 0
private

Definition at line 138 of file G4ChordFinder.hh.


The documentation for this class was generated from the following files: