Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:59

0001 // ********************************************************************
0002 // * License and Disclaimer                                           *
0003 // *                                                                  *
0004 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0005 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0006 // * conditions of the Geant4 Software License,  included in the file *
0007 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0008 // * include a list of copyright holders.                             *
0009 // *                                                                  *
0010 // * Neither the authors of this software system, nor their employing *
0011 // * institutes,nor the agencies providing financial support for this *
0012 // * work  make  any representation or  warranty, express or implied, *
0013 // * regarding  this  software system or assume any liability for its *
0014 // * use.  Please see the license in the file  LICENSE  and URL above *
0015 // * for the full disclaimer and the limitation of liability.         *
0016 // *                                                                  *
0017 // * This  code  implementation is the result of  the  scientific and *
0018 // * technical work of the GEANT4 collaboration.                      *
0019 // * By using,  copying,  modifying or  distributing the software (or *
0020 // * any work based  on the software)  you  agree  to acknowledge its *
0021 // * use  in  resulting  scientific  publications,  and indicate your *
0022 // * acceptance of all terms of the Geant4 Software license.          *
0023 // ********************************************************************
0024 //
0025 // G4BulirschStoer driver
0026 //
0027 // Class description:
0028 //
0029 // G4IntegrationDriver<G4BulirschStoer> is a driver class using
0030 // Bulirsch-Stoer method to integrate the equation of motion.
0031 
0032 // Author: Dmitry Sorokin, Google Summer of Code 2016
0033 // Supervision: John Apostolakis, CERN
0034 // --------------------------------------------------------------------
0035 #ifndef G4BULIRSCH_STOER_DRIVER_HH
0036 #define G4BULIRSCH_STOER_DRIVER_HH
0037 
0038 #include "G4IntegrationDriver.hh"
0039 #include "G4BulirschStoer.hh"
0040 #include "G4ChordFinderDelegate.hh"
0041 
0042 template <>
0043 class G4IntegrationDriver<G4BulirschStoer>: 
0044     public G4VIntegrationDriver,
0045     public G4ChordFinderDelegate<G4IntegrationDriver<G4BulirschStoer>>
0046 {
0047   public:
0048 
0049     G4IntegrationDriver( G4double hminimum,
0050                          G4BulirschStoer* stepper,
0051                          G4int numberOfComponents = 6,
0052                          G4int statisticsVerbosity = 1);
0053 
0054     ~G4IntegrationDriver() = default;
0055 
0056     G4IntegrationDriver(const G4IntegrationDriver&) = delete;
0057     G4IntegrationDriver& operator=(const G4IntegrationDriver&) = delete;
0058 
0059     virtual G4double AdvanceChordLimited(G4FieldTrack& track,
0060                                          G4double hstep,
0061                                          G4double eps,
0062                                          G4double chordDistance) override
0063     {
0064       return ChordFinderDelegate::
0065              AdvanceChordLimitedImpl(track, hstep, eps, chordDistance);
0066     }
0067 
0068     virtual void OnStartTracking() override
0069     {
0070       ChordFinderDelegate::ResetStepEstimate();
0071     }
0072 
0073     virtual void OnComputeStep(const G4FieldTrack* /*track*/ = nullptr) override {};
0074 
0075     virtual G4bool DoesReIntegrate() const override { return false; }  /// ????
0076    
0077     virtual G4bool AccurateAdvance( G4FieldTrack& track,
0078                                     G4double stepLen,
0079                                     G4double eps,
0080                                     G4double beginStep = 0) override;
0081 
0082     virtual G4bool QuickAdvance( G4FieldTrack& y_val,
0083                                  const G4double dydx[],
0084                                  G4double hstep,
0085                                  G4double& missDist,
0086                                  G4double& dyerr) override;
0087 
0088     void OneGoodStep( G4double y[],
0089                       const G4double dydx[],
0090                       G4double& curveLength,
0091                       G4double htry,
0092                       G4double eps,
0093                       G4double& hdid,
0094                       G4double& hnext);
0095 
0096     virtual void GetDerivatives( const G4FieldTrack& track,
0097                                  G4double dydx[]) const override;
0098 
0099     virtual void GetDerivatives( const G4FieldTrack& track,
0100                                  G4double dydx[],
0101                                  G4double field[]) const override;
0102 
0103     virtual void SetVerboseLevel(G4int level) override;
0104     virtual G4int GetVerboseLevel() const override;
0105 
0106     virtual G4double ComputeNewStepSize(
0107                           G4double  errMaxNorm,    // normalised error
0108                           G4double  hstepCurrent) override; // current step size
0109 
0110     virtual G4EquationOfMotion* GetEquationOfMotion() override;
0111     const G4EquationOfMotion* GetEquationOfMotion() const;
0112     virtual void SetEquationOfMotion(G4EquationOfMotion* equation) override;
0113 
0114     virtual const G4MagIntegratorStepper* GetStepper() const override;
0115     virtual G4MagIntegratorStepper* GetStepper() override;
0116 
0117     virtual void  StreamInfo( std::ostream& os ) const override;
0118      // Write out the parameters / state of the driver
0119    
0120   private:
0121 
0122     G4int GetNumberOfVarialbles() const;
0123 
0124     G4double fMinimumStep;
0125     G4double fVerbosity;
0126 
0127     G4ModifiedMidpoint fMidpointMethod;
0128     G4BulirschStoer* bulirschStoer;
0129 
0130     G4double yIn[G4FieldTrack::ncompSVEC],
0131              yMid[G4FieldTrack::ncompSVEC],
0132              yMid2[G4FieldTrack::ncompSVEC],
0133              yOut[G4FieldTrack::ncompSVEC],
0134              yOut2[G4FieldTrack::ncompSVEC],
0135              yError[G4FieldTrack::ncompSVEC];
0136 
0137 
0138     G4double dydxCurrent[G4FieldTrack::ncompSVEC];
0139     G4double yCurrent[G4FieldTrack::ncompSVEC];
0140 
0141     G4double derivs[2][6][G4FieldTrack::ncompSVEC];
0142 
0143     const G4int interval_sequence[2];
0144 
0145     using ChordFinderDelegate =
0146           G4ChordFinderDelegate<G4IntegrationDriver<G4BulirschStoer>>;
0147 };
0148 
0149 #include "G4BulirschStoerDriver.icc"
0150 
0151 #endif