File indexing completed on 2025-01-18 09:59:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 extern G4GEOM_DLL G4Allocator<G4TouchableHistory>*& aTouchableHistoryAllocator();
0032
0033 inline
0034 void G4TouchableHistory::UpdateYourself( G4VPhysicalVolume* pPhysVol,
0035 const G4NavigationHistory* pHistory )
0036 {
0037 fhistory = *pHistory;
0038 const G4AffineTransform& tf = fhistory.GetTopTransform();
0039 if( pPhysVol == nullptr )
0040 {
0041
0042
0043
0044
0045 fhistory.SetFirstEntry(pPhysVol);
0046 }
0047 ftlate = tf.InverseNetTranslation();
0048 frot = tf.InverseNetRotation();
0049 }
0050
0051 inline
0052 G4int G4TouchableHistory::CalculateHistoryIndex( G4int stackDepth ) const
0053 {
0054 return G4int(fhistory.GetDepth()-stackDepth);
0055 }
0056
0057 inline
0058 G4VPhysicalVolume* G4TouchableHistory::GetVolume( G4int depth ) const
0059 {
0060 return fhistory.GetVolume(CalculateHistoryIndex(depth));
0061 }
0062
0063 inline
0064 G4VSolid* G4TouchableHistory::GetSolid( G4int depth ) const
0065 {
0066 return fhistory.GetVolume(CalculateHistoryIndex(depth))
0067 ->GetLogicalVolume()->GetSolid();
0068 }
0069
0070 inline
0071 G4int G4TouchableHistory::GetReplicaNumber( G4int depth ) const
0072 {
0073 return fhistory.GetReplicaNo(CalculateHistoryIndex(depth));
0074 }
0075
0076 inline
0077 G4int G4TouchableHistory::GetCopyNumber(G4int depth) const
0078 {
0079 return GetReplicaNumber(depth);
0080 }
0081
0082 inline
0083 G4int G4TouchableHistory::GetHistoryDepth() const
0084 {
0085 return G4int(fhistory.GetDepth());
0086 }
0087
0088 inline
0089 G4int G4TouchableHistory::MoveUpHistory( G4int num_levels )
0090 {
0091 auto maxLevelsMove = G4int(fhistory.GetDepth());
0092 G4int minLevelsMove = 0;
0093
0094
0095
0096 if( num_levels > maxLevelsMove )
0097 {
0098 num_levels = maxLevelsMove;
0099 }
0100 else if( num_levels < minLevelsMove )
0101 {
0102 num_levels = minLevelsMove;
0103 }
0104 fhistory.BackLevel( num_levels );
0105
0106 return num_levels;
0107 }
0108
0109 inline
0110 const G4NavigationHistory* G4TouchableHistory::GetHistory() const
0111 {
0112 return &fhistory;
0113 }
0114
0115
0116
0117
0118 inline
0119 void* G4TouchableHistory::operator new(std::size_t)
0120 {
0121
0122
0123
0124 if (aTouchableHistoryAllocator() == nullptr)
0125 {
0126 aTouchableHistoryAllocator() = new G4Allocator<G4TouchableHistory>;
0127 }
0128 return (void *) aTouchableHistoryAllocator()->MallocSingle();
0129 }
0130
0131 inline
0132 void G4TouchableHistory::operator delete(void* aTH)
0133 {
0134 aTouchableHistoryAllocator()->FreeSingle((G4TouchableHistory *) aTH);
0135 }
0136