Geant4 9.6.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//
27// $Id$
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 "geomdefs.hh"
47
48#include "G4AffineTransform.hh"
49#include "G4VPhysicalVolume.hh"
50#include "G4NavigationLevel.hh"
52
53#include <vector>
54#include <iostream>
55
57{
58
59 public: // with description
60
61 friend std::ostream&
62 operator << (std::ostream &os, const G4NavigationHistory &h);
63
65 // Constructor: sizes history lists & resets histories.
66
68 // Destructor.
69
71 // Copy constructor.
72
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
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
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
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#ifdef WIN32
144 std::vector<G4NavigationLevel> fNavHistory;
145#else
146 std::vector<G4NavigationLevel,
148 // The geometrical tree; uses specialized allocator to optimize
149 // memory handling and reduce possible fragmentation
150#endif
151
152 G4int fStackDepth;
153 // Depth of stack: effectively depth in geometrical tree
154
155};
156
157#include "G4NavigationHistory.icc"
158
159#endif
int G4int
Definition: G4Types.hh:66
EVolume GetTopVolumeType() const
void NewLevel(G4VPhysicalVolume *pNewMother, EVolume vType=kNormal, G4int nReplica=-1)
G4int GetDepth() const
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)
G4VPhysicalVolume * GetTopVolume() const
const G4AffineTransform * GetPtrTopTransform() const
EVolume GetVolumeType(G4int n) const
G4int GetMaxDepth() const
const G4AffineTransform & GetTransform(G4int n) const
EVolume
Definition: geomdefs.hh:68
@ kNormal
Definition: geomdefs.hh:68