7 #include "G4ThreeVector.hh"
9 #include "G4Geantino.hh"
10 #include "G4ChargedGeantino.hh"
17 #include "GeoModelKernel/throwExcept.h"
18 #include "GaudiKernel/SystemOfUnits.h"
32 G4bool MmSensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory*) {
34 if (!processStep(aStep)) {
39 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
43 ATH_MSG_VERBOSE(
" Track is inside volume "<< touchHist->GetHistory()->GetTopVolume()->GetName()
46 const Identifier hitID = getIdentifier(gctx, readOutEle, localToGlobal.translation());
47 if (!hitID.is_valid()) {
53 propagateAndSaveStrip(hitID, toGasGap, aStep);
64 <<
" in "<<m_detMgr->idHelperSvc()->toStringDetEl(readOutEle->
identify())<<
" dZ: "
65 <<std::abs(gapCentre.z() - hitAtGapPlane.z()));
66 if (std::abs(gapCentre.z() - hitAtGapPlane.z()) <
tolerance) {
68 <<m_detMgr->idHelperSvc()->toStringDetEl(readOutEle->
identify())<<
" gasGap: "<<
gap);
73 <<m_detMgr->idHelperSvc()->toStringDetEl(readOutEle->
identify()));
77 const G4TouchableHistory* touchHist)
const {
79 const std::string& stationVolume = touchHist->GetVolume(4)->GetName();
81 const std::vector<std::string> volumeTokens =
tokenize(stationVolume.substr(stationVolume.rfind(
"NSW") + 4),
"_");
83 if (volumeTokens.size() != 4) {
84 THROW_EXCEPTION(
" Cannot deduce the station name from "<<stationVolume);
87 const std::string
stName = volumeTokens[0][0] ==
'S' ?
"MMS" :
"MML";
88 const int stationEta =
atoi(volumeTokens[2]);
89 const int stationPhi =
atoi(volumeTokens[3]);
91 const MmIdHelper& idHelper{m_detMgr->idHelperSvc()->mmIdHelper()};
92 const Identifier detElIdMl1 = idHelper.channelID(idHelper.stationNameIndex(
stName), stationEta, stationPhi, 1, 1, 1);
93 const Identifier detElIdMl2 = idHelper.multilayerID(detElIdMl1, 2);
94 const MmReadoutElement* readOutElemMl1 = m_detMgr->getMmReadoutElement(detElIdMl1);
95 const MmReadoutElement* readOutElemMl2 = m_detMgr->getMmReadoutElement(detElIdMl2);
96 if (!readOutElemMl1 || !readOutElemMl2) {
98 <<m_detMgr->idHelperSvc()->toStringDetEl(detElIdMl1)<<
" "<<stationVolume);
106 return std::abs(centerMl2.z()) -
tolerance <= std::abs(transformCenter.z()) ? readOutElemMl2 : readOutElemMl1;