Geant4-11
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// 25.07.96 - P.Kent Initial version. Services derived from
35// 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
53{
54
55 public: // with description
56
57 friend std::ostream&
58 operator << (std::ostream& os, const G4NavigationHistory& h);
59
61 // Constructor: sizes history lists & resets histories.
62
64 // Destructor.
65
67 // Copy constructor.
68
70 // Assignment operator.
71
72 inline void Reset();
73 // Resets history. It now does clear most entries.
74 // Level 0 is preserved.
75
76 inline void Clear();
77 // Clears entries, zeroing transforms, matrices & negating
78 // replica history.
79
80 inline void SetFirstEntry(G4VPhysicalVolume* pVol);
81 // Setup initial entry in stack: copies through volume transform & matrix.
82 // The volume is assumed to be unrotated.
83
84 inline const G4AffineTransform& GetTopTransform() const;
85 // Returns topmost transform.
86
88 // Returns pointer to topmost transform.
89
90 inline G4int GetTopReplicaNo() const;
91 // Returns topmost replica no record.
92
93 inline EVolume GetTopVolumeType() const;
94 // Returns topmost volume type.
95
97 // Returns topmost physical volume pointer.
98
99 inline size_t GetDepth() const;
100 // Returns current history depth.
101
102 inline size_t GetMaxDepth() const;
103 // Returns current maximum size of history.
104 // Note: MaxDepth of 16 mean history entries [0..15] inclusive.
105
106 inline const G4AffineTransform& GetTransform(G4int n) const;
107 // Returns specified transformation.
108
109 inline G4int GetReplicaNo(G4int n) const;
110 // Returns specified replica no record.
111
113 // Returns specified volume type.
114
116 // Returns specified physical volume pointer.
117
118 inline void NewLevel(G4VPhysicalVolume* pNewMother,
119 EVolume vType = kNormal,
120 G4int nReplica = -1);
121 // Changes navigation level to that of the new mother.
122
123 inline void BackLevel();
124 // Back up one level in history: from mother to grandmother.
125 // It does not erase history record of current mother.
126
127 inline void BackLevel(G4int n);
128 // Back up specified number of levels in history.
129
130 inline void *operator new(size_t);
131 // Override "new" for "G4Allocator".
132 inline void operator delete(void *aHistory);
133 // Override "delete" for "G4Allocator".
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
144 std::vector<G4NavigationLevel>* fNavHistory;
145 // Pointer to the vector of navigation levels.
146
148 // Depth of stack: effectively depth in geometrical tree.
149};
150
152
153#endif
int G4int
Definition: G4Types.hh:85
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)
std::vector< G4NavigationLevel > * fNavHistory
G4int GetReplicaNo(G4int n) const
size_t GetDepth() const
const G4AffineTransform & GetTopTransform() const
G4int GetTopReplicaNo() const
G4VPhysicalVolume * GetVolume(G4int n) const
G4NavigationHistory & operator=(const G4NavigationHistory &h)
size_t GetMaxDepth() const
G4VPhysicalVolume * GetTopVolume() const
const G4AffineTransform * GetPtrTopTransform() const
EVolume GetVolumeType(G4int n) const
const G4AffineTransform & GetTransform(G4int n) const
EVolume
Definition: geomdefs.hh:83
@ kNormal
Definition: geomdefs.hh:84