ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ChordFinder.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ChordFinder.hh
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 // G4ChordFinder
27 //
28 // Class description:
29 //
30 // A class that provides RK integration of motion ODE (as does g4magtr)
31 // and also has a method that returns an Approximate point on the curve
32 // near to a (chord) point.
33 
34 // Author: J.Apostolakis - Design and implementation - 25.02.1997
35 // -------------------------------------------------------------------
36 #ifndef G4CHORDFINDER_HH
37 #define G4CHORDFINDER_HH
38 
39 #include "G4VIntegrationDriver.hh"
41 
42 #include <memory>
43 
45 
46 class G4MagneticField;
48 class G4HelixHeum;
49 
51 {
52  public: // with description
53 
54  explicit G4ChordFinder( G4VIntegrationDriver* pIntegrationDriver );
55  // The most flexible constructor, which allows the user to specify
56  // any type of field, equation, stepper and integration driver.
57 
58  G4ChordFinder( G4MagneticField* itsMagField,
59  G4double stepMinimum = 1.0e-2, // * mm
60  G4MagIntegratorStepper* pItsStepper = nullptr,
61  // G4bool useHigherEfficiencyStepper = true,
62  G4bool useFSALstepper = false );
63  // A constructor that creates defaults for all "children" classes.
64  //
65  // The type of equation of motion is fixed.
66  // A default type of stepper (Dormand Prince since release 10.4) is used,
67  // and the corresponding integration driver.
68  // Except if 'useFSAL' is set (true), which provides a FSAL stepper
69  // and its corresponding specialised (templated) driver.
70 
71  virtual ~G4ChordFinder();
72 
73  G4ChordFinder(const G4ChordFinder&) = delete;
74  G4ChordFinder& operator=(const G4ChordFinder&) = delete;
75  // Copy constructor and assignment operator not allowed.
76 
77  inline G4double AdvanceChordLimited( G4FieldTrack& yCurrent,
78  G4double stepInitial,
79  G4double epsStep_Relative,
80  const G4ThreeVector& latestSafetyOrigin,
81  G4double lasestSafetyRadius);
82  // Uses ODE solver's driver to find the endpoint that satisfies
83  // the chord criterion: that d_chord < delta_chord
84  // -> Returns Length of Step taken.
85 
86  G4FieldTrack ApproxCurvePointS( const G4FieldTrack& curveAPointVelocity,
87  const G4FieldTrack& curveBPointVelocity,
88  const G4FieldTrack& ApproxCurveV,
89  const G4ThreeVector& currentEPoint,
90  const G4ThreeVector& currentFPoint,
91  const G4ThreeVector& PointG,
92  G4bool first, G4double epsStep);
93 
94  G4FieldTrack ApproxCurvePointV( const G4FieldTrack& curveAPointVelocity,
95  const G4FieldTrack& curveBPointVelocity,
96  const G4ThreeVector& currentEPoint,
97  G4double epsStep);
98 
99  inline G4double InvParabolic( const G4double xa, const G4double ya,
100  const G4double xb, const G4double yb,
101  const G4double xc, const G4double yc );
102 
103  inline G4double GetDeltaChord() const;
104  inline void SetDeltaChord(G4double newval);
105 
106  inline void SetIntegrationDriver(G4VIntegrationDriver* IntegrationDriver);
108  // Access and set Driver.
109 
110  inline void ResetStepEstimate();
111  // Clear internal state (last step estimate)
112 
113  inline G4int SetVerbose( G4int newvalue=1);
114  // Set verbosity and return old value
115 
116  void OnComputeStep();
117 
118  protected: // .........................................................
119 
120  void PrintDchordTrial(G4int noTrials,
121  G4double stepTrial,
122  G4double oldStepTrial,
123  G4double dChordStep);
124 
125  private: // ............................................................
126 
127  // Constants
128  // ---------------------
129  const G4double fDefaultDeltaChord; // SET in G4ChordFinder.cc = 0.25 mm
130 
131  // PARAMETERS
132  // ---------------------
133  G4double fDeltaChord; // Maximum miss distance
134 
135  G4int fStatsVerbose = 0; // if > 0, print Statistics in destructor
136 
137  // DEPENDENT Objects
138  // ---------------------
142  std::unique_ptr<G4HelixHeum> fLongStepper;
144  // G4VFSALIntegrationStepper* fOldFSALStepperOwned = nullptr;
146 };
147 
148 // Inline function implementation:
149 
150 #include "G4ChordFinder.icc"
151 
152 #endif // G4CHORDFINDER_HH