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 inline methods implementation
0027 //
0028 // Created: J.Apostolakis, CERN - 05.11.1998
0029 // --------------------------------------------------------------------
0030 
0031 inline void
0032 G4MagHelicalStepper::LinearStep( const G4double  yIn[],
0033                                        G4double  h,
0034                                        G4double  yLinear[]) const
0035 {
0036   // Linear Step in regions of no field
0037 
0038   G4double momentum_val = std::sqrt(yIn[3]*yIn[3]+yIn[4]*yIn[4]+yIn[5]*yIn[5]);
0039   G4double inv_momentum = 1.0 / momentum_val;
0040   G4double yDir[3];
0041 
0042   for( auto i = 0; i < 3; ++i )
0043   {
0044     yDir[i]   = inv_momentum * yIn[i+3];     
0045     yLinear[i]   = yIn[i] + h * yDir[i];
0046     yLinear[i+3] = yIn[i+3];
0047   }
0048 }
0049 
0050 inline void
0051 G4MagHelicalStepper::MagFieldEvaluate(const G4double y[],
0052                                       G4ThreeVector& Bfield )   
0053 {
0054   G4double B[3];
0055   GetEquationOfMotion()->GetFieldValue(y, B);
0056   Bfield = G4ThreeVector( B[0], B[1], B[2] );
0057 }
0058 
0059 inline G4double
0060 G4MagHelicalStepper::GetInverseCurve(const G4double Momentum,
0061                                      const G4double Bmag)
0062 {
0063   constexpr G4double chargeFactor = 1.0 / (CLHEP::eplus*CLHEP::c_light);
0064   
0065   G4double  inv_momentum  = 1.0 / Momentum ;
0066   G4double particleCharge = fPtrMagEqOfMot->FCof() * chargeFactor;
0067   G4double fCoefficient   = -fUnitConstant  * particleCharge * inv_momentum;
0068 
0069   return fCoefficient*Bmag;
0070 }
0071 
0072 inline void G4MagHelicalStepper::SetAngCurve(const G4double Ang)
0073 {                                                
0074   fAngCurve=Ang;
0075 }
0076 
0077 inline G4double G4MagHelicalStepper::GetAngCurve() const 
0078 {
0079   return fAngCurve;
0080 }
0081 
0082 inline void G4MagHelicalStepper::SetCurve(const G4double Curve)
0083 {
0084   frCurve=Curve;  
0085 }
0086 
0087 inline G4double G4MagHelicalStepper::GetCurve() const 
0088 {
0089   return frCurve;  
0090 }
0091 
0092 inline void G4MagHelicalStepper::SetRadHelix(const G4double Rad)
0093 {
0094   frHelix=Rad;  
0095 }
0096 
0097 inline G4double G4MagHelicalStepper::GetRadHelix() const 
0098 {
0099   return frHelix;  
0100 }