ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ChordFinderDelegate.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ChordFinderDelegate.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 // G4ChordFinderDelegate
27 //
28 // Class description:
29 //
30 // Implementation of common algorithm of finding step size
31 // with distance to chord less then provided value.
32 
33 // Created: D.Sorokin
34 // --------------------------------------------------------------------
35 #ifndef G4CHORD_FINDER_DELEGATE_HH
36 #define G4CHORD_FINDER_DELEGATE_HH
37 
38 #include "G4VIntegrationDriver.hh"
39 
40 template <class Driver>
42 {
43  public:
44 
45  virtual ~G4ChordFinderDelegate();
46 
48  G4double hstep,
49  G4double eps,
50  G4double chordDistance);
51  void ResetStepEstimate();
52 
53  void TestChordPrint(G4int noTrials,
54  G4int lastStepTrial,
55  G4double dChordStep,
56  G4double fDeltaChord,
57  G4double nextStepTrial);
58 
59  // Get statistics about number of calls & trials in FindNextChord
60  G4int GetNoCalls();
61  G4int GetNoTrials(); // Total number of trials
62  G4int GetNoMaxTrials(); // Maximum # of trials for one call
63 
64  // Parameters for performance ... change with great care
65  void SetFractions_Last_Next(G4double fractLast = 0.90,
66  G4double fractNext = 0.95);
67  void SetFirstFraction(G4double fractFirst);
68 
69  // Printing for monitoring ...
70  G4double GetFirstFraction(); // Originally 0.999
71  G4double GetFractionLast(); // Originally 1.000
72  G4double GetFractionNextEstimate(); // Originally 0.980
73 
75  void SetLastStepEstimateUnc(G4double stepEst);
76 
77  private:
78 
79  Driver& GetDriver();
80 
81  G4double FindNextChord(const G4FieldTrack& yStart,
82  G4double stepMax,
83  G4double epsStep,
84  G4double chordDistance,
85  G4FieldTrack& yEnd, // Endpoint
86  G4double& dyErrPos, // Error of endpoint
87  G4double& pStepForAccuracy);
88 
89  G4double NewStep(G4double stepTrialOld,
90  G4double dChordStep, // Curr. dchord achieved
91  G4double fDeltaChord,
92  G4double& stepEstimate_Unconstrained);
93 
94  void AccumulateStatistics(G4int noTrials);
95 
96  void PrintStatistics();
97 
102 
106 };
107 
108 #include "G4ChordFinderDelegate.icc"
109 
110 #endif