Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-11 09:11:04

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 // G4EquationOfMotion
0027 //
0028 // Class description:
0029 //
0030 // Abstract Base Class for the right hand size of the equation of
0031 // motion of a particle in a field.
0032 
0033 // Author: John Apostolakis (CERN), 1998
0034 // -------------------------------------------------------------------
0035 #ifndef G4EQUATIONOFMOTION_HH
0036 #define G4EQUATIONOFMOTION_HH
0037 
0038 #include "G4Types.hh"
0039 #include "G4Field.hh"   // required in inline method implementations
0040 #include "G4FieldParameters.hh"
0041 
0042 #include "G4ChargeState.hh"
0043 
0044 /**
0045  * @brief G4EquationOfMotion is the abstract base class for the right
0046  * hand size of the equation of motion of a particle in a field.
0047  */
0048 
0049 class G4EquationOfMotion 
0050 {
0051   public:
0052 
0053     /**
0054      * Constructor for G4EquationOfMotion.
0055      *  @param[in] Field Pointer to the field.
0056      */
0057     G4EquationOfMotion( G4Field* Field );
0058 
0059     /**
0060      * Default virtual Destructor.
0061      */
0062     virtual ~G4EquationOfMotion() = default;
0063 
0064     /**
0065      * Calculates the value of the derivative, given the value of the field.
0066      *  @param[in] y Coefficients array.
0067      *  @param[in] Field Field value.
0068      *  @param[out] dydx Derivatives array.
0069      */
0070     virtual void EvaluateRhsGivenB( const G4double y[],
0071                                     const G4double B[3],
0072                                           G4double dydx[] ) const = 0;
0073 
0074     /**
0075      * Sets the charge, momentum and mass of the current particle.
0076      * Used to set the equation's coefficients.
0077      *  @param[in] particleCharge Magnetic charge and moments in e+ units.
0078      *  @param[in] MomentumXc Particle momentum.
0079      *  @param[in] mass Particle mass.
0080      */
0081     virtual void SetChargeMomentumMass(G4ChargeState particleCharge,
0082                                        G4double MomentumXc,
0083                                        G4double MassXc2) = 0;
0084 
0085     /**
0086      * Returns the equation type-ID, "kUserEquation".
0087      */
0088     virtual G4EquationType GetEquationType() const { return kUserEquation; }
0089 
0090     /**
0091      * Calculates the value of the derivative 'dydx' at 'y'.
0092      * Calls the virtual function above.
0093      *  @param[in] y Coefficients array.
0094      *  @param[out] dydx Derivatives array.
0095      */
0096     inline void RightHandSide( const G4double y[],
0097                                      G4double dydx[] ) const;
0098 
0099     /**
0100      * Calculates the value of the derivative 'dydx' at 'y' as above,
0101      * but also returns the value of B.
0102      *  @param[in] y Coefficients array.
0103      *  @param[out] dydx Derivatives array.
0104      *  @param[out] Field Field value.
0105      */
0106     inline void EvaluateRhsReturnB( const G4double y[],
0107                                           G4double dydx[],
0108                                           G4double Field[] ) const;
0109 
0110     /**
0111      * Returns the 'Field' value at the given time 'Point'.
0112      *  @param[in] Point The time point (x,y,z,t).
0113      *  @param[out] Field The returned field value.
0114      */
0115     inline void GetFieldValue( const G4double Point[4],
0116                                      G4double Field[] ) const;
0117 
0118     /**
0119      * Accessors and modifier for the field.
0120      */
0121     inline const G4Field* GetFieldObj() const;
0122     inline G4Field* GetFieldObj();
0123     inline void SetFieldObj(G4Field* pField);
0124 
0125   private:
0126 
0127     G4Field* itsField = nullptr;
0128 };
0129 
0130 #include "G4EquationOfMotion.icc"
0131 
0132 #endif