Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // G4MagHelicalStepper 27 // 28 // Class description: 29 // 30 // Abstract base class for integrator of particle's equation of motion, 31 // used in tracking in space dependent magnetic field 32 // 33 // It is used for a set of steppers which use the helix as a sort of 34 // 'first order' solution. 35 // - Most obtain an error by breaking up the step in two 36 // - G4ExactHelicalStepper does not provide an error estimate 37 38 // Created: J.Apostolakis, CERN - 05.11.1998 39 // -------------------------------------------------------------------- 40 #ifndef G4MAGHELICALSTEPPER_HH 41 #define G4MAGHELICALSTEPPER_HH 42 43 #include <CLHEP/Units/PhysicalConstants.h> 44 45 #include "G4Types.hh" 46 #include "G4MagIntegratorStepper.hh" 47 #include "G4Mag_EqRhs.hh" 48 #include "G4ThreeVector.hh" 49 50 class G4MagHelicalStepper : public G4MagIntegratorStepper 51 { 52 public: 53 54 G4MagHelicalStepper(G4Mag_EqRhs *EqRhs); 55 ~G4MagHelicalStepper() override; 56 57 G4MagHelicalStepper(const G4MagHelicalStepper&) = delete; 58 G4MagHelicalStepper& operator=(const G4MagHelicalStepper&) = delete; 59 60 void Stepper( const G4double y[], // VIRTUAL for ExactHelix 61 const G4double dydx[], 62 G4double h, 63 G4double yout[], 64 G4double yerr[] ) override; 65 // The stepper for the Runge Kutta integration. 66 // The stepsize is fixed, equal to h. 67 // Integrates ODE starting values y[0 to 6] 68 // Outputs yout[] and its estimated error yerr[]. 69 70 virtual void DumbStepper( const G4double y[], 71 G4ThreeVector Bfld, 72 G4double h, 73 G4double yout[] ) = 0; 74 // Performs a 'dump' Step without error calculation. 75 76 G4double DistChord()const override ; 77 // Estimate maximum distance of curved solution and chord ... 78 79 protected: 80 81 inline void LinearStep( const G4double yIn[], 82 G4double h, 83 G4double yHelix[]) const; 84 // A linear Step in regions without magnetic field. 85 86 void AdvanceHelix( const G4double yIn[], 87 const G4ThreeVector& Bfld, 88 G4double h, 89 G4double yHelix[], G4double yHelix2[] = nullptr); 90 // A first order Step along a helix inside the field. 91 92 inline void MagFieldEvaluate( const G4double y[], G4ThreeVector& Bfield ); 93 // Evaluate the field at a certain point. 94 95 inline G4double GetInverseCurve( const G4double Momentum, 96 const G4double Bmag ); 97 // Evaluate Inverse of Curvature of Track 98 99 // Store and use the parameters of track : 100 // radius of curve, Stepping angle, Radius of projected helix 101 102 inline void SetAngCurve(const G4double Ang); 103 inline G4double GetAngCurve()const; 104 105 inline void SetCurve(const G4double Curve); 106 inline G4double GetCurve()const; 107 108 inline void SetRadHelix(const G4double Rad); 109 inline G4double GetRadHelix()const; 110 111 private: 112 113 static const G4double fUnitConstant; 114 // As in G4Mag_EqRhs.hh/cc where it is not used. 115 116 G4Mag_EqRhs* fPtrMagEqOfMot = nullptr; 117 118 // Data stored in order to find the chord 119 // 120 G4double fAngCurve = 0.0; 121 G4double frCurve = 0.0; 122 G4double frHelix = 0.0; 123 G4ThreeVector yInitial, yMidPoint, yFinal; 124 }; 125 126 #include "G4MagHelicalStepper.icc" 127 128 #endif 129