Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:50:52

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 // G4BorisDriver inline methods implementation
0027 //
0028 // Author: Divyansh Tiwari (CERN, Google Summer of Code 2022), 05.11.2022
0029 // Supervision: John Apostolakis (CERN), Renee Fatemi, Soon Yung Jun (FNAL)
0030 // --------------------------------------------------------------------
0031 
0032 inline
0033 G4double G4BorisDriver::AdvanceChordLimited(G4FieldTrack& track,
0034                                             G4double hstep,
0035                                             G4double eps,
0036                                             G4double chordDistance)
0037 {
0038   return ChordFinderDelegate::
0039          AdvanceChordLimitedImpl(track, hstep, eps, chordDistance);
0040 }
0041 
0042 inline
0043 void G4BorisDriver::OnStartTracking()
0044 {
0045   ChordFinderDelegate::ResetStepEstimate();
0046 }
0047 
0048 inline
0049 void G4BorisDriver::OnComputeStep(const G4FieldTrack*)
0050 {
0051 }
0052 
0053 inline
0054 G4bool G4BorisDriver::DoesReIntegrate() const
0055 {
0056   return true;
0057 }
0058 
0059 inline
0060 G4double G4BorisDriver::ComputeNewStepSize( G4double /* errMaxNorm*/,
0061                                             G4double  hstepCurrent)
0062 {
0063   return hstepCurrent;
0064 }
0065 
0066 inline
0067 void G4BorisDriver::SetVerboseLevel(G4int level)
0068 {
0069   fVerbosity = (level != 0);
0070 }
0071 
0072 inline
0073 G4int G4BorisDriver::GetVerboseLevel() const
0074 {
0075   return static_cast<G4int>(fVerbosity);
0076 }
0077 
0078 inline
0079 const G4EquationOfMotion* G4BorisDriver::GetEquationOfMotion() const
0080 {
0081   auto eq = boris->GetEquationOfMotion();
0082   return eq;
0083 }
0084 
0085 inline
0086 G4EquationOfMotion* G4BorisDriver::GetEquationOfMotion()
0087 {
0088   auto eq = boris->GetEquationOfMotion();
0089   return eq;
0090 }
0091 
0092 inline
0093 G4int G4BorisDriver::GetNumberOfVariables() const
0094 {
0095   return boris->GetNumberOfVariables();
0096 }
0097 
0098 inline
0099 const G4MagIntegratorStepper* G4BorisDriver::GetStepper() const
0100 {
0101   return nullptr;
0102 }
0103 
0104 inline
0105 G4MagIntegratorStepper* G4BorisDriver::GetStepper()
0106 {
0107   return nullptr;
0108 }
0109 
0110 inline
0111 void G4BorisDriver::CheckStep(const G4ThreeVector& posIn,
0112                               const G4ThreeVector& posOut,
0113                               G4double hdid) const
0114 {
0115   const G4double endPointDist = (posOut - posIn).mag();
0116   if (endPointDist >= hdid * (1. + CLHEP::perMillion))
0117   {
0118     // ++fNoAccurateAdvanceBadSteps;
0119 // #ifdef G4DEBUG_FIELD
0120     // Issue a warning only for gross differences -
0121     // we understand how small difference occur.
0122     if (endPointDist >= hdid * (1. + CLHEP::perThousand))
0123     {
0124       G4Exception("G4BorisDriver::CheckStep()", "GeomField1002", JustWarning,
0125                   "endPointDist >= hdid!");
0126     }
0127     else
0128     {
0129       G4cerr << "G4BorisDriver::CheckStep: moved further than curve distance! "
0130              << "  curve hdid= " << hdid << " endpoint dist= " << endPointDist
0131              << "  ratio - 1 = " << (endPointDist - hdid) / hdid
0132              << " ( > 1.0e-6 threshold to report ) "
0133              << G4endl; 
0134     }
0135 // #endif
0136   }
0137   else
0138   {
0139     // ++fNoAccurateAdvanceGoodSteps;
0140   }
0141 }