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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 10.0.p4)


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