Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:11:29

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4MagErrorStepper
0027 //
0028 // Class description:
0029 //
0030 // Abstract base class for integrator of particle's equation of motion,
0031 // used in tracking in space dependent magnetic field.
0032 
0033 // Author: W.Wander (MIT), 09.12.1997
0034 // --------------------------------------------------------------------
0035 #ifndef G4MAGERRORSTEPPER_HH
0036 #define G4MAGERRORSTEPPER_HH
0037 
0038 #include "G4Types.hh"
0039 #include "G4MagIntegratorStepper.hh"
0040 #include "G4Mag_EqRhs.hh"
0041 #include "G4ThreeVector.hh"
0042 
0043 /**
0044  * @brief G4MagErrorStepper is an abstract base class for integrator of
0045  * particle's equation of motion, used in tracking in space dependent
0046  * magnetic field.
0047  */
0048 
0049 class G4MagErrorStepper : public G4MagIntegratorStepper
0050 {
0051   public:
0052 
0053     /**
0054      * Constructor for G4MagErrorStepper.
0055      *  @param[in] EqRhs Pointer to the provided equation of motion.
0056      *  @param[in] numberOfVariables The number of integration variables.
0057      *  @param[in] numberOfVariables The number of state variables.
0058      */
0059     G4MagErrorStepper(G4EquationOfMotion*EqRhs,
0060                       G4int numberOfVariables,
0061                       G4int numStateVariables = 12);
0062 
0063     /**
0064      * Destructor.
0065      */
0066     ~G4MagErrorStepper() override;
0067   
0068     /**
0069      * Copy constructor and assignment operator not allowed.
0070      */
0071     G4MagErrorStepper(const G4MagErrorStepper&) = delete;
0072     G4MagErrorStepper& operator=(const G4MagErrorStepper&) = delete;
0073 
0074     /**
0075      * The stepper for the Runge Kutta integration.
0076      * The stepsize is fixed, with the step size given by 'h'.
0077      * Integrates ODE starting values y[0 to 6].
0078      * Outputs yout[] and its estimated error yerr[].
0079      *  @param[in] y Starting values array of integration variables.
0080      *  @param[in] dydx Derivatives array.
0081      *  @param[in] h The given step size.
0082      *  @param[out] yout Integration output.
0083      *  @param[out] yerr The estimated error.
0084      */
0085     void Stepper( const G4double y[],
0086                   const G4double dydx[],
0087                         G4double h,
0088                         G4double yout[],
0089                         G4double yerr[] ) override;
0090 
0091     /**
0092      * Same as Stepper() function above, but should perform a 'dump' step
0093      * without error calculation. To be implemented in concrete derived classes.
0094      */
0095     virtual void DumbStepper( const G4double y[],
0096                               const G4double dydx[],
0097                                     G4double h,
0098                                     G4double yout[] ) = 0;
0099 
0100     /**
0101      * Estimates the maximum distance of curved solution and chord.
0102      */
0103     G4double DistChord() const override;
0104 
0105   private:
0106 
0107     /** Data stored in order to find the chord. */
0108     G4ThreeVector fInitialPoint, fMidPoint, fFinalPoint;
0109  
0110     /** Arrays used only for temporary storage; they are allocated at the
0111         class level only for efficiency, so that calls to new and delete are
0112         not made in Stepper(). */
0113     G4double *yInitial, *yMiddle, *dydxMid, *yOneStep;
0114 };
0115 
0116 #include  "G4MagErrorStepper.icc"
0117 
0118 #endif