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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.5.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 //
                                                   >>  27 // $Id: G4MultiNavigator.hh,v 1.5 2008-10-24 14:00:03 gcosmo Exp $
                                                   >>  28 // GEANT4 tag $Name: not supported by cvs2svn $
                                                   >>  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 << 116                          const G4bool keepState = false);
111     // Calculate the isotropic distance to the    117     // Calculate the isotropic distance to the nearest boundary 
112     // in any geometry from the specified poin    118     // in any geometry from the specified point in the global coordinate
113     // system. The geometry must be closed.       119     // system. The geometry must be closed.
114                                                   120 
115   G4TouchableHandle CreateTouchableHistoryHand << 121   G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;
116     // Returns a reference counted handle to a    122     // Returns a reference counted handle to a touchable history.
117                                                   123 
118   G4ThreeVector GetLocalExitNormal( G4bool* ob << 124   virtual G4ThreeVector GetLocalExitNormal(G4bool* obtained); // const
119   G4ThreeVector GetLocalExitNormalAndCheck( co << 125   virtual G4ThreeVector GetLocalExitNormalAndCheck(const G4ThreeVector &CurrentE_Point,
120                                             G4 << 126                G4bool* obtained); // const
121   G4ThreeVector GetGlobalExitNormal( const G4T << 127   virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &CurrentE_Point,
122                                            G4b << 128                      G4bool* obtained); // const
123     // Return Exit Surface Normal and validity    129     // Return Exit Surface Normal and validity too.
124     // Can only be called if the Navigator's l    130     // Can only be called if the Navigator's last Step either
125     //  - has just crossed a volume geometrica    131     //  - has just crossed a volume geometrical boundary and relocated, or
126     //  - has arrived at a boundary in a Compu    132     //  - has arrived at a boundary in a ComputeStep
127     // It returns the Normal to the surface po    133     // It returns the Normal to the surface pointing out of the volume that
128     //   was left behind and/or into the volum    134     //   was left behind and/or into the volume that was entered.
129     // Convention:x                               135     // Convention:x
130     //   The *local* normal is in the coordina    136     //   The *local* normal is in the coordinate system of the *final* volume.
131     // Restriction:                               137     // Restriction:
132     //   Normals are not available for replica    138     //   Normals are not available for replica volumes (returns obtained= false)
133                                                   139 
134  public:  // without description                  140  public:  // without description
135                                                   141 
136   inline G4Navigator* GetNavigator( G4int n )  << 142   G4Navigator* GetNavigator(G4int n) const
137   {                                               143   { 
138     if( (n>fNoActiveNavigators) || (n<0) ) { n << 144      if( (n>fNoActiveNavigators)||(n<0)){ n=0; }
139     return fpNavigator[n];                     << 145      return fpNavigator[n]; 
140   }                                               146   }
141                                                   147 
142  protected:  // with description                  148  protected:  // with description
143                                                   149 
144   void ResetState() override;                  << 150   void ResetState();
145     // Utility method to reset the navigator s    151     // Utility method to reset the navigator state machine.
146                                                   152 
147   void SetupHierarchy() override;              << 153   void SetupHierarchy();
148     // Renavigate & reset hierarchy described     154     // Renavigate & reset hierarchy described by current history
149     // o Reset volumes                            155     // o Reset volumes
150     // o Recompute transforms and/or solids of    156     // o Recompute transforms and/or solids of replicated/parameterised
151     //   volumes.                                 157     //   volumes.
152                                                   158 
153   void WhichLimited(); // Flag which processes    159   void WhichLimited(); // Flag which processes limited the step
154   void PrintLimited(); // Auxiliary, debugging    160   void PrintLimited(); // Auxiliary, debugging printing 
155   void CheckMassWorld();                          161   void CheckMassWorld(); 
156                                                   162 
157  private:                                         163  private:
158                                                   164 
159    // STATE Information                           165    // STATE Information 
160                                                   166 
161    G4int fNoActiveNavigators = 0;              << 167    G4int   fNoActiveNavigators; 
162    static const G4int fMaxNav = 16;            << 168    static const G4int fMaxNav = 8;   // rename to kMaxNoNav ??
163    G4VPhysicalVolume* fLastMassWorld = nullptr << 169    G4VPhysicalVolume* fLastMassWorld; 
164                                                   170 
165    G4Navigator*  fpNavigator[fMaxNav];         << 171    // Global state (retained during stepping for one track
166      // Global state (retained during stepping << 172    G4Navigator*  fpNavigator[fMaxNav];   // G4Navigator** fpNavigator;
167                                                   173 
168    // State after a step computation              174    // State after a step computation 
169    //                                          << 
170    ELimited      fLimitedStep[fMaxNav];           175    ELimited      fLimitedStep[fMaxNav];
171    G4bool        fLimitTruth[fMaxNav];            176    G4bool        fLimitTruth[fMaxNav];
172    G4double      fCurrentStepSize[fMaxNav];       177    G4double      fCurrentStepSize[fMaxNav]; 
173    G4double      fNewSafety[ fMaxNav ]; // Saf << 178    G4double      fNewSafety[ fMaxNav ];      // Safety for starting point
174    G4int         fNoLimitingStep = -1;  // How << 179    G4int         fNoLimitingStep;       // How many geometries limited the step
175    G4int         fIdNavLimiting = -1;   // Id  << 180    G4int         fIdNavLimiting;        // Id of Navigator limiting step (if only one limits)
176                                                << 181 
177    // Lowest values - determine step length, a << 182    // Lowest values - determine step length, and safety 
178    //                                          << 183    G4double      fMinStep;      // As reported by Navigators. Can be kInfinity
179    G4double      fMinStep = -kInfinity; // As  << 184    G4double      fMinSafety;
180    G4double      fMinSafety = -kInfinity;      << 185    G4double      fTrueMinStep;  // Corrected in case fMinStep >= proposed 
181    G4double      fTrueMinStep = -kInfinity; // << 
182                                                   186 
183    // State after calling 'locate'                187    // State after calling 'locate'
184    //                                          << 
185    G4VPhysicalVolume* fLocatedVolume[fMaxNav];    188    G4VPhysicalVolume* fLocatedVolume[fMaxNav];
186    G4ThreeVector      fLastLocatedPosition;       189    G4ThreeVector      fLastLocatedPosition; 
187                                                   190 
188    // Cache of safety information              << 191    // cache of safety information 
189    //                                          << 192    G4ThreeVector fSafetyLocation;       //  point where ComputeSafety is called
190    G4ThreeVector fSafetyLocation;              << 193    G4double      fMinSafety_atSafLocation; // /\ corresponding value of safety
191      // point where ComputeSafety is called    << 194    G4ThreeVector fPreStepLocation;      //  point where last ComputeStep called
192    G4double      fMinSafety_atSafLocation = -1 << 195    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                                                   196 
199    G4TransportationManager* pTransportManager;    197    G4TransportationManager* pTransportManager; // Cache for frequent use
200 };                                                198 };
201                                                   199 
202 #endif                                            200 #endif
203                                                   201