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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 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 // G4NavigationHistory
 27 //
 28 // Class description:
 29 //
 30 // Responsible for maintenance of the history of the path taken through
 31 // the geometrical hierarchy. Principally a utility class for use by the
 32 // G4Navigator.
 33 
 34 // 25.07.96 - P.Kent Initial version. Services derived from
 35 //                   requirements of G4Navigator.
 36 // ----------------------------------------------------------------------
 37 #ifndef G4NAVIGATIONHISTORY_HH
 38 #define G4NAVIGATIONHISTORY_HH
 39 
 40 #include <assert.h>
 41 #include <vector>
 42 #include <iostream>
 43 
 44 #include "geomdefs.hh"
 45 #include "geomwdefs.hh"
 46 #include "G4AffineTransform.hh"
 47 #include "G4VPhysicalVolume.hh"
 48 #include "G4NavigationLevel.hh"
 49 #include "G4NavigationHistoryPool.hh"
 50 #include "G4Allocator.hh"
 51 
 52 class G4NavigationHistory
 53 {
 54 
 55  public:  // with description
 56 
 57   friend std::ostream&
 58   operator << (std::ostream& os, const G4NavigationHistory& h);
 59 
 60   G4NavigationHistory();
 61     // Constructor: sizes history lists & resets histories.
 62 
 63   ~G4NavigationHistory();
 64     // Destructor.
 65 
 66   G4NavigationHistory(const G4NavigationHistory& h);
 67     // Copy constructor.
 68 
 69   inline G4NavigationHistory& operator=(const G4NavigationHistory& h);
 70     // Assignment operator.
 71 
 72   inline void Reset();
 73     // Resets history. It now does clear most entries.
 74     // Level 0 is preserved.
 75 
 76   inline void Clear();
 77     // Clears entries, zeroing transforms, matrices & negating
 78     // replica history.
 79 
 80   inline void SetFirstEntry(G4VPhysicalVolume* pVol);
 81     // Setup initial entry in stack: copies through volume transform & matrix.
 82     // The volume is assumed to be unrotated.
 83 
 84   inline const G4AffineTransform& GetTopTransform() const; 
 85     // Returns topmost transform.
 86 
 87   inline const G4AffineTransform* GetPtrTopTransform() const;
 88     // Returns pointer to topmost transform.
 89 
 90   inline G4int GetTopReplicaNo() const;
 91     // Returns topmost replica no record.
 92 
 93   inline EVolume GetTopVolumeType() const;
 94     // Returns topmost volume type.
 95 
 96   inline G4VPhysicalVolume* GetTopVolume() const;
 97     // Returns topmost physical volume pointer.
 98 
 99   inline std::size_t GetDepth() const;
100     // Returns current history depth.
101 
102   inline std::size_t GetMaxDepth() const;
103     // Returns current maximum size of history.
104     // Note: MaxDepth of 16 mean history entries [0..15] inclusive.
105 
106   inline const G4AffineTransform& GetTransform(G4int n) const;
107     // Returns specified transformation.
108 
109   inline G4int GetReplicaNo(G4int n) const;
110     // Returns specified replica no record.
111 
112   inline EVolume GetVolumeType(G4int n) const;
113     // Returns specified volume type.
114 
115   inline G4VPhysicalVolume* GetVolume(G4int n) const;
116     // Returns specified physical volume pointer.
117 
118   inline void NewLevel(G4VPhysicalVolume* pNewMother,
119                        EVolume vType = kNormal,
120                        G4int nReplica = -1);
121     // Changes navigation level to that of the new mother.
122 
123   inline void BackLevel();
124     // Back up one level in history: from mother to grandmother.
125     // It does not erase history record of current mother.
126 
127   inline void BackLevel(G4int n);
128     // Back up specified number of levels in history.
129 
130   inline void *operator new(std::size_t);
131     // Override "new" for "G4Allocator".
132   inline void operator delete(void *aHistory);
133     // Override "delete" for "G4Allocator".
134 
135  private:
136 
137   inline void EnlargeHistory();
138     // Enlarge history if required: increase size by kHistoryStride.
139     // Note that additional history entries are `dirty' (non zero) apart
140     // from the volume history.
141 
142  private:
143 
144   std::vector<G4NavigationLevel>* fNavHistory;
145     // Pointer to the vector of navigation levels.
146 
147   std::size_t fStackDepth{0};
148     // Depth of stack: effectively depth in geometrical tree.
149 };
150 
151 #include "G4NavigationHistory.icc"
152 
153 #endif
154