Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.hh,v 2.6 1998/11/19 14:04:45 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// J.Apostolakis, V.Grichine 30.1.97
|
||||
|
||||
#ifndef G4CashKARP_RKF45
|
||||
#define G4CashKARP_RKF45
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
|
||||
class G4CashKarpRKF45: public G4MagIntegratorStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
|
||||
~G4CashKarpRKF45() ;
|
||||
|
||||
void Stepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[],
|
||||
G4double yerr[] ) ;
|
||||
|
||||
void StepWithEst(const G4double yIn[],
|
||||
const G4double dydx[],
|
||||
const G4double Step,
|
||||
G4double yOut[],
|
||||
G4double& alpha2,
|
||||
G4double& beta2,
|
||||
const G4double B1[],
|
||||
G4double B2[] ) ;
|
||||
|
||||
G4double DistChord() const = 0 ; // This is not IMPLEMENTED yet.
|
||||
// It must be done before it can work.
|
||||
|
||||
G4int IntegratorOrder() { return 4 ; };
|
||||
|
||||
private:
|
||||
G4int fNumberOfVariables ;
|
||||
|
||||
G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *yTemp, *yIn; // scratch space
|
||||
};
|
||||
|
||||
#endif /* G4CashKARP_RKF45 */
|
||||
@@ -0,0 +1,135 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ChordFinder.hh,v 2.5 1998/11/12 13:22:41 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
// GEANT 4 include file implementation
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division (formely CN), ASD group
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// A class that provides RK integration of motion ODE (as does g4magtr)
|
||||
// and also has a method that returns an Approximate point on the curve
|
||||
// near to a (chord) point.
|
||||
//
|
||||
// 25.02.97 John Apostolakis, design and implementation
|
||||
// 05.03.97 V. Grichine , makeup to G4 'standard'
|
||||
|
||||
#ifndef G4CHORDFINDER_HH
|
||||
#define G4CHORDFINDER_HH
|
||||
|
||||
// #include "globals.hh"
|
||||
#include "G4MagIntegratorDriver.hh"
|
||||
#include "G4FieldTrack.hh"
|
||||
#include "G4MagneticField.hh"
|
||||
// class G4Mag_EqRhs;
|
||||
// class G4MagIntegratorStepper;
|
||||
|
||||
class G4ChordFinder
|
||||
{
|
||||
public: // Constructors
|
||||
|
||||
G4ChordFinder( G4MagInt_Driver* pIntegrationDriver );
|
||||
|
||||
// A constructor that creates defaults for all "children" classes
|
||||
//
|
||||
G4ChordFinder( G4MagneticField* itsMagField,
|
||||
G4double stepMinimum = 1.0e-2 * mm,
|
||||
G4MagIntegratorStepper* pItsStepper = 0 );
|
||||
|
||||
~G4ChordFinder();
|
||||
|
||||
// Uses ODE solver's driver to find the endpoint that satisfies
|
||||
// the chord criterion: that d_chord < delta_chord
|
||||
// -> Returns Length of Step taken
|
||||
|
||||
G4double AdvanceChordLimited( G4FieldTrack& yCurrent,
|
||||
const G4double stepInitial,
|
||||
const G4double epsStep );
|
||||
|
||||
G4FieldTrack ApproxCurvePointV(const G4FieldTrack& curveAPointVelocity,
|
||||
const G4FieldTrack& curveBPointVelocity,
|
||||
const G4ThreeVector& currentEPoint,
|
||||
const G4double epsStep);
|
||||
|
||||
G4double GetDeltaChord();
|
||||
void SetDeltaChord( G4double newval);
|
||||
|
||||
// Routine to inform integration driver of charge, speed
|
||||
//
|
||||
void SetChargeMomentumMass( const G4double pCharge, // in e+ units
|
||||
const G4double pMomentum,
|
||||
const G4double pMass );
|
||||
|
||||
// Access and set Driver
|
||||
//
|
||||
void SetIntegrationDriver( G4MagInt_Driver* IntegrationDriver)
|
||||
{ fIntgrDriver=IntegrationDriver;}
|
||||
G4MagInt_Driver* GetIntegrationDriver()
|
||||
{ return fIntgrDriver;}
|
||||
|
||||
protected: // .........................................................
|
||||
|
||||
G4bool AcceptableMissDist(G4double dChordStep)
|
||||
{
|
||||
return (dChordStep <= fDeltaChord) ;
|
||||
}
|
||||
|
||||
G4double NewStep( const G4double stepTrialOld,
|
||||
const G4double dChordStep ) ; // Current dchord
|
||||
|
||||
G4double FindNextChord( const G4FieldTrack yStart,
|
||||
const G4double stepMax,
|
||||
G4FieldTrack& yEnd,
|
||||
G4double& dyErr, // Error of endpoint
|
||||
G4double epsStep );
|
||||
|
||||
private: // ............................................................
|
||||
// G4int nOK, nBAD;
|
||||
G4MagInt_Driver* fIntgrDriver;
|
||||
|
||||
G4double fDeltaChord;
|
||||
|
||||
static const G4double fDefaultDeltaChord; // SET in G4ChordFinder.cc = 3 mm
|
||||
|
||||
// Variables used in construction/destruction
|
||||
G4bool fAllocatedStepper;
|
||||
G4Mag_EqRhs* fEquation;
|
||||
G4MagIntegratorStepper* fDriversStepper;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Inline function implementation:
|
||||
|
||||
inline
|
||||
G4ChordFinder:: G4ChordFinder( G4MagInt_Driver* pIntegrationDriver )
|
||||
: fDeltaChord( fDefaultDeltaChord )
|
||||
{
|
||||
fIntgrDriver= pIntegrationDriver ;
|
||||
fAllocatedStepper= false ;
|
||||
}
|
||||
|
||||
inline void
|
||||
G4ChordFinder::SetChargeMomentumMass( const G4double pCharge, // in e+ units
|
||||
const G4double pMomentum,
|
||||
const G4double pMass )
|
||||
{
|
||||
fIntgrDriver-> SetChargeMomentumMass(pCharge, pMomentum, pMass);
|
||||
}
|
||||
|
||||
inline G4double G4ChordFinder::GetDeltaChord()
|
||||
{ return fDeltaChord; }
|
||||
|
||||
inline void G4ChordFinder::SetDeltaChord( G4double newval)
|
||||
{ fDeltaChord=newval; }
|
||||
|
||||
#endif // G4CHORDFINDER_HH
|
||||
@@ -0,0 +1,54 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ClassicalRK4.hh,v 2.3 1998/11/17 18:20:08 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// J.Apostolakis, V.Grichine 30.1.97
|
||||
// changed: W.Wander <wwc@mit.edu> 12/09/97: Moved into MagErrorStepper
|
||||
|
||||
#include "G4MagErrorStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4ClassicalRK4 : public G4MagErrorStepper
|
||||
{
|
||||
public:
|
||||
|
||||
G4ClassicalRK4(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
|
||||
|
||||
~G4ClassicalRK4() ;
|
||||
|
||||
void StepWithEst( const G4double yIn[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yOut[],
|
||||
G4double& alpha2,
|
||||
G4double& beta2,
|
||||
const G4double B1[],
|
||||
G4double B2[] ) ;
|
||||
|
||||
|
||||
G4int IntegratorOrder() { return 4; };
|
||||
|
||||
|
||||
// A stepper that does not know about errors.
|
||||
// It is used by the MagErrorStepper stepper.
|
||||
|
||||
void DumbStepper( const G4double yIn[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yOut[]) ;
|
||||
|
||||
// Could make above G4SixPoint to keep tangents too ...?
|
||||
|
||||
private:
|
||||
|
||||
G4int fNumberOfVariables ; // is set default to 6 in constructor
|
||||
|
||||
G4double *dydxm, *dydxt, *yt; // scratch space - not state
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ElectroMagneticField.hh,v 2.2 1998/11/19 20:45:01 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// A full Electromagnetic field, containing both electric and magnetic fields.
|
||||
//
|
||||
// It is an abstract class, and a derived type of this field must be
|
||||
// created by the user to describe his/her field configuration.
|
||||
//
|
||||
// Created: JA, November 12th, 1998
|
||||
//
|
||||
|
||||
#ifndef G4ELECTROMAGNETIC_FIELD_DEF
|
||||
#define G4ELECTROMAGNETIC_FIELD_DEF
|
||||
|
||||
#include "G4MagneticField.hh"
|
||||
|
||||
class G4ElectroMagneticField : public G4MagneticField
|
||||
{
|
||||
public:
|
||||
|
||||
G4ElectroMagneticField();
|
||||
virtual ~G4ElectroMagneticField();
|
||||
|
||||
// Copy constructor & assignment operator
|
||||
G4ElectroMagneticField(const G4ElectroMagneticField &p);
|
||||
G4ElectroMagneticField& operator = (const G4ElectroMagneticField &p);
|
||||
|
||||
virtual void GetFieldValue( const double Point[3],
|
||||
double *Bfield ) const = 0;
|
||||
};
|
||||
|
||||
// Implementation
|
||||
|
||||
inline G4ElectroMagneticField::G4ElectroMagneticField() {}
|
||||
inline G4ElectroMagneticField::~G4ElectroMagneticField() {}
|
||||
inline G4ElectroMagneticField::G4ElectroMagneticField(const G4ElectroMagneticField &p) {}
|
||||
// Not needed: { *this = p; }
|
||||
|
||||
inline G4ElectroMagneticField&
|
||||
G4ElectroMagneticField::operator = (const G4ElectroMagneticField &p)
|
||||
{ *this = p; return *this; }
|
||||
|
||||
#endif /* G4ELECTROMAGNETIC_FIELD_DEF */
|
||||
@@ -0,0 +1,46 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EqMagElectricField.hh,v 2.4 1998/11/18 16:36:22 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// This is the right-hand side of equation of motion in a combined
|
||||
// electric and magnetic field.
|
||||
////
|
||||
// 10.11.98 V.Grichine
|
||||
//
|
||||
#ifndef G4EQMAGELECTRICFIELD_hh
|
||||
#define G4EQMAGELECTRICFIELD_hh
|
||||
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
#include "G4ElectroMagneticField.hh"
|
||||
|
||||
class G4EqMagElectricField : public G4Mag_EqRhs
|
||||
{
|
||||
public:
|
||||
G4EqMagElectricField( G4ElectroMagneticField *emField ) :
|
||||
G4Mag_EqRhs( emField ) {};
|
||||
|
||||
~G4EqMagElectricField() {} ;
|
||||
|
||||
// Given the value of the electromagnetic field, this function
|
||||
// calculates the value of the derivative dydx.
|
||||
|
||||
void SetChargeMomentumMass( const G4double particleCharge, // in e+ units
|
||||
const G4double MomentumXc,
|
||||
const G4double mass);
|
||||
|
||||
void EvaluateRhsGivenB( const G4double y[],
|
||||
const G4double Field[],
|
||||
G4double dydx[] ) const;
|
||||
|
||||
private:
|
||||
|
||||
G4double fElectroMagCof ;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EquationOfMotion.hh,v 2.4 1998/11/12 19:48:09 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// Abstract Base Class for:
|
||||
//
|
||||
// The right hand size of the equation of motion of a particle in a field.
|
||||
//
|
||||
#ifndef G4_EquationOfMotion_DEF
|
||||
#define G4_EquationOfMotion_DEF
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4Field.hh" // class G4Field; // should be enough
|
||||
|
||||
class G4EquationOfMotion
|
||||
{
|
||||
public:
|
||||
G4EquationOfMotion( G4Field *Field );
|
||||
virtual ~G4EquationOfMotion();
|
||||
|
||||
// Given the value of the field "B", this function
|
||||
// calculates the value of the derivative dydx.
|
||||
// --------------------------------------------------------
|
||||
// This is the _only_ function a subclass must define.
|
||||
// The other two functions use Rhs_givenB.
|
||||
//
|
||||
virtual void EvaluateRhsGivenB( const G4double y[],
|
||||
const G4double B[3],
|
||||
G4double dydx[] ) const = 0;
|
||||
|
||||
// Set the charge, momentum and mass of the current particle
|
||||
// --> used to set the equation's coefficients ...
|
||||
virtual void SetChargeMomentumMass(
|
||||
const G4double particleCharge, // in e+ units
|
||||
const G4double MomentumXc,
|
||||
const G4double MassXc2) = 0;
|
||||
|
||||
|
||||
// This calculates the value of the derivative dydx at y.
|
||||
// It is the usual enquiry function.
|
||||
// ---------------------------
|
||||
// (It is not virtual, but calls the virtual function above.)
|
||||
//
|
||||
void RightHandSide( const G4double y[],
|
||||
G4double dydx[] ) const;
|
||||
|
||||
// Same as RHS above, but also returns the value of B.
|
||||
//
|
||||
// Should be made the new default ? after putting dydx & B in a class
|
||||
//
|
||||
void EvaluateRhsReturnB( const G4double y[],
|
||||
G4double dydx[],
|
||||
G4double Field[] ) const;
|
||||
|
||||
// Obtain only the field - the stepper assumes it is pure Magnetic
|
||||
// Not protected, because G4RKG3_Stepper uses it directly
|
||||
|
||||
void GetFieldValue( const G4double Point[3],
|
||||
G4double Field[] ) const
|
||||
{ itsField-> GetFieldValue( Point, Field ); }
|
||||
|
||||
G4Field* GetFieldObj();
|
||||
void SetFieldObj(G4Field* pField);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//public:
|
||||
// virtual void doNothing(); // To help compiler with their virtual tables.
|
||||
|
||||
private:
|
||||
|
||||
G4Field *itsField;
|
||||
|
||||
};
|
||||
|
||||
#include "G4EquationOfMotion.icc"
|
||||
|
||||
#endif /* G4_EquationOfMotion_DEF */
|
||||
@@ -0,0 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4EquationOfMotion.icc,v 2.3 1998/11/12 15:41:00 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Inline implementation
|
||||
//
|
||||
inline G4Field* G4EquationOfMotion::GetFieldObj()
|
||||
{
|
||||
return itsField;
|
||||
}
|
||||
|
||||
inline void G4EquationOfMotion::SetFieldObj(G4Field* pField)
|
||||
{
|
||||
itsField= pField;
|
||||
}
|
||||
|
||||
inline G4EquationOfMotion::G4EquationOfMotion(G4Field* pField)
|
||||
:itsField(pField)
|
||||
{}
|
||||
|
||||
inline G4EquationOfMotion::~G4EquationOfMotion() {}
|
||||
@@ -0,0 +1,37 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ExplicitEuler.hh,v 2.2 1998/11/09 11:52:45 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 12/09/97
|
||||
|
||||
#ifndef G4EXPLICITEULER_HH
|
||||
#define G4EXPLICITEULER_HH
|
||||
#include "G4MagErrorStepper.hh"
|
||||
|
||||
class G4ExplicitEuler: public G4MagErrorStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4ExplicitEuler(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
|
||||
~G4ExplicitEuler();
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
G4int IntegratorOrder() { return 1; };
|
||||
|
||||
private:
|
||||
|
||||
G4int fNumberOfVariables ;
|
||||
};
|
||||
|
||||
#endif /* G4EXPLICITEULER_HH */
|
||||
@@ -0,0 +1,37 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Field.hh,v 2.2 1998/11/19 20:45:01 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// G4Field:
|
||||
// abstract class for any kind of Field,
|
||||
// It allows any kind of field (vector, scalar, tensor and any set of them)
|
||||
// to be defiend by implementing the inquiry function interface.
|
||||
//
|
||||
// Created: John Apostolakis, 10.03.1997
|
||||
// Modified:
|
||||
|
||||
#ifndef G4FIELD_HH
|
||||
#define G4FIELD_HH
|
||||
|
||||
class G4Field
|
||||
{
|
||||
public:
|
||||
virtual void GetFieldValue( const double Point[3],
|
||||
double *Bfield ) const = 0;
|
||||
G4Field(){};
|
||||
virtual ~G4Field(){};
|
||||
|
||||
// A field signature function that can be used to insure
|
||||
// that the Equation of motion object and the G4Field object
|
||||
// have the same "field signature"?
|
||||
};
|
||||
|
||||
|
||||
#endif /* G4FIELD_HH */
|
||||
@@ -0,0 +1,108 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldManager.hh,v 2.1 1998/07/12 02:54:53 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
// The G4FieldManager class exists to allow the user program to specify
|
||||
// the electric, magnetic and/or other field(s) of the detector.
|
||||
// (OR, in the future, of a part of it - planned to be a logical volume).
|
||||
// It also stores a pointer to the ChordFinder object that can do the
|
||||
// propagation in this field. All geometrical track "advancement"
|
||||
// in the field is handled by this ChordFinder object.
|
||||
//
|
||||
// G4FieldManager allows the other classes/object (of the MagneticField
|
||||
// & other class categories) to find out whether a detector field object
|
||||
// exists and what that object is.
|
||||
//
|
||||
// The Chord Finder must be created either by calling
|
||||
// CreateChordFinder for a Magnetic Field or by the user creating a
|
||||
// a Chord Finder object "manually" and setting this pointer.
|
||||
//
|
||||
// A default FieldManager is created by the singleton
|
||||
// class G4NavigatorForTracking and exists before main is called.
|
||||
// However a new one can be created and given to G4NavigatorForTracking.
|
||||
//
|
||||
// Synopsis:
|
||||
// A class to manage (Store) a pointer to the Field subclass that
|
||||
// describes the field of a detector (magnetic, electric or other).
|
||||
// Also stores a reference to the chord finder.
|
||||
//
|
||||
// 10.03.97 John Apostolakis, design and implementation
|
||||
//
|
||||
#ifndef G4FIELDMANAGER_HH
|
||||
#define G4FIELDMANAGER_HH 1
|
||||
|
||||
#include "G4Field.hh"
|
||||
#include "G4MagneticField.hh"
|
||||
#include "G4ChordFinder.hh"
|
||||
|
||||
class G4FieldManager
|
||||
{
|
||||
public:
|
||||
G4FieldManager();
|
||||
G4FieldManager(G4MagneticField *detectorField);
|
||||
~G4FieldManager();
|
||||
|
||||
G4bool SetDetectorField(G4Field *detectorField);
|
||||
G4Field* GetDetectorField();
|
||||
G4bool DoesFieldExist();
|
||||
|
||||
void CreateChordFinder(G4MagneticField *detectorMagField);
|
||||
void SetChordFinder(G4ChordFinder *aChordFinder);
|
||||
G4ChordFinder* GetChordFinder();
|
||||
|
||||
private:
|
||||
G4Field* fDetectorField;
|
||||
G4ChordFinder* fChordFinder;
|
||||
|
||||
G4bool fAllocatedChordFinder; // Did we used "new" to
|
||||
// create fChordFinder ?
|
||||
};
|
||||
|
||||
// Our current design envisions that one Field manager is
|
||||
// valid for a detector.
|
||||
// (eg a detector with electric E and magnetic B field will now treat
|
||||
// them as one field - and could treat any other field of importance
|
||||
// as additional components of a single field.)
|
||||
// Does it make sense to have several instead ?
|
||||
// Is the lack of elegance of the design (of G4Field) made up
|
||||
// for by the simplification it allows ?
|
||||
|
||||
// Implementation of inline functions
|
||||
|
||||
inline G4bool G4FieldManager::SetDetectorField(G4Field *detectorField)
|
||||
{
|
||||
fDetectorField= detectorField;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline G4Field* G4FieldManager::GetDetectorField()
|
||||
{
|
||||
// If pointer is null, should this raise an exception ??
|
||||
return fDetectorField;
|
||||
}
|
||||
|
||||
inline G4bool G4FieldManager::DoesFieldExist(){
|
||||
return (fDetectorField != 0);
|
||||
}
|
||||
|
||||
inline
|
||||
void G4FieldManager::SetChordFinder(G4ChordFinder *aChordFinder)
|
||||
{
|
||||
fChordFinder= aChordFinder;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ChordFinder* G4FieldManager::GetChordFinder()
|
||||
{
|
||||
return fChordFinder;
|
||||
}
|
||||
|
||||
#endif /* G4FIELDMANAGER_HH */
|
||||
@@ -0,0 +1,112 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldTrack.hh,v 2.6 1998/11/18 21:13:05 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Data structure bringing together a magnetic track's state.
|
||||
// (position, momentum direction & modulus, energy, spin, ... )
|
||||
// Uses/abilities:
|
||||
// - does not maintain any relationship between its data (eg energy/momentum)
|
||||
// - for use in Runge-Kutta solver (in passing it the values right now).
|
||||
//
|
||||
// First version: Oct 14, 1996 John Apostolakis
|
||||
// Modified: Oct 24, 1996 JA: Added dist_on_curve, deleted constructor
|
||||
// Nov 5, 1998 JA: Added energy, momentum, TOF, spin
|
||||
// & several constructor, access, set methods
|
||||
//
|
||||
//
|
||||
#ifndef G4FieldTrack_HH
|
||||
#define G4FieldTrack_HH
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4FieldTrack{
|
||||
public:
|
||||
// Constructors
|
||||
|
||||
G4FieldTrack( const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity, // Or UnitVelocity
|
||||
const G4double curve_length,
|
||||
const G4double Energy,
|
||||
const G4double LabratTimeOfFlight=0.0,
|
||||
const G4double ProperTimeOfFlight=0.0,
|
||||
const G4ThreeVector* pSpin=0);
|
||||
|
||||
G4FieldTrack( const G4FieldTrack& pFieldTrack );
|
||||
|
||||
// Destructor
|
||||
~G4FieldTrack();
|
||||
|
||||
// Equality operator
|
||||
G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
|
||||
|
||||
// Old multi-set method
|
||||
inline G4FieldTrack& SetCurvePnt(
|
||||
const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity,
|
||||
const G4double s_curve );
|
||||
|
||||
// Access Methods: ("Const")
|
||||
G4ThreeVector Position() const; // Renamed to GetPosition
|
||||
G4ThreeVector GetVelocity() const;
|
||||
G4double CurveS() const; // distance along curve of point
|
||||
// Old methods above to be deleted.
|
||||
G4ThreeVector GetPosition() const;
|
||||
const G4ThreeVector& GetMomentumDir() const;
|
||||
G4double GetCurveLength() const; // distance along curve of point
|
||||
// G4double GetEnergy() const; // Wrong Energy --> FIXME
|
||||
G4double GetMomentumModulus() const;
|
||||
G4ThreeVector GetSpin() const;
|
||||
G4double GetLabTimeOfFlight() const;
|
||||
G4double GetProperTimeOfFlight() const;
|
||||
|
||||
// Modifiers
|
||||
void SetPosition(G4ThreeVector nPos);
|
||||
void SetVelocity(G4ThreeVector nMomDir); // does change mom-dir too
|
||||
void SetMomentumDir(G4ThreeVector nMomDir); // does NOT change velocity
|
||||
void SetCurveLength(G4double nCurve_s); // distance along curve
|
||||
void SetEnergy(G4double nEnergy); // does not modify momentum
|
||||
void SetMomentumModulus(G4double nMomentumMod); // does not modify energy
|
||||
void SetSpin(G4ThreeVector nSpin);
|
||||
void SetLabTimeOfFlight(G4double nTOF);
|
||||
void SetProperTimeOfFlight(G4double nTOF);
|
||||
// older one:
|
||||
void SetCurveS(G4double new_curve_s);
|
||||
|
||||
// G4double* PosVelVec(); // [6] Needed for RK integrator
|
||||
// This old method completely broke encapsulation ?
|
||||
|
||||
// Needed and should be used only for RK integration driver
|
||||
// static const G4int ncompSVEC=15;
|
||||
enum { ncompSVEC = 16 };
|
||||
void DumpToArray( G4double valArr[ncompSVEC] ) const;
|
||||
void LoadFromArray( const G4double valArr[ncompSVEC] );
|
||||
|
||||
friend ostream& operator<<( ostream& os, G4FieldTrack& SixVec);
|
||||
|
||||
private:
|
||||
G4double SixVector[6];
|
||||
G4double fDistanceAlongCurve; // distance along curve of point
|
||||
G4double fEnergy;
|
||||
G4double fLabTimeOfFlight;
|
||||
G4double fProperTimeOfFlight;
|
||||
G4double fMomentumModulus;
|
||||
G4ThreeVector fSpin;
|
||||
G4ThreeVector fMomentumDir;
|
||||
};
|
||||
|
||||
#include "G4FieldTrack.icc"
|
||||
|
||||
#endif /* End of ifndef G4FieldTrack_HH */
|
||||
|
||||
// Rename:
|
||||
//
|
||||
// s/distance_along_curve/fDistanceAlongCurve/g;
|
||||
// s/SixVector/fSixVector/g;
|
||||
// s/G4SixVector/G4FieldTrack/g;
|
||||
@@ -0,0 +1,252 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FieldTrack.icc,v 2.10 1998/11/18 21:13:06 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
#include "PhysicalConstants.h"
|
||||
|
||||
inline G4FieldTrack&
|
||||
G4FieldTrack::SetCurvePnt( const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity, // Can be Unit
|
||||
const G4double s_curve )
|
||||
{
|
||||
SixVector[0] = pPosition.x();
|
||||
SixVector[1] = pPosition.y();
|
||||
SixVector[2] = pPosition.z();
|
||||
|
||||
SixVector[3] = pVelocity.x();
|
||||
SixVector[4] = pVelocity.y();
|
||||
SixVector[5] = pVelocity.z();
|
||||
|
||||
fMomentumDir = pVelocity.unit();
|
||||
|
||||
fDistanceAlongCurve= s_curve;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
|
||||
const G4ThreeVector& pVelocity, // Can be unit
|
||||
const G4double curve_length,
|
||||
const G4double pEnergy,
|
||||
const G4double pLabortTimeOfFlight,
|
||||
const G4double pProperTimeOfFlight,
|
||||
const G4ThreeVector* pSpin) :
|
||||
fEnergy(pEnergy),
|
||||
fLabTimeOfFlight(pLabortTimeOfFlight),
|
||||
fProperTimeOfFlight(pProperTimeOfFlight)
|
||||
{
|
||||
SetCurvePnt( pPosition, pVelocity, curve_length );
|
||||
if(pSpin){ fSpin= *pSpin; }
|
||||
fMomentumDir = pVelocity.unit();
|
||||
}
|
||||
|
||||
inline
|
||||
G4FieldTrack::G4FieldTrack( const G4FieldTrack& rStVec ) :
|
||||
fEnergy( rStVec.fEnergy ),
|
||||
fLabTimeOfFlight( rStVec.fLabTimeOfFlight ),
|
||||
fProperTimeOfFlight( rStVec.fProperTimeOfFlight ),
|
||||
fMomentumModulus( rStVec.fMomentumModulus ),
|
||||
fMomentumDir( rStVec.fMomentumDir ),
|
||||
fSpin( rStVec.fSpin ),
|
||||
fDistanceAlongCurve( rStVec.fDistanceAlongCurve)
|
||||
{
|
||||
SixVector[0]= rStVec.SixVector[0];
|
||||
SixVector[1]= rStVec.SixVector[1];
|
||||
SixVector[2]= rStVec.SixVector[2];
|
||||
SixVector[3]= rStVec.SixVector[3];
|
||||
SixVector[4]= rStVec.SixVector[4];
|
||||
SixVector[5]= rStVec.SixVector[5];
|
||||
// Old code:
|
||||
// SetCurvePnt(rStVec.GetPosition(),
|
||||
// rStVec.GetMomentumDir(),
|
||||
// rStVec.GetCurveLength() ); // Slow, so changed it
|
||||
}
|
||||
|
||||
// Destructor
|
||||
inline G4FieldTrack::~G4FieldTrack(){}
|
||||
|
||||
inline G4ThreeVector G4FieldTrack::GetPosition() const
|
||||
{
|
||||
G4ThreeVector myPosition( SixVector[0], SixVector[1], SixVector[2] );
|
||||
return myPosition;
|
||||
}
|
||||
|
||||
inline void G4FieldTrack::SetPosition( G4ThreeVector pPosition)
|
||||
{
|
||||
SixVector[0] = pPosition.x();
|
||||
SixVector[1] = pPosition.y();
|
||||
SixVector[2] = pPosition.z();
|
||||
}
|
||||
|
||||
// Older ... obsolete
|
||||
inline G4ThreeVector G4FieldTrack::Position() const
|
||||
{
|
||||
return this->GetPosition();
|
||||
}
|
||||
|
||||
inline const G4ThreeVector& G4FieldTrack::GetMomentumDir() const
|
||||
{
|
||||
// G4ThreeVector myVelocity( SixVector[3], SixVector[4], SixVector[5] );
|
||||
// return myVelocity;
|
||||
return fMomentumDir;
|
||||
}
|
||||
|
||||
inline G4double G4FieldTrack::GetCurveLength() const
|
||||
{
|
||||
return fDistanceAlongCurve;
|
||||
}
|
||||
|
||||
inline G4double G4FieldTrack::CurveS() const
|
||||
{
|
||||
return this->GetCurveLength();
|
||||
}
|
||||
|
||||
inline void G4FieldTrack::SetCurveLength(G4double nCurve_s)
|
||||
{
|
||||
fDistanceAlongCurve= nCurve_s;
|
||||
}
|
||||
|
||||
inline void G4FieldTrack::SetCurveS(G4double new_curve_s)
|
||||
{
|
||||
this->SetCurveLength(new_curve_s);
|
||||
}
|
||||
|
||||
#ifdef ENERGY_OK
|
||||
inline G4double G4FieldTrack::GetEnergy() const
|
||||
{ return fEnergy;}
|
||||
#endif
|
||||
|
||||
inline void G4FieldTrack::SetEnergy(G4double nEnergy)
|
||||
{ fEnergy=nEnergy;}
|
||||
inline G4ThreeVector G4FieldTrack::GetSpin() const
|
||||
{ return fSpin;}
|
||||
inline void G4FieldTrack::SetSpin(G4ThreeVector nSpin)
|
||||
{ fSpin=nSpin; }
|
||||
|
||||
inline G4double G4FieldTrack::GetLabTimeOfFlight() const
|
||||
{ return fLabTimeOfFlight; }
|
||||
inline void G4FieldTrack::SetLabTimeOfFlight(G4double nTOF)
|
||||
{ fLabTimeOfFlight=nTOF;}
|
||||
|
||||
inline G4double G4FieldTrack::GetProperTimeOfFlight() const
|
||||
{ return fProperTimeOfFlight; }
|
||||
inline void G4FieldTrack::SetProperTimeOfFlight(G4double nTOF)
|
||||
{ fProperTimeOfFlight=nTOF;}
|
||||
|
||||
inline G4double G4FieldTrack::GetMomentumModulus() const
|
||||
{ return fMomentumModulus;}
|
||||
inline void G4FieldTrack::SetMomentumModulus(G4double nMomentumMod)
|
||||
{ fMomentumModulus= nMomentumMod ;} // does not modify energy
|
||||
|
||||
inline void G4FieldTrack::SetMomentumDir(G4ThreeVector newMomDir)
|
||||
{ fMomentumDir= newMomDir; }
|
||||
|
||||
inline G4ThreeVector G4FieldTrack::GetVelocity() const
|
||||
{ return G4ThreeVector( SixVector[3], SixVector[4], SixVector[5] ); }
|
||||
|
||||
inline void G4FieldTrack::SetVelocity(G4ThreeVector pVelocity)
|
||||
{
|
||||
SixVector[3] = pVelocity.x();
|
||||
SixVector[4] = pVelocity.y();
|
||||
SixVector[5] = pVelocity.z();
|
||||
|
||||
fMomentumDir = pVelocity.unit();
|
||||
}
|
||||
|
||||
// Dump values to array
|
||||
//
|
||||
// note that momentum direction is not saved
|
||||
|
||||
inline
|
||||
void G4FieldTrack::DumpToArray(G4double valArr[ncompSVEC] ) const
|
||||
{
|
||||
valArr[0]=SixVector[0];
|
||||
valArr[1]=SixVector[1];
|
||||
valArr[2]=SixVector[2];
|
||||
valArr[3]=SixVector[3];
|
||||
valArr[4]=SixVector[4];
|
||||
valArr[5]=SixVector[5];
|
||||
|
||||
G4ThreeVector Velocity(valArr[3],valArr[4],valArr[5]);
|
||||
G4double velocity_mag_sq = Velocity.mag2();
|
||||
|
||||
G4double mass_in_Kg;
|
||||
mass_in_Kg = fEnergy / velocity_mag_sq * (1-velocity_mag_sq/c_squared);
|
||||
valArr[6]= mass_in_Kg;
|
||||
|
||||
// valArr[6]=fEnergy; // When it is integrated over, do this ...
|
||||
valArr[7]=fLabTimeOfFlight;
|
||||
valArr[8]=fProperTimeOfFlight;
|
||||
valArr[9]=fSpin.x();
|
||||
valArr[10]=fSpin.y();
|
||||
valArr[11]=fSpin.z();
|
||||
// valArr[13]=fMomentumDir.x();
|
||||
// valArr[14]=fMomentumDir.y();
|
||||
// valArr[15]=fMomentumDir.z();
|
||||
// valArr[]=fDistanceAlongCurve;
|
||||
}
|
||||
|
||||
// Load values from array
|
||||
//
|
||||
// note that momentum direction must-be/is normalised
|
||||
|
||||
inline
|
||||
void G4FieldTrack::LoadFromArray( const G4double valArr[ncompSVEC] )
|
||||
{
|
||||
SixVector[0]=valArr[0];
|
||||
SixVector[1]=valArr[1];
|
||||
SixVector[2]=valArr[2];
|
||||
SixVector[3]=valArr[3];
|
||||
SixVector[4]=valArr[4];
|
||||
SixVector[5]=valArr[5];
|
||||
|
||||
G4ThreeVector Velocity(valArr[3],valArr[4],valArr[5]);
|
||||
G4double velocity_mag_sq = Velocity.mag2();
|
||||
|
||||
// fEnergy=valArr[6]; // When it is integrated over, do this ...
|
||||
|
||||
G4double mass_in_Kg=valArr[6];
|
||||
fEnergy= mass_in_Kg * velocity_mag_sq / (1-velocity_mag_sq/c_squared);
|
||||
// sqr(c_light)
|
||||
fMomentumDir= Velocity.unit();
|
||||
|
||||
fLabTimeOfFlight=valArr[7];
|
||||
fProperTimeOfFlight=valArr[8];
|
||||
fSpin=G4ThreeVector(valArr[9],valArr[10],valArr[11]);
|
||||
// fMomentumDir=G4ThreeVector(valArr[13],valArr[14],valArr[15]);
|
||||
// fDistanceAlongCurve= valArr[];
|
||||
}
|
||||
|
||||
inline
|
||||
G4FieldTrack & G4FieldTrack::operator = ( const G4FieldTrack& rStVec )
|
||||
{
|
||||
// SetCurvePnt(rStVec.GetPosition(),
|
||||
// rStVec.GetMomentumDir(),
|
||||
// rStVec.GetCurveLength() );
|
||||
SixVector[0]= rStVec.SixVector[0];
|
||||
SixVector[1]= rStVec.SixVector[1];
|
||||
SixVector[2]= rStVec.SixVector[2];
|
||||
SixVector[3]= rStVec.SixVector[3];
|
||||
SixVector[4]= rStVec.SixVector[4];
|
||||
SixVector[5]= rStVec.SixVector[5];
|
||||
SetCurveLength( rStVec.GetCurveLength() );
|
||||
|
||||
SetEnergy( rStVec.fEnergy );
|
||||
SetLabTimeOfFlight( rStVec.GetLabTimeOfFlight() );
|
||||
SetProperTimeOfFlight( rStVec.GetProperTimeOfFlight() );
|
||||
SetSpin( rStVec.GetSpin() );
|
||||
SetMomentumModulus( rStVec.GetMomentumModulus());
|
||||
SetMomentumDir( rStVec.fMomentumDir );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.hh,v 2.2 1998/11/09 14:09:24 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 12/09/97
|
||||
|
||||
#ifndef G4HELIXEXPLICITEULER_HH
|
||||
#define G4HELIXEXPLICITEULER_HH
|
||||
#include "G4MagHelicalStepper.hh"
|
||||
|
||||
class G4HelixExplicitEuler: public G4MagHelicalStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4HelixExplicitEuler(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
|
||||
~G4HelixExplicitEuler(){};
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
// DELETED RightHandSide( ) !!!!
|
||||
// Replace by MagFieldEvaluate( const G4double y[], G4double B[] )
|
||||
// in G4HelicalStepper
|
||||
|
||||
G4int IntegratorOrder() { return 1; };
|
||||
};
|
||||
|
||||
#endif /* G4EXPLICITEULER_HH */
|
||||
@@ -0,0 +1,33 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixHeum.hh,v 2.2 1998/11/09 14:09:25 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 03/11/98
|
||||
|
||||
#ifndef G4HELIXHEUM_HH
|
||||
#define G4HELIXHEUM_HH
|
||||
#include "G4MagHelicalStepper.hh"
|
||||
|
||||
class G4HelixHeum: public G4MagHelicalStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4HelixHeum(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
|
||||
~G4HelixHeum(){};
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
G4int IntegratorOrder() { return 2; };
|
||||
};
|
||||
|
||||
#endif /* G4HELIXHEUM_HH */
|
||||
@@ -0,0 +1,33 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.hh,v 2.3 1998/11/10 18:16:47 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 03/11/98
|
||||
|
||||
#ifndef G4HELIXIMPLICITEULER_HH
|
||||
#define G4HELIXIMPLICITEULER_HH
|
||||
#include "G4MagHelicalStepper.hh"
|
||||
|
||||
class G4HelixImplicitEuler: public G4MagHelicalStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4HelixImplicitEuler(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
|
||||
~G4HelixImplicitEuler(){};
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
G4int IntegratorOrder() { return 2; };
|
||||
};
|
||||
|
||||
#endif /* G4HELIXIMPLICITEULER_HH */
|
||||
@@ -0,0 +1,33 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.hh,v 2.3 1998/11/10 18:16:48 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 03/12/98
|
||||
|
||||
#ifndef G4HELIXSIMPLERUNGE_HH
|
||||
#define G4HELIXSIMPLERUNGE_HH
|
||||
#include "G4MagHelicalStepper.hh"
|
||||
|
||||
class G4HelixSimpleRunge: public G4MagHelicalStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4HelixSimpleRunge(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
|
||||
~G4HelixSimpleRunge(){};
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
G4int IntegratorOrder() { return 2; };
|
||||
};
|
||||
|
||||
#endif /* G4HELIXSIMPLERUNGE_HH */
|
||||
@@ -0,0 +1,37 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4ImplicitEuler.hh,v 2.2 1998/11/09 11:52:46 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 12/09/97
|
||||
|
||||
#ifndef G4IMPLICITEULER_HH
|
||||
#define G4IMPLICITEULER_HH
|
||||
#include "G4MagErrorStepper.hh"
|
||||
|
||||
class G4ImplicitEuler: public G4MagErrorStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4ImplicitEuler(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
|
||||
~G4ImplicitEuler();
|
||||
|
||||
void DumbStepper( const G4double y[] ,
|
||||
const G4double dydx[] ,
|
||||
const G4double h ,
|
||||
G4double yout[] ) ;
|
||||
|
||||
G4int IntegratorOrder() { return 2 ; } ;
|
||||
|
||||
private:
|
||||
|
||||
G4int fNumberOfVariables ;
|
||||
};
|
||||
|
||||
#endif /* G4IMPLICITEULER_HH */
|
||||
@@ -0,0 +1,39 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4LineSection.hh,v 2.1 1998/07/12 02:54:56 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// A utility class that calculates the distance of a point from a
|
||||
// line section.
|
||||
//
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
typedef G4ThreeVector POINT;
|
||||
typedef POINT Vector;
|
||||
|
||||
|
||||
class G4LineSection {
|
||||
public:
|
||||
G4LineSection( const POINT& PntA, const POINT& PntB );
|
||||
|
||||
G4double Dist( POINT OtherPnt ) const;
|
||||
G4double InvsqDistAB() const { return inverse_square_distAB; }
|
||||
|
||||
//
|
||||
static G4double Distline( const POINT& OtherPnt,
|
||||
const POINT& LinePntA,
|
||||
const POINT& LinePntB );
|
||||
private:
|
||||
POINT EndpointA;
|
||||
Vector VecAtoB;
|
||||
G4double inverse_square_distAB;
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagErrorStepper.hh,v 2.4 1998/11/12 16:22:21 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// Abstract base class (ie Interface)
|
||||
// -------------------
|
||||
// for integrator of particle's equation of motion,
|
||||
// used in tracking in space dependent magnetic field
|
||||
// -----------------------------------------------------
|
||||
//
|
||||
// History:
|
||||
// 09.12.97 W.Wander <wwc@mit.edu> Created G4MagErrorStepper
|
||||
// 09.03.98 W.Wander <wwc@mit.edu> Added AdvanceHelix functionality
|
||||
// 09.11.98 J.Apostolakis Moved AdvanceHelix to G4MagHelicalStepper
|
||||
// $ Id: $
|
||||
|
||||
#ifndef G4MAGERRORSTEPPER_HH
|
||||
#define G4MAGERRORSTEPPER_HH
|
||||
#include "globals.hh"
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4MagErrorStepper : public G4MagIntegratorStepper
|
||||
{
|
||||
public:
|
||||
|
||||
G4MagErrorStepper(G4Mag_EqRhs *EqRhs,G4int numberOfVariables);
|
||||
~G4MagErrorStepper(){} ;
|
||||
|
||||
// The stepper for the Runge Kutta integration. The stepsize
|
||||
// is fixed, with the Step size given by h.
|
||||
// Integrates ODE starting values y[0 to 6 ]
|
||||
// Outputs yout[] and its estimated error yerr[].
|
||||
|
||||
void Stepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[],
|
||||
G4double yerr[] );
|
||||
|
||||
// performs a 'dump' Step without error calculation.
|
||||
|
||||
virtual void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[] ) = 0;
|
||||
|
||||
G4double DistChord() const;
|
||||
private:
|
||||
|
||||
// Data stored in order to find the chord
|
||||
G4ThreeVector yInitial, yMidPoint, yFinal;
|
||||
|
||||
G4int theNumberOfVariables ;
|
||||
};
|
||||
#include "G4MagErrorStepper.icc"
|
||||
|
||||
#endif /* G4MAGERRORSTEPPER_HH */
|
||||
@@ -0,0 +1,16 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagErrorStepper.icc,v 2.4 1998/11/12 16:22:42 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
inline G4MagErrorStepper::G4MagErrorStepper(G4Mag_EqRhs *EqRhs,
|
||||
G4int numberOfVariables)
|
||||
:G4MagIntegratorStepper(EqRhs),
|
||||
theNumberOfVariables(numberOfVariables)
|
||||
{};
|
||||
@@ -0,0 +1,88 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.hh,v 2.4 1998/11/13 14:27:10 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
// Started from G4MagErrorStepper.hh
|
||||
//
|
||||
// Abstract base class (ie Interface)
|
||||
// -------------------
|
||||
// for integrator of particle's equation of motion,
|
||||
// used in tracking in space dependent magnetic field
|
||||
// -----------------------------------------------------
|
||||
//
|
||||
// History:
|
||||
// 05.11.98 J.Apostolakis Creation of new ABC
|
||||
//
|
||||
#ifndef G4MagHelicalStepper_hh
|
||||
#define G4MagHelicalStepper_hh
|
||||
#include "globals.hh"
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4MagHelicalStepper : public G4MagIntegratorStepper
|
||||
{
|
||||
public:
|
||||
|
||||
G4MagHelicalStepper(G4Mag_EqRhs *EqRhs);
|
||||
~G4MagHelicalStepper(){} ;
|
||||
|
||||
// The stepper for the Runge Kutta integration. The stepsize
|
||||
// is fixed, equal to h.
|
||||
// Integrates ODE starting values y[0 to 6 ]
|
||||
// Outputs yout[] and its estimated error yerr[].
|
||||
|
||||
void Stepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[],
|
||||
G4double yerr[] );
|
||||
|
||||
// performs a 'dump' Step without error calculation.
|
||||
|
||||
virtual void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[] ) = 0;
|
||||
|
||||
// Estimate maximum distance of curved solution and chord ...
|
||||
|
||||
G4double DistChord() const;
|
||||
|
||||
// --- Methods used to implement all the derived classes -----
|
||||
protected:
|
||||
|
||||
// a linear Step in regions without magnetic field
|
||||
|
||||
inline void LinearStep( const G4double yIn[],
|
||||
const G4double h,
|
||||
G4double yHelix[]);
|
||||
|
||||
// a first order Step along a helix inside the field
|
||||
|
||||
void AdvanceHelix( const G4double yIn[],
|
||||
const G4double B[],
|
||||
const G4double h,
|
||||
G4double yHelix[]);
|
||||
|
||||
// evaluate the field at a certain point
|
||||
|
||||
void MagFieldEvaluate( const G4double y[], G4double B[] )
|
||||
{ GetEquationOfMotion()-> GetFieldValue(y, B); }
|
||||
|
||||
private:
|
||||
|
||||
// Data stored in order to find the chord
|
||||
G4ThreeVector yInitial, yMidPoint, yFinal;
|
||||
|
||||
G4Mag_EqRhs* fPtrMagEqOfMot;
|
||||
};
|
||||
|
||||
#include "G4MagHelicalStepper.icc"
|
||||
|
||||
#endif /* G4MagHelicalStepper_hh */
|
||||
@@ -0,0 +1,25 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.icc,v 2.2 1998/11/13 14:27:10 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
// linear Step in regions of no field
|
||||
|
||||
inline void
|
||||
G4MagHelicalStepper::LinearStep( const G4double yIn[],
|
||||
const G4double h,
|
||||
G4double yLinear[])
|
||||
{
|
||||
for( G4int i = 0; i < 3; i++ ) {
|
||||
yLinear[i] = yIn[i] + h * yIn[i+3];
|
||||
yLinear[i+3] = yIn[i+3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.hh,v 2.5 1998/11/11 18:51:10 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// Provides Driver that talks to Integrator Stepper, and insures that
|
||||
// the error is within acceptable bounds.
|
||||
|
||||
#ifndef G4MagInt_Driver_Def
|
||||
#define G4MagInt_Driver_Def
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4FieldTrack.hh"
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
|
||||
class G4MagInt_Driver
|
||||
{
|
||||
public:
|
||||
G4bool AccurateAdvance( G4FieldTrack& y_current,
|
||||
const G4double hstep,
|
||||
const G4double eps); // Requested y_err/hstep
|
||||
|
||||
//
|
||||
// Above drivers for integrator (Runge-Kutta) with stepsize control.
|
||||
// Integrates ODE starting values y_current
|
||||
// from current s (s=s0) to s=s0+h with accuracy eps.
|
||||
// On output ystart is replaced by value at end of interval.
|
||||
// The concept is similar to the odeint routine from NRC p.721-722 .
|
||||
|
||||
// QuickAdvance just tries one Step - it does not ensure accuracy
|
||||
G4bool QuickAdvance( G4FieldTrack& y_val, // INOUT
|
||||
const G4double dydx[],
|
||||
G4double hstep, // IN
|
||||
G4double& dchord_step,
|
||||
G4double& dyerr ) ;
|
||||
|
||||
// Constructor, destructor
|
||||
//
|
||||
G4MagInt_Driver( G4double hminimum,
|
||||
G4MagIntegratorStepper *pItsStepper,
|
||||
G4int numberOfComponents=6);
|
||||
~G4MagInt_Driver(){}
|
||||
|
||||
// Access functions
|
||||
// ----------------
|
||||
//
|
||||
G4double Hmin(){ return hminimum_val;}
|
||||
G4double GetSafety(){ return safety; }
|
||||
G4double GetPshrnk(){ return pshrnk;}
|
||||
G4double GetPgrow(){ return pgrow;}
|
||||
G4double GetErrcon(){ return errcon;}
|
||||
|
||||
void GetDerivatives( const G4FieldTrack y_curr, // const, INput
|
||||
G4double dydx[] ); // OUTput
|
||||
|
||||
// Set functions
|
||||
// ----------------
|
||||
//
|
||||
G4double SetHmin(G4double newval){ return hminimum_val;}
|
||||
//
|
||||
// The following function sets a new stepper pItsStepper for
|
||||
// this driver, and then calls ReSetParameters to reset its
|
||||
// parameters accordingly.
|
||||
//
|
||||
void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper);
|
||||
//
|
||||
//
|
||||
// ReSetParameters does the following:
|
||||
// i) sets the exponents (pgrow & pshrnk),
|
||||
// using the current Stepper's order,
|
||||
// ii) sets the safety
|
||||
// ii) calculates "errcon" according to the above values.
|
||||
//
|
||||
void ReSetParameters(G4double new_safety= 0.9 );
|
||||
//
|
||||
// When setting safety or pgrow, errcon will be set to a
|
||||
// compatible value
|
||||
//
|
||||
void SetSafety(G4double valS);
|
||||
void SetPshrnk(G4double valPs);
|
||||
void SetPgrow( G4double valPg);
|
||||
void SetErrcon(G4double valEc);
|
||||
//
|
||||
G4double ComputeAndSetErrcon();
|
||||
|
||||
|
||||
void SetChargeMomentumMass( // Change them in Equation
|
||||
const G4double particleCharge, // in e+ units
|
||||
const G4double MomentumXc,
|
||||
const G4double Mass );
|
||||
|
||||
G4MagIntegratorStepper* GetStepper();
|
||||
|
||||
// This takes one Step that is as large as possible while
|
||||
// satisfying the accuracy criterion of
|
||||
// yerr < eps * |y_end-y_start|
|
||||
//
|
||||
void OneGoodStep( G4double ystart[], // Like old RKF45step()
|
||||
const G4double dydx[],
|
||||
G4double& x,
|
||||
const G4double htry,
|
||||
const G4double eps, // memb variables ?
|
||||
G4double& hdid,
|
||||
G4double& hnext ) ;
|
||||
|
||||
// Taking the last step's normalised error, calculate
|
||||
// a step size for the next step.
|
||||
// Do not limit the next step's size within a factor of the current one.
|
||||
G4double ComputeNewStepSize(
|
||||
G4double errMaxNorm, // normalised error
|
||||
G4double hstepCurrent); // current step size
|
||||
|
||||
// Taking the last step's normalised error, calculate
|
||||
// a step size for the next step.
|
||||
// Limit the next step's size within a range around the current one.
|
||||
G4double ComputeNewStepSize_WithinLimits(
|
||||
G4double errMaxNorm, // normalised error
|
||||
G4double hstepCurrent); // current step size
|
||||
private:
|
||||
G4double hminimum_val; // Minimum Step allowed in a Step
|
||||
|
||||
const G4int nvar;
|
||||
|
||||
G4MagIntegratorStepper *pIntStepper;
|
||||
|
||||
// Parameters used to grow and shrink trial stepsize
|
||||
G4double safety;
|
||||
G4double pshrnk; // exponent for shrinking
|
||||
G4double pgrow; // exponent for growth
|
||||
G4double errcon;
|
||||
// maximum stepsize increase/decrease factors
|
||||
const static G4double max_stepping_increase;
|
||||
const static G4double max_stepping_decrease;
|
||||
};
|
||||
|
||||
#include "G4MagIntegratorDriver.icc"
|
||||
|
||||
#endif /* G4MagInt_Driver_Def */
|
||||
@@ -0,0 +1,80 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.icc,v 2.4 1998/11/13 13:41:50 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
inline G4double G4MagInt_Driver::ComputeAndSetErrcon()
|
||||
{
|
||||
errcon = pow(max_stepping_increase/GetSafety(),1.0/GetPgrow());
|
||||
return errcon;
|
||||
}
|
||||
|
||||
inline void G4MagInt_Driver::ReSetParameters( G4double new_safety )
|
||||
{
|
||||
safety = new_safety;
|
||||
pshrnk = -1.0 / pIntStepper->IntegratorOrder();
|
||||
pgrow = -1.0 / (1.0 + pIntStepper->IntegratorOrder());
|
||||
ComputeAndSetErrcon();
|
||||
}
|
||||
|
||||
inline void G4MagInt_Driver::SetSafety(G4double val)
|
||||
{
|
||||
safety=val;
|
||||
ComputeAndSetErrcon();
|
||||
}
|
||||
|
||||
inline void G4MagInt_Driver::SetPgrow(G4double val)
|
||||
{
|
||||
pgrow=val;
|
||||
ComputeAndSetErrcon();
|
||||
}
|
||||
|
||||
inline void G4MagInt_Driver::SetErrcon(G4double val)
|
||||
{
|
||||
errcon=val;
|
||||
}
|
||||
|
||||
inline void G4MagInt_Driver::RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper)
|
||||
{
|
||||
pIntStepper = pItsStepper;
|
||||
ReSetParameters();
|
||||
}
|
||||
|
||||
inline void G4MagInt_Driver:: SetChargeMomentumMass(
|
||||
const G4double particleCharge, // in e+ units
|
||||
const G4double MomentumXc,
|
||||
const G4double Mass )
|
||||
{
|
||||
pIntStepper->GetEquationOfMotion()
|
||||
->SetChargeMomentumMass(particleCharge, MomentumXc, Mass);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
//
|
||||
inline G4MagInt_Driver::G4MagInt_Driver( G4double hminimum,
|
||||
G4MagIntegratorStepper *pItsStepper,
|
||||
G4int numComponents)
|
||||
: nvar(numComponents)
|
||||
{
|
||||
RenewStepperAndAdjust( pItsStepper );
|
||||
hminimum_val= hminimum;
|
||||
}
|
||||
|
||||
inline G4MagIntegratorStepper* G4MagInt_Driver::GetStepper()
|
||||
{ return pIntStepper; }
|
||||
|
||||
inline void G4MagInt_Driver::GetDerivatives(
|
||||
const G4FieldTrack y_curr, // const, INput
|
||||
G4double dydx[] ) // OUTput
|
||||
{
|
||||
G4double tmpValArr[G4FieldTrack::ncompSVEC];
|
||||
y_curr.DumpToArray( tmpValArr );
|
||||
pIntStepper -> RightHandSide( tmpValArr , dydx );
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.hh,v 2.2 1998/11/10 18:16:48 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
// Abstract base class (ie Interface)
|
||||
// -------------------
|
||||
// for integrator of particle's equation of motion,
|
||||
// used in tracking in space dependent magnetic field
|
||||
// -----------------------------------------------------
|
||||
//
|
||||
// History:
|
||||
// 15.01.97 J.Apostolakis (J.Apostolakis@cern.ch)
|
||||
|
||||
#ifndef G4MAGIntegratorSTEPPER
|
||||
#define G4MAGIntegratorSTEPPER
|
||||
#include "globals.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
|
||||
class G4MagIntegratorStepper
|
||||
{
|
||||
public:
|
||||
|
||||
G4MagIntegratorStepper(G4Mag_EqRhs *EqRhs);
|
||||
~G4MagIntegratorStepper(){} ;
|
||||
|
||||
// "Key" methods
|
||||
// ---------------
|
||||
// The stepper for the Runge Kutta integration. The stepsize
|
||||
// is fixed, with the Step size given by h.
|
||||
// Integrates ODE starting values y[0 to 6 ]
|
||||
// Outputs yout[] and its estimated error yerr[].
|
||||
|
||||
virtual void Stepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[],
|
||||
G4double yerr[] ) = 0 ;
|
||||
|
||||
// Estimate the maximum distance of chord from true path over
|
||||
// segment last integrated.
|
||||
|
||||
virtual G4double DistChord() const = 0;
|
||||
|
||||
|
||||
// Utility methods
|
||||
// ---------------
|
||||
// Simple function to (re)normalise 'unit velocity' vector
|
||||
//
|
||||
void NormaliseTangentVector( G4double vec[6] );
|
||||
|
||||
// Supply the standard Evaluation of the Right Hand side
|
||||
// of the associated equation.
|
||||
//
|
||||
virtual void RightHandSide( const double y[], double dydx[] )
|
||||
{ theEquation_Rhs-> RightHandSide(y, dydx); }
|
||||
|
||||
#if 0
|
||||
// Supply the standard Evaluation of the Right Hand side
|
||||
// of the associated equation.
|
||||
void
|
||||
SetChargeAndMomentum( const G4double particleCharge, // in e+ units
|
||||
const G4double MomentumXc)
|
||||
{ theEquation_Rhs -> SetChargeAndMomentum(particleCharge, MomentumXc);}
|
||||
#endif
|
||||
|
||||
// returns the order of the integrator
|
||||
// i.e. its error behaviour is of the order O(h^order)
|
||||
virtual G4int IntegratorOrder() = 0;
|
||||
|
||||
// As some steppers (eg RKG3) require other methods of Eq_Rhs
|
||||
// the next function allows for access to them.
|
||||
G4EquationOfMotion *GetEquationOfMotion() const;
|
||||
|
||||
private:
|
||||
|
||||
G4EquationOfMotion *theEquation_Rhs;
|
||||
|
||||
};
|
||||
|
||||
#include "G4MagIntegratorStepper.icc"
|
||||
|
||||
#endif /* G4MAGIntegratorSTEPPER */
|
||||
@@ -0,0 +1,25 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.icc,v 2.2 1998/11/10 18:16:49 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
inline G4EquationOfMotion* G4MagIntegratorStepper::GetEquationOfMotion() const
|
||||
{ return theEquation_Rhs; }
|
||||
|
||||
inline void G4MagIntegratorStepper::
|
||||
NormaliseTangentVector( G4double vec[6] )
|
||||
{
|
||||
double drds2 = vec[3]*vec[3]+vec[4]*vec[4]+vec[5]*vec[5];
|
||||
|
||||
if( fabs(drds2 - 1.0) > 1.e-14 ){
|
||||
double normx = 1.0 / sqrt(drds2);
|
||||
for(int i=0;i<3;i++)
|
||||
vec[i+3] *= normx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.hh,v 2.4 1998/11/12 16:23:25 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// The right hand size of the equation of motion of a particle
|
||||
// in a magnetic field.
|
||||
//
|
||||
// (Possible use of alternative to "normal" version: rotating reference
|
||||
// frame)
|
||||
//
|
||||
// JA, January 13th, 1996
|
||||
//
|
||||
#ifndef G4_MAG_EQRHS_DEF
|
||||
#define G4_MAG_EQRHS_DEF
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4EquationOfMotion.hh"
|
||||
|
||||
#include "G4MagneticField.hh" // class G4MagneticField; not enough ??
|
||||
|
||||
class G4Mag_EqRhs : public G4EquationOfMotion
|
||||
{
|
||||
public:
|
||||
G4Mag_EqRhs( G4MagneticField *magField );
|
||||
~G4Mag_EqRhs();
|
||||
|
||||
// Given the value of the field "B", this function
|
||||
// calculates the value of the derivative dydx.
|
||||
// --------------------------------------------------------
|
||||
// This is the _only_ function a subclass must define.
|
||||
// The other two functions use Rhs_givenB.
|
||||
//
|
||||
virtual void EvaluateRhsGivenB( const G4double y[],
|
||||
const G4double B[3],
|
||||
G4double dydx[] ) const = 0;
|
||||
|
||||
G4double FCof() const { return fCof_val; }
|
||||
|
||||
void SetChargeMomentumMass( const G4double particleCharge, // in e+ units
|
||||
const G4double MomentumXc,
|
||||
const G4double mass);
|
||||
|
||||
private:
|
||||
|
||||
G4double fCof_val;
|
||||
|
||||
// Coefficient in the Lorentz motion equation (Lorentz force), if the
|
||||
// magnetic field B is in Tesla, the particle charge in units of the
|
||||
// elementary (positron?) charge, the momentum P in MeV/c, and the
|
||||
// space coordinates and path along the trajectory in mm .
|
||||
//
|
||||
static const G4double fUnitConstant; // Set in G4Mag_EqRhs.cc
|
||||
// to 0.299792458
|
||||
};
|
||||
|
||||
#endif /* G4_MAG_EQRHS_DEF */
|
||||
@@ -0,0 +1,40 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Mag_UsualEqRhs.hh,v 2.2 1998/11/10 18:16:49 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// J. Apostolakis, January 13th, 1997
|
||||
//
|
||||
#ifndef G4MAG_USUAL_EQRHS
|
||||
#define G4MAG_USUAL_EQRHS
|
||||
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
#include "G4MagneticField.hh"
|
||||
|
||||
class G4Mag_UsualEqRhs: public G4Mag_EqRhs{
|
||||
public:
|
||||
G4Mag_UsualEqRhs( G4MagneticField* MagField ) :
|
||||
G4Mag_EqRhs( MagField ) {};
|
||||
~G4Mag_UsualEqRhs() {} ;
|
||||
|
||||
// Given the value of the magnetic field B, this function
|
||||
// calculates the value of the derivative dydx.
|
||||
//
|
||||
void EvaluateRhsGivenB( const G4double y[],
|
||||
const G4double B[3],
|
||||
G4double dydx[] ) const;
|
||||
};
|
||||
|
||||
#endif /* G4MAG_USUAL_EQRHS */
|
||||
@@ -0,0 +1,53 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4MagneticField.hh,v 2.4 1998/11/19 20:45:02 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Magnetic Field abstract class, implements inquiry function interface.
|
||||
//
|
||||
// JA, January 13th, 1996
|
||||
//
|
||||
// November 5th, 1997 - G.Cosmo, added default & copy constructors, virtual
|
||||
// destructor and assignment operator.
|
||||
|
||||
#ifndef G4MAGNETIC_FIELD_DEF
|
||||
#define G4MAGNETIC_FIELD_DEF
|
||||
|
||||
#include "G4Field.hh"
|
||||
|
||||
class G4MagneticField : public G4Field
|
||||
{
|
||||
public:
|
||||
|
||||
G4MagneticField();
|
||||
virtual ~G4MagneticField();
|
||||
|
||||
// Copy constructor & assignment operator
|
||||
G4MagneticField(const G4MagneticField &p);
|
||||
G4MagneticField& operator = (const G4MagneticField &p);
|
||||
|
||||
// Old version of field evaluation function:
|
||||
// to be replaced by following function (GetFieldValue)
|
||||
// virtual void MagneticField( const double Point[3],
|
||||
// double Bfield[3] ) = 0;
|
||||
|
||||
virtual void GetFieldValue( const double Point[3],
|
||||
double *Bfield ) const = 0;
|
||||
};
|
||||
|
||||
// Implementation
|
||||
|
||||
inline G4MagneticField::G4MagneticField() {}
|
||||
inline G4MagneticField::~G4MagneticField() {}
|
||||
inline G4MagneticField::G4MagneticField(const G4MagneticField &p) {}
|
||||
// Not needed: { *this = p; }
|
||||
inline G4MagneticField& G4MagneticField::operator = (const G4MagneticField &p)
|
||||
{ *this = p; return *this; }
|
||||
|
||||
#endif /* G4MAGNETIC_FIELD_DEF */
|
||||
@@ -0,0 +1,170 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PropagatorInField.hh,v 2.8 1998/11/27 22:49:12 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
// GEANT 4 include file implementation
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division (formely CN), ASD group
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// This class performs the navigation/propagation of a particle/track
|
||||
// in a magnetic field. The field is in general non-uniform.
|
||||
// For the calculation of the path, it relies on the class G4MagTr.
|
||||
//
|
||||
// class G4PropagatorInField
|
||||
// Methods:
|
||||
// ComputeStep(..)
|
||||
// CalculateStepTimeAndAccuracy(..)
|
||||
// LocateIntersectionPoint(..)
|
||||
//
|
||||
// 25.10.96 John Apostolakis, design and implementation
|
||||
// 25.03.97 John Apostolakis, adaptation for G4Transportation and cleanup
|
||||
// ------------------------------------------------------------------------
|
||||
#ifndef G4PropagatorInField_hh
|
||||
#define G4PropagatorInField_hh 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4FieldTrack.hh"
|
||||
// #include "G4VPhysicalVolume.hh"
|
||||
// class G4VPhysicalVolume;
|
||||
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4ChordFinder.hh"
|
||||
|
||||
#include "G4FieldManager.hh"
|
||||
|
||||
// #include "G4MagIntegratorDriver.hh"
|
||||
|
||||
class G4PropagatorInField {
|
||||
|
||||
public:
|
||||
// To create an object, must have an object that calculates the Curved
|
||||
// paths and also must know the value of the maximum displacement allowed
|
||||
//
|
||||
|
||||
G4PropagatorInField( G4Navigator *theNavigator,
|
||||
G4FieldManager *detectorFieldMgr);
|
||||
|
||||
G4PropagatorInField( G4Navigator *theNavigator );
|
||||
~G4PropagatorInField(){};
|
||||
|
||||
// Compute the next geometric Step
|
||||
//
|
||||
G4double ComputeStep(G4FieldTrack &pFieldTrack,
|
||||
G4double pCurrentProposedStepLength,
|
||||
G4double &pNewSafety,
|
||||
G4VPhysicalVolume *pPhysVol=0 );
|
||||
|
||||
G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
|
||||
const G4ThreeVector &pCurveTangent, // Unit vector
|
||||
G4double pCurrentProposedStepLength,
|
||||
G4double &pNewSafety,
|
||||
G4VPhysicalVolume *pPhysVol=0 );
|
||||
// Current Volume (to check)
|
||||
|
||||
// Return the state after the Step
|
||||
//
|
||||
G4ThreeVector EndPosition();
|
||||
G4ThreeVector EndMomentumDir();
|
||||
G4bool IsParticleLooping();
|
||||
|
||||
// The accuracy of finding an intersection
|
||||
//
|
||||
G4double DeltaIntersection();
|
||||
|
||||
// The accuracy of a single Step
|
||||
//
|
||||
G4double DeltaOneStep();
|
||||
|
||||
// The ratio DeltaOneStep()/h_current_step
|
||||
//
|
||||
G4double GetEpsilonStep(); // Relative accuracy for current Step (Calc.)
|
||||
void SetEpsilonStep(G4double newEps);
|
||||
|
||||
// A maximum for the number of steps that a (looping) particle
|
||||
// can take.
|
||||
//
|
||||
G4int GetMaxLoopCount();
|
||||
void SetMaxLoopCount(G4int new_max);
|
||||
|
||||
void SetChargeMomentumMass( G4double Charge, // in e+ units
|
||||
G4double Momentum, // in Geant4 units
|
||||
G4double pMass);
|
||||
|
||||
G4ChordFinder* GetChordFinder();
|
||||
// void SetChordFinder(G4ChordFinder* newCF); // Not yet relevant
|
||||
|
||||
G4int SetVerboseLevel( G4int Verbose ){ return fVerboseLevel=Verbose; }
|
||||
G4int Verbose(){ return fVerboseLevel; }
|
||||
|
||||
// Print Method - useful mostly for debugging this class
|
||||
//
|
||||
void printStatus(
|
||||
const G4FieldTrack& StartFT,
|
||||
const G4FieldTrack& CurrentFT,
|
||||
G4double requestStep,
|
||||
G4double safety,
|
||||
G4int Step,
|
||||
G4VPhysicalVolume* startVolume);
|
||||
|
||||
// The Field Manager of the Detector
|
||||
//
|
||||
// void SetGlobalFieldMgr( G4FieldManager *detectorFieldMgr );
|
||||
|
||||
private:
|
||||
|
||||
// The Field Manager of the whole Detector
|
||||
//
|
||||
G4FieldManager *fDetectorFieldMgr;
|
||||
|
||||
G4Navigator *fNavigator;
|
||||
|
||||
// End point storage:
|
||||
//
|
||||
G4FieldTrack End_PointAndTangent;
|
||||
|
||||
// If such an intersection exists, this function
|
||||
// calculate the intersection point of the true path of the particle
|
||||
// with the surface of the current volume (or of one of its daughters).
|
||||
// (Should use lateral displacement as measure of convergence).
|
||||
//
|
||||
G4bool LocateIntersectionPoint(
|
||||
const G4FieldTrack& CurveStartPointTangent, // A
|
||||
const G4FieldTrack& CurveEndPointTangent, // B
|
||||
const G4ThreeVector& TrialPoint, // E
|
||||
G4FieldTrack& IntersectPointTangent); // Output
|
||||
//
|
||||
// [ Should this have fewer or additional arguments ?
|
||||
// pointer to info on solution already obtained
|
||||
// tolerance
|
||||
// ]
|
||||
|
||||
G4double fEpsilonStep; // Relative accuracy for current Step (Calc.)
|
||||
|
||||
G4bool fParticleIsLooping;
|
||||
// For debuging purposes
|
||||
G4int fVerboseLevel;
|
||||
|
||||
// For the moment class constants ... set in G4PropagatemagField.cc
|
||||
//
|
||||
static const G4double delta_intersection_val; // = 0.1 * mm;
|
||||
static const G4double delta_one_step_val; // = 0.25 * mm;
|
||||
|
||||
G4int fmax_loop_count;
|
||||
}; // End of class G4PropagatorInField {
|
||||
|
||||
// Defines the constructor.
|
||||
//
|
||||
#include "G4PropagatorInField.icc"
|
||||
|
||||
#endif
|
||||
// End of "#ifndef G4PropagatorInField_hh"
|
||||
@@ -0,0 +1,98 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PropagatorInField.icc,v 2.6 1998/11/24 19:17:24 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
// GEANT 4 include file implementation
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division (formely CN), ASD group
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// 25.10.96 John Apostolakis, design and implementation
|
||||
// 25.03.97 John Apostolakis, adaptation for G4Transportation and cleanup
|
||||
//
|
||||
// To create an object, must have
|
||||
// an object that calculates the Curved paths
|
||||
// the navigator to find (linear) intersections
|
||||
// and ?? also must know the value of the maximum displacement allowed
|
||||
//
|
||||
|
||||
inline G4PropagatorInField::
|
||||
G4PropagatorInField( G4Navigator *theNavigator,
|
||||
G4FieldManager *detectorFieldMgr) :
|
||||
fNavigator(theNavigator),
|
||||
fDetectorFieldMgr(detectorFieldMgr),
|
||||
fmax_loop_count(1000),
|
||||
End_PointAndTangent(G4ThreeVector(0.,0.,0.),G4ThreeVector(0.,0.,0.),0.0,0.0)
|
||||
{
|
||||
// this->fChordFinder = new G4ChordFinder( (G4MagneticField*)0, 1e-6 );
|
||||
}
|
||||
|
||||
inline
|
||||
G4ChordFinder* G4PropagatorInField::GetChordFinder()
|
||||
{
|
||||
// Now only the "Chord Finder" of the global Field Mgr is used
|
||||
// ...
|
||||
return fDetectorFieldMgr->GetChordFinder();
|
||||
}
|
||||
|
||||
inline void G4PropagatorInField::SetChargeMomentumMass(
|
||||
G4double Charge, // in e+ units
|
||||
G4double Momentum, // in GeV/c
|
||||
G4double Mass) // in ? units
|
||||
{
|
||||
GetChordFinder()->SetChargeMomentumMass(Charge, Momentum, Mass);
|
||||
}
|
||||
|
||||
// Obtain the final space-point and velocity (normal) at the end of the Step
|
||||
//
|
||||
inline
|
||||
G4ThreeVector G4PropagatorInField::EndPosition()
|
||||
{
|
||||
return End_PointAndTangent.Position();
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4PropagatorInField::EndMomentumDir()
|
||||
{
|
||||
return End_PointAndTangent.GetMomentumDir();
|
||||
}
|
||||
|
||||
inline G4double G4PropagatorInField::GetEpsilonStep()
|
||||
{
|
||||
return fEpsilonStep;
|
||||
}
|
||||
inline void G4PropagatorInField::SetEpsilonStep(G4double newEps)
|
||||
{
|
||||
fEpsilonStep=newEps;
|
||||
}
|
||||
inline G4bool G4PropagatorInField::IsParticleLooping()
|
||||
{
|
||||
return fParticleIsLooping;
|
||||
}
|
||||
|
||||
inline G4int G4PropagatorInField::GetMaxLoopCount()
|
||||
{
|
||||
return fmax_loop_count;
|
||||
}
|
||||
|
||||
inline void G4PropagatorInField::SetMaxLoopCount(G4int new_max)
|
||||
{
|
||||
fmax_loop_count= new_max;
|
||||
}
|
||||
|
||||
// inline void G4PropagatorInField::SetChordFinder(G4ChordFinder* newCF)
|
||||
|
||||
inline G4double G4PropagatorInField::DeltaOneStep()
|
||||
{ return delta_one_step_val; }
|
||||
|
||||
inline G4double G4PropagatorInField::DeltaIntersection()
|
||||
{ return delta_intersection_val; }
|
||||
@@ -0,0 +1,69 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RKG3_Stepper.hh,v 2.2 1998/11/10 18:16:50 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// J.Apostolakis, V.Grichine 30.01.97
|
||||
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4RKG3_Stepper : public G4MagIntegratorStepper
|
||||
{
|
||||
public:
|
||||
G4RKG3_Stepper(G4Mag_EqRhs *EqRhs): G4MagIntegratorStepper(EqRhs){};
|
||||
~G4RKG3_Stepper(){};
|
||||
|
||||
// The method it must provide, even if less efficiently
|
||||
|
||||
void
|
||||
Stepper( const G4double yIn[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yOut[],
|
||||
G4double yErr[] );
|
||||
// G4double& beta2) const
|
||||
|
||||
G4double DistChord() const ;
|
||||
|
||||
// Additional "optimised" methods:
|
||||
|
||||
// Integrator RK Stepper from G3 with only two field evaluation per
|
||||
// Step. It is used in propagation initial Step by small substeps
|
||||
// after solution error and delta geometry considerations.
|
||||
// B[3] is magnetic field which is passed from substep to substep.
|
||||
|
||||
void StepNoErr( const G4double tIn[7],
|
||||
const G4double dydx[7],
|
||||
const G4double Step,
|
||||
G4double tOut[7],
|
||||
G4double B[3] );
|
||||
|
||||
void StepWithEst(const G4double tIn[7],
|
||||
const G4double dydx[7],
|
||||
const G4double Step,
|
||||
G4double tOut[7],
|
||||
// G4double tError[6],
|
||||
G4double& alpha2, // to delete ?
|
||||
G4double& beta2,
|
||||
const G4double B1[3],
|
||||
G4double B3[3] );
|
||||
|
||||
G4int IntegratorOrder() { return 4; };
|
||||
|
||||
protected:
|
||||
// void Field( const double Point[3],
|
||||
// double Bfield[3] ) const
|
||||
// { EqRhs-> GetFieldValue( Point, Bfield ) ; }
|
||||
private:
|
||||
G4ThreeVector fyInitial,
|
||||
fyMidPoint,
|
||||
fyFinal ;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleHeum.hh,v 2.3 1998/11/17 18:20:09 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 12/09/97
|
||||
|
||||
#ifndef G4SIMPLEHEUM_HH
|
||||
#define G4SIMPLEHEUM_HH
|
||||
#include "G4MagErrorStepper.hh"
|
||||
|
||||
class G4SimpleHeum: public G4MagErrorStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4SimpleHeum(G4Mag_EqRhs *EqRhs, G4int num_variables=6);
|
||||
~G4SimpleHeum();
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
G4int IntegratorOrder() { return 3; };
|
||||
|
||||
private:
|
||||
const G4int fNumberOfVariables;
|
||||
|
||||
// scratch space
|
||||
G4double* dydxTemp ;
|
||||
G4double* dydxTemp2 ;
|
||||
G4double* yTemp ;
|
||||
G4double* yTemp2 ;
|
||||
};
|
||||
|
||||
#endif /* G4SIMPLEHEUM_HH */
|
||||
@@ -0,0 +1,42 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SimpleRunge.hh,v 2.3 1998/11/17 18:20:09 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 12/09/97
|
||||
|
||||
#ifndef G4SIMPLERUNGE_HH
|
||||
#define G4SIMPLERUNGE_HH
|
||||
#include "G4MagErrorStepper.hh"
|
||||
|
||||
class G4SimpleRunge: public G4MagErrorStepper
|
||||
{
|
||||
|
||||
public:
|
||||
G4SimpleRunge(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
|
||||
~G4SimpleRunge();
|
||||
|
||||
void DumbStepper( const G4double y[],
|
||||
const G4double dydx[],
|
||||
const G4double h,
|
||||
G4double yout[]);
|
||||
|
||||
G4int IntegratorOrder() { return 2; };
|
||||
|
||||
private:
|
||||
|
||||
G4int fNumberOfVariables ;
|
||||
|
||||
// scratch space
|
||||
G4double* dydxTemp;
|
||||
G4double* dydxTemp2;
|
||||
G4double* yTemp;
|
||||
};
|
||||
|
||||
#endif /* G4SIMPLERUNGE_HH */
|
||||
@@ -0,0 +1,55 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformElectricField.hh,v 2.3 1998/11/19 20:45:02 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
// Class for creation of Uniform Magnetic Field
|
||||
//
|
||||
// 30.1.97 V.Grichine
|
||||
// 1.8.97 J.Apostolakis, cleanup, new 3-vector constructor,
|
||||
// and removal of helix-stepper (to separate file)
|
||||
// 5.11.97 G.Cosmo, added copy constructor and assignment operator.
|
||||
|
||||
#ifndef G4UNIFORMELECTRICFIELD_HH
|
||||
#define G4UNIFORMELECTRICFIELD_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4ElectroMagneticField.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
|
||||
class G4UniformElectricField : public G4ElectroMagneticField
|
||||
{
|
||||
public:
|
||||
// A field with value equal to FieldVector
|
||||
//
|
||||
G4UniformElectricField(const G4ThreeVector FieldVector );
|
||||
|
||||
G4UniformElectricField(G4double vField,
|
||||
G4double vTheta,
|
||||
G4double vPhi ) ;
|
||||
|
||||
~G4UniformElectricField() ;
|
||||
|
||||
// Copy constructor and assignment operator
|
||||
//
|
||||
G4UniformElectricField(const G4UniformElectricField &p);
|
||||
G4UniformElectricField& operator = (const G4UniformElectricField &p);
|
||||
|
||||
void GetFieldValue(const G4double position[] ,
|
||||
G4double B[] ) const ;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
G4double fFieldComponents[6] ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UniformMagField.hh,v 2.3 1998/11/27 16:15:51 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
// Class for creation of Uniform Magnetic Field
|
||||
//
|
||||
// 30.1.97 V.Grichine
|
||||
// 1.8.97 J.Apostolakis, cleanup, new 3-vector constructor,
|
||||
// and removal of helix-stepper (to separate file)
|
||||
// 5.11.97 G.Cosmo, added copy constructor and assignment operator.
|
||||
|
||||
#ifndef G4UNIFORMMAGFIELD_HH
|
||||
#define G4UNIFORMMAGFIELD_HH
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4MagneticField.hh"
|
||||
#include "G4Mag_EqRhs.hh"
|
||||
|
||||
class G4UniformMagField : public G4MagneticField
|
||||
{
|
||||
public:
|
||||
// A field with value equal to FieldVector
|
||||
//
|
||||
G4UniformMagField(const G4ThreeVector& FieldVector );
|
||||
|
||||
G4UniformMagField(G4double vField,
|
||||
G4double vTheta,
|
||||
G4double vPhi ) ;
|
||||
|
||||
~G4UniformMagField() ;
|
||||
|
||||
// Copy constructor and assignment operator
|
||||
//
|
||||
G4UniformMagField(const G4UniformMagField &p);
|
||||
G4UniformMagField& operator = (const G4UniformMagField &p);
|
||||
|
||||
void GetFieldValue(const G4double yTrack[3] ,
|
||||
G4double *MagField ) const ;
|
||||
|
||||
void SetFieldValue( const G4ThreeVector& newFieldValue );
|
||||
|
||||
// Return the field value
|
||||
G4ThreeVector GetConstantFieldValue() const;
|
||||
|
||||
private:
|
||||
G4double fFieldComponents[3] ;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user