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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/navigation/include/G4VIntersectionLocator.hh (Version 11.3.0) and /geometry/navigation/include/G4VIntersectionLocator.hh (Version 9.6.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 //
                                                   >>  27 // $Id$
                                                   >>  28 //
                                                   >>  29 //
 26 // Class G4VIntersectionLocator                    30 // Class G4VIntersectionLocator 
 27 //                                                 31 //
 28 // class description:                              32 // class description:
 29 //                                             <<  33 // 
 30 // Base class for the calculation of the inter     34 // Base class for the calculation of the intersection point with a boundary 
 31 // when PropagationInField is used.                35 // when PropagationInField is used.
 32 // Gives possibility to choose the method of i     36 // Gives possibility to choose the method of intersection; concrete locators
 33 // implemented are: G4SimpleLocator, G4MultiLe     37 // implemented are: G4SimpleLocator, G4MultiLevelLocator, G4BrentLocator.
 34 //                                                 38 //
 35 // Key Method: EstimateIntersectionPoint()         39 // Key Method: EstimateIntersectionPoint()
 36                                                    40 
                                                   >>  41 // History:
                                                   >>  42 // -------
 37 // 27.10.08 - John Apostolakis, Tatiana Nikiti     43 // 27.10.08 - John Apostolakis, Tatiana Nikitina: Design and implementation 
 38 // -------------------------------------------     44 // ---------------------------------------------------------------------------
                                                   >>  45 
 39 #ifndef G4VINTERSECTIONLOCATOR_HH                  46 #ifndef G4VINTERSECTIONLOCATOR_HH
 40 #define G4VINTERSECTIONLOCATOR_HH                  47 #define G4VINTERSECTIONLOCATOR_HH
 41                                                    48 
 42 #include "G4Types.hh"                              49 #include "G4Types.hh" 
 43 #include "G4ThreeVector.hh"                        50 #include "G4ThreeVector.hh"
 44 #include "G4FieldTrack.hh"                         51 #include "G4FieldTrack.hh"
 45                                                    52 
 46 #include "G4Navigator.hh"                          53 #include "G4Navigator.hh"
 47 #include "G4ChordFinder.hh"                        54 #include "G4ChordFinder.hh"
 48                                                    55 
 49 class G4VIntersectionLocator                       56 class G4VIntersectionLocator
 50  {                                                 57  {
 51    public:  // with description                    58    public:  // with description 
 52                                                    59  
 53      G4VIntersectionLocator(G4Navigator *theNa     60      G4VIntersectionLocator(G4Navigator *theNavigator);
 54        // Constructor                              61        // Constructor
 55      virtual ~G4VIntersectionLocator();            62      virtual ~G4VIntersectionLocator();
 56        // Default destructor                       63        // Default destructor
 57                                                    64      
 58      virtual G4bool EstimateIntersectionPoint(     65      virtual G4bool EstimateIntersectionPoint( 
 59          const G4FieldTrack&       curveStartP <<  66          const  G4FieldTrack&       curveStartPointTangent,  // A
 60          const G4FieldTrack&       curveEndPoi <<  67          const  G4FieldTrack&       curveEndPointTangent,    // B
 61          const G4ThreeVector&      trialPoint, <<  68          const  G4ThreeVector&      trialPoint,              // E
 62                G4FieldTrack&       intersectPo <<  69                 G4FieldTrack&       intersectPointTangent,   // Output
 63                G4bool&             recalculate <<  70                 G4bool&             recalculatedEndPoint,    // Out
 64                G4double&           fPreviousSa <<  71                 G4double&           fPreviousSafety,         // In/Out
 65                G4ThreeVector&      fPreviousSf <<  72                 G4ThreeVector&      fPreviousSftOrigin) = 0; // In/Out   
 66        // If such an intersection exists, this     73        // If such an intersection exists, this function calculates the
 67        // intersection point of the true path      74        // intersection point of the true path of the particle with the surface
 68        // of the current volume (or of one of      75        // of the current volume (or of one of its daughters). 
 69        // Should use lateral displacement as m     76        // Should use lateral displacement as measure of convergence
 70        // NOTE: changes the safety!                77        // NOTE: changes the safety!
 71                                                    78 
 72      void printStatus( const G4FieldTrack& sta     79      void printStatus( const G4FieldTrack& startFT,
 73                        const G4FieldTrack& cur     80                        const G4FieldTrack& currentFT, 
 74                              G4double      req     81                              G4double      requestStep, 
 75                              G4double      saf     82                              G4double      safety,
 76                              G4int         ste <<  83                              G4int         step);
 77        // Print Method, useful mostly for debu     84        // Print Method, useful mostly for debugging
 78                                                    85 
 79      inline G4bool IntersectChord( const G4Thr     86      inline G4bool IntersectChord( const G4ThreeVector&  StartPointA,
 80                                    const G4Thr     87                                    const G4ThreeVector&  EndPointB,
 81                                    G4double&   <<  88                                    G4double      &NewSafety,
 82                                    G4double&   <<  89                                    G4double      &PreviousSafety,    // In/Out
 83                                    G4ThreeVect <<  90                                    G4ThreeVector &PreviousSftOrigin, // In/Out
 84                                    G4double&   <<  91                                    G4double      &LinearStepLength,
 85                                    G4ThreeVect <<  92                                    G4ThreeVector &IntersectionPoint,
 86                                    G4bool*     <<  93                                    G4bool        *calledNavigator=0 );
 87        // Intersect the chord from StartPointA     94        // Intersect the chord from StartPointA to EndPointB and return
 88        // whether an intersection occurred. NO     95        // whether an intersection occurred. NOTE: changes the Safety!
 89                                                    96 
 90      inline void SetEpsilonStepFor( G4double E <<  97      inline void    SetEpsilonStepFor( G4double EpsilonStep );
 91      inline void SetDeltaIntersectionFor( G4do <<  98      inline void    SetDeltaIntersectionFor( G4double deltaIntersection );
 92      inline void SetNavigatorFor( G4Navigator* <<  99      inline void    SetNavigatorFor( G4Navigator *fNavigator );
 93      inline void SetChordFinderFor(G4ChordFind << 100      inline void    SetChordFinderFor(G4ChordFinder *fCFinder );
 94        // These parameters must be set at each    101        // These parameters must be set at each step, in case they were changed
                                                   >> 102 
 95        // Note: This simple approach ensures t    103        // Note: This simple approach ensures that all scenarios are considered. 
 96        //       Future refinement may identify << 104        //   [ Future refinement may identify which are invariant during a 
 97        //       track, run or event            << 105        //      track, run or event ]
 98                                                   106 
 99      inline void  SetVerboseFor(G4int fVerbose << 107     inline void     SetVerboseFor(G4int fVerbose);
100      inline G4int GetVerboseFor();             << 108     inline G4int    GetVerboseFor();
101        // Controling verbosity enables checkin    109        // Controling verbosity enables checking of the locating of intersections
102                                                   110 
103   public:  // without description                 111   public:  // without description
104                                                << 
105     // Additional inline Set/Get methods for p    112     // Additional inline Set/Get methods for parameters, dependent objects
106                                                   113 
107     inline G4double       GetDeltaIntersection    114     inline G4double       GetDeltaIntersectionFor();
108     inline G4double       GetEpsilonStepFor();    115     inline G4double       GetEpsilonStepFor();
109     inline G4Navigator*   GetNavigatorFor();      116     inline G4Navigator*   GetNavigatorFor();
110     inline G4ChordFinder* GetChordFinderFor();    117     inline G4ChordFinder* GetChordFinderFor();
111                                                   118 
112     inline void SetSafetyParametersFor(G4bool  << 119     inline void   SetSafetyParametersFor(G4bool UseSafety );
113                                                   120 
114     inline void AddAdjustementOfFoundIntersect << 121     inline void   AddAdjustementOfFoundIntersection(G4bool UseCorrection);
115     inline G4bool GetAdjustementOfFoundInterse    122     inline G4bool GetAdjustementOfFoundIntersection();
116       // Methods to be made Obsolete - replace    123       // Methods to be made Obsolete - replaced by methods below
117     inline void AdjustIntersections(G4bool Use << 124     inline void   AdjustIntersections(G4bool UseCorrection); 
118     inline G4bool AreIntersectionsAdjusted(){     125     inline G4bool AreIntersectionsAdjusted(){ return fUseNormalCorrection; }  
119       // Change adjustment flag  ( New Interfa    126       // Change adjustment flag  ( New Interface ) 
120                                                   127 
121     static void printStatus( const G4FieldTrac << 
122                              const G4FieldTrac << 
123                                    G4double    << 
124                                    G4double    << 
125                                    G4int       << 
126                                    std::ostrea << 
127                                    G4int       << 
128       // Print Method for any ostream - e.g. c << 
129                                                << 
130     inline void SetCheckMode( G4bool value ) { << 
131     inline G4bool GetCheckMode()             { << 
132                                                << 
133   protected:  // with description                 128   protected:  // with description
134                                                   129 
135     G4FieldTrack ReEstimateEndpoint( const G4F << 130     G4FieldTrack ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,  
136                                      const G4F << 131                                      const G4FieldTrack &EstimtdEndStateB,
137                                            G4d << 132                                            G4double      linearDistSq,
138                                            G4d << 133                                            G4double      curveDist);
139       // Return new estimate for state after c    134       // Return new estimate for state after curveDist starting from
140       // CurrentStateA, to replace EstimtdEndS    135       // CurrentStateA, to replace EstimtdEndStateB, and report displacement
141       // (if field is compiled verbose)           136       // (if field is compiled verbose)
142                                                   137 
143     G4bool CheckAndReEstimateEndpoint( const G << 138     G4ThreeVector GetSurfaceNormal(const G4ThreeVector &CurrentInt_Point,
144                                        const G << 139                                          G4bool        &validNormal); // const
145                                              G << 
146                                              G << 
147       // Check whether EndB is too far from St << 
148       // and if, re-estimate new value for End << 
149       // Report error if  EndB is before Start << 
150       // In that case return errorCode = 2.    << 
151                                                << 
152     G4ThreeVector GetSurfaceNormal(const G4Thr << 
153                                          G4boo << 
154       // Position *must* be the intersection p    140       // Position *must* be the intersection point from last call
155       // to G4Navigator's ComputeStep  (via In    141       // to G4Navigator's ComputeStep  (via IntersectChord )
156       // Will try to use cached (last) value i    142       // Will try to use cached (last) value in Navigator for speed, 
157       // if it was kept and valid.                143       // if it was kept and valid.
158       // Value returned is in global coordinat    144       // Value returned is in global coordinates.
159       // It does NOT guarantee to obtain Norma    145       // It does NOT guarantee to obtain Normal. This can happen eg if:
160       //  - the "Intersection" Point is not on    146       //  - the "Intersection" Point is not on a surface, potentially due to
161       //  - inaccuracies in the transformation    147       //  - inaccuracies in the transformations used, or
162       //  - issues with the Solid.                148       //  - issues with the Solid.
163                                                   149 
164     G4ThreeVector GetGlobalSurfaceNormal(const << 150     G4ThreeVector GetGlobalSurfaceNormal(const G4ThreeVector &CurrentE_Point,
165                                                << 151                                                G4bool        &validNormal);
166       // Return the SurfaceNormal of Intersect    152       // Return the SurfaceNormal of Intersecting Solid in global coordinates
167       // Costlier then GetSurfaceNormal           153       // Costlier then GetSurfaceNormal
168                                                   154 
169     G4bool AdjustmentOfFoundIntersection(const << 155     G4bool AdjustmentOfFoundIntersection(const G4ThreeVector &A,
170                                          const << 156                                          const G4ThreeVector &CurrentE_Point, 
171                                          const << 157                                          const G4ThreeVector &CurrentF_Point,
172                                          const << 158                                          const G4ThreeVector &MomentumDir,
173                                          const    159                                          const G4bool         IntersectAF, 
174                                                << 160                                                G4ThreeVector &IntersectionPoint,
175                                                << 161                                                G4double      &NewSafety,
176                                                << 162                                                G4double      &fPrevSafety,
177                                                << 163                                                G4ThreeVector &fPrevSftOrigin );
178       // Optional method for adjustment of loc    164       // Optional method for adjustment of located intersection point
179       // using the surface-normal                 165       // using the surface-normal
180                                                   166   
181     void ReportTrialStep( G4int step_no,          167     void ReportTrialStep( G4int step_no, 
182                           const G4ThreeVector&    168                           const G4ThreeVector& ChordAB_v,
183                           const G4ThreeVector&    169                           const G4ThreeVector& ChordEF_v,
184                           const G4ThreeVector&    170                           const G4ThreeVector& NewMomentumDir,
185                           const G4ThreeVector&    171                           const G4ThreeVector& NormalAtEntry,
186                           G4bool validNormal      172                           G4bool validNormal   );
187       // Print a three-line report on the curr << 173       // Print a three-line report on the current "sub-step", ie trial intersection
188       // intersection                          << 
189                                                   174 
190     G4bool LocateGlobalPointWithinVolumeAndChe << 
191       // Locate point using navigator - update << 
192       // By default, it assumes that the point << 
193       // and returns true.                     << 
194       // In check mode, checks whether the poi << 
195       //   If it is inside, it returns true.   << 
196       //   If not, issues a warning and return << 
197                                                << 
198     void LocateGlobalPointWithinVolumeCheckAnd << 
199                                             co << 
200                                                << 
201       // As above, but report information abou << 
202       // If CheckMode > 1, report extra inform << 
203                                                << 
204   protected:  // without description           << 
205                                                << 
206     // Auxiliary methods -- to report issues   << 
207                                                << 
208     void ReportReversedPoints( std::ostringstr << 
209                                const G4FieldTr << 
210                                const G4FieldTr << 
211                                      G4double  << 
212                                const G4FieldTr << 
213                                const G4FieldTr << 
214                                const G4FieldTr << 
215                                const G4ThreeVe << 
216                                const G4FieldTr << 
217                                G4int sbstp_no, << 
218       // Build error messsage (in ossMsg) to r << 
219       // gone past 'A'                         << 
220                                                << 
221     void ReportProgress( std::ostream& oss,    << 
222                          const G4FieldTrack& S << 
223                          const G4FieldTrack& E << 
224                                G4int         s << 
225                          const G4FieldTrack& A << 
226                          const G4FieldTrack& B << 
227                                G4double      s << 
228                                G4int         d << 
229       // Report the current status / progress  << 
230                                                << 
231      void ReportImmediateHit( const char*      << 
232                               const G4ThreeVec << 
233                               const G4ThreeVec << 
234                                     G4double   << 
235                                  unsigned long << 
236       // Report case: trial point is 'close' t << 
237                                                << 
238   private:  // no description                     175   private:  // no description
239                                                   176 
240     G4ThreeVector GetLocalSurfaceNormal(const  << 177     G4ThreeVector GetLocalSurfaceNormal(const G4ThreeVector &CurrentE_Point,
241                                                << 178                                               G4bool &validNormal);
242       // Return the SurfaceNormal of Intersect    179       // Return the SurfaceNormal of Intersecting Solid  in local coordinates
243                                                   180 
244     G4ThreeVector GetLastSurfaceNormal( const     181     G4ThreeVector GetLastSurfaceNormal( const G4ThreeVector& intersectPoint,
245                                                << 182                                         G4bool        &validNormal) const; 
246       // Position *must* be the intersection p    183       // Position *must* be the intersection point from last call
247       // to G4Navigator's ComputeStep  (via In    184       // to G4Navigator's ComputeStep  (via IntersectChord )
248       // Temporary - will use the same method     185       // Temporary - will use the same method in the Navigator
249                                                   186 
250   protected:                                      187   protected:
251                                                   188 
252     G4double kCarTolerance;                  / << 189     G4double kCarTolerance;         // Constant
                                                   >> 190 
                                                   >> 191     G4int    fVerboseLevel;          // For debugging
                                                   >> 192     G4bool   fUseNormalCorrection;   // Configuration parameter
                                                   >> 193 
                                                   >> 194     G4Navigator   *fiNavigator;
253                                                   195 
254     G4int    fVerboseLevel = 0;              / << 196     G4ChordFinder *fiChordFinder;
255     G4bool   fUseNormalCorrection = false;   / << 197     G4double       fiEpsilonStep;
256     G4bool   fCheckMode = false;               << 198     G4double       fiDeltaIntersection;
257     G4bool   fiUseSafety = false;    // Whethe << 199     G4bool         fiUseSafety;
258                                                << 
259     G4Navigator* fiNavigator;                  << 
260                                                << 
261     G4ChordFinder* fiChordFinder = nullptr;  / << 
262     G4double fiEpsilonStep = -1.0;           / << 
263     G4double fiDeltaIntersection = -1.0;     / << 
264       // Parameters set at each physical step     200       // Parameters set at each physical step by calling method 
265       // by G4PropagatorInField                   201       // by G4PropagatorInField
266                                                   202 
267     G4Navigator *fHelpingNavigator;               203     G4Navigator *fHelpingNavigator;
268       // Helper for location                      204       // Helper for location
269                                                   205 
270     G4TouchableHistory *fpTouchable = nullptr; << 206     G4TouchableHistory *fpTouchable;
271       // Touchable history hook                   207       // Touchable history hook
272 };                                                208 };
273                                                   209 
274 #include "G4VIntersectionLocator.icc"             210 #include "G4VIntersectionLocator.icc"
275                                                   211 
276 #endif                                            212 #endif
277                                                   213