Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:39

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 // Created: J.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 class G4MagHelicalStepper : public G4MagIntegratorStepper
0051 {
0052   public:
0053 
0054     G4MagHelicalStepper(G4Mag_EqRhs *EqRhs);
0055    ~G4MagHelicalStepper() override;
0056   
0057     G4MagHelicalStepper(const G4MagHelicalStepper&) = delete;
0058     G4MagHelicalStepper& operator=(const G4MagHelicalStepper&) = delete;
0059  
0060     void Stepper( const G4double y[], // VIRTUAL for ExactHelix
0061                   const G4double dydx[],
0062                         G4double h,
0063                         G4double yout[],
0064                         G4double yerr[] ) override;
0065       // The stepper for the Runge Kutta integration.
0066       // The stepsize is fixed, equal to h.
0067       // Integrates ODE starting values y[0 to 6]
0068       // Outputs yout[] and its estimated error yerr[].
0069   
0070     virtual  void DumbStepper( const G4double y[],
0071                                      G4ThreeVector Bfld,
0072                                      G4double h,
0073                                      G4double yout[] ) = 0;
0074       // Performs a 'dump' Step without error calculation.
0075   
0076     G4double DistChord()const override ;
0077       // Estimate maximum distance of curved solution and chord ... 
0078 
0079   protected:
0080 
0081     inline void LinearStep( const G4double yIn[],
0082                                   G4double h,
0083                                   G4double yHelix[]) const;
0084       // A linear Step in regions without magnetic field.
0085 
0086     void AdvanceHelix( const G4double yIn[],
0087                        const G4ThreeVector& Bfld,
0088                              G4double h,
0089                              G4double yHelix[], G4double yHelix2[] = nullptr);
0090       // A first order Step along a helix inside the field.
0091 
0092     inline void MagFieldEvaluate( const G4double y[], G4ThreeVector& Bfield );
0093       // Evaluate the field at a certain point.
0094   
0095     inline G4double GetInverseCurve( const G4double Momentum,
0096                                      const G4double Bmag );
0097       // Evaluate Inverse of Curvature of Track
0098 
0099     // Store and use the parameters of track : 
0100     // radius of curve, Stepping angle, Radius of projected helix
0101 
0102     inline void SetAngCurve(const G4double Ang);
0103     inline G4double GetAngCurve()const;
0104 
0105     inline void SetCurve(const G4double Curve);
0106     inline G4double GetCurve()const;
0107 
0108     inline void SetRadHelix(const G4double Rad);
0109     inline G4double GetRadHelix()const;
0110 
0111   private:
0112 
0113     static const G4double fUnitConstant;
0114       // As in G4Mag_EqRhs.hh/cc where it is not used.
0115 
0116     G4Mag_EqRhs* fPtrMagEqOfMot = nullptr;
0117  
0118     // Data stored in order to find the chord
0119     //
0120     G4double fAngCurve = 0.0;
0121     G4double frCurve = 0.0;
0122     G4double frHelix = 0.0;
0123     G4ThreeVector yInitial, yMidPoint, yFinal;
0124 };
0125 
0126 #include  "G4MagHelicalStepper.icc"
0127 
0128 #endif