9 #include "G4StepPoint.hh"
10 #include "G4TouchableHistory.hh"
23 m_isInitialized(false),
24 m_volumeCollectionMap(volCollMap)
35 " recording envelopes:");
38 ATH_MSG_DEBUG(
" " << volCollPair.first <<
", " << volCollPair.second);
48 " not found in geometry!");
51 " will NOT be recorded");
76 recEnvelope.BeginOfEvent();
89 G4StepPoint* preStep = aStep->GetPreStepPoint();
90 G4StepPoint* postStep = aStep->GetPostStepPoint();
92 G4VPhysicalVolume* preVol = preStep->GetPhysicalVolume();
93 G4VPhysicalVolume* postVol = postStep->GetPhysicalVolume();
95 if (preVol == postVol)
return;
97 const G4TouchableHistory* preTHist =
static_cast<const G4TouchableHistory*
>(preStep->GetTouchable());
98 const G4TouchableHistory* postTHist =
static_cast<const G4TouchableHistory*
>(postStep->GetTouchable());
99 const int preStepVolDepth = preTHist->GetHistoryDepth();
100 const int postStepVolDepth = postTHist->GetHistoryDepth();
104 const int envelopeLevel = recEnvelope.GetLevel();
105 if (envelopeLevel <= preStepVolDepth)
108 const G4LogicalVolume* logicalVolume1 =
109 preTHist->GetVolume(preStepVolDepth-envelopeLevel)->GetLogicalVolume();
110 if (logicalVolume1 != recEnvelope.GetLogicalVolume())
continue;
112 if (envelopeLevel <= postStepVolDepth &&
113 logicalVolume1 == postTHist->GetVolume(postStepVolDepth-envelopeLevel)
114 ->GetLogicalVolume())
121 recEnvelope.AddTrackRecord(aStep);