ATLAS Offline Software
Loading...
Searching...
No Matches
MdtCalibTestAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "MdtCalibTestAlg.h"
6
9namespace Muon{
10
12 ATH_CHECK(m_idHelperSvc.retrieve());
13 ATH_CHECK(m_readKey.initialize());
14 ATH_CHECK(detStore()->retrieve(m_detMgr));
15 return StatusCode::SUCCESS;
16 }
17 StatusCode MdtCalibTestAlg::execute(const EventContext& ctx) const {
18 SG::ReadCondHandle calibContainer{m_readKey, ctx};
19 if (!calibContainer.isValid()) {
20 ATH_MSG_FATAL("Failed to retrieve "<<m_readKey.fullKey());
21 return StatusCode::FAILURE;
22 }
23 std::vector<const MuonGMR4::MdtReadoutElement*> mdtMls = m_detMgr->getAllMdtReadoutElements();
24 std::set<MuonCalib::MdtFullCalibData::RtRelationPtr> testedRt{};
25 for (const MuonGMR4::MdtReadoutElement* re : mdtMls){
26 const MuonCalib::MdtFullCalibData* calibData = calibContainer->getCalibData(re->identify(), msgStream());
27 if (!calibData) {
28 ATH_MSG_FATAL("No calibration constants were defined for multilayer "<<m_idHelperSvc->toStringDetEl(re->identify()));
29 return StatusCode::FAILURE;
30 }
31 if (false && testedRt.insert(calibData->rtRelation).second) {
33 double r =0.;
34 while (r < re->innerTubeRadius()) {
35
36 const std::optional<double> t = calibData->rtRelation->tr()->driftTime(r);
37 if (!t) {
38 r+=m_stepR;
39 continue;
40 }
41 const double backR = calibData->rtRelation->rt()->radius(*t);
42 if (std::abs(r - backR) > m_mapTolerance) {
43 ATH_MSG_FATAL("The drift radius "<<r<<" is mapped back to "<<backR<<". Difference: "<<std::abs(r -backR)
44 <<" "<<m_idHelperSvc->toStringDetEl(re->identify()));
45 return StatusCode::FAILURE;
46 }
47 r+=m_stepR;
48 }
49 }
50 }
51 return StatusCode::SUCCESS;
52 }
53}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
const ServiceHandle< StoreGateSvc > & detStore() const
const MuonGMR4::MuonDetectorManager * m_detMgr
Gaudi::Property< double > m_mapTolerance
Compatibility window.
SG::ReadCondHandleKey< MuonCalib::MdtCalibDataContainer > m_readKey
Gaudi::Property< double > m_stepR
Step width to scan the compatibility of the R-t relation.
virtual StatusCode execute(const EventContext &ctx) const override final
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual StatusCode initialize() override final
int r
Definition globals.cxx:22
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
class which holds the full set of calibration constants for a given tube