[831] | 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 | // |
---|
[1315] | 27 | // $Id: G4NavigationHistory.hh,v 1.18 2010/04/22 09:06:50 gcosmo Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[831] | 29 | // |
---|
| 30 | // class G4NavigationHistory |
---|
| 31 | // |
---|
| 32 | // Class description: |
---|
| 33 | // |
---|
| 34 | // Responsible for maintenance of the history of the path taken through |
---|
| 35 | // the geometrical hierarchy. Principally a utility class for use by the |
---|
| 36 | // G4Navigator. |
---|
| 37 | |
---|
| 38 | // History: |
---|
| 39 | // |
---|
| 40 | // 25.07.96 P.Kent Initial version. Services derived from |
---|
| 41 | // requirements of G4Navigator. |
---|
| 42 | // ---------------------------------------------------------------------- |
---|
| 43 | #ifndef G4NAVIGATIONHISTORY_HH |
---|
| 44 | #define G4NAVIGATIONHISTORY_HH |
---|
| 45 | |
---|
| 46 | #include <assert.h> |
---|
| 47 | #include "geomdefs.hh" |
---|
| 48 | |
---|
| 49 | #include "G4AffineTransform.hh" |
---|
| 50 | #include "G4VPhysicalVolume.hh" |
---|
| 51 | #include "G4NavigationLevel.hh" |
---|
[1315] | 52 | #include "G4EnhancedVecAllocator.hh" |
---|
[831] | 53 | |
---|
| 54 | #include <vector> |
---|
| 55 | #include <iostream> |
---|
| 56 | |
---|
| 57 | class G4NavigationHistory |
---|
| 58 | { |
---|
| 59 | |
---|
| 60 | public: // with description |
---|
| 61 | |
---|
| 62 | friend std::ostream& |
---|
| 63 | operator << (std::ostream &os, const G4NavigationHistory &h); |
---|
| 64 | |
---|
| 65 | G4NavigationHistory(); |
---|
| 66 | // Constructor: sizes history lists & resets histories. |
---|
| 67 | |
---|
| 68 | ~G4NavigationHistory(); |
---|
| 69 | // Destructor. |
---|
| 70 | |
---|
| 71 | G4NavigationHistory(const G4NavigationHistory &h); |
---|
| 72 | // Copy constructor. |
---|
| 73 | |
---|
| 74 | G4NavigationHistory& operator=(const G4NavigationHistory &h); |
---|
| 75 | // Assignment operator. |
---|
| 76 | |
---|
| 77 | inline void Reset(); |
---|
| 78 | // Resets history. It now does clear most entries. |
---|
| 79 | // Level 0 is preserved. |
---|
| 80 | |
---|
| 81 | inline void Clear(); |
---|
| 82 | // Clears entries, zeroing transforms, matrices & negating |
---|
| 83 | // replica history. |
---|
| 84 | |
---|
| 85 | inline void SetFirstEntry(G4VPhysicalVolume* pVol); |
---|
| 86 | // Setup initial entry in stack: copies through volume transform & matrix. |
---|
| 87 | // The volume is assumed to be unrotated. |
---|
| 88 | |
---|
| 89 | inline const G4AffineTransform& GetTopTransform() const; |
---|
| 90 | // Returns topmost transform. |
---|
| 91 | |
---|
| 92 | inline const G4AffineTransform* GetPtrTopTransform() const; |
---|
| 93 | // Returns pointer to topmost transform. |
---|
| 94 | |
---|
| 95 | inline G4int GetTopReplicaNo() const; |
---|
| 96 | // Returns topmost replica no record. |
---|
| 97 | |
---|
| 98 | inline EVolume GetTopVolumeType() const; |
---|
| 99 | // Returns topmost volume type. |
---|
| 100 | |
---|
| 101 | inline G4VPhysicalVolume* GetTopVolume() const; |
---|
| 102 | // Returns topmost physical volume pointer. |
---|
| 103 | |
---|
| 104 | inline G4int GetDepth() const; |
---|
| 105 | // Returns current history depth. |
---|
| 106 | |
---|
| 107 | inline G4int GetMaxDepth() const; |
---|
| 108 | // Returns current maximum size of history. |
---|
| 109 | // Note: MaxDepth of 16 mean history entries [0..15] inclusive. |
---|
| 110 | |
---|
| 111 | inline const G4AffineTransform& GetTransform(G4int n) const; |
---|
| 112 | // Returns specified transformation. |
---|
| 113 | |
---|
| 114 | inline G4int GetReplicaNo(G4int n) const; |
---|
| 115 | // Returns specified replica no record. |
---|
| 116 | |
---|
| 117 | inline EVolume GetVolumeType(G4int n) const; |
---|
| 118 | // Returns specified volume type. |
---|
| 119 | |
---|
| 120 | inline G4VPhysicalVolume* GetVolume(G4int n) const; |
---|
| 121 | // Returns specified physical volume pointer. |
---|
| 122 | |
---|
| 123 | inline void NewLevel(G4VPhysicalVolume *pNewMother, |
---|
| 124 | EVolume vType=kNormal, |
---|
| 125 | G4int nReplica=-1); |
---|
| 126 | // Changes navigation level to that of the new mother. |
---|
| 127 | |
---|
| 128 | inline void BackLevel(); |
---|
| 129 | // Back up one level in history: from mother to grandmother. |
---|
| 130 | // It does not erase history record of current mother. |
---|
| 131 | |
---|
| 132 | inline void BackLevel(G4int n); |
---|
| 133 | // Back up specified number of levels in history. |
---|
| 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 | |
---|
[1315] | 144 | std::vector<G4NavigationLevel, |
---|
| 145 | G4EnhancedVecAllocator<G4NavigationLevel> > fNavHistory; |
---|
| 146 | // The geometrical tree; uses specialized allocator to optimize |
---|
| 147 | // memory handling and reduce possible fragmentation |
---|
[831] | 148 | |
---|
| 149 | G4int fStackDepth; |
---|
| 150 | // Depth of stack: effectively depth in geometrical tree |
---|
| 151 | |
---|
| 152 | }; |
---|
| 153 | |
---|
| 154 | #include "G4NavigationHistory.icc" |
---|
| 155 | |
---|
| 156 | #endif |
---|