Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:07:52

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 // G4ExactHelixStepper
0027 //
0028 // Class description:
0029 //
0030 // Concrete class for particle motion in constant magnetic field.
0031 // Helix a-la-Explicity Euler: x_1 = x_0 + helix(h)
0032 // with helix(h) being a helix piece of length h.
0033 // simplest approach for solving linear differential equations.
0034 // Take the current derivative and add it to the current position.
0035 //
0036 // As the field is assumed constant, an error is not calculated.
0037 
0038 // Author: John Apostolakis (CERN), 28.01.2005.
0039 //         Implementation adapted from ExplicitEuler by W.Wander 
0040 // --------------------------------------------------------------------
0041 #ifndef G4EXACTHELIXSTEPPER_HH
0042 #define G4EXACTHELIXSTEPPER_HH
0043 
0044 #include "G4Types.hh"
0045 #include "G4ThreeVector.hh"
0046 
0047 #include "G4MagIntegratorStepper.hh"
0048 #include "G4MagHelicalStepper.hh"
0049 #include "G4Mag_EqRhs.hh"
0050 
0051 /**
0052  * @brief G4ExactHelixStepper is a concrete class for particle motion in
0053  * constant magnetic field. Helix a-la-Explicity Euler: x_1 = x_0 + helix(h)
0054  * with helix(h) being a helix piece of length h.
0055  * As the field is assumed constant, an error is not calculated.
0056  */
0057 
0058 class G4ExactHelixStepper : public G4MagHelicalStepper
0059 {
0060   public:
0061 
0062     /**
0063      * Constructor for G4ExactHelixStepper.
0064      *  @param[in] EqRhs Pointer to the standard equation of motion.
0065      */
0066     G4ExactHelixStepper(G4Mag_EqRhs* EqRhs);
0067 
0068     /**
0069      * Default Destructor.
0070      */
0071     ~G4ExactHelixStepper() override = default;
0072   
0073     /**
0074      * Copy constructor and assignment operator not allowed.
0075      */
0076     G4ExactHelixStepper(const G4ExactHelixStepper&) = delete;
0077     G4ExactHelixStepper& operator=(const G4ExactHelixStepper&) = delete;
0078 
0079     /**
0080      * The stepper for the Runge Kutta integration.
0081      * The stepsize is fixed, with the step size given by 'h'.
0082      * Provides helix starting values y[0 to 6].
0083      * Outputs yout[] and ZERO estimated error yerr[]=0.
0084      *  @param[in] yInput Starting values array of integration variables.
0085      *  @param[in] dydx Derivatives array.
0086      *  @param[in] h The given step size.
0087      *  @param[out] yout Integration output.
0088      *  @param[out] yerr The estimated error.
0089      */
0090     void Stepper( const G4double y[],
0091                   const G4double dydx[],
0092                         G4double h,
0093                         G4double yout[],
0094                         G4double yerr[] ) override;
0095   
0096     /**
0097      * Same as Stepper() function above, but should perform a 'dump' step
0098      * without error calculation. Assuming a constant field, the solution is
0099      * a helix. Should NOT be called; issues a fatal exception as the Stepper
0100      * must do all the work.
0101      */
0102     void DumbStepper( const G4double y[],
0103                             G4ThreeVector Bfld,
0104                             G4double h,
0105                             G4double yout[] ) override;
0106   
0107     /**
0108      * Estimates the maximum distance of curved solution and chord.
0109      */
0110     G4double DistChord() const override;
0111 
0112     /**
0113      * Returns the order, 1, of integration.
0114      */
0115     inline G4int IntegratorOrder() const override { return 1; }
0116 
0117     /**
0118      * Returns the stepper type-ID, "kExactHelixStepper".
0119      */
0120     inline G4StepperType StepperType() const override { return kExactHelixStepper; }
0121 
0122   private:
0123 
0124     /** Initial value of field at last step. */
0125     G4ThreeVector fBfieldValue;
0126 };
0127 
0128 #endif