|
|
|||
File indexing completed on 2026-08-03 09:14:36
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4TouchableHistory 0027 // 0028 // Class description: 0029 // 0030 // Object representing a touchable detector element, and its history in the 0031 // geometrical hierarchy, including its net resultant local->global transform. 0032 // 0033 // Touchables are objects capable of maintaining an 0034 // association between parts of the geometrical hierarchy (volumes 0035 // &/or solids) and their resultant transformation. 0036 // 0037 // Utilisation: 0038 // ----------- 0039 // A touchable is a geometrical volume (solid) which has a unique 0040 // placement in a detector description. 0041 // It must respond to the two following "requests": 0042 // 0043 // 1) GetTranslation and GetRotation that return the components of the 0044 // volume's transformation. 0045 // 0046 // 2) GetSolid that gives the solid of this touchable. 0047 // 0048 // Additional capabilities are available from implementations with more 0049 // information. These have a default implementation that causes an exception. 0050 // 0051 // Several capabilities are available from touchables with physical volumes: 0052 // 0053 // 3) GetVolume gives the physical volume. 0054 // 0055 // 4) GetReplicaNumber or GetCopyNumber gives the copy number of the 0056 // physical volume, either if it is replicated or not. 0057 // 0058 // Touchables that store volume hierarchy (history) have the whole stack of 0059 // parent volumes available. Thus it is possible to add a little more state 0060 // in order to extend its functionality. We add a "pointer" to a level and a 0061 // member function to move the level in this stack. Then calling the above 0062 // member functions for another level, the information for that level can be 0063 // retrieved. 0064 // 0065 // The top of the history tree is, by convention, the world volume. 0066 // 0067 // 5) GetHistoryDepth gives the depth of the history tree. 0068 // 0069 // 6) GetReplicaNumber/GetCopyNumber, GetVolume, GetTranslation and 0070 // GetRotation each can be called with a depth argument. 0071 // They return the value of the respective level of the touchable. 0072 // 0073 // 7) MoveUpHistory(num) moves the current pointer inside the touchable 0074 // to point "num" levels up the history tree. Thus, eg, calling 0075 // it with num=1 will cause the internal pointer to move to the mother 0076 // of the current volume. 0077 // NOTE: this method MODIFIES the touchable. 0078 // 0079 // An update method, with different arguments is available, so that the 0080 // information in a touchable can be updated: 0081 // 0082 // 8) UpdateYourself takes a physical volume pointer and can additionally 0083 // take a NavigationHistory. 0084 0085 // Author: Paul Kent (CERN), August 1996 0086 // ---------------------------------------------------------------------- 0087 #ifndef G4TOUCHABLEHISTORY_HH 0088 #define G4TOUCHABLEHISTORY_HH 0089 0090 #include "G4NavigationHistory.hh" 0091 #include "G4Allocator.hh" 0092 #include "G4LogicalVolume.hh" 0093 #include "G4ThreeVector.hh" 0094 #include "G4RotationMatrix.hh" 0095 0096 #include "geomwdefs.hh" 0097 0098 /** 0099 * @brief G4TouchableHistory is an object representing a touchable detector 0100 * element, and its history in the geometrical hierarchy, including its net 0101 * resultant local->global transform. 0102 * A touchable is a geometrical volume (solid) which has a unique placement 0103 * in a detector description. 0104 */ 0105 0106 class G4TouchableHistory 0107 { 0108 public: 0109 0110 /** 0111 * Default Constructor. It produces a touchable-history of 'zero-depth', 0112 * i.e. an "unphysical" and not very usable one; for initialisation only. 0113 */ 0114 G4TouchableHistory(); 0115 0116 /** 0117 * Default Destructor. Virtual, as it is a reference-counted object, 0118 * but there is no provision for this class to be subclassed; if subclassed, 0119 * it may fail and not give explicit errors! 0120 */ 0121 virtual ~G4TouchableHistory() = default; 0122 0123 /** 0124 * Copy constructor. 0125 */ 0126 G4TouchableHistory( const G4NavigationHistory& history ); 0127 0128 /** 0129 * Accessors. 0130 */ 0131 inline G4VPhysicalVolume* GetVolume( G4int depth = 0 ) const; 0132 inline G4VSolid* GetSolid( G4int depth = 0 ) const; 0133 const G4ThreeVector& GetTranslation( G4int depth = 0 ) const; 0134 const G4RotationMatrix* GetRotation( G4int depth = 0 ) const; 0135 0136 /** 0137 * Accessors for touchables with history. 0138 */ 0139 inline G4int GetReplicaNumber( G4int depth = 0 ) const; 0140 inline G4int GetCopyNumber( G4int depth = 0 ) const; 0141 inline G4int GetHistoryDepth() const; 0142 G4int MoveUpHistory( G4int num_levels = 1 ); 0143 0144 /** 0145 * Update method for touchables with history. 0146 */ 0147 void UpdateYourself( G4VPhysicalVolume* pPhysVol, 0148 const G4NavigationHistory* history = nullptr ); 0149 0150 /** 0151 * Returns a pointer to the navigation history; used in 0152 * G4Navigator::LocateGlobalPointAndSetup(). 0153 */ 0154 inline const G4NavigationHistory* GetHistory() const; 0155 0156 /** 0157 * Operators overriding new/delete for use by G4Allocator. 0158 */ 0159 inline void* operator new(std::size_t); 0160 inline void operator delete(void* aTH); 0161 0162 private: 0163 0164 /** 0165 * Calculates and returns the history index, given a depth 'stackDepth'. 0166 */ 0167 inline G4int CalculateHistoryIndex( G4int stackDepth ) const; 0168 0169 private: 0170 0171 G4RotationMatrix frot; 0172 G4ThreeVector ftlate; 0173 G4NavigationHistory fhistory; 0174 }; 0175 0176 #include "G4TouchableHistory.icc" 0177 0178 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|