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