Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4MagHelicalStepper.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // G4MagHelicalStepper
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 // It is used for a set of steppers which use the helix as a sort of
0034 // 'first order' solution.
0035 //   - Most obtain an error by breaking up the step in two
0036 //   - G4ExactHelicalStepper does not provide an error estimate
0037 
0038 // Author: John Apostolakis (CERN), 05.11.1998
0039 // --------------------------------------------------------------------
0040 #ifndef G4MAGHELICALSTEPPER_HH
0041 #define G4MAGHELICALSTEPPER_HH
0042 
0043 #include <CLHEP/Units/PhysicalConstants.h>
0044 
0045 #include "G4Types.hh"
0046 #include "G4MagIntegratorStepper.hh"
0047 #include "G4Mag_EqRhs.hh"
0048 #include "G4ThreeVector.hh"
0049 
0050 /**
0051  * @brief G4MagHelicalStepper is an abstract base class for integrator of
0052  * particle's equation of motion, used in tracking in space dependent magnetic
0053  * field, and for a set of steppers which use the helix as 'first order'
0054  * solution.
0055  */
0056 
0057 class G4MagHelicalStepper : public G4MagIntegratorStepper
0058 {
0059   public:
0060 
0061     /**
0062      * Constructor for G4MagHelicalStepper.
0063      *  @param[in] EqRhs Pointer to the provided equation of motion.
0064      */
0065     G4MagHelicalStepper(G4Mag_EqRhs *EqRhs);
0066 
0067     /**
0068      * Default Destructor.
0069      */
0070     ~G4MagHelicalStepper() override = default;
0071   
0072     /**
0073      * Copy constructor and assignment operator not allowed.
0074      */
0075     G4MagHelicalStepper(const G4MagHelicalStepper&) = delete;
0076     G4MagHelicalStepper& operator=(const G4MagHelicalStepper&) = delete;
0077  
0078     /**
0079      * The stepper for the Runge Kutta integration.
0080      * The stepsize is fixed, with the step size given by 'h'.
0081      * Integrates ODE starting values y[0 to 6].
0082      * Outputs yout[] and its estimated error yerr[].
0083      *  @param[in] y Starting values array of integration variables.
0084      *  @param[in] dydx Derivatives array.
0085      *  @param[in] h The given step size.
0086      *  @param[out] yout Integration output.
0087      *  @param[out] yerr The estimated error.
0088      */
0089     void Stepper( const G4double y[], // VIRTUAL for ExactHelix
0090                   const G4double dydx[],
0091                         G4double h,
0092                         G4double yout[],
0093                         G4double yerr[] ) override;
0094   
0095     /**
0096      * Same as Stepper() function above, but should perform a 'dump' step
0097      * without error calculation. To be implemented in concrete derived classes.
0098      */
0099     virtual void DumbStepper( const G4double y[],
0100                                     G4ThreeVector Bfld,
0101                                     G4double h,
0102                                     G4double yout[] ) = 0;
0103   
0104     /**
0105      * Estimates the maximum distance of curved solution and chord.
0106      */
0107     G4double DistChord()const override ;
0108 
0109   protected:
0110 
0111     /**
0112      * Performs a linear Step in regions without magnetic field.
0113      */
0114     inline void LinearStep( const G4double yIn[],
0115                                   G4double h,
0116                                   G4double yHelix[]) const;
0117 
0118     /**
0119      * A first order Step along a helix inside the field.
0120      */
0121     void AdvanceHelix( const G4double yIn[],
0122                        const G4ThreeVector& Bfld,
0123                              G4double h,
0124                              G4double yHelix[], G4double yHelix2[] = nullptr);
0125 
0126     /**
0127      * Evaluates the field at a certain point.
0128      */
0129     inline void MagFieldEvaluate( const G4double y[], G4ThreeVector& Bfield );
0130   
0131     /**
0132      * Evaluates inverse of Curvature of Track.
0133      */
0134     inline G4double GetInverseCurve( const G4double Momentum,
0135                                      const G4double Bmag );
0136 
0137     // Store and use the parameters of track : 
0138     // radius of curve, Stepping angle, Radius of projected helix
0139 
0140     /**
0141      * Modifiers and accessors for storing and using the parameters of a track: 
0142      * radius of curve, Stepping angle, Radius of projected helix.
0143      */
0144     inline void SetAngCurve(const G4double Ang);
0145     inline G4double GetAngCurve()const;
0146     inline void SetCurve(const G4double Curve);
0147     inline G4double GetCurve()const;
0148     inline void SetRadHelix(const G4double Rad);
0149     inline G4double GetRadHelix()const;
0150 
0151   private:
0152 
0153     /** As in G4Mag_EqRhs.hh/cc where it is not used. */
0154     static const G4double fUnitConstant;
0155 
0156     G4Mag_EqRhs* fPtrMagEqOfMot = nullptr;
0157  
0158     /** Data stored in order to find the chord. */
0159     G4double fAngCurve = 0.0;
0160     G4double frCurve = 0.0;
0161     G4double frHelix = 0.0;
0162     G4ThreeVector yInitial, yMidPoint, yFinal;
0163 };
0164 
0165 #include  "G4MagHelicalStepper.icc"
0166 
0167 #endif