Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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// 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// Author: Paul Kent (CERN), 25.07.1996 - Initial version.
35// Services derived from 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"
50#include "G4Allocator.hh"
51
52/**
53 * @brief G4NavigationHistory is a class responsible for the maintenance
54 * of the history of the path taken through the geometrical hierarchy.
55 */
56
58{
59 public:
60
61 /**
62 * Streaming operator.
63 */
64 friend std::ostream&
65 operator << (std::ostream& os, const G4NavigationHistory& h);
66
67 /**
68 * Constructor. Sizes history lists & resets histories.
69 */
71
72 /**
73 * Default Destructor.
74 */
76
77 /**
78 * Copy contructor and assigment operator.
79 */
82
83 /**
84 * Resets history. It does clear most entries. Level 0 is preserved.
85 */
86 inline void Reset();
87
88 /**
89 * Clears entries, zeroing transforms, matrices & negating replica history.
90 */
91 inline void Clear();
92
93 /**
94 * Setups the initial entry in stack: copies through volume transform
95 * and rotarion matrix. The volume 'pVol' is assumed to be unrotated.
96 */
97 inline void SetFirstEntry(G4VPhysicalVolume* pVol);
98
99 /**
100 * Returns the topmost transformation.
101 */
102 inline const G4AffineTransform& GetTopTransform() const;
103
104 /**
105 * Returns a pointer to the topmost transformation.
106 */
108
109 /**
110 * Returns the topmost replica number record.
111 */
112 inline G4int GetTopReplicaNo() const;
113
114 /**
115 * Returns the topmost volume type.
116 */
117 inline EVolume GetTopVolumeType() const;
118
119 /**
120 * Returns the topmost physical volume pointer.
121 */
123
124 /**
125 * Returns the current history depth.
126 */
127 inline std::size_t GetDepth() const;
128
129 /**
130 * Returns the current maximum size of the history. The maximum depth
131 * is set to 16, meaning history entries [0..15] inclusive.
132 */
133 inline std::size_t GetMaxDepth() const;
134
135 /**
136 * Returns the specified transformation.
137 * @param[in] n The history level.
138 */
139 inline const G4AffineTransform& GetTransform(G4int n) const;
140
141 /**
142 * Returns the specified replica number record.
143 * @param[in] n The history level.
144 */
145 inline G4int GetReplicaNo(G4int n) const;
146
147 /**
148 * Returns the specified volume type.
149 * @param[in] n The history level.
150 */
151 inline EVolume GetVolumeType(G4int n) const;
152
153 /**
154 * Returns the specified physical volume pointer.
155 * @param[in] n The history level.
156 */
158
159 /**
160 * Changes the navigation level to that of the new mother.
161 * @param[in] pNewMother Pointer to the mother physical volume
162 * @param[in] vType The volume type.
163 * @param[in] nReplica The replica number.
164 */
165 inline void NewLevel(G4VPhysicalVolume* pNewMother,
166 EVolume vType = kNormal,
167 G4int nReplica = -1);
168
169 /**
170 * Backs up one level in history: from mother to grandmother.
171 * It does not erase the history record of the current mother.
172 */
173 inline void BackLevel();
174
175 /**
176 * Backs up the specified number of levels in history.
177 * @param[in] n The history level.
178 */
179 inline void BackLevel(G4int n);
180
181 /**
182 * New/delete override for "G4Allocator".
183 */
184 inline void *operator new(std::size_t);
185 inline void operator delete(void *aHistory);
186
187 private:
188
189 /**
190 * Enlarges the history if required: increases the size by kHistoryStride.
191 * Note that additional history entries are 'dirty' (non zero) apart
192 * from the volume history.
193 */
194 inline void EnlargeHistory();
195
196 private:
197
198 /** Pointer to the vector of navigation levels. */
199 std::vector<G4NavigationLevel>* fNavHistory;
200
201 /** Depth of the stack: effectively depth in the geometrical tree. */
202 std::size_t fStackDepth{0};
203};
204
205#include "G4NavigationHistory.icc"
206
207#endif
int G4int
Definition G4Types.hh:85
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
EVolume GetTopVolumeType() const
void NewLevel(G4VPhysicalVolume *pNewMother, EVolume vType=kNormal, G4int nReplica=-1)
friend std::ostream & operator<<(std::ostream &os, const G4NavigationHistory &h)
void BackLevel(G4int n)
void SetFirstEntry(G4VPhysicalVolume *pVol)
G4int GetReplicaNo(G4int n) const
const G4AffineTransform & GetTopTransform() const
G4int GetTopReplicaNo() const
G4VPhysicalVolume * GetVolume(G4int n) const
G4NavigationHistory & operator=(const G4NavigationHistory &h)
std::size_t GetDepth() const
G4VPhysicalVolume * GetTopVolume() const
const G4AffineTransform * GetPtrTopTransform() const
EVolume GetVolumeType(G4int n) const
const G4AffineTransform & GetTransform(G4int n) const
std::size_t GetMaxDepth() const
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
EVolume
Definition geomdefs.hh:83
@ kNormal
Definition geomdefs.hh:84