Geant4  10.01.p01
G4NavigationHistory.hh
Go to the documentation of this file.
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 86527 2014-11-13 15:06:24Z gcosmo $
28 //
29 // class G4NavigationHistory
30 //
31 // Class description:
32 //
33 // Responsible for maintenance of the history of the path taken through
34 // the geometrical hierarchy. Principally a utility class for use by the
35 // G4Navigator.
36 
37 // History:
38 //
39 // 25.07.96 P.Kent Initial version. Services derived from
40 // requirements of G4Navigator.
41 // ----------------------------------------------------------------------
42 #ifndef G4NAVIGATIONHISTORY_HH
43 #define G4NAVIGATIONHISTORY_HH
44 
45 #include <assert.h>
46 #include <vector>
47 #include <iostream>
48 
49 #include "geomdefs.hh"
50 #include "geomwdefs.hh"
51 #include "G4AffineTransform.hh"
52 #include "G4VPhysicalVolume.hh"
53 #include "G4NavigationLevel.hh"
55 #include "G4Allocator.hh"
56 
58 {
59 
60  public: // with description
61 
62  friend std::ostream&
63  operator << (std::ostream &os, const G4NavigationHistory &h);
64 
66  // Constructor: sizes history lists & resets histories.
67 
69  // Destructor.
70 
72  // Copy constructor.
73 
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  inline void *operator new(size_t);
136  // Override "new" for "G4Allocator".
137  inline void operator delete(void *aHistory);
138  // Override "delete" for "G4Allocator".
139 
140  private:
141 
142  inline void EnlargeHistory();
143  // Enlarge history if required: increase size by kHistoryStride.
144  // Note that additional history entries are `dirty' (non zero) apart
145  // from the volume history.
146 
147  private:
148 
149  std::vector<G4NavigationLevel> *fNavHistory;
150  // Pointer to the vector of navigation levels.
151 
153  // Depth of stack: effectively depth in geometrical tree.
154 };
155 
156 #include "G4NavigationHistory.icc"
157 
158 #endif
G4VPhysicalVolume * GetTopVolume() const
const G4AffineTransform * GetPtrTopTransform() const
G4int GetDepth() const
EVolume GetVolumeType(G4int n) const
G4int GetMaxDepth() const
int G4int
Definition: G4Types.hh:78
G4int GetTopReplicaNo() const
friend std::ostream & operator<<(std::ostream &os, const G4NavigationHistory &h)
EVolume GetTopVolumeType() const
G4int GetReplicaNo(G4int n) const
const G4int n
std::vector< G4NavigationLevel > * fNavHistory
void SetFirstEntry(G4VPhysicalVolume *pVol)
void NewLevel(G4VPhysicalVolume *pNewMother, EVolume vType=kNormal, G4int nReplica=-1)
const G4AffineTransform & GetTransform(G4int n) const
const G4AffineTransform & GetTopTransform() const
EVolume
Definition: geomdefs.hh:68
G4VPhysicalVolume * GetVolume(G4int n) const
G4NavigationHistory & operator=(const G4NavigationHistory &h)