| 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: G4VIntersectionLocator.hh,v 1.6 2009/11/30 11:39:15 japost Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // Class G4VIntersectionLocator
|
|---|
| 32 | //
|
|---|
| 33 | // class description:
|
|---|
| 34 | //
|
|---|
| 35 | // Base class for the calculation of the intersection point with a boundary
|
|---|
| 36 | // when PropagationInField is used.
|
|---|
| 37 | // Gives possibility to choose the method of intersection; concrete locators
|
|---|
| 38 | // implemented are: G4SimpleLocator, G4MultiLevelLocator, G4BrentLocator.
|
|---|
| 39 | //
|
|---|
| 40 | // Key Method: EstimateIntersectionPoint()
|
|---|
| 41 |
|
|---|
| 42 | // History:
|
|---|
| 43 | // -------
|
|---|
| 44 | // 27.10.08 - John Apostolakis, Tatiana Nikitina: Design and implementation
|
|---|
| 45 | // ---------------------------------------------------------------------------
|
|---|
| 46 |
|
|---|
| 47 | #ifndef G4VINTERSECTIONLOCATOR_HH
|
|---|
| 48 | #define G4VINTERSECTIONLOCATOR_HH
|
|---|
| 49 |
|
|---|
| 50 | #include "G4Types.hh"
|
|---|
| 51 | #include "G4ThreeVector.hh"
|
|---|
| 52 | #include "G4FieldTrack.hh"
|
|---|
| 53 |
|
|---|
| 54 | #include "G4Navigator.hh"
|
|---|
| 55 | #include "G4ChordFinder.hh"
|
|---|
| 56 |
|
|---|
| 57 | class G4VIntersectionLocator
|
|---|
| 58 | {
|
|---|
| 59 | public: // with description
|
|---|
| 60 |
|
|---|
| 61 | G4VIntersectionLocator(G4Navigator *theNavigator);
|
|---|
| 62 | // Constructor
|
|---|
| 63 | virtual ~G4VIntersectionLocator();
|
|---|
| 64 | // Default destructor
|
|---|
| 65 |
|
|---|
| 66 | virtual G4bool EstimateIntersectionPoint(
|
|---|
| 67 | const G4FieldTrack& curveStartPointTangent, // A
|
|---|
| 68 | const G4FieldTrack& curveEndPointTangent, // B
|
|---|
| 69 | const G4ThreeVector& trialPoint, // E
|
|---|
| 70 | G4FieldTrack& intersectPointTangent, // Output
|
|---|
| 71 | G4bool& recalculatedEndPoint, // Out
|
|---|
| 72 | G4double& fPreviousSafety, // In/Out
|
|---|
| 73 | G4ThreeVector& fPreviousSftOrigin) = 0; // In/Out
|
|---|
| 74 | // If such an intersection exists, this function calculates the
|
|---|
| 75 | // intersection point of the true path of the particle with the surface
|
|---|
| 76 | // of the current volume (or of one of its daughters).
|
|---|
| 77 | // Should use lateral displacement as measure of convergence
|
|---|
| 78 | // NOTE: changes the safety!
|
|---|
| 79 |
|
|---|
| 80 | void printStatus( const G4FieldTrack& startFT,
|
|---|
| 81 | const G4FieldTrack& currentFT,
|
|---|
| 82 | G4double requestStep,
|
|---|
| 83 | G4double safety,
|
|---|
| 84 | G4int step);
|
|---|
| 85 | // Print Method, useful mostly for debugging
|
|---|
| 86 |
|
|---|
| 87 | inline G4bool IntersectChord( G4ThreeVector StartPointA,
|
|---|
| 88 | G4ThreeVector EndPointB,
|
|---|
| 89 | G4double &NewSafety,
|
|---|
| 90 | G4double &fPreviousSafety, // In/Out
|
|---|
| 91 | G4ThreeVector &fPreviousSftOrigin, // In/Out
|
|---|
| 92 | G4double &LinearStepLength,
|
|---|
| 93 | G4ThreeVector &IntersectionPoint);
|
|---|
| 94 | // Intersect the chord from StartPointA to EndPointB and return
|
|---|
| 95 | // whether an intersection occurred. NOTE: changes the Safety!
|
|---|
| 96 |
|
|---|
| 97 | inline void SetEpsilonStepFor( G4double EpsilonStep );
|
|---|
| 98 | inline void SetDeltaIntersectionFor( G4double deltaIntersection );
|
|---|
| 99 | inline void SetNavigatorFor( G4Navigator *fNavigator );
|
|---|
| 100 | inline void SetChordFinderFor(G4ChordFinder *fCFinder );
|
|---|
| 101 | // These parameters must be set at each step, in case they were changed
|
|---|
| 102 |
|
|---|
| 103 | // Note: This simple approach ensures that all scenarios are considered.
|
|---|
| 104 | // [ Future refinement may identify which are invariant during a
|
|---|
| 105 | // track, run or event ]
|
|---|
| 106 |
|
|---|
| 107 | inline void SetVerboseFor(G4int fVerbose);
|
|---|
| 108 | inline G4int GetVerboseFor();
|
|---|
| 109 | // Controling verbosity enables checking of the locating of intersections
|
|---|
| 110 |
|
|---|
| 111 | public: // without description
|
|---|
| 112 | // Additional inline Set/Get methods for parameters, dependent objects
|
|---|
| 113 |
|
|---|
| 114 | inline G4double GetDeltaIntersectionFor();
|
|---|
| 115 | inline G4double GetEpsilonStepFor();
|
|---|
| 116 | inline G4Navigator* GetNavigatorFor();
|
|---|
| 117 | inline G4ChordFinder* GetChordFinderFor();
|
|---|
| 118 |
|
|---|
| 119 | inline void SetSafetyParametersFor(G4bool UseSafety );
|
|---|
| 120 |
|
|---|
| 121 | inline void AddAdjustementOfFoundIntersection(G4bool UseCorrection);
|
|---|
| 122 | inline G4bool GetAdjustementOfFoundIntersection();
|
|---|
| 123 | // Methods to be made Obsolete - replaced by methods below
|
|---|
| 124 | inline void AdjustIntersections(G4bool UseCorrection);
|
|---|
| 125 | inline G4bool AreIntersectionsAdjusted(){ return fUseNormalCorrection; }
|
|---|
| 126 | // Change adjustment flag ( New Interface )
|
|---|
| 127 |
|
|---|
| 128 | protected: // with description
|
|---|
| 129 |
|
|---|
| 130 | G4FieldTrack ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
|---|
| 131 | const G4FieldTrack &EstimtdEndStateB,
|
|---|
| 132 | G4double linearDistSq,
|
|---|
| 133 | G4double curveDist);
|
|---|
| 134 | // Return new estimate for state after curveDist starting from
|
|---|
| 135 | // CurrentStateA, to replace EstimtdEndStateB, and report displacement
|
|---|
| 136 | // (if field is compiled verbose)
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 | G4ThreeVector GetLocalSurfaceNormal(const G4ThreeVector &CurrentE_Point,
|
|---|
| 140 | G4bool &validNormal);
|
|---|
| 141 | // Return the SurfaceNormal of Intersecting Solid
|
|---|
| 142 |
|
|---|
| 143 | G4bool AdjustmentOfFoundIntersection(const G4ThreeVector &A,
|
|---|
| 144 | const G4ThreeVector &CurrentE_Point,
|
|---|
| 145 | const G4ThreeVector &CurrentF_Point,
|
|---|
| 146 | const G4ThreeVector &MomentumDir,
|
|---|
| 147 | const G4bool IntersectAF,
|
|---|
| 148 | G4ThreeVector &IntersectionPoint,
|
|---|
| 149 | G4double &NewSafety,
|
|---|
| 150 | G4double &fPrevSafety,
|
|---|
| 151 | G4ThreeVector &fPrevSftOrigin );
|
|---|
| 152 | // Optional method for adjustment of located intersection point
|
|---|
| 153 | // using the surface-normal
|
|---|
| 154 |
|
|---|
| 155 | protected:
|
|---|
| 156 |
|
|---|
| 157 | G4double kCarTolerance; // Constant
|
|---|
| 158 |
|
|---|
| 159 | G4int fVerboseLevel; // For debugging
|
|---|
| 160 | G4bool fUseNormalCorrection; // Configuration parameter
|
|---|
| 161 |
|
|---|
| 162 | G4Navigator *fiNavigator;
|
|---|
| 163 | // Parameters set by G4PropagatorInField ( when ? )
|
|---|
| 164 |
|
|---|
| 165 | G4ChordFinder *fiChordFinder;
|
|---|
| 166 | G4double fiEpsilonStep;
|
|---|
| 167 | G4double fiDeltaIntersection;
|
|---|
| 168 | G4bool fiUseSafety;
|
|---|
| 169 | // Parameters set at each physical step by calling method - G4PropagatorInField
|
|---|
| 170 |
|
|---|
| 171 | G4Navigator *fHelpingNavigator;
|
|---|
| 172 | // Helper for location
|
|---|
| 173 | };
|
|---|
| 174 |
|
|---|
| 175 | #include "G4VIntersectionLocator.icc"
|
|---|
| 176 |
|
|---|
| 177 | #endif
|
|---|