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