00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // class G4VTouchable 00031 // 00032 // Class description: 00033 // 00034 // Base class for `touchable' objects capable of maintaining an 00035 // association between parts of the geometrical hierarchy (volumes 00036 // &/or solids) and their resultant transformation. 00037 // 00038 // Utilisation: 00039 // ----------- 00040 // A touchable is a geometrical volume (solid) which has a unique 00041 // placement in a detector description. It is an abstract base class which 00042 // can be implemented in a variety of ways. Each way must provide the 00043 // capabilities of obtaining the transformation and solid that is described 00044 // by the touchable. 00045 // 00046 // All G4VTouchable implementations must respond to the two following 00047 // "requests": 00048 // 00049 // 1) GetTranslation and GetRotation that return the components of the 00050 // volume's transformation. 00051 // 00052 // 2) GetSolid that gives the solid of this touchable. 00053 // 00054 // 00055 // Additional capabilities are available from implementations with more 00056 // information. These have a default implementation that causes an exception. 00057 // 00058 // Several capabilities are available from touchables with physical volumes: 00059 // 00060 // 3) GetVolume gives the physical volume. 00061 // 00062 // 4) GetReplicaNumber or GetCopyNumber gives the copy number of the 00063 // physical volume, either if it is replicated or not. 00064 // 00065 // Touchables that store volume hierarchy (history) have the whole stack of 00066 // parent volumes available. Thus it is possible to add a little more state 00067 // in order to extend its functionality. We add a "pointer" to a level and a 00068 // member function to move the level in this stack. Then calling the above 00069 // member functions for another level, the information for that level can be 00070 // retrieved. 00071 // 00072 // The top of the history tree is, by convention, the world volume. 00073 // 00074 // 5) GetHistoryDepth gives the depth of the history tree. 00075 // 00076 // 6) GetReplicaNumber/GetCopyNumber, GetVolume, GetTranslation and 00077 // GetRotation each can be called with a depth argument. 00078 // They return the value of the respective level of the touchable. 00079 // 00080 // 7) MoveUpHistory(num) moves the current pointer inside the touchable 00081 // to point "num" levels up the history tree. Thus, eg, calling 00082 // it with num=1 will cause the internal pointer to move to the mother 00083 // of the current volume. 00084 // NOTE: this method MODIFIES the touchable. 00085 // 00086 // An update method, with different arguments is available, so that the 00087 // information in a touchable can be updated: 00088 // 00089 // 8) UpdateYourself takes a physical volume pointer and can additionally 00090 // take a NavigationHistory. 00091 00092 // History: 00093 // Created: Paul Kent, August 1996 00094 // -------------------------------------------------------------------- 00095 #ifndef G4VTOUCHABLE_HH 00096 #define G4VTOUCHABLE_HH 00097 00098 #include "G4Types.hh" 00099 00100 class G4VPhysicalVolume; 00101 class G4VSolid; 00102 class G4NavigationHistory; 00103 00104 #include "G4RotationMatrix.hh" 00105 #include "G4ThreeVector.hh" 00106 00107 class G4VTouchable 00108 { 00109 00110 public: // with description 00111 00112 G4VTouchable(); 00113 virtual ~G4VTouchable(); 00114 // Constructor and destructor. 00115 00116 virtual const G4ThreeVector& GetTranslation(G4int depth=0) const = 0; 00117 virtual const G4RotationMatrix* GetRotation(G4int depth=0) const = 0; 00118 // Accessors for translation and rotation. 00119 virtual G4VPhysicalVolume* GetVolume(G4int depth=0) const; 00120 virtual G4VSolid* GetSolid(G4int depth=0) const; 00121 // Accessors for physical volumes and solid. 00122 00123 virtual G4int GetReplicaNumber(G4int depth=0) const; 00124 inline G4int GetCopyNumber(G4int depth=0) const; 00125 virtual G4int GetHistoryDepth() const; 00126 virtual G4int MoveUpHistory(G4int num_levels=1); 00127 // Methods for touchables with history. 00128 00129 virtual void UpdateYourself(G4VPhysicalVolume* pPhysVol, 00130 const G4NavigationHistory* history=0); 00131 // Update method. 00132 00133 public: // without description 00134 00135 // virtual void ResetLevel(); 00136 00137 virtual const G4NavigationHistory* GetHistory() const; 00138 // Should this method be deprecated ? It is used in G4Navigator! 00139 }; 00140 00141 #include "G4VTouchable.icc" 00142 00143 #endif