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] [ 10.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 /processes/electromagnetic/dna/management/include/G4ITMultiNavigator.hh (Version 11.3.0) and /processes/electromagnetic/dna/management/include/G4ITMultiNavigator.hh (Version 10.3.p2)


  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 //                                                 26 //
                                                   >>  27 // $Id: G4ITMultiNavigator.hh 66356 2012-12-18 09:02:32Z gcosmo $
 27 //                                                 28 //
 28 //                                                 29 //
 29 // class G4ITMultiNavigator                        30 // class G4ITMultiNavigator
 30 //                                                 31 //
 31 // Class description:                              32 // Class description:
 32 //                                                 33 //
 33 // Utility class for polling the navigators of     34 // Utility class for polling the navigators of several geometries to
 34 // identify the next  boundary.                    35 // identify the next  boundary. 
 35                                                    36 
 36 /// \brief { Class description:                    37 /// \brief { Class description:
 37 ///                                                38 ///
 38 /// G4ITMultiNavigator is a duplicate version      39 /// G4ITMultiNavigator is a duplicate version of G4MultiNavigator 
 39 ///                                                40 ///
 40 /// Utility class for polling the navigators o     41 /// Utility class for polling the navigators of several geometries to
 41 /// identify the next  boundary.                   42 /// identify the next  boundary.
 42 ///                                                43 ///
 43 /// }                                              44 /// }
 44                                                    45 
 45 // History:                                        46 // History:
 46 // - Created. John Apostolakis, November 2006      47 // - Created. John Apostolakis, November 2006
 47 // *******************************************     48 // *********************************************************************
 48                                                    49 
 49 #ifndef G4ITMULTINAVIGATOR_HH                      50 #ifndef G4ITMULTINAVIGATOR_HH
 50 #define G4ITMULTINAVIGATOR_HH                      51 #define G4ITMULTINAVIGATOR_HH
 51                                                    52 
 52 #include <iostream>                                53 #include <iostream>
 53                                                    54 
 54 #include "geomdefs.hh"                             55 #include "geomdefs.hh"
 55 #include "G4ThreeVector.hh"                        56 #include "G4ThreeVector.hh"
 56 #include "G4ITNavigator.hh"                        57 #include "G4ITNavigator.hh"
 57                                                    58 
 58 #include "G4TouchableHandle.hh"                <<  59 #include "G4TouchableHistoryHandle.hh"
 59                                                    60 
 60 #include "G4NavigationHistory.hh"                  61 #include "G4NavigationHistory.hh"
 61 #include "G4TrackState.hh"                         62 #include "G4TrackState.hh"
 62 #include "G4MultiNavigator.hh"                     63 #include "G4MultiNavigator.hh"
 63                                                    64 
 64 namespace G4ITMN                               <<  65 namespace G4IT
 65 {                                                  66 {
 66 enum ELimited                                      67 enum ELimited
 67 {                                                  68 {
 68   kDoNot,                                          69   kDoNot,
 69   kUnique,                                         70   kUnique,
 70   kSharedTransport,                                71   kSharedTransport,
 71   kSharedOther,                                    72   kSharedOther,
 72   kUndefLimited                                    73   kUndefLimited
 73 };                                                 74 };
 74 }                                                  75 }
 75 class G4ITTransportationManager;                   76 class G4ITTransportationManager;
 76 class G4VPhysicalVolume;                           77 class G4VPhysicalVolume;
 77                                                    78 
 78 class G4ITMultiNavigator;                          79 class G4ITMultiNavigator;
 79                                                    80 
 80 // Global state (retained during stepping for      81 // Global state (retained during stepping for one track
 81 template<>                                         82 template<>
 82   class G4TrackState<G4ITMultiNavigator> : pub     83   class G4TrackState<G4ITMultiNavigator> : public G4TrackState<G4ITNavigator>
 83   {                                                84   {
 84   public:                                          85   public:
 85     ~G4TrackState() override                   <<  86     ~G4TrackState<G4ITMultiNavigator>()
 86     = default;                                 <<  87     {
                                                   >>  88     }
 87                                                    89 
 88     G4TrackState()                             <<  90     G4TrackState<G4ITMultiNavigator>()
 89     {                                              91     {
 90       G4ThreeVector Big3Vector(kInfinity, kInf     92       G4ThreeVector Big3Vector(kInfinity, kInfinity, kInfinity);
 91       fLastLocatedPosition = Big3Vector;           93       fLastLocatedPosition = Big3Vector;
 92       fSafetyLocation = Big3Vector;                94       fSafetyLocation = Big3Vector;
 93       fPreStepLocation = Big3Vector;               95       fPreStepLocation = Big3Vector;
 94                                                    96 
 95       fMinSafety_PreStepPt = -1.0;                 97       fMinSafety_PreStepPt = -1.0;
 96       fMinSafety_atSafLocation = -1.0;             98       fMinSafety_atSafLocation = -1.0;
 97       fMinSafety = -kInfinity;                     99       fMinSafety = -kInfinity;
 98       fTrueMinStep = fMinStep = -kInfinity;       100       fTrueMinStep = fMinStep = -kInfinity;
 99                                                   101 
100       for (G4int num = 0; num < G4ITNavigator:    102       for (G4int num = 0; num < G4ITNavigator::fMaxNav; ++num)
101       {                                           103       {
102         fLimitTruth[num] = false;                 104         fLimitTruth[num] = false;
103         fLimitedStep[num] = kUndefLimited;        105         fLimitedStep[num] = kUndefLimited;
104         fCurrentStepSize[num] = fNewSafety[num    106         fCurrentStepSize[num] = fNewSafety[num] = -1.0;
105         fLocatedVolume[num] = nullptr;         << 107         fLocatedVolume[num] = 0;
106       }                                           108       }
107                                                   109 
108       fNoLimitingStep = -1; // How many geomet    110       fNoLimitingStep = -1; // How many geometries limited the step
109       fIdNavLimiting = -1; // Id of Navigator     111       fIdNavLimiting = -1; // Id of Navigator limiting step (if only one limits)
110       fWasLimitedByGeometry = false;              112       fWasLimitedByGeometry = false;
111     }                                             113     }
112     ;                                             114     ;
113                                                   115 
114   protected:                                      116   protected:
115     friend class G4ITMultiNavigator;              117     friend class G4ITMultiNavigator;
116     // State after a step computation             118     // State after a step computation
117     ELimited fLimitedStep[G4ITNavigator::fMaxN    119     ELimited fLimitedStep[G4ITNavigator::fMaxNav];
118     G4bool fLimitTruth[G4ITNavigator::fMaxNav]    120     G4bool fLimitTruth[G4ITNavigator::fMaxNav];
119     G4double fCurrentStepSize[G4ITNavigator::f    121     G4double fCurrentStepSize[G4ITNavigator::fMaxNav];
120     G4double fNewSafety[G4ITNavigator::fMaxNav    122     G4double fNewSafety[G4ITNavigator::fMaxNav]; // Safety for starting point
121     G4int fNoLimitingStep; // How many geometr    123     G4int fNoLimitingStep; // How many geometries limited the step
122     G4int fIdNavLimiting; // Id of Navigator l    124     G4int fIdNavLimiting; // Id of Navigator limiting step (if only one limits)
123                                                   125 
124     G4bool fWasLimitedByGeometry;                 126     G4bool fWasLimitedByGeometry;
125                                                   127 
126     // Lowest values - determine step length,     128     // Lowest values - determine step length, and safety
127     G4double fMinStep; // As reported by Navig    129     G4double fMinStep; // As reported by Navigators. Can be kInfinity
128     G4double fMinSafety;                          130     G4double fMinSafety;
129     G4double fTrueMinStep; // Corrected in cas    131     G4double fTrueMinStep; // Corrected in case fMinStep >= proposed
130                                                   132 
131     // State after calling 'locate'               133     // State after calling 'locate'
132     G4VPhysicalVolume* fLocatedVolume[G4ITNavi    134     G4VPhysicalVolume* fLocatedVolume[G4ITNavigator::fMaxNav];
133     G4ThreeVector fLastLocatedPosition;           135     G4ThreeVector fLastLocatedPosition;
134                                                   136 
135     // cache of safety information                137     // cache of safety information
136     G4ThreeVector fSafetyLocation; //  point w    138     G4ThreeVector fSafetyLocation; //  point where ComputeSafety is called
137     G4double fMinSafety_atSafLocation; // /\ c    139     G4double fMinSafety_atSafLocation; // /\ corresponding value of safety
138     G4ThreeVector fPreStepLocation; //  point     140     G4ThreeVector fPreStepLocation; //  point where last ComputeStep called
139     G4double fMinSafety_PreStepPt; //   /\ cor    141     G4double fMinSafety_PreStepPt; //   /\ corresponding value of safety
140   };                                              142   };
141                                                   143 
142 class G4ITMultiNavigator : public G4ITNavigato    144 class G4ITMultiNavigator : public G4ITNavigator,
143                            public G4TrackState    145                            public G4TrackStateDependent<G4ITMultiNavigator>
144 {                                                 146 {
145 public:                                           147 public:
146   // with description                             148   // with description
147                                                   149 
148   friend std::ostream& operator <<(std::ostrea    150   friend std::ostream& operator <<(std::ostream &os, const G4ITNavigator &n);
149                                                   151 
150   G4ITMultiNavigator();                           152   G4ITMultiNavigator();
151   // Constructor - initialisers and setup.        153   // Constructor - initialisers and setup.
152                                                   154 
153   ~G4ITMultiNavigator() override;              << 155   ~G4ITMultiNavigator();
154   // Destructor. No actions.                      156   // Destructor. No actions.
155                                                   157 
156   G4double ComputeStep(const G4ThreeVector &pG    158   G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
157                        const G4ThreeVector &pD    159                        const G4ThreeVector &pDirection,
158                        const G4double pCurrent    160                        const G4double pCurrentProposedStepLength,
159                        G4double &pNewSafety) o << 161                        G4double &pNewSafety);
160   // Return the distance to the next boundary     162   // Return the distance to the next boundary of any geometry
161                                                   163 
162   G4double ObtainFinalStep(G4int navigatorId,     164   G4double ObtainFinalStep(G4int navigatorId, G4double &pNewSafety, // for this geom
163                            G4double &minStepLa    165                            G4double &minStepLast,
164                            ELimited &limitedSt    166                            ELimited &limitedStep);
165   // Get values for a single geometry             167   // Get values for a single geometry
166                                                   168 
167   void PrepareNavigators();                       169   void PrepareNavigators();
168   // Find which geometries are registered for     170   // Find which geometries are registered for this particles, and keep info
169   void PrepareNewTrack(const G4ThreeVector pos    171   void PrepareNewTrack(const G4ThreeVector position,
170                        const G4ThreeVector dir    172                        const G4ThreeVector direction);
171   // Prepare Navigators and locate                173   // Prepare Navigators and locate
172                                                   174 
173   G4VPhysicalVolume* ResetHierarchyAndLocate(c    175   G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point,
174                                              c    176                                              const G4ThreeVector &direction,
175                                              c << 177                                              const G4TouchableHistory &h);
176   // Reset the geometrical hierarchy for all g    178   // Reset the geometrical hierarchy for all geometries.
177   // Use the touchable history for the first (    179   // Use the touchable history for the first (mass) geometry.
178   // Return the volume in the first (mass) geo    180   // Return the volume in the first (mass) geometry.
179   //                                              181   //
180   // Important Note: In order to call this the    182   // Important Note: In order to call this the geometries MUST be closed.
181                                                   183 
182   G4VPhysicalVolume* LocateGlobalPointAndSetup    184   G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
183                                                   185                                                const G4ThreeVector* direction =
184                                                << 186                                                    0,
185                                                   187                                                const G4bool pRelativeSearch =
186                                                   188                                                    true,
187                                                   189                                                const G4bool ignoreDirection =
188                                                << 190                                                    true);
189   // Locate in all geometries.                    191   // Locate in all geometries.
190   // Return the volume in the first (mass) geo    192   // Return the volume in the first (mass) geometry
191   //  Maintain vector of other volumes,  to be    193   //  Maintain vector of other volumes,  to be returned separately
192   //                                              194   //
193   // Important Note: In order to call this the    195   // Important Note: In order to call this the geometry MUST be closed.
194                                                   196 
195   void LocateGlobalPointWithinVolume(const G4T << 197   void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
196   // Relocate in all geometries for point that    198   // Relocate in all geometries for point that has not changed volume
197   // (ie is within safety  in all geometries o    199   // (ie is within safety  in all geometries or is distance less that
198   // along the direction of a computed step.      200   // along the direction of a computed step.
199                                                   201 
200   G4double ComputeSafety(const G4ThreeVector &    202   G4double ComputeSafety(const G4ThreeVector &globalpoint,
201                          const G4double pPropo    203                          const G4double pProposedMaxLength = DBL_MAX,
202                          const G4bool keepStat << 204                          const G4bool keepState = false);
203                          // Calculate the isot    205                          // Calculate the isotropic distance to the nearest boundary
204                          // in any geometry fr    206                          // in any geometry from the specified point in the global coordinate
205                          // system. The geomet    207                          // system. The geometry must be closed.
206                                                   208 
207   G4TouchableHandle CreateTouchableHistoryHand << 209   G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
208   // Returns a reference counted handle to a t    210   // Returns a reference counted handle to a touchable history.
209                                                   211 
210   G4ThreeVector GetLocalExitNormal(G4bool* obt << 212   virtual G4ThreeVector GetLocalExitNormal(G4bool* obtained);// const
211   G4ThreeVector GetLocalExitNormalAndCheck(con << 213   virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector &CurrentE_Point,
212   G4bool* obtained) override;// const          << 214   G4bool* obtained);// const
213   G4ThreeVector GetGlobalExitNormal(const G4Th << 215   virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point,
214   G4bool* obtained) override;// const          << 216   G4bool* obtained);// const
215   // Return Exit Surface Normal and validity t    217   // Return Exit Surface Normal and validity too.
216   // Can only be called if the Navigator's las    218   // Can only be called if the Navigator's last Step either
217   //  - has just crossed a volume geometrical     219   //  - has just crossed a volume geometrical boundary and relocated, or
218   //  - has arrived at a boundary in a Compute    220   //  - has arrived at a boundary in a ComputeStep
219   // It returns the Normal to the surface poin    221   // It returns the Normal to the surface pointing out of the volume that
220   //   was left behind and/or into the volume     222   //   was left behind and/or into the volume that was entered.
221   // Convention:x                                 223   // Convention:x
222   //   The *local* normal is in the coordinate    224   //   The *local* normal is in the coordinate system of the *final* volume.
223   // Restriction:                                 225   // Restriction:
224   //   Normals are not available for replica v    226   //   Normals are not available for replica volumes (returns obtained= false)
225                                                   227 
226 public:// without description                     228 public:// without description
227                                                   229 
228  G4ITNavigator* GetNavigator(G4int n) const       230  G4ITNavigator* GetNavigator(G4int n) const
229  {                                                231  {
230    if( (n>fNoActiveNavigators)||(n<0))            232    if( (n>fNoActiveNavigators)||(n<0))
231    { n=0;}                                        233    { n=0;}
232    return fpNavigator[n];                         234    return fpNavigator[n];
233  }                                                235  }
234                                                   236 
235 protected: // with description                    237 protected: // with description
236                                                   238 
237   void ResetState() override;                  << 239   void ResetState();
238   // Utility method to reset the navigator sta    240   // Utility method to reset the navigator state machine.
239                                                   241 
240   void SetupHierarchy() override;              << 242   void SetupHierarchy();
241   // Renavigate & reset hierarchy described by    243   // Renavigate & reset hierarchy described by current history
242   // o Reset volumes                              244   // o Reset volumes
243   // o Recompute transforms and/or solids of r    245   // o Recompute transforms and/or solids of replicated/parameterised
244   //   volumes.                                   246   //   volumes.
245                                                   247 
246   void WhichLimited();// Flag which processes     248   void WhichLimited();// Flag which processes limited the step
247   void PrintLimited();// Auxiliary, debugging     249   void PrintLimited();// Auxiliary, debugging printing
248   void CheckMassWorld();                          250   void CheckMassWorld();
249                                                   251 
250 private:                                          252 private:
251                                                   253 
252   G4int fNoActiveNavigators;                      254   G4int fNoActiveNavigators;
253   G4VPhysicalVolume* fLastMassWorld{nullptr};  << 255   G4VPhysicalVolume* fLastMassWorld;
254                                                   256 
255   G4ITNavigator* fpNavigator[fMaxNav];// G4ITN    257   G4ITNavigator* fpNavigator[fMaxNav];// G4ITNavigator** fpNavigator;
256                                                   258 
257   G4ITTransportationManager* pTransportManager    259   G4ITTransportationManager* pTransportManager;// Cache for frequent use
258 };                                                260 };
259                                                   261 
260 #endif                                            262 #endif
261                                                   263