Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-18 08:35:02

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 // G4RKG3_Stepper
0027 //
0028 // Class description:
0029 //
0030 // Runga-Kutta integrator stepper from Geant-3.
0031 
0032 // Authors: John Apostolakis & Vladimir Grichine (CERN), 30.01.1997
0033 // -------------------------------------------------------------------
0034 #ifndef G4RKG3_STEPPER_HH
0035 #define G4RKG3_STEPPER_HH
0036 
0037 #include "G4Types.hh"
0038 #include "G4MagIntegratorStepper.hh"
0039 #include "G4ThreeVector.hh"
0040 
0041 class G4Mag_EqRhs;
0042 
0043 /**
0044  * @brief G4RKG3_Stepper implements a Runga-Kutta integrator stepper
0045  * used in Geant-3.
0046  */
0047 
0048 class G4RKG3_Stepper : public G4MagIntegratorStepper
0049 {
0050   public:
0051 
0052     /**
0053      * Constructor for G4RKG3_Stepper.
0054      *  @param[in] EqRhs Pointer to the provided equation of motion.
0055      */
0056     G4RKG3_Stepper(G4Mag_EqRhs* EqRhs);
0057 
0058     /**
0059      * Default Destructor.
0060      */
0061     ~G4RKG3_Stepper() override = default;
0062 
0063     /**
0064      * Copy constructor and assignment operator not allowed.
0065      */
0066     G4RKG3_Stepper(const G4RKG3_Stepper&) = delete;
0067     G4RKG3_Stepper& operator= (const G4RKG3_Stepper&) = delete;
0068 
0069     /**
0070      * The stepper for the Runge Kutta integration.
0071      * Method provided, even if less efficient.
0072      * The stepsize is fixed, with the step size given by 'h'.
0073      * Integrates ODE starting values yInput[0 to 6].
0074      * Outputs yOut[] and its estimated error yErr[].
0075      *  @param[in] yIn Starting values array of integration variables.
0076      *  @param[in] dydx Derivatives array.
0077      *  @param[in] h The given step size.
0078      *  @param[out] yOut Integration output.
0079      *  @param[out] yErr The estimated error.
0080      */
0081     void Stepper( const G4double yIn[],
0082                   const G4double dydx[],
0083                         G4double h,
0084                         G4double yOut[],
0085                         G4double yErr[] ) override;
0086 
0087     /**
0088      * Returns the distance from chord line.
0089      */
0090     G4double DistChord() const override ;
0091  
0092     /**
0093      * Integrator of Runge-Kutta Stepper from Geant-3 with only two field
0094      * evaluation per Step. It is used in propagating the initial Step
0095      * by small substeps after solution error and delta geometry
0096      * considerations. B[3] is magnetic field which is passed from substep
0097      * to substep.
0098      */
0099     void StepNoErr( const G4double tIn[8],
0100                     const G4double dydx[6],
0101                           G4double Step,
0102                           G4double tOut[8],
0103                           G4double B[3] );
0104     /**
0105      * Integrator for Runge-Kutta from Geant-3 with evaluation of error in
0106      * solution and delta geometry based on naive similarity with the case
0107      * of uniform magnetic field.
0108      * B1[3] is in input and is the first magnetic field values
0109      * B2[3] is the output and is the final magnetic field values.
0110      */
0111     void StepWithEst( const G4double tIn[8],
0112                       const G4double dydx[6],
0113                             G4double Step,
0114                             G4double tOut[8],
0115                             G4double& alpha2,
0116                             G4double& beta2,
0117                       const G4double B1[3],
0118                             G4double B2[3] );
0119 
0120     /**
0121      * Returns the order, 4, of integration.
0122      */
0123     inline G4int IntegratorOrder() const override { return 4; }
0124 
0125     /**
0126      * Returns the stepper type-ID, "kRKG3Stepper".
0127      */
0128     inline G4StepperType StepperType() const override { return kRKG3Stepper; }
0129 
0130   private:
0131 
0132     G4ThreeVector fyInitial,
0133                   fyMidPoint,
0134                   fyFinal;
0135     G4ThreeVector fpInitial;
0136     G4ThreeVector BfldIn;
0137     G4double      hStep = 0.0;
0138 };
0139 
0140 #endif