Skip to content
Snippets Groups Projects

Add a callback to CommonMuonTool, to update cached geometry when alignment changes

Merged Marco Cattaneo requested to merge addCallbackMuonID into master
2 files
+ 35
6
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -40,12 +40,8 @@ StatusCode CommonMuonTool::initialize() {
m_stationsCount = m_muonDet->stations();
m_regionsCount = m_muonDet->regions()/m_stationsCount;
m_firstUsedStation = m_stationsCount - num_active_stations;
// Load station information from detector description
for (unsigned s = 0; s != m_stationsCount; ++s) {
m_regionInner.emplace_back(m_muonDet->getInnerX(s), m_muonDet->getInnerY(s));
m_regionOuter.emplace_back(m_muonDet->getOuterX(s), m_muonDet->getOuterY(s));
m_stationZ.push_back(m_muonDet->getStationZ(s));
}
updMgrSvc()->registerCondition( this, m_muonDet->geometry(), &CommonMuonTool::updateGeometry);
// Prepare to load information from conditions data base
Condition* condFoiFactor = nullptr;
@@ -346,3 +342,34 @@ std::pair<float,float> CommonMuonTool::i_foi(unsigned int station, unsigned int
unsigned int CommonMuonTool::getFirstUsedStation() const noexcept {
return m_firstUsedStation;
}
StatusCode CommonMuonTool::updateGeometry()
{
if( msgLevel(MSG::DEBUG) ) {
debug() << "Station positions: Inner{X,Y}, Outer{X,Y}, Z :" << endmsg;
}
// Update the cached DeMuon geometry (should be done by the detector element..)
m_muonDet->fillGeoArray();
// 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_muonDet->stations(); ++s) {
m_regionInner.emplace_back(m_muonDet->getInnerX(s), m_muonDet->getInnerY(s));
m_regionOuter.emplace_back(m_muonDet->getOuterX(s), m_muonDet->getOuterY(s));
m_stationZ.push_back(m_muonDet->getStationZ(s));
if( msgLevel(MSG::DEBUG) ) {
debug() << m_muonDet->getInnerX(s) << ", " << m_muonDet->getInnerY(s) << ", " <<
m_muonDet->getOuterX(s) << ", " << m_muonDet->getOuterY(s) << ", " <<
m_muonDet->getStationZ(s) << endmsg;
}
}
return StatusCode::SUCCESS;
}
Loading