Skip to content
Snippets Groups Projects
Commit 9291276b authored by Marco Cattaneo's avatar Marco Cattaneo
Browse files

Merge branch 'addCallbackMuonID' into 'run2-patches'

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

See merge request !1154
parents 814b833f dceb820b
No related branches found
No related tags found
1 merge request!1154Add a callback to CommonMuonTool, to update cached geometry when alignment changes
...@@ -49,12 +49,7 @@ auto CommonMuonTool::initialize() -> StatusCode { ...@@ -49,12 +49,7 @@ auto CommonMuonTool::initialize() -> StatusCode {
myRegions = m_det->regions()/myStations; myRegions = m_det->regions()/myStations;
first_used_station = myStations - num_active_stations; first_used_station = myStations - num_active_stations;
// Load station information from detector description updMgrSvc()->registerCondition( this, m_det->geometry(), &CommonMuonTool::updateGeometry);
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));
}
// Prepare to load information from conditions data base // Prepare to load information from conditions data base
Condition* condFoiFactor = nullptr; Condition* condFoiFactor = nullptr;
...@@ -352,3 +347,34 @@ auto CommonMuonTool::i_foi(int station, int region, double p) const noexcept ...@@ -352,3 +347,34 @@ auto CommonMuonTool::i_foi(int station, int region, double p) const noexcept
unsigned int CommonMuonTool::getFirstUsedStation() const noexcept { unsigned int CommonMuonTool::getFirstUsedStation() const noexcept {
return first_used_station; return first_used_station;
} }
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_det->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_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;
}
...@@ -49,6 +49,8 @@ class CommonMuonTool final : public extends1<GaudiTool, ICommonMuonTool> { ...@@ -49,6 +49,8 @@ class CommonMuonTool final : public extends1<GaudiTool, ICommonMuonTool> {
-> std::pair<double, double> override; -> std::pair<double, double> override;
virtual auto getFirstUsedStation() const noexcept -> unsigned int override; virtual auto getFirstUsedStation() const noexcept -> unsigned int override;
StatusCode updateGeometry();
unsigned myStations, myRegions; unsigned myStations, myRegions;
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment