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] [ 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/G4MultiNavigator.hh (Version 11.3.0) and /geometry/navigation/include/G4MultiNavigator.hh (Version 9.0.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: G4MultiNavigator.hh,v 1.3 2006/11/13 17:34:08 gcosmo Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-08-03-patch-01 $
                                                   >>  29 //
                                                   >>  30 //
 26 // class G4MultiNavigator                          31 // class G4MultiNavigator
 27 //                                                 32 //
 28 // Class description:                              33 // Class description:
 29 //                                                 34 //
 30 // Utility class for polling the navigators of     35 // Utility class for polling the navigators of several geometries to
 31 // identify the next boundary.                 <<  36 // identify the next  boundary. 
 32                                                    37 
 33 // History:                                        38 // History:
 34 // - Created. John Apostolakis, November 2006      39 // - Created. John Apostolakis, November 2006
 35 // ------------------------------------------- <<  40 // *********************************************************************
                                                   >>  41 
 36 #ifndef G4MULTINAVIGATOR_HH                        42 #ifndef G4MULTINAVIGATOR_HH
 37 #define G4MULTINAVIGATOR_HH                        43 #define G4MULTINAVIGATOR_HH
 38                                                    44 
 39 #include <iostream>                                45 #include <iostream>
 40                                                    46 
 41 #include "geomdefs.hh"                             47 #include "geomdefs.hh"
 42 #include "G4ThreeVector.hh"                        48 #include "G4ThreeVector.hh"
 43 #include "G4Navigator.hh"                          49 #include "G4Navigator.hh"
 44                                                    50 
 45 #include "G4TouchableHandle.hh"                <<  51 #include "G4TouchableHistoryHandle.hh"
 46                                                    52 
 47 #include "G4NavigationHistory.hh"                  53 #include "G4NavigationHistory.hh"
 48                                                    54 
 49 enum  ELimited { kDoNot,kUnique,kSharedTranspo     55 enum  ELimited { kDoNot,kUnique,kSharedTransport,kSharedOther,kUndefLimited };
 50                                                    56 
 51 class G4TransportationManager;                     57 class G4TransportationManager;
 52 class G4VPhysicalVolume;                           58 class G4VPhysicalVolume;
 53                                                    59 
 54 class G4MultiNavigator : public G4Navigator        60 class G4MultiNavigator : public G4Navigator
 55 {                                                  61 {
 56   public:  // with description                     62   public:  // with description
 57                                                    63 
 58   friend std::ostream& operator << (std::ostre <<  64   friend std::ostream& operator << (std::ostream &os, const G4Navigator &n);
 59                                                    65 
 60   G4MultiNavigator();                              66   G4MultiNavigator();
 61     // Constructor - initialisers and setup.       67     // Constructor - initialisers and setup.
 62                                                    68 
 63   ~G4MultiNavigator() override;                <<  69   ~G4MultiNavigator();
 64     // Destructor. No actions.                     70     // Destructor. No actions.
 65                                                    71 
 66   G4double ComputeStep( const G4ThreeVector& p <<  72   G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
 67                         const G4ThreeVector& p <<  73                        const G4ThreeVector &pDirection,
 68                         const G4double       p <<  74                        const G4double      pCurrentProposedStepLength,
 69                               G4double&      p <<  75                              G4double      &pNewSafety);
 70     // Return the distance to the next boundar     76     // Return the distance to the next boundary of any geometry
 71                                                    77 
 72   G4double ObtainFinalStep( G4int        navig     78   G4double ObtainFinalStep( G4int        navigatorId, 
 73                             G4double&    pNewS <<  79                             G4double     &pNewSafety,     // for this geom 
 74                             G4double&    minSt <<  80                             G4double     &minStepLast,
 75                             ELimited&    limit <<  81                             ELimited     &limitedStep); 
 76     // Get values for a single geometry            82     // Get values for a single geometry
 77                                                    83 
 78   void PrepareNavigators();                        84   void PrepareNavigators(); 
 79     // Find which geometries are registered fo <<  85     // Find which geometries are registered for this particles - and keep info
 80   void PrepareNewTrack( const G4ThreeVector& p <<  86   void PrepareNewTrack( const G4ThreeVector position, 
 81                         const G4ThreeVector di     87                         const G4ThreeVector direction ); 
 82     // Prepare Navigators and locate               88     // Prepare Navigators and locate 
 83                                                    89 
 84   G4VPhysicalVolume* ResetHierarchyAndLocate(  <<  90   G4VPhysicalVolume* ResetHierarchyAndLocate(const G4ThreeVector &point,
 85                                    const G4Thr <<  91                                              const G4ThreeVector &direction,
 86                                    const G4Tou <<  92                                              const G4TouchableHistory &h);
 87     // Reset the geometrical hierarchy for all     93     // Reset the geometrical hierarchy for all geometries.
 88     // Use the touchable history for the first     94     // Use the touchable history for the first (mass) geometry.
 89     // Return the volume in the first (mass) g     95     // Return the volume in the first (mass) geometry.
 90     //                                             96     // 
 91     // Important Note: In order to call this t     97     // Important Note: In order to call this the geometries MUST be closed.
 92                                                    98 
 93   G4VPhysicalVolume* LocateGlobalPointAndSetup <<  99   G4VPhysicalVolume* LocateGlobalPointAndSetup(const G4ThreeVector& point,
 94                                    const G4Thr << 100                                                const G4ThreeVector* direction=0,
 95                                    const G4boo << 101                                                const G4bool pRelativeSearch=true,
 96                                    const G4boo << 102                                                const G4bool ignoreDirection=true);
 97     // Locate in all geometries.                  103     // Locate in all geometries.
 98     // Return the volume in the first (mass) g    104     // Return the volume in the first (mass) geometry
 99     //  Maintain vector of other volumes,  to     105     //  Maintain vector of other volumes,  to be returned separately
100     //                                            106     // 
101     // Important Note: In order to call this t    107     // Important Note: In order to call this the geometry MUST be closed.
102                                                   108 
103   void LocateGlobalPointWithinVolume( const G4 << 109   void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
104     // Relocate in all geometries for point th    110     // Relocate in all geometries for point that has not changed volume
105     // (ie is within safety  in all geometries    111     // (ie is within safety  in all geometries or is distance less that 
106     // along the direction of a computed step.    112     // along the direction of a computed step.
107                                                   113 
108   G4double ComputeSafety( const G4ThreeVector& << 114   G4double ComputeSafety(const G4ThreeVector &globalpoint,
109                           const G4double pProp << 115                          const G4double pProposedMaxLength = DBL_MAX);
110                           const G4bool keepSta << 
111     // Calculate the isotropic distance to the    116     // Calculate the isotropic distance to the nearest boundary 
112     // in any geometry from the specified poin << 117     // in any geometry from the specified point in the global coordinate system. 
113     // system. The geometry must be closed.    << 118     // The geometry must be closed.
114                                                   119 
115   G4TouchableHandle CreateTouchableHistoryHand << 120   G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
116     // Returns a reference counted handle to a    121     // Returns a reference counted handle to a touchable history.
117                                                   122 
118   G4ThreeVector GetLocalExitNormal( G4bool* ob << 
119   G4ThreeVector GetLocalExitNormalAndCheck( co << 
120                                             G4 << 
121   G4ThreeVector GetGlobalExitNormal( const G4T << 
122                                            G4b << 
123     // Return Exit Surface Normal and validity << 
124     // Can only be called if the Navigator's l << 
125     //  - has just crossed a volume geometrica << 
126     //  - has arrived at a boundary in a Compu << 
127     // It returns the Normal to the surface po << 
128     //   was left behind and/or into the volum << 
129     // Convention:x                            << 
130     //   The *local* normal is in the coordina << 
131     // Restriction:                            << 
132     //   Normals are not available for replica << 
133                                                << 
134  public:  // without description                  123  public:  // without description
135                                                   124 
136   inline G4Navigator* GetNavigator( G4int n )  << 125   G4Navigator* GetNavigator(G4int n) const
137   {                                               126   { 
138     if( (n>fNoActiveNavigators) || (n<0) ) { n << 127      if( (n>fNoActiveNavigators)||(n<0)){ n=0; }
139     return fpNavigator[n];                     << 128      return fpNavigator[n]; 
140   }                                               129   }
141                                                   130 
142  protected:  // with description                  131  protected:  // with description
143                                                   132 
144   void ResetState() override;                  << 133   void ResetState();
145     // Utility method to reset the navigator s    134     // Utility method to reset the navigator state machine.
146                                                   135 
147   void SetupHierarchy() override;              << 136   void SetupHierarchy();
148     // Renavigate & reset hierarchy described     137     // Renavigate & reset hierarchy described by current history
149     // o Reset volumes                            138     // o Reset volumes
150     // o Recompute transforms and/or solids of    139     // o Recompute transforms and/or solids of replicated/parameterised
151     //   volumes.                                 140     //   volumes.
152                                                   141 
153   void WhichLimited(); // Flag which processes    142   void WhichLimited(); // Flag which processes limited the step
154   void PrintLimited(); // Auxiliary, debugging    143   void PrintLimited(); // Auxiliary, debugging printing 
155   void CheckMassWorld();                          144   void CheckMassWorld(); 
156                                                   145 
157  private:                                         146  private:
158                                                   147 
159    // STATE Information                           148    // STATE Information 
160                                                   149 
161    G4int fNoActiveNavigators = 0;              << 150    G4int   fNoActiveNavigators; 
162    static const G4int fMaxNav = 16;            << 151    static const G4int fMaxNav = 8;   // rename to kMaxNoNav ??
163    G4VPhysicalVolume* fLastMassWorld = nullptr << 152    G4VPhysicalVolume* fLastMassWorld; 
164                                                   153 
165    G4Navigator*  fpNavigator[fMaxNav];         << 154    // Global state (retained during stepping for one track
166      // Global state (retained during stepping << 155    G4Navigator*  fpNavigator[fMaxNav];   // G4Navigator** fpNavigator;
167                                                   156 
168    // State after a step computation              157    // State after a step computation 
169    //                                          << 
170    ELimited      fLimitedStep[fMaxNav];           158    ELimited      fLimitedStep[fMaxNav];
171    G4bool        fLimitTruth[fMaxNav];            159    G4bool        fLimitTruth[fMaxNav];
172    G4double      fCurrentStepSize[fMaxNav];       160    G4double      fCurrentStepSize[fMaxNav]; 
173    G4double      fNewSafety[ fMaxNav ]; // Saf << 161    G4double      fNewSafety[ fMaxNav ];      // Safety for starting point
174    G4int         fNoLimitingStep = -1;  // How << 162 
175    G4int         fIdNavLimiting = -1;   // Id  << 163    // Lowest values - determine step length, and safety 
176                                                << 164    G4double      fMinStep;      // As reported by Navigators -- can be kInfinity
177    // Lowest values - determine step length, a << 165    G4double      fMinSafety;
178    //                                          << 166    G4double      fTrueMinStep;  // Corrected in case fMinStep >= proposed 
179    G4double      fMinStep = -kInfinity; // As  << 
180    G4double      fMinSafety = -kInfinity;      << 
181    G4double      fTrueMinStep = -kInfinity; // << 
182                                                   167 
183    // State after calling 'locate'                168    // State after calling 'locate'
184    //                                          << 
185    G4VPhysicalVolume* fLocatedVolume[fMaxNav];    169    G4VPhysicalVolume* fLocatedVolume[fMaxNav];
186    G4ThreeVector      fLastLocatedPosition;       170    G4ThreeVector      fLastLocatedPosition; 
187                                                   171 
188    // Cache of safety information              << 172    // cache of safety information 
189    //                                          << 173    G4ThreeVector fSafetyLocation;       //  point where ComputeSafety is called
190    G4ThreeVector fSafetyLocation;              << 174    G4double      fMinSafety_atSafLocation; // /\ corresponding value of safety
191      // point where ComputeSafety is called    << 175    G4ThreeVector fPreStepLocation;      //  point where last ComputeStep called
192    G4double      fMinSafety_atSafLocation = -1 << 176    G4double      fMinSafety_PreStepPt;  //   /\ corresponding value of safety
193      // - corresponding value of safety        << 
194    G4ThreeVector fPreStepLocation;             << 
195      // point where last ComputeStep called    << 
196    G4double      fMinSafety_PreStepPt = -1.0;  << 
197      // - corresponding value of safety        << 
198                                                   177 
                                                   >> 178    // STATE Auxiliary variables 
                                                   >> 179    G4int  fVerboseLevel;
199    G4TransportationManager* pTransportManager;    180    G4TransportationManager* pTransportManager; // Cache for frequent use
200 };                                                181 };
201                                                   182 
202 #endif                                            183 #endif
203                                                   184