Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.121 2007/06/08 09:38:43 gcosmo Exp $
|
||||
$Id: History,v 1.125.2.2 2007/12/10 13:17:13 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,14 +17,42 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
June 8th, 2007 T. Nikitina - field-V08-03-03
|
||||
--------------------------
|
||||
- Relax FatalExeption to Warning in AccurateAdvance() for case of step zero
|
||||
and return previous value. This fixes problem observed by ATLAS in release
|
||||
8.3 when using very conservative values for field parameters.
|
||||
September 9th, 2007 G.Cosmo - field-V09-00-02a
|
||||
----------------------------
|
||||
- Some code cleanup in G4MagHelicalStepper.cc.
|
||||
|
||||
May 18th, 2007 T. Nikitina - field-V08-03-02
|
||||
--------------------------
|
||||
August 30th, 2007 P.Gumplinger - field-V09-00-02
|
||||
---------------------------------
|
||||
- Add G4EqEMFieldWithSpin class to allow tracking of spin also in
|
||||
G4ElectroMagneticFields
|
||||
|
||||
August 21st, 2007 T.Nikitina - field-V09-00-01
|
||||
-------------------------------
|
||||
- Fix to DistChord() method for Helical Steppers: adopt 'special' case
|
||||
also for Ang<2pi not only for Ang<pi; use cos() in place of tan(), to
|
||||
improve CPU performance.
|
||||
- Improved AdvanceHelix() to be able to make half step and full step
|
||||
in one call.
|
||||
- In G4HelixMixedStepper added possibility to call different steppers for
|
||||
small steps and add some statistics how offen different steppers are called.
|
||||
- G4RKG3_Stepper: improved internal algorithm to use pre-computed values;
|
||||
the stepper now gives comparable CPU performance as ClassicalRK4.
|
||||
- Updated unit tests.
|
||||
|
||||
August 17th, 2007 G.Cosmo - field-V09-00-00
|
||||
----------------------------
|
||||
- Changed FatalException to EventMustBeAborted in AccurateAdvance()
|
||||
if proposed integration step is negative.
|
||||
|
||||
June 8th, 2007 T.Nikitina - field-V08-03-03
|
||||
----------------------------
|
||||
- Relaxed FatalException to Warning in G4MagIntegratorDriver::AccurateAdvance()
|
||||
for case of step zero and return previous value. This fixes problem
|
||||
observed by ATLAS in release 8.3 when requiring very accurate propagation
|
||||
-- ie using very small values for acceptable integration error.
|
||||
|
||||
May 18th, 2007 T.Nikitina - field-V08-03-02
|
||||
----------------------------
|
||||
- New class G4HelixMixedStepper, mixing helical stepper and RK
|
||||
G4MagHelicalStepper
|
||||
- Keep values of inverse Radius, ..
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.hh,v 1.10 2006/06/29 18:20:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4CashKarpRKF45
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ChordFinder.hh,v 1.17 2006/06/29 18:21:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ChordFinder
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ChordFinder.icc,v 1.12 2006/06/29 18:21:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// G4ChordFinder inline implementations
|
||||
//
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ChordFinderSaf.hh,v 1.3 2006/06/29 18:21:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ChordFinderRad
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ClassicalRK4.hh,v 1.10 2006/06/29 18:21:55 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ClassicalRK4
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DELPHIMagField.hh,v 1.4 2006/06/29 18:21:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4DELPHIMagField
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectricField.hh,v 1.2 2006/06/29 18:21:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ElectricField
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectroMagneticField.hh,v 1.11 2006/06/29 18:22:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ElectroMagneticField
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EqEMFieldWithSpin.hh,v 1.1 2007/08/30 23:34:01 gum Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4EqEMFieldWithSpin
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This is the right-hand side of equation of motion in a combined
|
||||
// electric and magnetic field.
|
||||
|
||||
// History:
|
||||
// - Created. Chris Gong, P.Gumplinger, 30.08.2007
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef G4EQEMFIELDWITHSPIN_hh
|
||||
#define G4EQEMFIELDWITHSPIN_hh
|
||||
|
||||
#include "G4EquationOfMotion.hh"
|
||||
#include "G4ElectroMagneticField.hh"
|
||||
|
||||
class G4EqEMFieldWithSpin : public G4EquationOfMotion
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4EqEMFieldWithSpin(G4ElectroMagneticField *emField );
|
||||
|
||||
~G4EqEMFieldWithSpin() {;}
|
||||
|
||||
void SetChargeMomentumMass(G4double particleCharge, // in e+ units
|
||||
G4double MomentumXc,
|
||||
G4double mass);
|
||||
|
||||
void EvaluateRhsGivenB(const G4double y[],
|
||||
const G4double Field[],
|
||||
G4double dydx[] ) const;
|
||||
// Given the value of the electromagnetic field, this function
|
||||
// calculates the value of the derivative dydx.
|
||||
|
||||
private:
|
||||
|
||||
G4double fElectroMagCof ;
|
||||
G4double fMassCof;
|
||||
|
||||
G4double omegac;
|
||||
G4double anomaly;
|
||||
G4double ParticleCharge;
|
||||
G4double E;
|
||||
G4double gamma;
|
||||
G4double beta;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EqMagElectricField.hh,v 1.9 2006/06/29 18:22:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4EqMagElectricField
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EquationOfMotion.hh,v 1.10 2006/06/29 18:22:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4EquationOfMotion
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EquationOfMotion.icc,v 1.9 2006/06/29 18:22:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Inline implementation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorMag_UsualEqRhs.hh,v 1.1 2007/05/16 12:54:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ExactHelixStepper.hh,v 1.5 2007/05/18 12:50:31 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ExactHelixStepper
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ExplicitEuler.hh,v 1.9 2006/06/29 18:22:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ExplicitEuler
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Field.hh,v 1.10 2006/06/29 18:22:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4Field
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldManager.hh,v 1.16 2006/06/29 18:22:15 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4FieldManager
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldManager.icc,v 1.12 2006/06/29 18:22:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// G4FieldManager inline implementation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldTrack.hh,v 1.21 2006/11/13 18:24:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4FieldTrack
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldTrack.icc,v 1.21 2006/11/13 18:24:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HarmonicPolMagField.hh,v 1.4 2006/06/29 18:22:24 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// class G4HarmonicPolMagField
|
||||
//
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.hh,v 1.8 2006/06/29 18:22:29 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4HelixExplicitEuler.hh,v 1.9 2007/08/21 08:52:00 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixExplicitEuler
|
||||
@@ -54,12 +54,18 @@ class G4HelixExplicitEuler : public G4MagHelicalStepper
|
||||
: G4MagHelicalStepper(EqRhs) {}
|
||||
|
||||
~G4HelixExplicitEuler() {}
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
G4ThreeVector Bfld,
|
||||
G4double h,
|
||||
G4double yout[]);
|
||||
void Stepper( const G4double y[],
|
||||
const G4double*,
|
||||
G4double h,
|
||||
G4double yout[],
|
||||
G4double yerr[] );
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
G4ThreeVector Bfld,
|
||||
G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
G4double DistChord() const;
|
||||
public: // without description
|
||||
|
||||
// DELETED RightHandSide( ) !!!!
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixHeum.hh,v 1.8 2006/06/29 18:22:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixHeum
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.hh,v 1.8 2006/06/29 18:22:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixImplicitEuler
|
||||
|
||||
@@ -29,9 +29,21 @@
|
||||
//
|
||||
// G4HelixMixedStepper split the Method used for Integration in two:
|
||||
//
|
||||
// If Stepping Angle ( h / R_curve) < pi/3 : use Classical RK4Stepper
|
||||
// If Stepping Angle ( h / R_curve) < pi/3 : use Stepper for small step
|
||||
//
|
||||
// Else use HelixExplicitEuler Stepper
|
||||
//
|
||||
// Stepper for the small step is G4ClassicalRK4 by default, but
|
||||
// it possible to choose other stepper,like G4CashKarpRK45 or G4RKG3_Stepper,
|
||||
// by setting StepperNumber : new HelixMixedStepper(EqRhs,N)
|
||||
//
|
||||
// N=0 G4ExplicitEuler; N=1 G4ImplicitEuler;
|
||||
// N=2 G4SimpleRunge; N=3 G4SimpleHeum;
|
||||
// N=4 G4ClassicalRK4; N=5 G4HelixExplicitEuler;
|
||||
// N=6 G4HelixExplicitEuler; N=7 G4HelixSimpleRunge;
|
||||
// N=8 G4CashKarpRK45; N=9 G4ExactHelixStepper;
|
||||
// N=10 G4RKG3_Stepper;
|
||||
//
|
||||
// History:
|
||||
// Derived from ExactHelicalStepper 18/05/07
|
||||
//
|
||||
@@ -48,7 +60,7 @@ class G4HelixMixedStepper: public G4MagHelicalStepper
|
||||
|
||||
public:
|
||||
|
||||
G4HelixMixedStepper(G4Mag_EqRhs *EqRhs);
|
||||
G4HelixMixedStepper(G4Mag_EqRhs *EqRhs,G4int fStepperNumber=0);
|
||||
~G4HelixMixedStepper();
|
||||
|
||||
void Stepper( const G4double y[],
|
||||
@@ -67,19 +79,28 @@ class G4HelixMixedStepper: public G4MagHelicalStepper
|
||||
G4double yout[]);
|
||||
G4double DistChord() const;
|
||||
// Estimate maximum distance of curved solution and chord ...
|
||||
|
||||
|
||||
public: // with description
|
||||
|
||||
inline void SetVerbose (G4int newvalue){fVerbose=newvalue;}
|
||||
|
||||
public: // without description
|
||||
public: // without description
|
||||
void PrintCalls();
|
||||
G4MagIntegratorStepper* SetupStepper(G4Mag_EqRhs* EqRhs, G4int StepperName);
|
||||
|
||||
|
||||
G4int IntegratorOrder() const { return 4; }
|
||||
|
||||
private:
|
||||
// Mixed Integration RK4 for 'small' steps
|
||||
G4MagIntegratorStepper* fRK4Stepper;
|
||||
|
||||
|
||||
private:
|
||||
// Used for DistChord Calculation
|
||||
G4double fLastStepSize; // Length of last step
|
||||
|
||||
|
||||
// Used for statistic = how many calls to different steppers
|
||||
G4int fVerbose;
|
||||
G4int fNumCallsRK4;
|
||||
G4int fNumCallsHelix;
|
||||
|
||||
};
|
||||
|
||||
#endif /* G4HELIXMIXEDSTEPPER_HH */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.hh,v 1.7 2006/06/29 18:22:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixSimpleRunge
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ImplicitEuler.hh,v 1.8 2006/06/29 18:22:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4ImplicitEuler
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LineCurrentMagField.hh,v 1.4 2006/06/29 18:22:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4LineCurrentMagField
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LineSection.hh,v 1.9 2006/06/29 18:22:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4LineSection
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagErrorStepper.hh,v 1.11 2006/06/29 18:22:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagErrorStepper
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagErrorStepper.icc,v 1.13 2006/06/29 18:22:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.hh,v 1.13 2007/05/18 15:45:22 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.hh,v 1.15 2007/08/21 08:48:28 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4MagHelicalStepper
|
||||
@@ -83,7 +85,7 @@ class G4MagHelicalStepper : public G4MagIntegratorStepper
|
||||
void AdvanceHelix( const G4double yIn[],
|
||||
G4ThreeVector Bfld,
|
||||
G4double h,
|
||||
G4double yHelix[]); // output
|
||||
G4double yHelix[],G4double yHelix2[]=0); // output
|
||||
// A first order Step along a helix inside the field.
|
||||
|
||||
inline void MagFieldEvaluate( const G4double y[], G4ThreeVector& Bfield );
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.icc,v 1.13 2007/05/18 15:45:15 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// Linear Step in regions of no field
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.hh,v 1.20 2007/05/10 10:10:05 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagInt_Driver
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.icc,v 1.13 2007/05/10 10:10:48 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.hh,v 1.12 2006/09/20 09:31:01 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagIntegratorStepper
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.icc,v 1.10 2006/09/20 09:31:46 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
inline
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.hh,v 1.9 2006/06/29 18:23:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_EqRhs
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_SpinEqRhs.hh,v 1.11 2006/06/29 18:23:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_SpinEqRhs
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_UsualEqRhs.hh,v 1.7 2006/06/29 18:23:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_UsualEqRhs
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagneticField.hh,v 1.14 2006/06/29 18:23:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagneticField
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4QuadrupoleMagField.hh,v 1.4 2006/06/29 18:23:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4QuadrupoleMagField
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RKG3_Stepper.hh,v 1.13 2007/05/18 12:44:02 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleHeum.hh,v 1.8 2006/06/29 18:23:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4SimpleHeum
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleRunge.hh,v 1.8 2006/06/29 18:23:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4SimpleRunge
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UniformElectricField.hh,v 1.9 2006/06/29 18:23:25 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4UniformElectricField
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UniformMagField.hh,v 1.9 2006/06/29 18:23:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// class G4UniformMagField
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.cc,v 1.14 2006/06/29 18:23:29 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
|
||||
// order method (giving fifth-order accuracy) for the solution of an ODE.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ChordFinder.cc,v 1.47 2006/06/29 18:23:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// 25.02.97 John Apostolakis, design and implimentation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ClassicalRK4.cc,v 1.12 2006/06/29 18:23:37 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DELPHIMagField.cc,v 1.6 2006/06/29 18:23:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4DELPHIMagField.hh"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectricField.cc,v 1.2 2006/06/29 18:23:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectroMagneticField.cc,v 1.3 2006/06/29 18:23:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EqEMFieldWithSpin.cc,v 1.1 2007/08/30 23:34:19 gum Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion.
|
||||
//
|
||||
// The only case another is required is when using a moving reference
|
||||
// frame ... or extending the class to include additional Forces,
|
||||
// eg an electric field
|
||||
//
|
||||
// 30.08.2007 Chris Gong, Peter Gumplinger
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4EqEMFieldWithSpin.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
G4EqEMFieldWithSpin::G4EqEMFieldWithSpin(G4ElectroMagneticField *emField )
|
||||
: G4EquationOfMotion( emField ) { anomaly = 1.165923e-3; }
|
||||
|
||||
void
|
||||
G4EqEMFieldWithSpin::SetChargeMomentumMass(G4double particleCharge, // e+ units
|
||||
G4double MomentumXc,
|
||||
G4double particleMass)
|
||||
{
|
||||
fElectroMagCof = eplus*particleCharge*c_light ;
|
||||
fMassCof = particleMass*particleMass ;
|
||||
|
||||
omegac = 0.105658387*GeV/particleMass * 2.837374841e-3*(rad/cm/kilogauss);
|
||||
|
||||
ParticleCharge = particleCharge;
|
||||
|
||||
E = std::sqrt(sqr(MomentumXc)+sqr(particleMass));
|
||||
beta = MomentumXc/E;
|
||||
gamma = E/particleMass;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
G4EqEMFieldWithSpin::EvaluateRhsGivenB(const G4double y[],
|
||||
const G4double Field[],
|
||||
G4double dydx[] ) const
|
||||
{
|
||||
|
||||
// Components of y:
|
||||
// 0-2 dr/ds,
|
||||
// 3-5 dp/ds - momentum derivatives
|
||||
|
||||
G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
|
||||
|
||||
G4double Energy = std::sqrt( pSquared + fMassCof );
|
||||
G4double cof2 = Energy/c_light ;
|
||||
|
||||
G4double pModuleInverse = 1.0/std::sqrt(pSquared) ;
|
||||
|
||||
// G4double inverse_velocity = Energy * c_light * pModuleInverse;
|
||||
G4double inverse_velocity = Energy * pModuleInverse / c_light;
|
||||
|
||||
G4double cof1 = fElectroMagCof*pModuleInverse ;
|
||||
|
||||
// G4double vDotE = y[3]*Field[3] + y[4]*Field[4] + y[5]*Field[5] ;
|
||||
|
||||
|
||||
dydx[0] = y[3]*pModuleInverse ;
|
||||
dydx[1] = y[4]*pModuleInverse ;
|
||||
dydx[2] = y[5]*pModuleInverse ;
|
||||
|
||||
dydx[3] = cof1*(cof2*Field[3] + (y[4]*Field[2] - y[5]*Field[1])) ;
|
||||
|
||||
dydx[4] = cof1*(cof2*Field[4] + (y[5]*Field[0] - y[3]*Field[2])) ;
|
||||
|
||||
dydx[5] = cof1*(cof2*Field[5] + (y[3]*Field[1] - y[4]*Field[0])) ;
|
||||
|
||||
// Lab Time of flight
|
||||
dydx[7] = inverse_velocity;
|
||||
|
||||
G4ThreeVector BField(Field[0],Field[1],Field[2]);
|
||||
|
||||
G4ThreeVector u(y[3], y[4], y[5]);
|
||||
u *= pModuleInverse;
|
||||
|
||||
G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u);
|
||||
G4double ucb = (anomaly+1./gamma)/beta;
|
||||
|
||||
G4ThreeVector Spin(y[9],y[10],y[11]);
|
||||
G4ThreeVector dSpin;
|
||||
|
||||
dSpin = ParticleCharge*omegac*(ucb*(Spin.cross(BField))-udb*(Spin.cross(u)));
|
||||
|
||||
dydx[ 9] = dSpin.x();
|
||||
dydx[10] = dSpin.y();
|
||||
dydx[11] = dSpin.z();
|
||||
|
||||
return ;
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EqMagElectricField.cc,v 1.13 2006/06/29 18:23:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EquationOfMotion.cc,v 1.9 2006/06/29 18:23:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ErrorMag_UsualEqRhs.cc,v 1.1 2007/05/16 12:54:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ExactHelixStepper.cc,v 1.6 2007/05/18 15:49:18 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4ExactHelixStepper.cc,v 1.8 2007/12/10 16:29:47 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// Helix a-la-Explicity Euler: x_1 = x_0 + helix(h)
|
||||
// with helix(h) being a helix piece of length h
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
G4ExactHelixStepper::G4ExactHelixStepper(G4Mag_EqRhs *EqRhs)
|
||||
: G4MagHelicalStepper(EqRhs),
|
||||
fBfieldValue(DBL_MAX, DBL_MAX, DBL_MAX), yInitialEHS(DBL_MAX), yFinalEHS(-DBL_MAX),
|
||||
fLastStepSize( DBL_MAX )
|
||||
fBfieldValue(DBL_MAX, DBL_MAX, DBL_MAX), yInitialEHS(DBL_MAX), yFinalEHS(-DBL_MAX)
|
||||
|
||||
{
|
||||
const G4int nvar = 6 ;
|
||||
G4int i;
|
||||
@@ -89,7 +89,7 @@ G4ExactHelixStepper::Stepper( const G4double yInput[],
|
||||
yInitialEHS = G4ThreeVector( yInput[0], yInput[1], yInput[2]);
|
||||
yFinalEHS = G4ThreeVector( yOut[0], yOut[1], yOut[2]);
|
||||
fBfieldValue=Bfld_value;
|
||||
fLastStepSize=hstep;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -115,22 +115,25 @@ G4double G4ExactHelixStepper::DistChord() const
|
||||
// Else DistChord=R_helix
|
||||
//
|
||||
G4double distChord;
|
||||
G4double H_helix;
|
||||
H_helix=fLastStepSize;
|
||||
G4double Ang_curve=GetAngCurve();
|
||||
if(Ang_curve<pi){
|
||||
|
||||
distChord=0.5*H_helix*std::tan(0.25*Ang_curve);
|
||||
|
||||
}
|
||||
else{
|
||||
distChord=GetRadHelix();
|
||||
|
||||
if(Ang_curve<=pi){
|
||||
distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve));
|
||||
}
|
||||
else
|
||||
if(Ang_curve<twopi){
|
||||
distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve)));
|
||||
}
|
||||
else{
|
||||
distChord=2.*GetRadHelix();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return distChord;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
G4int
|
||||
G4ExactHelixStepper::IntegratorOrder() const
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ExplicitEuler.cc,v 1.8 2006/06/29 18:23:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Explicit Euler: x_1 = x_0 + h * dx_0
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldManager.cc,v 1.14 2006/06/29 18:23:55 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldTrack.cc,v 1.13 2006/06/29 18:23:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HarmonicPolMagField.cc,v 1.6 2006/06/29 18:24:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.cc,v 1.6 2006/06/29 18:24:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4HelixExplicitEuler.cc,v 1.8 2007/12/10 16:29:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Helix Explicit Euler: x_1 = x_0 + helix(h)
|
||||
@@ -39,13 +39,73 @@
|
||||
#include "G4HelixExplicitEuler.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
|
||||
void G4HelixExplicitEuler::Stepper( const G4double yInput[7],
|
||||
const G4double*,
|
||||
G4double Step,
|
||||
G4double yOut[7],
|
||||
G4double yErr[])
|
||||
|
||||
{
|
||||
|
||||
//Estimation of the Stepping Angle
|
||||
|
||||
G4ThreeVector Bfld;
|
||||
MagFieldEvaluate(yInput, Bfld);
|
||||
|
||||
const G4int nvar = 6 ;
|
||||
G4int i;
|
||||
G4double yTemp[7], yIn[7] ;
|
||||
G4ThreeVector Bfld_midpoint;
|
||||
// Saving yInput because yInput and yOut can be aliases for same array
|
||||
for(i=0;i<nvar;i++) yIn[i]=yInput[i];
|
||||
|
||||
G4double h = Step * 0.5;
|
||||
|
||||
// Do full step and two half steps
|
||||
G4double yTemp2[7];
|
||||
AdvanceHelix(yIn, Bfld, h, yTemp2,yTemp);
|
||||
MagFieldEvaluate(yTemp2, Bfld_midpoint) ;
|
||||
AdvanceHelix(yTemp2, Bfld_midpoint, h, yOut);
|
||||
|
||||
// Error estimation
|
||||
for(i=0;i<nvar;i++) {
|
||||
yErr[i] = yOut[i] - yTemp[i] ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double G4HelixExplicitEuler::DistChord() const
|
||||
{
|
||||
// Implementation : must check whether h/R > 2 pi !!
|
||||
// If( h/R < pi) use G4LineSection::DistLine
|
||||
// Else DistChord=R_helix
|
||||
//
|
||||
G4double distChord;
|
||||
G4double Ang_curve=GetAngCurve();
|
||||
|
||||
|
||||
if(Ang_curve<=pi){
|
||||
distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve));
|
||||
}
|
||||
else
|
||||
if(Ang_curve<twopi){
|
||||
distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve)));
|
||||
}
|
||||
else{
|
||||
distChord=2.*GetRadHelix();
|
||||
}
|
||||
|
||||
return distChord;
|
||||
|
||||
}
|
||||
void
|
||||
G4HelixExplicitEuler::DumbStepper( const G4double yIn[],
|
||||
G4ThreeVector Bfld,
|
||||
G4double h,
|
||||
G4double yOut[])
|
||||
G4double h,
|
||||
G4double yOut[])
|
||||
{
|
||||
AdvanceHelix(yIn, Bfld, h, yOut);
|
||||
|
||||
// NormaliseTangentVector( yOut ); // this could harm more than it helps
|
||||
|
||||
AdvanceHelix(yIn, Bfld, h, yOut);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixHeum.cc,v 1.6 2006/06/29 18:24:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Simple Heum:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.cc,v 1.6 2006/06/29 18:24:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Helix Implicit Euler:
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
//
|
||||
// G4HelixMixedStepper split the Method used for Integration in two:
|
||||
//
|
||||
// If Stepping Angle ( h / R_curve) < pi/3 use Classical RK4Stepper
|
||||
// If Stepping Angle ( h / R_curve) < pi/3
|
||||
// use Stepper for small step(ClassicalRK4 by default)
|
||||
// Else use HelixExplicitEuler Stepper
|
||||
//
|
||||
// History:
|
||||
@@ -39,17 +40,33 @@
|
||||
|
||||
#include "G4HelixMixedStepper.hh"
|
||||
#include "G4ClassicalRK4.hh"
|
||||
#include "G4CashKarpRKF45.hh"
|
||||
#include "G4SimpleRunge.hh"
|
||||
#include "G4HelixImplicitEuler.hh"
|
||||
#include "G4HelixExplicitEuler.hh"
|
||||
#include "G4HelixSimpleRunge.hh"
|
||||
#include "G4ExactHelixStepper.hh"
|
||||
#include "G4ExplicitEuler.hh"
|
||||
#include "G4ImplicitEuler.hh"
|
||||
#include "G4SimpleHeum.hh"
|
||||
#include "G4RKG3_Stepper.hh"
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
G4HelixMixedStepper::G4HelixMixedStepper(G4Mag_EqRhs *EqRhs)
|
||||
#include "G4LineSection.hh"
|
||||
G4HelixMixedStepper::G4HelixMixedStepper(G4Mag_EqRhs *EqRhs,G4int fStepperNumber)
|
||||
: G4MagHelicalStepper(EqRhs)
|
||||
|
||||
{
|
||||
|
||||
fRK4Stepper= new G4ClassicalRK4(EqRhs);
|
||||
SetVerbose(1); fNumCallsRK4=0; fNumCallsHelix=0;
|
||||
if(!fStepperNumber) fStepperNumber=4;
|
||||
fRK4Stepper = SetupStepper(EqRhs, fStepperNumber);
|
||||
}
|
||||
|
||||
|
||||
G4HelixMixedStepper::~G4HelixMixedStepper() {
|
||||
|
||||
delete(fRK4Stepper);
|
||||
if (fVerbose>0){ PrintCalls();};
|
||||
}
|
||||
void G4HelixMixedStepper::Stepper( const G4double yInput[7],
|
||||
const G4double dydx[7],
|
||||
@@ -74,33 +91,34 @@ void G4HelixMixedStepper::Stepper( const G4double yInput[7],
|
||||
R_1=std::abs(GetInverseCurve(velocityVal,Bmag));
|
||||
Ang_curve=R_1*Step;
|
||||
SetAngCurve(Ang_curve);
|
||||
fLastStepSize=Step;
|
||||
SetCurve(std::abs(1/R_1));
|
||||
|
||||
|
||||
if(Ang_curve<0.33*pi){
|
||||
fNumCallsRK4++;
|
||||
fRK4Stepper->Stepper(yInput,dydx,Step,yOut,yErr);
|
||||
|
||||
fRK4Stepper->Stepper(yInput,dydx,Step,yOut,yErr);
|
||||
|
||||
}
|
||||
else{
|
||||
fNumCallsHelix++;
|
||||
const G4int nvar = 6 ;
|
||||
G4int i;
|
||||
G4double yTemp[7], yIn[7] ;
|
||||
G4double yTemp2[7];
|
||||
G4ThreeVector Bfld_midpoint;
|
||||
// Saving yInput because yInput and yOut can be aliases for same array
|
||||
for(i=0;i<nvar;i++) yIn[i]=yInput[i];
|
||||
|
||||
G4double h = Step * 0.5;
|
||||
|
||||
// Do two half steps
|
||||
AdvanceHelix(yIn, Bfld, h, yTemp);
|
||||
// Do two half steps and full step
|
||||
AdvanceHelix(yIn, Bfld, h, yTemp,yTemp2);
|
||||
MagFieldEvaluate(yTemp, Bfld_midpoint) ;
|
||||
AdvanceHelix(yTemp, Bfld_midpoint, h, yOut);
|
||||
// Do a full step
|
||||
h = Step ;
|
||||
AdvanceHelix(yIn, Bfld, h, yTemp);
|
||||
// Error estimation
|
||||
for(i=0;i<nvar;i++) {
|
||||
yErr[i] = yOut[i] - yTemp[i] ;
|
||||
yErr[i] = yOut[i] - yTemp2[i] ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +140,6 @@ G4HelixMixedStepper::DumbStepper( const G4double yIn[],
|
||||
|
||||
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
G4double G4HelixMixedStepper::DistChord() const
|
||||
{
|
||||
@@ -131,19 +148,54 @@ G4double G4HelixMixedStepper::DistChord() const
|
||||
// Else DistChord=R_helix
|
||||
//
|
||||
G4double distChord;
|
||||
G4double H_helix;
|
||||
H_helix=fLastStepSize;
|
||||
G4double Ang_curve=GetAngCurve();
|
||||
|
||||
if(Ang_curve<pi){
|
||||
|
||||
distChord=0.5*H_helix*std::tan(0.25*Ang_curve);
|
||||
|
||||
}
|
||||
else{
|
||||
distChord=GetRadHelix();
|
||||
}
|
||||
|
||||
|
||||
if(Ang_curve<=pi){
|
||||
distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve));
|
||||
}
|
||||
else
|
||||
if(Ang_curve<twopi){
|
||||
distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve)));
|
||||
}
|
||||
else{
|
||||
distChord=2.*GetRadHelix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return distChord;
|
||||
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
void G4HelixMixedStepper::PrintCalls()
|
||||
{
|
||||
G4cout<<"In HelixMixedStepper::Number of calls to smallStepStepper = "<<fNumCallsRK4
|
||||
<<" and Number of calls to Helix = "<<fNumCallsHelix<<G4endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
G4MagIntegratorStepper* G4HelixMixedStepper:: SetupStepper(G4Mag_EqRhs* pE, G4int StepperNumber)
|
||||
{
|
||||
G4MagIntegratorStepper* pStepper;
|
||||
if (fVerbose>0)G4cout<<"In G4HelixMixedStepper Stepper for small steps is ";
|
||||
switch ( StepperNumber )
|
||||
{
|
||||
case 0: pStepper = new G4ExplicitEuler( pE ); if (fVerbose>0)G4cout<<"G4ExplicitEuler"<<G4endl; break;
|
||||
case 1: pStepper = new G4ImplicitEuler( pE ); if (fVerbose>0)G4cout<<"G4ImplicitEuler"<<G4endl; break;
|
||||
case 2: pStepper = new G4SimpleRunge( pE ); if (fVerbose>0)G4cout<<"G4SimpleRunge"<<G4endl; break;
|
||||
case 3: pStepper = new G4SimpleHeum( pE ); if (fVerbose>0)G4cout<<"G4SimpleHeum"<<G4endl;break;
|
||||
case 4: pStepper = new G4ClassicalRK4( pE ); if (fVerbose>0)G4cout<<"G4ClassicalRK4"<<G4endl; break;
|
||||
case 5: pStepper = new G4HelixExplicitEuler( pE ); if (fVerbose>0)G4cout<<"G4HelixExplicitEuler"<<G4endl; break;
|
||||
case 6: pStepper = new G4HelixImplicitEuler( pE ); if (fVerbose>0)G4cout<<"G4HelixImplicitEuler"<<G4endl; break;
|
||||
case 7: pStepper = new G4HelixSimpleRunge( pE ); if (fVerbose>0)G4cout<<"G4HelixSimpleRunge"<<G4endl; break;
|
||||
case 8: pStepper = new G4CashKarpRKF45( pE ); if (fVerbose>0)G4cout<<"G4CashKarpRKF45"<<G4endl; break;
|
||||
case 9: pStepper = new G4ExactHelixStepper( pE ); if (fVerbose>0)G4cout<<"G4ExactHelixStepper"<<G4endl; break;
|
||||
case 10: pStepper = new G4RKG3_Stepper( pE ); if (fVerbose>0)G4cout<<"G4RKG3_Stepper"<<G4endl; break;
|
||||
|
||||
default: pStepper = new G4ClassicalRK4( pE );G4cout<<"Default G4ClassicalRK4"<<G4endl; break;
|
||||
|
||||
}
|
||||
return pStepper;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.cc,v 1.7 2006/06/29 18:24:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Simple Runge:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ImplicitEuler.cc,v 1.9 2006/06/29 18:24:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Implicit Euler:
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4LineCurrentMagField.cc,v 1.6 2006/06/29 18:24:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4LineCurrentMagField.hh"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LineSection.cc,v 1.10 2006/06/29 18:24:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagErrorStepper.cc,v 1.13 2006/06/29 18:24:18 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.19 2007/05/18 15:48:42 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.23 2007/09/05 12:20:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -37,65 +37,70 @@
|
||||
// (as in the normal runge-kutta-methods) is to add helix segments to the
|
||||
// current position
|
||||
|
||||
|
||||
// Constant for determining unit conversion when using normal as integrand.
|
||||
//
|
||||
const G4double G4MagHelicalStepper::fUnitConstant = 0.299792458*(GeV/(tesla*m));
|
||||
|
||||
|
||||
G4MagHelicalStepper::G4MagHelicalStepper(G4Mag_EqRhs *EqRhs)
|
||||
: G4MagIntegratorStepper(EqRhs, 6) // integrate over 6 variables only !!
|
||||
// position & velocity
|
||||
{
|
||||
fPtrMagEqOfMot = EqRhs;
|
||||
|
||||
}
|
||||
|
||||
G4MagHelicalStepper::~G4MagHelicalStepper()
|
||||
{
|
||||
}
|
||||
|
||||
// Constant for determining unit conversion when using normal as integrand.
|
||||
const G4double G4MagHelicalStepper::fUnitConstant = 0.299792458 * (GeV/(tesla*m));
|
||||
|
||||
void
|
||||
G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
G4ThreeVector Bfld,
|
||||
G4double h,
|
||||
G4double yHelix[])
|
||||
G4ThreeVector Bfld,
|
||||
G4double h,
|
||||
G4double yHelix[],
|
||||
G4double yHelix2[] )
|
||||
{
|
||||
// const G4int nvar = 6;
|
||||
|
||||
//OLD const G4double approc_limit = 0.05;
|
||||
// OLD const G4double approc_limit = 0.05;
|
||||
// OLD approc_limit = 0.05 gives max.error=x^5/5!=(0.05)^5/5!=2.6*e-9
|
||||
// NEW approc_limit = 0.005 gives max.error=x^5/5!=2.6*e-14
|
||||
|
||||
const G4double approc_limit = 0.005;
|
||||
G4ThreeVector Bnorm, B_x_P, vperp, vpar;
|
||||
// G4double norm;
|
||||
G4double B_d_P; // B_perp;
|
||||
G4double Theta; // , Theta_1;
|
||||
|
||||
G4double B_d_P;
|
||||
G4double B_v_P;
|
||||
G4double Theta;
|
||||
G4double R_1;
|
||||
G4double R_Helix;
|
||||
G4double CosT2, SinT2, CosT, SinT;
|
||||
//G4double CosT, SinT;
|
||||
G4ThreeVector positionMove, endTangent;
|
||||
|
||||
G4double Bmag = Bfld.mag();
|
||||
const G4double *pIn = yIn+3;
|
||||
G4ThreeVector initVelocity= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
|
||||
G4double velocityVal = initVelocity.mag();
|
||||
G4ThreeVector initTangent = (1.0/velocityVal) * initVelocity; // .unit();
|
||||
|
||||
R_1=GetInverseCurve(velocityVal,Bmag);
|
||||
G4ThreeVector initTangent = (1.0/velocityVal) * initVelocity;
|
||||
|
||||
R_1=GetInverseCurve(velocityVal,Bmag);
|
||||
|
||||
// for too small magnetic fields there is no curvature
|
||||
// (include momentum here) FIXME
|
||||
|
||||
if( (std::fabs(R_1) < 1e-10)||(Bmag<1e-12) ) {
|
||||
LinearStep( yIn, h, yHelix );
|
||||
// Store and/or calculate parameters for chord distance.
|
||||
|
||||
SetAngCurve(1.);
|
||||
SetCurve(h);
|
||||
SetRadHelix(0.);
|
||||
|
||||
} else {
|
||||
// Bnorm = Bfld.unit();
|
||||
if( (std::fabs(R_1) < 1e-10)||(Bmag<1e-12) )
|
||||
{
|
||||
LinearStep( yIn, h, yHelix );
|
||||
|
||||
// Store and/or calculate parameters for chord distance
|
||||
|
||||
SetAngCurve(1.);
|
||||
SetCurve(h);
|
||||
SetRadHelix(0.);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bnorm = (1.0/Bmag)*Bfld;
|
||||
|
||||
// calculate the direction of the force
|
||||
@@ -109,59 +114,71 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
vpar = B_d_P * Bnorm; // the component parallel to B
|
||||
vperp= initTangent - vpar; // the component perpendicular to B
|
||||
|
||||
// B_v_P = std::sqrt( 1 - B_d_P * B_d_P); // Fraction of P perp to B
|
||||
B_v_P = std::sqrt( 1 - B_d_P * B_d_P); // Fraction of P perp to B
|
||||
|
||||
// calculate the stepping angle
|
||||
|
||||
Theta = R_1 * h; // * B_v_P;
|
||||
Theta = R_1 * h; // * B_v_P;
|
||||
|
||||
// Trigonometrix
|
||||
// Trigonometrix
|
||||
|
||||
if( std::fabs(Theta) > approc_limit ) {
|
||||
SinT2 = std::sin(0.5 * Theta);
|
||||
CosT2 = std::cos(0.5 * Theta);
|
||||
// SinT = std::sin(Theta);
|
||||
// CosT = std::cos(Theta);
|
||||
SinT = 2.0 * SinT2 * CosT2;
|
||||
CosT = 1.0 - 2.0 * SinT2 * SinT2;
|
||||
} else {
|
||||
G4double Theta2 = Theta*Theta;
|
||||
G4double Theta3 = Theta2 * Theta;
|
||||
G4double Theta4 = Theta2 * Theta2;
|
||||
SinT = Theta - 1.0/6.0 * Theta3;
|
||||
CosT = 1 - 0.5 * Theta2 + 1.0/24.0 * Theta4;
|
||||
SinT2 = 0.5 * Theta - 1.0/48.0 * Theta3;
|
||||
CosT2 = 1 - 0.125 * Theta2 + 1.0/384 * Theta4;
|
||||
}
|
||||
if( std::fabs(Theta) > approc_limit )
|
||||
{
|
||||
SinT = std::sin(Theta);
|
||||
CosT = std::cos(Theta);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4double Theta2 = Theta*Theta;
|
||||
G4double Theta3 = Theta2 * Theta;
|
||||
G4double Theta4 = Theta2 * Theta2;
|
||||
SinT = Theta - 1.0/6.0 * Theta3;
|
||||
CosT = 1 - 0.5 * Theta2 + 1.0/24.0 * Theta4;
|
||||
}
|
||||
|
||||
// the actual "rotation"
|
||||
// the actual "rotation"
|
||||
|
||||
G4double R = 1.0 / R_1;
|
||||
// positionMove = h * ( CosT2 * vperp + SinT2 * B_x_P + vpar );
|
||||
positionMove = R * ( SinT * vperp + (1-CosT) * B_x_P) + h * vpar;
|
||||
endTangent = (CosT * vperp + SinT * B_x_P + vpar);
|
||||
G4double R = 1.0 / R_1;
|
||||
|
||||
// Store the resulting position and tangent
|
||||
yHelix[0] = yIn[0] + positionMove.x();
|
||||
yHelix[1] = yIn[1] + positionMove.y();
|
||||
yHelix[2] = yIn[2] + positionMove.z();
|
||||
|
||||
yHelix[3] = velocityVal * endTangent.x();
|
||||
yHelix[4] = velocityVal * endTangent.y();
|
||||
yHelix[5] = velocityVal * endTangent.z();
|
||||
positionMove = R * ( SinT * vperp + (1-CosT) * B_x_P) + h * vpar;
|
||||
endTangent = CosT * vperp + SinT * B_x_P + vpar;
|
||||
|
||||
// Store and/or calculate parameters for chord distance.
|
||||
|
||||
G4ThreeVector B_x_P_x_B = B_x_P.cross(Bnorm);
|
||||
G4double ptan=B_x_P_x_B.dot(initVelocity);
|
||||
G4double particleCharge = fPtrMagEqOfMot->FCof() / (eplus*c_light);
|
||||
R_Helix =std::abs( ptan/(fUnitConstant * particleCharge*Bmag));
|
||||
// Store the resulting position and tangent
|
||||
|
||||
yHelix[0] = yIn[0] + positionMove.x();
|
||||
yHelix[1] = yIn[1] + positionMove.y();
|
||||
yHelix[2] = yIn[2] + positionMove.z();
|
||||
yHelix[3] = velocityVal * endTangent.x();
|
||||
yHelix[4] = velocityVal * endTangent.y();
|
||||
yHelix[5] = velocityVal * endTangent.z();
|
||||
|
||||
// Store 2*h step Helix if exist
|
||||
|
||||
if(yHelix2)
|
||||
{
|
||||
SinT2 = 2.0 * SinT * CosT;
|
||||
CosT2 = 1.0 - 2.0 * SinT * SinT;
|
||||
endTangent = (CosT2 * vperp + SinT2 * B_x_P + vpar);
|
||||
positionMove = R * ( SinT2 * vperp + (1-CosT2) * B_x_P) + h*2 * vpar;
|
||||
|
||||
yHelix2[0] = yIn[0] + positionMove.x();
|
||||
yHelix2[1] = yIn[1] + positionMove.y();
|
||||
yHelix2[2] = yIn[2] + positionMove.z();
|
||||
yHelix2[3] = velocityVal * endTangent.x();
|
||||
yHelix2[4] = velocityVal * endTangent.y();
|
||||
yHelix2[5] = velocityVal * endTangent.z();
|
||||
}
|
||||
|
||||
// Store and/or calculate parameters for chord distance
|
||||
|
||||
G4double ptan=velocityVal*B_v_P;
|
||||
|
||||
G4double particleCharge = fPtrMagEqOfMot->FCof() / (eplus*c_light);
|
||||
R_Helix =std::abs( ptan/(fUnitConstant * particleCharge*Bmag));
|
||||
|
||||
SetAngCurve(std::abs(Theta));
|
||||
SetCurve(std::abs(R));
|
||||
SetRadHelix(R_Helix);
|
||||
|
||||
|
||||
SetAngCurve(std::abs(Theta));
|
||||
SetCurve(std::abs(R));
|
||||
SetRadHelix(R_Helix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,14 +189,15 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
void
|
||||
G4MagHelicalStepper::Stepper( const G4double yInput[],
|
||||
const G4double*,
|
||||
G4double hstep,
|
||||
G4double yOut[],
|
||||
G4double yErr[] )
|
||||
const G4double*,
|
||||
G4double hstep,
|
||||
G4double yOut[],
|
||||
G4double yErr[] )
|
||||
{
|
||||
const G4int nvar = 6 ;
|
||||
const G4int nvar = 6;
|
||||
|
||||
G4int i;
|
||||
|
||||
// correction for Richardson Extrapolation.
|
||||
// G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
|
||||
|
||||
@@ -188,63 +206,53 @@ G4MagHelicalStepper::Stepper( const G4double yInput[],
|
||||
|
||||
// Saving yInput because yInput and yOut can be aliases for same array
|
||||
|
||||
for(i=0;i<nvar;i++) yIn[i]=yInput[i];
|
||||
for(i=0;i<nvar;i++) { yIn[i]=yInput[i]; }
|
||||
|
||||
G4double h = hstep * 0.5;
|
||||
|
||||
MagFieldEvaluate(yIn, Bfld_initial) ;
|
||||
|
||||
// Do two half steps
|
||||
|
||||
DumbStepper(yIn, Bfld_initial, h, yTemp);
|
||||
MagFieldEvaluate(yTemp, Bfld_midpoint) ;
|
||||
DumbStepper(yTemp, Bfld_midpoint, h, yOut);
|
||||
|
||||
// Store midpoint, to aid distance-from-chord calculation
|
||||
yMidPoint = G4ThreeVector( yTemp[0], yTemp[1], yTemp[2]);
|
||||
|
||||
// Do a full Step
|
||||
|
||||
h = hstep ;
|
||||
DumbStepper(yIn, Bfld_initial, h, yTemp);
|
||||
DumbStepper(yIn, Bfld_initial, h, yTemp);
|
||||
|
||||
// Error estimation
|
||||
|
||||
for(i=0;i<nvar;i++) {
|
||||
for(i=0;i<nvar;i++)
|
||||
{
|
||||
yErr[i] = yOut[i] - yTemp[i] ;
|
||||
}
|
||||
|
||||
#if G4HELICAL_USE_RICHARDSON_EXTRAPOLATION
|
||||
if( IntegratorOrder() > 1 ) {
|
||||
// It is unclear whether it is possible to
|
||||
// use the Richardson Extrapolation to increase accuracey by 1 order
|
||||
for(i=0;i<nvar;i++) {
|
||||
yOut[i] += yErr[i]*correction ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
yInitial = G4ThreeVector( yIn[0], yIn[1], yIn[2]);
|
||||
yFinal = G4ThreeVector( yOut[0], yOut[1], yOut[2]);
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
G4double
|
||||
G4MagHelicalStepper::DistChord() const
|
||||
{
|
||||
// Check whether h/R > pi !!
|
||||
// Method DistLine is good only for < pi
|
||||
// Method DistLine is good only for < pi
|
||||
|
||||
G4double Ang=GetAngCurve();
|
||||
|
||||
if(Ang<pi){
|
||||
return G4LineSection::Distline( yMidPoint, yInitial, yFinal );
|
||||
// This is a class method that gives distance of Mid
|
||||
// from the Chord between the Initial and Final points.
|
||||
|
||||
if(Ang<=pi)
|
||||
{
|
||||
return GetRadHelix()*(1-std::cos(0.5*Ang));
|
||||
}
|
||||
else{
|
||||
|
||||
return GetRadHelix();
|
||||
else
|
||||
{
|
||||
if(Ang<twopi)
|
||||
{
|
||||
return GetRadHelix()*(1+std::cos(0.5*(twopi-Ang)));
|
||||
}
|
||||
else // return Diameter of projected circle
|
||||
{
|
||||
return 2*GetRadHelix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.cc,v 1.48 2007/06/04 15:30:22 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4MagIntegratorDriver.cc,v 1.49 2007/08/17 12:30:33 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -153,14 +153,24 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
G4FieldTrack yStartFT(y_current);
|
||||
|
||||
// Ensure that hstep > 0
|
||||
if( hstep <= 0.0 ) {
|
||||
if(hstep==0.0){ G4cerr << " G4MagIntegratorDriver::AccurateAdvance(): Hstep is " << hstep << G4endl;
|
||||
if( hstep <= 0.0 )
|
||||
{
|
||||
if(hstep==0.0)
|
||||
{
|
||||
G4cerr << "WARNING - G4MagIntegratorDriver::AccurateAdvance()" << G4endl
|
||||
<< " Proposed step is zero; hstep = " << hstep
|
||||
<< " !" << G4endl;
|
||||
return succeeded;
|
||||
}
|
||||
else{
|
||||
G4Exception("G4MagInt_Driver::AccurateAdvance()",
|
||||
"Requested Integration Step is negative: it must be positive",
|
||||
FatalException, "Requested-Step-is-Negative");
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - G4MagIntegratorDriver::AccurateAdvance()" << G4endl
|
||||
<< " Proposed step is negative; hstep = " << hstep
|
||||
<< " !" << G4endl;
|
||||
G4Exception("G4MagInt_Driver::AccurateAdvance()",
|
||||
"InvalidCall", EventMustBeAborted,
|
||||
"Requested step cannot be negative! Aborting event.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.cc,v 1.11 2006/06/29 18:24:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.cc,v 1.11 2006/06/29 18:24:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion
|
||||
// in a pure Magnetic Field .
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_SpinEqRhs.cc,v 1.12 2006/06/29 18:24:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion.
|
||||
// This version of the right-hand side includes the three components
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_UsualEqRhs.cc,v 1.12 2006/06/29 18:24:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// This is the 'standard' right-hand side for the equation of motion
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagneticField.cc,v 1.3 2006/06/29 18:24:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4QuadrupoleMagField.cc,v 1.4 2006/06/29 18:24:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RKG3_Stepper.cc,v 1.14 2007/05/18 12:44:28 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4RKG3_Stepper.cc,v 1.15 2007/08/21 10:17:41 tnikitin Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -65,6 +65,7 @@ void G4RKG3_Stepper::Stepper( const G4double yInput[7],
|
||||
// Do two half steps
|
||||
|
||||
StepNoErr(yIn, dydx,h, yTemp,B) ;
|
||||
|
||||
//Store Bfld for DistChord Calculation
|
||||
for(i=0;i<3;i++)BfldIn[i]=B[i];
|
||||
|
||||
@@ -136,25 +137,23 @@ void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
|
||||
// Copy and edit the routine above, to delete alpha2, beta2, ...
|
||||
G4double K1[7],K2[7],K3[7],K4[7] ;
|
||||
G4double tTemp[7], yderiv[6] ;
|
||||
|
||||
// Need Momentum value to give correct values to the coefficients in equation
|
||||
// Integration on unit velocity, but tIn[3,4,5] is momentum
|
||||
G4double mom;
|
||||
G4double mom,inverse_mom;
|
||||
G4int i ;
|
||||
|
||||
#ifdef END_CODE_G3STEPPER
|
||||
G4Exception(" G4RKG3_Stepper::StepNoErr(): method to be no longer used.");
|
||||
#else
|
||||
const G4double c1=0.5,c2=0.125,c3=1./6.;
|
||||
|
||||
// GetEquationOfMotion()->EvaluateRhsReturnB(tIn,dydx,B1) ;
|
||||
// Correction for momentum not a velocity
|
||||
// Need the protection !!! must be not zero
|
||||
mom=std::sqrt(tIn[3]*tIn[3]+tIn[4]*tIn[4]+tIn[5]*tIn[5]);
|
||||
|
||||
inverse_mom=1./mom;
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
K1[i] = Step * dydx[i+3]/mom;
|
||||
tTemp[i] = tIn[i] + Step*(0.5*tIn[i+3]/mom + 0.125*K1[i]) ;
|
||||
tTemp[i+3] = tIn[i+3] + 0.5*K1[i]*mom ;
|
||||
K1[i] = Step * dydx[i+3]*inverse_mom;
|
||||
tTemp[i] = tIn[i] + Step*(c1*tIn[i+3]*inverse_mom + c2*K1[i]) ;
|
||||
tTemp[i+3] = tIn[i+3] + c1*K1[i]*mom ;
|
||||
|
||||
}
|
||||
|
||||
@@ -163,8 +162,8 @@ void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
|
||||
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
K2[i] = Step * yderiv[i+3]/mom;
|
||||
tTemp[i+3] = tIn[i+3] + 0.5*K2[i]*mom ;
|
||||
K2[i] = Step * yderiv[i+3]*inverse_mom;
|
||||
tTemp[i+3] = tIn[i+3] + c1*K2[i]*mom ;
|
||||
}
|
||||
|
||||
// Given B, calculate yderiv !
|
||||
@@ -172,8 +171,8 @@ void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
|
||||
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
K3[i] = Step * yderiv[i+3]/mom;
|
||||
tTemp[i] = tIn[i] + Step*(tIn[i+3]/mom + 0.5*K3[i]) ;
|
||||
K3[i] = Step * yderiv[i+3]*inverse_mom;
|
||||
tTemp[i] = tIn[i] + Step*(tIn[i+3]*inverse_mom + c1*K3[i]) ;
|
||||
tTemp[i+3] = tIn[i+3] + K3[i]*mom ;
|
||||
}
|
||||
|
||||
@@ -184,80 +183,35 @@ void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
|
||||
|
||||
for(i=0;i<3;i++) // Output trajectory vector
|
||||
{
|
||||
K4[i] = Step * yderiv[i+3]/mom;
|
||||
tOut[i] = tIn[i] + Step*(tIn[i+3]/mom + (K1[i] + K2[i] + K3[i])/6.0) ;
|
||||
tOut[i+3] = tIn[i+3] + mom*(K1[i] + 2*K2[i] + 2*K3[i] +K4[i])/6.0 ;
|
||||
K4[i] = Step * yderiv[i+3]*inverse_mom;
|
||||
tOut[i] = tIn[i] + Step*(tIn[i+3]*inverse_mom+ (K1[i] + K2[i] + K3[i])*c3) ;
|
||||
tOut[i+3] = tIn[i+3] + mom*(K1[i] + 2*K2[i] + 2*K3[i] +K4[i])*c3 ;
|
||||
}
|
||||
|
||||
// NormaliseTangentVector( tOut );
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
G4double G4RKG3_Stepper::DistChord() const
|
||||
{
|
||||
// Implementation : must check whether h/R > pi !!
|
||||
// If( h/R < pi) use G4LineSection::DistLine
|
||||
// Else use DistChord=R_helix
|
||||
G4double distChord,distLine;
|
||||
|
||||
//Calculation of R_helix and R_curv
|
||||
G4double R_helix;
|
||||
G4double R_curv;
|
||||
G4double H_helix=hStep;
|
||||
G4double Bmag=BfldIn.mag();
|
||||
|
||||
G4ThreeVector initVelocity= fpInitial;
|
||||
G4double velocityVal = initVelocity.mag();
|
||||
G4ThreeVector initTangent = (1.0/velocityVal) * initVelocity; // .unit();
|
||||
|
||||
const G4double fUnitConstant = 0.299792458 * (GeV/(tesla*m));
|
||||
G4double particleCharge = fPtrMagEqOfMot->FCof() / (eplus*c_light);
|
||||
G4double fCoefficient = (fUnitConstant ) * particleCharge;
|
||||
|
||||
// for too small field there is no curvature
|
||||
|
||||
if( Bmag>1e-12 ) {
|
||||
|
||||
// Bnorm = Bfld.unit();
|
||||
G4ThreeVector Bnorm = (1.0/Bmag)*BfldIn;
|
||||
|
||||
// calculate the direction of the force
|
||||
|
||||
G4double G4RKG3_Stepper::DistChord() const
|
||||
{
|
||||
// Soon: must check whether h/R > 2 pi !!
|
||||
// Method below is good only for < 2 pi
|
||||
G4double distChord,distLine;
|
||||
|
||||
G4ThreeVector B_x_P = Bnorm.cross(initTangent);
|
||||
|
||||
// parallel and perp vectors
|
||||
|
||||
G4ThreeVector B_x_P_x_B = B_x_P.cross(Bnorm);
|
||||
G4double ptan=B_x_P_x_B.dot(initVelocity);
|
||||
|
||||
R_helix =std::abs(( 1./fCoefficient)* ptan/Bmag);
|
||||
R_curv=std::abs(( 1./fCoefficient)* velocityVal/Bmag);
|
||||
|
||||
// G4cout<<"Bfld="<<BfldIn<<" Momentum="<<velocityVal<<" DirectionM="<<initTangent<<G4endl;
|
||||
// G4cout<<"R_helix="<<R_helix/mm<<" mm R_curv="<<R_curv/mm<<" BxP="<< B_x_P<<" BxPxP="<<B_x_P_x_B<<G4endl;
|
||||
}
|
||||
else{
|
||||
|
||||
R_helix=0.;
|
||||
R_curv=H_helix;
|
||||
}
|
||||
|
||||
// DistChord Calculation
|
||||
if(std::abs(H_helix/R_curv)<pi){
|
||||
if (fyInitial != fyFinal) {
|
||||
if (fyInitial != fyFinal) {
|
||||
distLine= G4LineSection::Distline(fyMidPoint,fyInitial,fyFinal );
|
||||
distChord = distLine;
|
||||
}else{
|
||||
distChord = (fyMidPoint-fyInitial).mag();
|
||||
}
|
||||
}
|
||||
else{
|
||||
distChord=R_helix;
|
||||
}
|
||||
// G4cout<<"distChord="<<distChord<<" hstep="<<H_helix<<" Helix/R ="<<std::abs(H_helix/R_curv)<<" R_helix="<<R_helix<<G4endl;
|
||||
return distChord;
|
||||
|
||||
}
|
||||
distChord = distLine;
|
||||
}else{
|
||||
distChord = (fyMidPoint-fyInitial).mag();
|
||||
}
|
||||
|
||||
|
||||
return distChord;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleHeum.cc,v 1.8 2006/06/29 18:24:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// Simple Heum:
|
||||
// x_1 = x_0 + h *
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleRunge.cc,v 1.10 2006/06/29 18:24:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// Simple Runge:
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UniformElectricField.cc,v 1.12 2006/06/29 18:24:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UniformMagField.cc,v 1.11 2006/06/29 18:24:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Class for creation of uniform Magnetic Field
|
||||
|
||||
Reference in New Issue
Block a user