[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 | // |
---|
| 27 | // $Id: G4NavigationHistory.hh,v 1.13 2006/06/29 18:57:18 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[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" |
---|
| 52 | |
---|
| 53 | #include <vector> |
---|
| 54 | #include <iostream> |
---|
| 55 | |
---|
| 56 | class G4NavigationHistory |
---|
| 57 | { |
---|
| 58 | |
---|
| 59 | public: // with description |
---|
| 60 | |
---|
| 61 | friend std::ostream& |
---|
| 62 | operator << (std::ostream &os, const G4NavigationHistory &h); |
---|
| 63 | |
---|
| 64 | G4NavigationHistory(); |
---|
| 65 | // Constructor: sizes history lists & resets histories. |
---|
| 66 | |
---|
| 67 | ~G4NavigationHistory(); |
---|
| 68 | // Destructor. |
---|
| 69 | |
---|
| 70 | G4NavigationHistory(const G4NavigationHistory &h); |
---|
| 71 | // Copy constructor. |
---|
| 72 | |
---|
| 73 | G4NavigationHistory& operator=(const G4NavigationHistory &h); |
---|
| 74 | // Assignment operator. |
---|
| 75 | |
---|
| 76 | inline void Reset(); |
---|
| 77 | // Resets history. It now does clear most entries. |
---|
| 78 | // Level 0 is preserved. |
---|
| 79 | |
---|
| 80 | inline void Clear(); |
---|
| 81 | // Clears entries, zeroing transforms, matrices & negating |
---|
| 82 | // replica history. |
---|
| 83 | |
---|
| 84 | inline void SetFirstEntry(G4VPhysicalVolume* pVol); |
---|
| 85 | // Setup initial entry in stack: copies through volume transform & matrix. |
---|
| 86 | // The volume is assumed to be unrotated. |
---|
| 87 | |
---|
| 88 | inline const G4AffineTransform& GetTopTransform() const; |
---|
| 89 | // Returns topmost transform. |
---|
| 90 | |
---|
| 91 | inline const G4AffineTransform* GetPtrTopTransform() const; |
---|
| 92 | // Returns pointer to topmost transform. |
---|
| 93 | |
---|
| 94 | inline G4int GetTopReplicaNo() const; |
---|
| 95 | // Returns topmost replica no record. |
---|
| 96 | |
---|
| 97 | inline EVolume GetTopVolumeType() const; |
---|
| 98 | // Returns topmost volume type. |
---|
| 99 | |
---|
| 100 | inline G4VPhysicalVolume* GetTopVolume() const; |
---|
| 101 | // Returns topmost physical volume pointer. |
---|
| 102 | |
---|
| 103 | inline G4int GetDepth() const; |
---|
| 104 | // Returns current history depth. |
---|
| 105 | |
---|
| 106 | inline G4int GetMaxDepth() const; |
---|
| 107 | // Returns current maximum size of history. |
---|
| 108 | // Note: MaxDepth of 16 mean history entries [0..15] inclusive. |
---|
| 109 | |
---|
| 110 | inline const G4AffineTransform& GetTransform(G4int n) const; |
---|
| 111 | // Returns specified transformation. |
---|
| 112 | |
---|
| 113 | inline G4int GetReplicaNo(G4int n) const; |
---|
| 114 | // Returns specified replica no record. |
---|
| 115 | |
---|
| 116 | inline EVolume GetVolumeType(G4int n) const; |
---|
| 117 | // Returns specified volume type. |
---|
| 118 | |
---|
| 119 | inline G4VPhysicalVolume* GetVolume(G4int n) const; |
---|
| 120 | // Returns specified physical volume pointer. |
---|
| 121 | |
---|
| 122 | inline void NewLevel(G4VPhysicalVolume *pNewMother, |
---|
| 123 | EVolume vType=kNormal, |
---|
| 124 | G4int nReplica=-1); |
---|
| 125 | // Changes navigation level to that of the new mother. |
---|
| 126 | |
---|
| 127 | inline void BackLevel(); |
---|
| 128 | // Back up one level in history: from mother to grandmother. |
---|
| 129 | // It does not erase history record of current mother. |
---|
| 130 | |
---|
| 131 | inline void BackLevel(G4int n); |
---|
| 132 | // Back up specified number of levels in history. |
---|
| 133 | |
---|
| 134 | private: |
---|
| 135 | |
---|
| 136 | inline void EnlargeHistory(); |
---|
| 137 | // Enlarge history if required: increase size by kHistoryStride. |
---|
| 138 | // Note that additional history entries are `dirty' (non zero) apart |
---|
| 139 | // from the volume history. |
---|
| 140 | |
---|
| 141 | private: |
---|
| 142 | |
---|
| 143 | std::vector<G4NavigationLevel> fNavHistory; |
---|
| 144 | |
---|
| 145 | G4int fStackDepth; |
---|
| 146 | // Depth of stack: effectively depth in geometrical tree |
---|
| 147 | |
---|
| 148 | }; |
---|
| 149 | |
---|
| 150 | #include "G4NavigationHistory.icc" |
---|
| 151 | |
---|
| 152 | #endif |
---|