Geant4-11
G4VTouchable.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// G4VTouchable
27//
28// Class description:
29//
30// Base class for `touchable' objects capable of maintaining an
31// association between parts of the geometrical hierarchy (volumes
32// &/or solids) and their resultant transformation.
33//
34// Utilisation:
35// -----------
36// A touchable is a geometrical volume (solid) which has a unique
37// placement in a detector description. It is an abstract base class which
38// can be implemented in a variety of ways. Each way must provide the
39// capabilities of obtaining the transformation and solid that is described
40// by the touchable.
41//
42// All G4VTouchable implementations must respond to the two following
43// "requests":
44//
45// 1) GetTranslation and GetRotation that return the components of the
46// volume's transformation.
47//
48// 2) GetSolid that gives the solid of this touchable.
49//
50//
51// Additional capabilities are available from implementations with more
52// information. These have a default implementation that causes an exception.
53//
54// Several capabilities are available from touchables with physical volumes:
55//
56// 3) GetVolume gives the physical volume.
57//
58// 4) GetReplicaNumber or GetCopyNumber gives the copy number of the
59// physical volume, either if it is replicated or not.
60//
61// Touchables that store volume hierarchy (history) have the whole stack of
62// parent volumes available. Thus it is possible to add a little more state
63// in order to extend its functionality. We add a "pointer" to a level and a
64// member function to move the level in this stack. Then calling the above
65// member functions for another level, the information for that level can be
66// retrieved.
67//
68// The top of the history tree is, by convention, the world volume.
69//
70// 5) GetHistoryDepth gives the depth of the history tree.
71//
72// 6) GetReplicaNumber/GetCopyNumber, GetVolume, GetTranslation and
73// GetRotation each can be called with a depth argument.
74// They return the value of the respective level of the touchable.
75//
76// 7) MoveUpHistory(num) moves the current pointer inside the touchable
77// to point "num" levels up the history tree. Thus, eg, calling
78// it with num=1 will cause the internal pointer to move to the mother
79// of the current volume.
80// NOTE: this method MODIFIES the touchable.
81//
82// An update method, with different arguments is available, so that the
83// information in a touchable can be updated:
84//
85// 8) UpdateYourself takes a physical volume pointer and can additionally
86// take a NavigationHistory.
87
88// Created: Paul Kent, August 1996
89// --------------------------------------------------------------------
90#ifndef G4VTOUCHABLE_HH
91#define G4VTOUCHABLE_HH 1
92
93#include "G4Types.hh"
94
96class G4VSolid;
98
99#include "G4RotationMatrix.hh"
100#include "G4ThreeVector.hh"
101
103{
104
105 public:
106
107 G4VTouchable() = default;
108 virtual ~G4VTouchable() = default;
109 // Constructor and destructor.
110
111 virtual const G4ThreeVector& GetTranslation(G4int depth=0) const = 0;
112 virtual const G4RotationMatrix* GetRotation(G4int depth=0) const = 0;
113 // Accessors for translation and rotation.
114 virtual G4VPhysicalVolume* GetVolume(G4int depth=0) const;
115 virtual G4VSolid* GetSolid(G4int depth=0) const;
116 // Accessors for physical volumes and solid.
117
118 virtual G4int GetReplicaNumber(G4int depth=0) const;
119 inline G4int GetCopyNumber(G4int depth=0) const;
120 virtual G4int GetHistoryDepth() const;
121 virtual G4int MoveUpHistory(G4int num_levels=1);
122 // Methods for touchables with history.
123
124 virtual void UpdateYourself(G4VPhysicalVolume* pPhysVol,
125 const G4NavigationHistory* history = nullptr);
126 // Update method.
127
128 virtual const G4NavigationHistory* GetHistory() const;
129 // Method used in G4Navigator.
130};
131
132#include "G4VTouchable.icc"
133
134#endif
int G4int
Definition: G4Types.hh:85
G4VTouchable()=default
virtual G4int MoveUpHistory(G4int num_levels=1)
Definition: G4VTouchable.cc:58
virtual const G4ThreeVector & GetTranslation(G4int depth=0) const =0
virtual G4VSolid * GetSolid(G4int depth=0) const
Definition: G4VTouchable.cc:42
virtual const G4RotationMatrix * GetRotation(G4int depth=0) const =0
G4int GetCopyNumber(G4int depth=0) const
virtual const G4NavigationHistory * GetHistory() const
Definition: G4VTouchable.cc:82
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:34
virtual void UpdateYourself(G4VPhysicalVolume *pPhysVol, const G4NavigationHistory *history=nullptr)
Definition: G4VTouchable.cc:66
virtual G4int GetHistoryDepth() const
Definition: G4VTouchable.cc:74
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:50
virtual ~G4VTouchable()=default
def history()
Definition: g4zmq.py:84