diff --git a/Muon/MuonID/src/component/CommonMuonTool.cpp b/Muon/MuonID/src/component/CommonMuonTool.cpp index 33f5b0e36861921f2ae5c5508ded0171b1fae100..7f19330c1d998687f82a6710cb809e049ceb8bf5 100644 --- a/Muon/MuonID/src/component/CommonMuonTool.cpp +++ b/Muon/MuonID/src/component/CommonMuonTool.cpp @@ -49,12 +49,7 @@ auto CommonMuonTool::initialize() -> StatusCode { myRegions = m_det->regions()/myStations; first_used_station = myStations - num_active_stations; - // Load station information from detector description - for (unsigned s = 0; s != myStations; ++s) { - m_regionInner.emplace_back(m_det->getInnerX(s), m_det->getInnerY(s)); - m_regionOuter.emplace_back(m_det->getOuterX(s), m_det->getOuterY(s)); - m_stationZ.push_back(m_det->getStationZ(s)); - } + updMgrSvc()->registerCondition( this, m_det->geometry(), &CommonMuonTool::updateGeometry); // Prepare to load information from conditions data base Condition* condFoiFactor = nullptr; @@ -352,3 +347,31 @@ auto CommonMuonTool::i_foi(int station, int region, double p) const noexcept unsigned int CommonMuonTool::getFirstUsedStation() const noexcept { return first_used_station; } + +StatusCode CommonMuonTool::updateGeometry() +{ + if( msgLevel(MSG::DEBUG) ) { + debug() << "Station positions: Inner{X,Y}, Outer{X,Y}, Z :" << endmsg; + } + + // Load station information from detector description + m_regionInner.clear(); + m_regionOuter.clear(); + m_stationZ.clear(); + + if( msgLevel(MSG::DEBUG) ) { + debug() << "Station positions: Inner{X,Y}, Outer{X,Y}, Z :" << endmsg; + } + for (int s = 0; s != m_det->stations(); ++s) { + m_regionInner.emplace_back(m_det->getInnerX(s), m_det->getInnerY(s)); + m_regionOuter.emplace_back(m_det->getOuterX(s), m_det->getOuterY(s)); + m_stationZ.push_back(m_det->getStationZ(s)); + if( msgLevel(MSG::DEBUG) ) { + debug() << m_det->getInnerX(s) << ", " << m_det->getInnerY(s) << ", " << + m_det->getOuterX(s) << ", " << m_det->getOuterY(s) << ", " << + m_det->getStationZ(s) << endmsg; + } + } + + return StatusCode::SUCCESS; +} diff --git a/Muon/MuonID/src/component/CommonMuonTool.h b/Muon/MuonID/src/component/CommonMuonTool.h index 2d31dd1dc2f677e6134fc92c329b085ab5037f35..830af3db52334c219cfa6feba021f08cc0df35f0 100644 --- a/Muon/MuonID/src/component/CommonMuonTool.h +++ b/Muon/MuonID/src/component/CommonMuonTool.h @@ -49,6 +49,8 @@ class CommonMuonTool final : public extends1<GaudiTool, ICommonMuonTool> { -> std::pair<double, double> override; virtual auto getFirstUsedStation() const noexcept -> unsigned int override; + StatusCode updateGeometry(); + unsigned myStations, myRegions; private: