Changeset 850 for trunk/source/geometry/magneticfield/src
- Timestamp:
- Sep 10, 2008, 5:40:37 PM (16 years ago)
- Location:
- trunk/source/geometry/magneticfield/src
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/geometry/magneticfield/src/G4CashKarpRKF45.cc
r831 r850 26 26 // 27 27 // $Id: G4CashKarpRKF45.cc,v 1.15 2008/01/11 18:11:44 japost Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth -
trunk/source/geometry/magneticfield/src/G4ChordFinder.cc
r831 r850 25 25 // 26 26 // 27 // $Id: G4ChordFinder.cc,v 1.4 7 2006/06/29 18:23:32 gunterExp $28 // GEANT4 tag $Name: $27 // $Id: G4ChordFinder.cc,v 1.49 2008/07/15 14:02:06 japost Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // … … 185 185 G4FieldTrack yEnd( yCurrent); 186 186 G4double startCurveLen= yCurrent.GetCurveLength(); 187 188 187 G4double nextStep; 189 188 // ************* … … 192 191 ); 193 192 // ************* 193 // G4cout<<"Exit Find Next Chord Err= "<<dyErr<<" eps= "<<epsStep<<"stepPos= "<<stepPossible<<G4endl; 194 194 G4bool good_advance; 195 195 196 if ( dyErr < epsStep * stepPossible ) 196 { 197 198 { //G4cout<<"err comparison = "<<dyErr<<" eps= "<<epsStep<<G4endl; 197 199 // Accept this accuracy. 198 200 yCurrent = yEnd; … … 200 202 } 201 203 else 202 { 204 { 205 // G4cout<<"Entering Accurate Advance"<<G4endl; 203 206 // Advance more accurately to "end of chord" 204 207 // *************** … … 212 215 213 216 #ifdef G4DEBUG_FIELD 214 G4cout << "Exiting FindNextChord Limited with:" << G4endl215 << " yCurrent: " << yCurrent<< G4endl;217 //G4cout << "Exiting FindNextChord Limited with:" << G4endl 218 // << " yCurrent: " << yCurrent<< G4endl; 216 219 #endif 217 220 … … 224 227 225 228 G4double 226 G4ChordFinder::FindNextChord( const G4FieldTrack 229 G4ChordFinder::FindNextChord( const G4FieldTrack& yStart, 227 230 G4double stepMax, 228 231 G4FieldTrack& yEnd, // Endpoint … … 235 238 // Returns Length of Step taken 236 239 { 240 //G4cout<<"Inter Find Next Chord with step="<<stepMax<<G4endl; 237 241 // G4int stepRKnumber=0; 238 242 G4FieldTrack yCurrent= yStart; … … 248 252 249 253 fIntgrDriver-> GetDerivatives( yCurrent, dydx ) ; 250 254 //for (G4int i=0;i<G4FieldTrack::ncompSVEC;i++){ 255 // dydx[i]=0.; 256 //} 251 257 G4int noTrials=0; 252 258 const G4double safetyFactor= fFirstFraction; // 0.975 or 0.99 ? was 0.999 … … 260 266 G4double stepForChord; 261 267 yCurrent = yStart; // Always start from initial point 262 268 263 269 // ************ 264 270 fIntgrDriver->QuickAdvance( yCurrent, dydx, stepTrial, … … 266 272 // ************ 267 273 268 // We check whether the criterion is met here. 269 validEndPoint = AcceptableMissDist(dChordStep); 270 // && (dyErrPos < eps) ; 274 // G4cout<<"AfterQuickAdv step="<<stepTrial<<" dC="<<dChordStep<<" yErr="<<dyErrPos<<G4endl; 275 276 // We check whether the criterion is met here. 277 validEndPoint = AcceptableMissDist(dChordStep); 278 // if(validEndPoint){G4cout<<"validEndPoint"<<fDeltaChord<<G4endl;} 279 // else{G4cout<<"No__validEndPoint"<<G4endl;} 280 281 282 //&& (dyErrPos < eps) ; 283 // validEndPoint = AcceptableMissDist(dChordStep) && (dyErrPos < epsStep) ; 271 284 272 285 lastStepLength = stepTrial; … … 322 335 << " StepForGoodChord=" << std::setw(10) << stepTrial << G4endl; 323 336 #endif 324 337 //G4cout << "ChordF/FindNextChord: NoTrials= " << noTrials 338 // << " StepForGoodChord=" << std::setw(10) << stepTrial << G4endl; 325 339 yEnd= yCurrent; 326 340 return stepTrial; … … 419 433 } 420 434 421 // 422 // Given a starting curve point A (CurveA_PointVelocity), a later 423 // curve point B (CurveB_PointVelocity) and a point E which is (generally) 424 // not on the curve, find and return a point F which is on the curve and 425 // which is close to E. While advancing towards F utilise eps_step 435 // ApproxCurvePointS is 2nd implementation of ApproxCurvePoint. 436 // Use Brent Algorithm(or InvParabolic) when it possible. 437 // Given a starting curve point A (CurveA_PointVelocity), 438 // curve point B (CurveB_PointVelocity), a point E which is (generally) 439 // not on the curve and a point F which is on the curve(first approximation) 440 // From this information find new point S on the curve closer to point E. 441 // While advancing towards S utilise eps_step 426 442 // as a measure of the relative accuracy of each Step. 427 443 G4FieldTrack 444 G4ChordFinder::ApproxCurvePointS( const G4FieldTrack& CurveA_PointVelocity, 445 const G4FieldTrack& CurveB_PointVelocity, 446 const G4ThreeVector& CurrentE_Point, 447 const G4ThreeVector& CurrentF_Point, 448 const G4ThreeVector& PointG, 449 G4bool first, G4double eps_step) 450 { 451 452 453 G4FieldTrack EndPoint( CurveA_PointVelocity); 454 G4ThreeVector Point_A=CurveA_PointVelocity.GetPosition(); 455 G4ThreeVector Point_B=CurveB_PointVelocity.GetPosition(); 456 G4double xa,xb,xc,ya,yb,yc; 457 458 //InverseParabolic 459 //AF Intersects (First Part of Curve) 460 if(first){ 461 xa=0.; 462 ya=(PointG-Point_A).mag(); 463 xb=(Point_A-CurrentF_Point).mag(); 464 yb=-(PointG-CurrentF_Point).mag(); 465 xc=(Point_A-Point_B).mag(); 466 yc=-(CurrentE_Point-Point_B).mag(); 467 } 468 else{ 469 xa=0.; 470 ya=(Point_A-PointG).mag(); 471 xb=(Point_B-Point_A).mag(); 472 yb=-(PointG-Point_B).mag(); 473 xc=-(Point_A-CurrentF_Point).mag(); 474 yc=-(Point_A-CurrentE_Point).mag(); 475 476 } 477 const G4double tolerance= 1.e-12; 478 if(ya<=tolerance||std::abs(yc)<=tolerance){ 479 ; //What to do for the moment return the same point as in begin 480 //Then PropagatorInField will take care 481 } 482 else{ 483 484 G4double test_step =InvParabolic(xa,ya,xb,yb,xc,yc); 485 G4double curve=std::abs(EndPoint.GetCurveLength()-CurveB_PointVelocity.GetCurveLength()); 486 G4double dist= (EndPoint.GetPosition()-Point_B).mag(); 487 if(test_step<=0) { test_step=0.1*xb;} 488 if(test_step>=xb){ test_step=0.5*xb;} 489 490 491 if(curve*(1.+eps_step)<dist){ 492 test_step=0.5*dist; 493 } 494 495 G4bool goodAdvance; 496 goodAdvance= 497 fIntgrDriver->AccurateAdvance(EndPoint,test_step, eps_step); 498 // *************** 499 500 #ifdef G4DEBUG_FIELD 501 G4cout<<"G4ChordFinder:: test-step ShF="<<test_step<<" EndPoint="<<EndPoint<<G4endl; 502 // Test Track 503 G4FieldTrack TestTrack( CurveA_PointVelocity); 504 TestTrack = ApproxCurvePointV( CurveA_PointVelocity, 505 CurveB_PointVelocity, 506 CurrentE_Point, 507 eps_step ); 508 G4cout.precision(14); 509 G4cout<<"G4ChordFinder:: BrentApprox="<<EndPoint<<G4endl; 510 G4cout<<"G4ChordFinder::LinearApprox="<<TestTrack<<G4endl; 511 #endif 512 } 513 return EndPoint; 514 } 515 428 516 G4FieldTrack 429 517 G4ChordFinder::ApproxCurvePointV( const G4FieldTrack& CurveA_PointVelocity, … … 435 523 // if r=|AE|/|AB|, and s=true path lenght (AB) 436 524 // return the point that is r*s along the curve! 437 438 G4FieldTrack Current_PointVelocity= CurveA_PointVelocity; 525 ///////////////////////////// 526 // 527 //2st implementation : Inverse Parabolic Extrapolation by D.C.Williams 528 // 529 // Uses InvParabolic (xa,ya,xb,yb,xc,yc) 530 531 G4FieldTrack Current_PointVelocity = CurveA_PointVelocity; 439 532 440 533 G4ThreeVector CurveA_Point= CurveA_PointVelocity.GetPosition(); … … 520 613 // If there was a memory of the step_length actually require at the start 521 614 // of the integration Step, this could be re-used ... 522 615 G4cout.precision(14); 616 617 // G4cout<<"G4ChordFinder::LinearApprox="<<Current_PointVelocity<<G4endl; 523 618 return Current_PointVelocity; 524 619 } -
trunk/source/geometry/magneticfield/src/G4ClassicalRK4.cc
r831 r850 26 26 // 27 27 // $Id: G4ClassicalRK4.cc,v 1.12 2006/06/29 18:23:37 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // ------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4DELPHIMagField.cc
r831 r850 26 26 // 27 27 // $Id: G4DELPHIMagField.cc,v 1.6 2006/06/29 18:23:39 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // ------------------------------------------------------------------- 30 30 -
trunk/source/geometry/magneticfield/src/G4ElectricField.cc
r831 r850 26 26 // 27 27 // $Id: G4ElectricField.cc,v 1.2 2006/06/29 18:23:42 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4ElectroMagneticField.cc
r831 r850 26 26 // 27 27 // $Id: G4ElectroMagneticField.cc,v 1.3 2006/06/29 18:23:44 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4EqEMFieldWithSpin.cc
r831 r850 25 25 // 26 26 // 27 // $Id: G4EqEMFieldWithSpin.cc,v 1. 1.2.1 2008/04/24 12:43:57 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-01-patch-02$27 // $Id: G4EqEMFieldWithSpin.cc,v 1.2 2008/04/24 12:33:08 tnikitin Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4EqMagElectricField.cc
r831 r850 25 25 // 26 26 // 27 // $Id: G4EqMagElectricField.cc,v 1.1 3.4.1 2008/04/24 12:43:57 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-01-patch-02$27 // $Id: G4EqMagElectricField.cc,v 1.14 2008/04/24 12:33:35 tnikitin Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4EquationOfMotion.cc
r831 r850 26 26 // 27 27 // $Id: G4EquationOfMotion.cc,v 1.9 2006/06/29 18:23:48 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // ------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4ErrorMag_UsualEqRhs.cc
r831 r850 26 26 // 27 27 // $Id: G4ErrorMag_UsualEqRhs.cc,v 1.1 2007/05/16 12:54:02 gcosmo Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4ExactHelixStepper.cc
r831 r850 26 26 // 27 27 // $Id: G4ExactHelixStepper.cc,v 1.8 2007/12/10 16:29:47 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // Helix a-la-Explicity Euler: x_1 = x_0 + helix(h) -
trunk/source/geometry/magneticfield/src/G4ExplicitEuler.cc
r831 r850 26 26 // 27 27 // $Id: G4ExplicitEuler.cc,v 1.8 2006/06/29 18:23:53 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4FieldManager.cc
r831 r850 26 26 // 27 27 // $Id: G4FieldManager.cc,v 1.15 2007/12/07 15:34:10 japost Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // ------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4FieldManagerStore.cc
r831 r850 26 26 // 27 27 // $Id: G4FieldManagerStore.cc,v 1.4 2008/01/17 10:56:23 gcosmo Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // G4FieldManagerStore -
trunk/source/geometry/magneticfield/src/G4FieldTrack.cc
r831 r850 26 26 // 27 27 // $Id: G4FieldTrack.cc,v 1.14 2007/10/03 15:34:42 japost Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // ------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4HarmonicPolMagField.cc
r831 r850 26 26 // 27 27 // $Id: G4HarmonicPolMagField.cc,v 1.6 2006/06/29 18:24:00 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // ------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4HelixExplicitEuler.cc
r831 r850 26 26 // 27 27 // $Id: G4HelixExplicitEuler.cc,v 1.8 2007/12/10 16:29:49 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4HelixHeum.cc
r831 r850 26 26 // 27 27 // $Id: G4HelixHeum.cc,v 1.6 2006/06/29 18:24:04 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4HelixImplicitEuler.cc
r831 r850 26 26 // 27 27 // $Id: G4HelixImplicitEuler.cc,v 1.6 2006/06/29 18:24:06 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4HelixSimpleRunge.cc
r831 r850 26 26 // 27 27 // $Id: G4HelixSimpleRunge.cc,v 1.7 2006/06/29 18:24:08 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4ImplicitEuler.cc
r831 r850 26 26 // 27 27 // $Id: G4ImplicitEuler.cc,v 1.9 2006/06/29 18:24:11 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4LineCurrentMagField.cc
r831 r850 25 25 // 26 26 // $Id: G4LineCurrentMagField.cc,v 1.6 2006/06/29 18:24:13 gunter Exp $ 27 // GEANT4 tag $Name: $27 // GEANT4 tag $Name: HEAD $ 28 28 // ------------------------------------------------------------------- 29 29 -
trunk/source/geometry/magneticfield/src/G4LineSection.cc
r831 r850 26 26 // 27 27 // $Id: G4LineSection.cc,v 1.10 2006/06/29 18:24:16 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4MagErrorStepper.cc
r831 r850 26 26 // 27 27 // $Id: G4MagErrorStepper.cc,v 1.13 2006/06/29 18:24:18 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4MagHelicalStepper.cc
r831 r850 26 26 // 27 27 // $Id: G4MagHelicalStepper.cc,v 1.23 2007/09/05 12:20:17 gcosmo Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4MagIntegratorDriver.cc
r831 r850 26 26 // 27 27 // $Id: G4MagIntegratorDriver.cc,v 1.49 2007/08/17 12:30:33 gcosmo Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4MagIntegratorStepper.cc
r831 r850 26 26 // 27 27 // $Id: G4MagIntegratorStepper.cc,v 1.11 2006/06/29 18:24:34 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4Mag_EqRhs.cc
r831 r850 26 26 // 27 27 // $Id: G4Mag_EqRhs.cc,v 1.11 2006/06/29 18:24:36 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // This is the standard right-hand side for equation of motion -
trunk/source/geometry/magneticfield/src/G4Mag_SpinEqRhs.cc
r831 r850 26 26 // 27 27 // $Id: G4Mag_SpinEqRhs.cc,v 1.12 2006/06/29 18:24:39 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // This is the standard right-hand side for equation of motion. -
trunk/source/geometry/magneticfield/src/G4Mag_UsualEqRhs.cc
r831 r850 26 26 // 27 27 // $Id: G4Mag_UsualEqRhs.cc,v 1.12 2006/06/29 18:24:42 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4MagneticField.cc
r831 r850 26 26 // 27 27 // $Id: G4MagneticField.cc,v 1.3 2006/06/29 18:24:44 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4QuadrupoleMagField.cc
r831 r850 26 26 // 27 27 // $Id: G4QuadrupoleMagField.cc,v 1.4 2006/06/29 18:24:46 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // ------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4RKG3_Stepper.cc
r831 r850 26 26 // 27 27 // $Id: G4RKG3_Stepper.cc,v 1.15 2007/08/21 10:17:41 tnikitin Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // ------------------------------------------------------------------- -
trunk/source/geometry/magneticfield/src/G4SimpleHeum.cc
r831 r850 26 26 // 27 27 // $Id: G4SimpleHeum.cc,v 1.8 2006/06/29 18:24:51 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // Simple Heum: -
trunk/source/geometry/magneticfield/src/G4SimpleRunge.cc
r831 r850 26 26 // 27 27 // $Id: G4SimpleRunge.cc,v 1.10 2006/06/29 18:24:53 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // Simple Runge: -
trunk/source/geometry/magneticfield/src/G4UniformElectricField.cc
r831 r850 26 26 // 27 27 // $Id: G4UniformElectricField.cc,v 1.12 2006/06/29 18:24:56 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // -
trunk/source/geometry/magneticfield/src/G4UniformMagField.cc
r831 r850 26 26 // 27 27 // $Id: G4UniformMagField.cc,v 1.11 2006/06/29 18:24:58 gunter Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 //
Note: See TracChangeset
for help on using the changeset viewer.