Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 09:10:33

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 // G4QSSDriver
0027 //
0028 // QSS Interpolator Driver
0029 
0030 // Authors: Lucio Santi, Rodrigo Castro (Univ. Buenos Aires), 2018-2021
0031 // --------------------------------------------------------------------
0032 #ifndef G4QSSDriver_HH
0033 #define G4QSSDriver_HH
0034 
0035 #include "G4InterpolationDriver.hh"
0036 #include "G4QSSMessenger.hh"
0037 
0038 /**
0039  * @brief G4QSSDriver is a templated driver class defining the QSS
0040  * (Quantum State Simulation) Interpolator Driver.
0041  */
0042 
0043 template <class T>
0044 class G4QSSDriver : public G4InterpolationDriver<T, true>
0045 {
0046   public:
0047 
0048     /**
0049      * Constructor for G4QSSDriver.
0050      *  @param[in] T Pointer to the stepper algorithm.
0051      */
0052     inline G4QSSDriver(T* stepper);
0053 
0054     /**
0055      * Copy constructor and assignment operator not allowed.
0056      */
0057     G4QSSDriver(const G4QSSDriver&) = delete;
0058     const G4QSSDriver& operator=(const G4QSSDriver&) = delete;
0059 
0060     /**
0061      * Dispatch interface method for initialisation/reset of driver.
0062      */
0063     void OnStartTracking() override;
0064 
0065     /**
0066      * Computes the step to take, based on chord limits.
0067      *  @param[in,out] track The current track in field.
0068      *  @param[in] hstep Proposed step length.
0069      *  @param[in] eps Requested accuracy, y_err/hstep.
0070      *  @param[in] chordDistance Maximum sagitta distance.
0071      *  @returns The length of step taken.
0072      */
0073     inline G4double AdvanceChordLimited(G4FieldTrack& track,
0074                                         G4double hstep,
0075                                         G4double eps,
0076                                         G4double chordDistance) override;
0077 
0078     /**
0079      * Dispatch interface method for computing step.
0080      */
0081     inline void OnComputeStep(const G4FieldTrack* track) override;
0082 
0083     /**
0084      * Setter for driver precision parameters.
0085      */
0086     inline void SetPrecision(G4double dq_rel, G4double dq_min);
0087 
0088     /**
0089      * Takes one Step that is as large as possible while satisfying the
0090      * accuracy criterion.
0091      *  @param[in] it Stepper iterator.
0092      *  @param[in,out] y The current track state, y.
0093      *  @param[in] dydx dydx array.
0094      *  @param[in,out] hstep Step to attempt.
0095      *  @param[in] epsStep The relative accuracy.
0096      *  @param[in] curveLength Step start, x.
0097      *  @param[in,out] track Pointer to the Field track. Not used.
0098      *  @returns The step achieved.
0099      */
0100     inline G4double OneGoodStep(typename G4InterpolationDriver<T, true>::StepperIterator it,
0101                                 field_utils::State& y,
0102                                 field_utils::State& dydx,
0103                                 G4double& hstep,
0104                                 G4double epsStep,
0105                                 G4double curveLength,
0106                                 G4FieldTrack* track) override;
0107 
0108   private:
0109 
0110     using Base = G4InterpolationDriver<T, true>;
0111 
0112     G4bool initializedOnFirstRun = false;
0113 };
0114 
0115 #include "G4QSSDriver.icc"
0116 
0117 #endif