ATLAS Offline Software
MdtTdcMap.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 // constructor
11  : m_statId{cabling_data}, m_mezzCard{mezType} {
12  for (uint8_t globTube : m_mezzCard->tdcToTubeMap()) {
13  if (globTube == NOTSET)
14  continue;
15  int8_t tube = globTube % m_mezzCard->numTubesPerLayer();
16  m_minTube = std::min(m_minTube, tube);
17  m_maxTube = std::max(m_maxTube, tube);
18  }
19  m_minTube += tubeZero();
20  m_maxTube += tubeZero();
21 }
22 
23 // get the offlineId
24 bool MdtTdcMap::offlineId(MdtCablingData& cabling_map, MsgStream& log) const {
25  if (onlineId() != cabling_map) {
26  if (log.level() <= MSG::VERBOSE) {
27  log << MSG::VERBOSE << cabling_map
28  << " does not have the same online Id " << onlineId() << endmsg;
29  return false;
30  }
31  }
32  using OfflineCh = MdtMezzanineCard::OfflineCh;
33  OfflineCh tubeLayer = m_mezzCard->offlineTube(cabling_map.channelId, log);
34  static_cast<MdtCablingOffData&>(cabling_map) = offId();
35  cabling_map.tube = tubeZero() + tubeLayer.tube;
36  cabling_map.layer = tubeLayer.layer;
37  return tubeLayer.isValid;
38 }
40  if (offId() != cabling_data) {
41  log << MSG::WARNING << "The cabling data " << cabling_data
42  << " does not share the same offline id as the Tdc " << offId()
43  << ". " << endmsg;
44  return false;
45  }
46  const bool debug = true || log.level() <= MSG::VERBOSE;
47  const uint8_t tubeOffSet =
48  (tubeZero() - 1) % m_mezzCard->numTubesPerLayer();
49  if (debug) {
50  log << MSG::VERBOSE << "Try to match " << cabling_data << endmsg;
51  }
52  if (cabling_data.tube < minTube() || cabling_data.tube > maxTube()) {
53  if (debug) {
54  log << MSG::VERBOSE << "The requested tube "
55  << static_cast<int>(cabling_data.tube) << " is out of range "
56  << static_cast<int>(minTube()) << " -- "
57  << static_cast<int>(maxTube()) << endmsg;
58  }
59  return false;
60  }
61  cabling_data.channelId = m_mezzCard->tdcChannel(
62  cabling_data.layer, cabling_data.tube - tubeOffSet, log);
63  static_cast<MdtCablingOnData&>(cabling_data) = m_statId;
64  cabling_data.tdcId = moduleId();
65  if (debug) {
66  log << MSG::VERBOSE << "Mapped to " << m_statId << ", channel "
67  << static_cast<int>(cabling_data.channelId) << endmsg;
68  }
69  return cabling_data.channelId != NOTSET;
70 }
MdtTdcMap::maxTube
uint8_t maxTube() const
Definition: MdtTdcMap.h:74
MdtTdcMap::offlineId
bool offlineId(MdtCablingData &cabling_data, MsgStream &log) const
retrieve the full information
Definition: MdtTdcMap.cxx:24
MdtCablingData::tube
int tube
Layer inside the multilayer.
Definition: MdtCablingData.h:86
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
MdtTdcMap::m_mezzCard
MezzCardPtr m_mezzCard
Definition: MdtTdcMap.h:80
MdtCablingOnData
Definition: MdtCablingData.h:50
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
createCablingJSON.cabling_data
dictionary cabling_data
Definition: createCablingJSON.py:46
MdtTdcMap::MdtTdcMap
MdtTdcMap(const MezzCardPtr mezType, const MdtCablingData &cabling_data)
constructor
Definition: MdtTdcMap.cxx:10
MdtTdcMap::MezzCardPtr
MdtMezzanineCard::MezzCardPtr MezzCardPtr
Definition: MdtTdcMap.h:31
MdtCablingOffData
Split the offline part of the cabling apart to use it later for sorting.
Definition: MdtCablingData.h:16
MdtMezzanineCard::OfflineCh
Helper struct to pipe the result from the tdc -> offline channel translation.
Definition: MdtMezzanineCard.h:72
MdtTdcMap::offId
const MdtCablingOffData & offId() const
get the offline identifier
Definition: MdtTdcMap.h:57
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
MdtTdcMap.h
MdtIdHelper.h
MdtCablingData
Definition: MdtCablingData.h:82
MdtTdcMap::NOTSET
static constexpr uint8_t NOTSET
Definition: MdtTdcMap.h:30
MdtTdcMap::onlineId
const MdtCablingOnData & onlineId() const
get the online identiifer
Definition: MdtTdcMap.h:59
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
MdtCablingData::layer
int layer
Definition: MdtCablingData.h:85
MdtTdcMap::tubeZero
uint8_t tubeZero() const
Definition: MdtTdcMap.h:72
MdtCablingData::channelId
uint8_t channelId
Identifier of the corresponding tdc.
Definition: MdtCablingData.h:92
MdtTdcMap::minTube
uint8_t minTube() const
Definition: MdtTdcMap.h:75
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MdtTdcMap::moduleId
uint8_t moduleId() const
return the tdc id
Definition: MdtTdcMap.h:50
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
calibdata.tube
tube
Definition: calibdata.py:31
MdtTdcMap::m_statId
MdtCablingData m_statId
tube corresponding to each tdc channel
Definition: MdtTdcMap.h:79