ATLAS Offline Software
Loading...
Searching...
No Matches
MdtTubeCalibContainer.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5#include <algorithm> //std::max
6#include <utility> //std::in_range
7
8namespace MuonCalib {
10 const Identifier& moduleID):
11 m_moduleID{idHelperSvc->chamberId(moduleID)},
13 const int nMl = m_idHelper.numberOfMultilayers(moduleID);
14 if (!std::in_range<std::uint8_t>(nMl)) {
15 throw std::runtime_error("Invalid number of multilayers for module");
16 }
17 m_nMl = static_cast<std::uint8_t>(nMl);
18 const Identifier secondMl = m_idHelper.multilayerID(m_moduleID, m_nMl);
19 m_nLayers = std::max(m_idHelper.tubeLayerMax(m_moduleID),
20 m_idHelper.tubeLayerMax(secondMl));
21 m_nTubes = std::max(m_idHelper.tubeMax(m_moduleID),
22 m_idHelper.tubeMax(secondMl));
23 m_data.resize(m_nLayers * m_nTubes * m_nMl);
24}
25bool MdtTubeCalibContainer::setCalib(SingleTubeCalib val, const Identifier& tubeId, MsgStream& msg) {
27 const unsigned int index = vectorIndex(tubeId);
28 if (m_moduleID != m_idHelperSvc->chamberId(tubeId)) {
29 msg << MSG::ERROR<<__FILE__<<":"<<__LINE__<<" The channel "<<m_idHelperSvc->toString(tubeId)
30 <<" does not correspond to chamber "<<m_idHelperSvc->chamberNameString(tubeId) <<endmsg;
31 return false;
32 }
33 if (index >= m_data.size()) {
34 msg << MSG::WARNING<<__FILE__<<":"<<__LINE__<<" The channel "<<m_idHelperSvc->toString(tubeId)
35 <<"does not seem to match the anticipated chamber sizes of "
36 <<m_idHelperSvc->chamberNameString(m_moduleID)<<endmsg;
37 m_data.resize(index +1);
38 }
39 m_data[index] = std::move(val);
40 if (msg.level() <= MSG::VERBOSE) {
41 msg << MSG::VERBOSE<<" Succesfully stored calibration data for channel "<<m_idHelperSvc->toString(tubeId) << endmsg;
42 }
43 return true;
44}
48}
#define endmsg
std::vector< SingleTubeCalib > m_data
bool setCalib(SingleTubeCalib val, const Identifier &tubeId, MsgStream &msg)
set the calibration constants of a single tube
MdtTubeCalibContainer(const Muon::IMuonIdHelperSvc *idHelperSvc, const Identifier &moduleID)
nMl = number of multilayres, nLayers = number of layers in multilayer (3 or 4); nTubes = number of tu...
uint8_t m_nMl
number of multilayers in chamber
const Muon::IMuonIdHelperSvc * idHelperSvc() const
const Muon::IMuonIdHelperSvc * m_idHelperSvc
unsigned int vectorIndex(const Identifier &measID) const
calculate postion of tube in vector
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition index.py:1
MsgStream & msg
Definition testRead.cxx:32