Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
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 //
27 // $Id: G4ChordFinder.hh 107470 2017-11-15 07:14:28Z gcosmo $
28 //
29 //
30 // Class G4ChordFinder
31 //
32 // class description:
33 //
34 // A class that provides RK integration of motion ODE (as does g4magtr)
35 // and also has a method that returns an Approximate point on the curve
36 // near to a (chord) point.
37 
38 // History:
39 // - 25.02.97 - John Apostolakis - Design and implementation
40 // -------------------------------------------------------------------
41 
42 #ifndef G4CHORDFINDER_HH
43 #define G4CHORDFINDER_HH
44 
45 #include "G4VIntegrationDriver.hh"
48 // #include "G4VFSALIntegratorSteper.hh"
49 
50 class G4MagneticField;
51 
53 {
54  public: // with description
55 
56  explicit G4ChordFinder( G4VIntegrationDriver* pIntegrationDriver );
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  virtual ~G4ChordFinder();
66 
68  G4double stepInitial,
69  G4double epsStep_Relative,
70  const G4ThreeVector& latestSafetyOrigin,
71  G4double lasestSafetyRadius);
72  // Uses ODE solver's driver to find the endpoint that satisfies
73  // the chord criterion: that d_chord < delta_chord
74  // -> Returns Length of Step taken.
75 
76  G4FieldTrack ApproxCurvePointS( const G4FieldTrack& curveAPointVelocity,
77  const G4FieldTrack& curveBPointVelocity,
78  const G4FieldTrack& ApproxCurveV,
79  const G4ThreeVector& currentEPoint,
80  const G4ThreeVector& currentFPoint,
81  const G4ThreeVector& PointG,
82  G4bool first, G4double epsStep);
83 
84  G4FieldTrack ApproxCurvePointV( const G4FieldTrack& curveAPointVelocity,
85  const G4FieldTrack& curveBPointVelocity,
86  const G4ThreeVector& currentEPoint,
87  G4double epsStep);
88 
89  inline G4double InvParabolic( const G4double xa, const G4double ya,
90  const G4double xb, const G4double yb,
91  const G4double xc, const G4double yc );
92 
93  inline G4double GetDeltaChord() const;
94  inline void SetDeltaChord(G4double newval);
95 
96  inline void SetIntegrationDriver(G4VIntegrationDriver* IntegrationDriver);
98  // Access and set Driver.
99 
100  inline void ResetStepEstimate();
101  // Clear internal state (last step estimate)
102 
103  inline G4int GetNoCalls();
104  inline G4int GetNoTrials(); // Total number of trials
105  inline G4int GetNoMaxTrials(); // Maximum # of trials for one call
106  // Get statistics about number of calls & trials in FindNextChord
107 
108  virtual void PrintStatistics();
109  // A report with the above -- and possibly other stats
110  inline G4int SetVerbose( G4int newvalue=1);
111  // Set verbosity and return old value
112 
113  void SetFractions_Last_Next( G4double fractLast= 0.90,
114  G4double fractNext= 0.95 );
115  // Parameters for performance ... change with great care
116 
117  inline void SetFirstFraction(G4double fractFirst);
118  // Parameter for performance ... change with great care
119 
120  public: // without description
121 
122  void TestChordPrint( G4int noTrials,
123  G4int lastStepTrial,
124  G4double dChordStep,
125  G4double nextStepTrial );
126 
127  // Printing for monitoring ...
128 
129  inline G4double GetFirstFraction(); // Originally 0.999
130  inline G4double GetFractionLast(); // Originally 1.000
131  inline G4double GetFractionNextEstimate(); // Originally 0.980
132  inline G4double GetMultipleRadius(); // No original value
133  // Parameters for adapting performance ... use with great care
134 
135  protected: // .........................................................
136 
137  inline void AccumulateStatistics( G4int noTrials );
138  // Accumulate the basic statistics
139  // - other specialised ones must be kept by derived classes
140 
141  inline G4bool AcceptableMissDist(G4double dChordStep) const;
142 
143  G4double NewStep( G4double stepTrialOld,
144  G4double dChordStep, // Current dchord estimate
145  G4double& stepEstimate_Unconstrained ) ;
146 
147  virtual G4double FindNextChord( const G4FieldTrack& yStart,
148  G4double stepMax,
149  G4FieldTrack& yEnd,
150  G4double& dyErr, // Error of endpoint
151  G4double epsStep,
152  G4double* pNextStepForAccuracy, // = 0,
153  const G4ThreeVector latestSafetyOrigin,
154  G4double latestSafetyRadius
155  );
156 
157  void PrintDchordTrial(G4int noTrials,
158  G4double stepTrial,
159  G4double oldStepTrial,
160  G4double dChordStep);
161 
163  inline void SetLastStepEstimateUnc( G4double stepEst );
164 
165  private: // ............................................................
166 
169  // Private copy constructor and assignment operator.
170 
171  private: // ............................................................
172  // G4int nOK, nBAD;
173 
174  // Constants
175  const G4double fDefaultDeltaChord; // SET in G4ChordFinder.cc = 0.25 mm
176 
177  // PARAMETERS
178  // ---------------------
179  G4double fDeltaChord; // Maximum miss distance
180  // Internal parameters
183  G4int fStatsVerbose; // if > 0, print Statistics in destructor
184 
185  // DEPENDENT Objects
186  // ---------------------
190  // G4VFSALIntegrationStepper* fOldFSALStepperOwned= nullptr;
192 
193  // STATE information
194  // --------------------
196  // State information for efficiency
197 
198  // For Statistics
199  // -- G4int fNoTrials, fNoCalls;
201 };
202 
203 // Inline function implementation:
204 
205 #include "G4ChordFinder.icc"
206 
207 #endif // G4CHORDFINDER_HH
G4VIntegrationDriver * GetIntegrationDriver()
G4bool AcceptableMissDist(G4double dChordStep) const
G4ChordFinder & operator=(const G4ChordFinder &)
G4double AdvanceChordLimited(G4FieldTrack &yCurrent, G4double stepInitial, G4double epsStep_Relative, const G4ThreeVector &latestSafetyOrigin, G4double lasestSafetyRadius)
virtual G4double FindNextChord(const G4FieldTrack &yStart, G4double stepMax, G4FieldTrack &yEnd, G4double &dyErr, G4double epsStep, G4double *pNextStepForAccuracy, const G4ThreeVector latestSafetyOrigin, G4double latestSafetyRadius)
G4int GetNoTrials()
void SetLastStepEstimateUnc(G4double stepEst)
void SetDeltaChord(G4double newval)
virtual ~G4ChordFinder()
G4double NewStep(G4double stepTrialOld, G4double dChordStep, G4double &stepEstimate_Unconstrained)
G4double fFractionLast
const G4double fDefaultDeltaChord
G4int fTotalNoTrials_FNC
G4double fMultipleRadius
G4FieldTrack ApproxCurvePointS(const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4FieldTrack &ApproxCurveV, const G4ThreeVector &currentEPoint, const G4ThreeVector &currentFPoint, const G4ThreeVector &PointG, G4bool first, G4double epsStep)
G4FieldTrack ApproxCurvePointV(const G4FieldTrack &curveAPointVelocity, const G4FieldTrack &curveBPointVelocity, const G4ThreeVector &currentEPoint, G4double epsStep)
void PrintDchordTrial(G4int noTrials, G4double stepTrial, G4double oldStepTrial, G4double dChordStep)
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4MagIntegratorStepper * fNewFSALStepperOwned
G4VIntegrationDriver * fIntgrDriver
void SetFirstFraction(G4double fractFirst)
G4double InvParabolic(const G4double xa, const G4double ya, const G4double xb, const G4double yb, const G4double xc, const G4double yc)
void ResetStepEstimate()
G4double GetLastStepEstimateUnc()
virtual void PrintStatistics()
G4double GetDeltaChord() const
G4double fFirstFraction
G4double GetMultipleRadius()
G4double fLastStepEstimate_Unconstrained
G4double GetFractionNextEstimate()
G4int SetVerbose(G4int newvalue=1)
void TestChordPrint(G4int noTrials, G4int lastStepTrial, G4double dChordStep, G4double nextStepTrial)
int G4int
Definition: G4Types.hh:78
G4double GetFirstFraction()
void SetIntegrationDriver(G4VIntegrationDriver *IntegrationDriver)
G4MagIntegratorStepper * fRegularStepperOwned
G4double fDeltaChord
G4EquationOfMotion * fEquation
G4int GetNoCalls()
G4int GetNoMaxTrials()
G4double GetFractionLast()
G4double fFractionNextEstimate
void SetFractions_Last_Next(G4double fractLast=0.90, G4double fractNext=0.95)
void AccumulateStatistics(G4int noTrials)
G4ChordFinder(G4VIntegrationDriver *pIntegrationDriver)