Geant4 User's Guide
For Application Developers Geometry |
A touchable for a volume serves the purpose of providing a unique identification for a detector element. This can be useful for description of the geometry alternative to the one used by the Geant4 tracking system, such as a Sensitive Detectors based read-out geometry, or a parameterised geometry for fast Monte Carlo. In order to create a touchable volume, several techniques can be implemented: for example, in Geant4 touchables are implemented as solids associated to a transformation-matrix in the global reference system, or as a hierarchy of physical volumes up to the root of the geometrical tree.
A touchable is a geometrical entity (volume or solid) which has a unique placement in a detector description. It is represented by an abstract base class which can be implemented in a variety of ways. Each way must provide the capabilities of obtaining the transformation and solid that is described by the touchable.
All G4VTouchable implementations must respond to the two following "requests", where in all cases, by depth it is meant the number of levels up in the tree to be considered (the default and current one is 0):
Additional capabilities are available from implementations with more information. These have a default implementation that causes an exception.
Several capabilities are available from touchables with physical volumes:
Touchables that store volume hierarchy (history) have the whole stack of parent volumes available. Thus it is possible to add a little more state in order to extend its functionality. We add a "pointer" to a level and a member function to move the level in this stack. Then calling the above member functions for another level the information for that level can be retrieved.
The top of the history tree is, by convention, the world volume.
An update method, with different arguments is available, so that the information in a touchable can be updated:
Touchable history holds stack of geometry data
As shown in Sections 4.1.3 and 4.1.4, a logical volume represents unpositioned detector elements, and a physical volume can represent multiple detector elements. On the other hand, touchables provide a unique identification for a detector element. In particular, the Geant4 transportation process and the tracking system exploit touchables as implemented in G4TouchableHistory. The touchable history is the minimal set of information required to specify the full genealogy of a given physical volume (up to the root of the geometrical tree). These touchable volumes are made available to the user at every step of the Geant4 tracking in G4VUserSteppingAction.
To create/access a G4TouchableHistory the user must message G4Navigator which provides the method CreateTouchableHistoryHandle():
G4TouchableHistoryHandle CreateTouchableHistoryHandle() const;this will return a handle to the touchable.
The methods that differentiate the touchable-history from other touchables (since they have meaning only for this type...), are:
G4int GetHistoryDepth() const; G4int MoveUpHistory( G4int num_levels = 1 );
The first method is used to find out how many levels deep in the geometry tree the current volume is. The second method asks the touchable to eliminate its deepest level.
As mentioned above, MoveUpHistory(num) significantly modifies the state of a touchable.