ATLAS Offline Software
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
MuonNRPC_CablingMap Class Reference

#include <MuonNRPC_CablingMap.h>

Collaboration diagram for MuonNRPC_CablingMap:

Public Types

using ChamberToROBMap = std::map< IdentifierHash, uint32_t >
 typedef to implement the csm mapping to ROB More...
 
using ROBToChamberMap = std::map< uint32_t, std::vector< IdentifierHash > >
 
using ListOfROB = std::vector< uint32_t >
 

Public Member Functions

 MuonNRPC_CablingMap ()
 
 ~MuonNRPC_CablingMap ()
 
bool getOfflineId (NrpcCablingData &cabling_data, MsgStream &log) const
 return the offline id given the online id More...
 
bool getOnlineId (NrpcCablingData &cabling_data, MsgStream &log) const
 return the online id given the offline id More...
 
bool convert (const NrpcCablingData &cabling_data, Identifier &id, bool check_valid=true) const
 converts the cabling data into an identifier. More...
 
bool convert (const Identifier &id, NrpcCablingData &cabling_data, bool setSideBit) const
 converts the identifier into a cabling data object. More...
 
bool insertChannels (const NrpcCablingCoolData &cabling_data, MsgStream &log)
 Inserts a cabling object into the map. More...
 
bool finalize (MsgStream &log)
 Performs consistency checks for the cabling data (I.e. More...
 
uint32_t getROBId (const IdentifierHash &stationCode, MsgStream &log) const
 return the ROD id of a given chamber, given the hash id More...
 
ListOfROB getROBId (const std::vector< IdentifierHash > &rpcHashVector, MsgStream &log) const
 get the robs corresponding to a vector of hashIds, copied from Svc before the readCdo migration More...
 
const std::vector< IdentifierHash > & getChamberHashVec (const uint32_t ROBI, MsgStream &log) const
 return a HashId list for a given ROD More...
 
const ListOfROBgetAllROBId () const
 return the full list of ROD id More...
 

Private Types

using OnlToOfflMap = std::map< NrpcCablOnDataByTdc, NrpcCablingOfflineID, std::less<> >
 
using OfflToOnlMap = std::map< NrpcCablingOfflineID, NrpcCablOnDataByStripSet, std::less<> >
 

Private Attributes

OnlToOfflMap m_onToOffline {}
 Map to cache the online -> offline conversions. More...
 
OfflToOnlMap m_offToOnline {}
 Map to cache the offline -> online conversions. More...
 
ChamberToROBMap m_chambROBs {}
 
ROBToChamberMap m_ROBHashes {}
 
const RpcIdHelperm_rpcIdHelper {}
 Pointer to the RpcIdHelper. More...
 
ListOfROB m_listOfROB {}
 full list of ROBs More...
 

Detailed Description

Definition at line 21 of file MuonNRPC_CablingMap.h.

Member Typedef Documentation

◆ ChamberToROBMap

typedef to implement the csm mapping to ROB

Definition at line 25 of file MuonNRPC_CablingMap.h.

◆ ListOfROB

using MuonNRPC_CablingMap::ListOfROB = std::vector<uint32_t>

Definition at line 27 of file MuonNRPC_CablingMap.h.

◆ OfflToOnlMap

Definition at line 67 of file MuonNRPC_CablingMap.h.

◆ OnlToOfflMap

Definition at line 66 of file MuonNRPC_CablingMap.h.

◆ ROBToChamberMap

using MuonNRPC_CablingMap::ROBToChamberMap = std::map<uint32_t, std::vector<IdentifierHash> >

Definition at line 26 of file MuonNRPC_CablingMap.h.

Constructor & Destructor Documentation

◆ MuonNRPC_CablingMap()

MuonNRPC_CablingMap::MuonNRPC_CablingMap ( )

Definition at line 13 of file MuonNRPC_CablingMap.cxx.

13  {
14  // initialize the message service
15 
16  // retrieve the RpcIdHelper
17  ISvcLocator* svcLocator = Gaudi::svcLocator();
18  StoreGateSvc* detStore = nullptr;
19  StatusCode sc = svcLocator->service("DetectorStore", detStore);
20  if (sc != StatusCode::SUCCESS) {
21  throw std::runtime_error("Could not find the detctor store");
22  }
23  sc = detStore->retrieve(m_rpcIdHelper, "RPCIDHELPER");
24  if (sc != StatusCode::SUCCESS) {
25  throw std::runtime_error("Could not retrieve the RpcIdHelper");
26  }
27 }

◆ ~MuonNRPC_CablingMap()

MuonNRPC_CablingMap::~MuonNRPC_CablingMap ( )
default

Member Function Documentation

◆ convert() [1/2]

bool MuonNRPC_CablingMap::convert ( const Identifier id,
NrpcCablingData cabling_data,
bool  setSideBit 
) const

converts the identifier into a cabling data object.

Returns false if the Identifier is not Nrpc.

Definition at line 49 of file MuonNRPC_CablingMap.cxx.

51  {
52  if (!m_rpcIdHelper->is_rpc(module_id))
53  return false;
54  cabling_data.stationIndex = m_rpcIdHelper->stationName(module_id);
55  cabling_data.eta = m_rpcIdHelper->stationEta(module_id);
56  cabling_data.phi = m_rpcIdHelper->stationPhi(module_id);
57  cabling_data.doubletR = m_rpcIdHelper->doubletR(module_id);
58  cabling_data.doubletPhi = m_rpcIdHelper->doubletPhi(module_id);
59  cabling_data.doubletZ = m_rpcIdHelper->doubletZ(module_id);
60  cabling_data.gasGap = m_rpcIdHelper->gasGap(module_id);
61  cabling_data.setMeasPhiAndSide(m_rpcIdHelper->measuresPhi(module_id), setSideBit);
62  cabling_data.strip = m_rpcIdHelper->strip(module_id);
63  return true;
64 }

◆ convert() [2/2]

bool MuonNRPC_CablingMap::convert ( const NrpcCablingData cabling_data,
Identifier id,
bool  check_valid = true 
) const

converts the cabling data into an identifier.

The check valid argument optionally enables the check that the returned identifier is actually well defined within the ranges but is also slow

Definition at line 31 of file MuonNRPC_CablingMap.cxx.

32  {
33  bool valid{!check_valid};
34  id =
35  check_valid
37  cabling_data.stationIndex, cabling_data.eta, cabling_data.phi,
38  cabling_data.doubletR, cabling_data.doubletZ,
39  cabling_data.doubletPhi, cabling_data.gasGap,
40  cabling_data.measuresPhi(), cabling_data.strip, valid)
42  cabling_data.stationIndex, cabling_data.eta, cabling_data.phi,
43  cabling_data.doubletR, cabling_data.doubletZ,
44  cabling_data.doubletPhi, cabling_data.gasGap,
45  cabling_data.measuresPhi(), cabling_data.strip);
46  return valid;
47 }

◆ finalize()

bool MuonNRPC_CablingMap::finalize ( MsgStream &  log)

Performs consistency checks for the cabling data (I.e.

looking for 0 strips and overlaps)

Generate the ROB maps

Definition at line 162 of file MuonNRPC_CablingMap.cxx.

162  {
163  if (m_offToOnline.empty()) {
164  log << MSG::ERROR << "finalize() -- No data has been loaded " << endmsg;
165  return false;
166  }
168  NrpcCablingData RobOffId{};
169  RobOffId.strip = 1;
170  for (const auto& [card, chamber] : m_onToOffline) {
171  static_cast<NrpcCablingOfflineID&>(RobOffId) = chamber;
172  Identifier chId{0};
173  if (!convert(RobOffId, chId, true)) {
174  log << MSG::ERROR
175  << "Could not construct an offline identifier from " << chamber
176  << endmsg;
177  return false;
178  }
179  IdentifierHash hash{0};
180  if (m_rpcIdHelper->get_module_hash(chId, hash)) {
181  log << MSG::ERROR << " Failed to generate a hash for " << chamber
182  << endmsg;
183  return false;
184  }
185  uint32_t hardId = (card.subDetector << 16) | card.tdcSector;
186  m_chambROBs[hash] = hardId;
187  std::vector<IdentifierHash>& robHashes = m_ROBHashes[hardId];
188  if (std::find(robHashes.begin(), robHashes.end(), hash) ==
189  robHashes.end())
190  robHashes.push_back(hash);
191  }
192  return true;
193 }

◆ getAllROBId()

const MuonNRPC_CablingMap::ListOfROB & MuonNRPC_CablingMap::getAllROBId ( ) const

return the full list of ROD id

Definition at line 222 of file MuonNRPC_CablingMap.cxx.

222  {
223  return m_listOfROB;
224 }

◆ getChamberHashVec()

const std::vector< IdentifierHash > & MuonNRPC_CablingMap::getChamberHashVec ( const uint32_t  ROBI,
MsgStream &  log 
) const

return a HashId list for a given ROD

Definition at line 213 of file MuonNRPC_CablingMap.cxx.

214  {
215  ROBToChamberMap::const_iterator itr = m_ROBHashes.find(ROBI);
216  if (itr != m_ROBHashes.end())
217  return itr->second;
218  log << MSG::WARNING << "ROB ID " << ROBI << " not found ! " << endmsg;
219  static const std::vector<IdentifierHash> dummy;
220  return dummy;
221 }

◆ getOfflineId()

bool MuonNRPC_CablingMap::getOfflineId ( NrpcCablingData cabling_data,
MsgStream &  log 
) const

return the offline id given the online id

Definition at line 66 of file MuonNRPC_CablingMap.cxx.

67  {
68  // Identify the chamber
69  OnlToOfflMap::const_iterator itr = m_onToOffline.find(cabling_map);
70  if (itr == m_onToOffline.end()) {
71  log << MSG::ERROR << "getOfflineId() -- The detector "
72  << static_cast<const NrpcCablingOnlineID&>(cabling_map) << " is unknown"
73  << endmsg;
74  return false;
75  }
76  cabling_map.NrpcCablingOfflineID::operator=(itr->second);
77  cabling_map.strip = itr->first.firstStrip + cabling_map.channelId - itr->first.firstChannel;
78  if (log.level() <= MSG::DEBUG) {
79  log << MSG::ALWAYS << " getOfflineId() -- Successfully converted " << cabling_map << endmsg;
80  }
81  return true;
82 }

◆ getOnlineId()

bool MuonNRPC_CablingMap::getOnlineId ( NrpcCablingData cabling_data,
MsgStream &  log 
) const

return the online id given the offline id

get the online id from the offline id

Assign the TDC / tdcSector / subDetector ID

Definition at line 85 of file MuonNRPC_CablingMap.cxx.

86  {
87  if (log.level()<= MSG::DEBUG) {
88  log<<MSG::ALWAYS<<__FILE__<<":"<<__LINE__<<" getOnlineId() - Test: "<<cabling_map<<endmsg;
89  }
90  const NrpcCablingOfflineID& offId{cabling_map};
91  OfflToOnlMap::const_iterator itr = m_offToOnline.find(offId);
92  if (itr == m_offToOnline.end()) {
93  log << MSG::ERROR <<__FILE__<<":"<<__LINE__<< " getOnlineId() -- The offline identifier "
94  << offId << " is unknown " << endmsg;
95  return false;
96  }
97  const NrpcCablOnDataByStripSet::const_iterator onlineCardItr = itr->second.find(cabling_map);
98  if (onlineCardItr != itr->second.end()) {
99  const NrpcCablOnDataByStrip& onlineCard = (*onlineCardItr);
101  static_cast<NrpcCablingOnlineID&>(cabling_map) = onlineCard;
102  cabling_map.channelId = (cabling_map.strip - onlineCard.firstStrip) + onlineCard.firstChannel;
103  if (log.level() <= MSG::DEBUG) {
104  log <<MSG::ALWAYS<<__FILE__<<":"<<__LINE__
105  <<" getOnlineId() -- Card "<<onlineCard<<" matches... Deduced channel "
106  <<static_cast<int>(cabling_map.channelId)<<endmsg;
107  }
108 
109  return true;
110  }
111  log << MSG::ERROR <<__FILE__<<":"<<__LINE__
112  << " getOnlineId() -- No tdc channel could be found for the object "
113  << static_cast<const NrpcCablingOfflineID&>(cabling_map)
114  << " strip: " << static_cast<int>(cabling_map.strip) << endmsg;
115  return false;
116 }

◆ getROBId() [1/2]

uint32_t MuonNRPC_CablingMap::getROBId ( const IdentifierHash stationCode,
MsgStream &  log 
) const

return the ROD id of a given chamber, given the hash id

Definition at line 194 of file MuonNRPC_CablingMap.cxx.

195  {
196  ChamberToROBMap::const_iterator it = m_chambROBs.find(stationCode);
197  if (it != m_chambROBs.end()) {
198  return it->second;
199  }
200  log << MSG::WARNING << "Station code " << stationCode << " not found !"
201  << endmsg;
202  return 0;
203 }

◆ getROBId() [2/2]

MuonNRPC_CablingMap::ListOfROB MuonNRPC_CablingMap::getROBId ( const std::vector< IdentifierHash > &  rpcHashVector,
MsgStream &  log 
) const

get the robs corresponding to a vector of hashIds, copied from Svc before the readCdo migration

Definition at line 205 of file MuonNRPC_CablingMap.cxx.

206  {
207  ListOfROB to_ret{};
208  to_ret.reserve(rpcHashVector.size());
209  for (const IdentifierHash& hash : rpcHashVector)
210  to_ret.push_back(getROBId(hash, log));
211  return to_ret;
212 }

◆ insertChannels()

bool MuonNRPC_CablingMap::insertChannels ( const NrpcCablingCoolData cabling_data,
MsgStream &  log 
)

Inserts a cabling object into the map.

Definition at line 118 of file MuonNRPC_CablingMap.cxx.

119  {
120  // Check that the channel is not overwritten
121  if (log.level() <= MSG::DEBUG) {
122  log << MSG::ALWAYS << "insertChannels() -- Insert new channel "
123  << cabling_data << endmsg;
124  }
126  log << MSG::ERROR
127  << "insertChannels() -- Failed to fill the offline -> online map "
128  << endmsg;
129  log << MSG::ERROR
130  << " --- Old: " << (*m_offToOnline[cabling_data].find(cabling_data))
131  << endmsg;
132  log << MSG::ERROR << " --- New: "
133  << static_cast<const NrpcCablingOnlineID&>(cabling_data) << endmsg;
134  return false;
135  }
136  if (!m_onToOffline[cabling_data]) {
138  } else {
139  log << MSG::ERROR
140  << "insertChannels() -- The online to offline map is already "
141  "booked for identifier "
142  << static_cast<const NrpcCablingOnlineID&>(cabling_data) << endmsg;
143  log << MSG::ERROR << " -- Old: " << m_onToOffline[cabling_data]
144  << endmsg;
145  log << MSG::ERROR << " -- New: "
146  << static_cast<const NrpcCablingOfflineID&>(cabling_data) << endmsg;
147  return false;
148  }
149 
150  int sub = cabling_data.subDetector;
151  int rod = cabling_data.tdcSector;
152 
153  uint32_t hardId = (sub << 16) | rod;
154 
155  const bool robInitialized = std::find(m_listOfROB.begin(), m_listOfROB.end(), hardId) != m_listOfROB.end();
156  if (!robInitialized) {
157  m_listOfROB.push_back(hardId);
158  }
159 
160  return true;
161 }

Member Data Documentation

◆ m_chambROBs

ChamberToROBMap MuonNRPC_CablingMap::m_chambROBs {}
private

Definition at line 73 of file MuonNRPC_CablingMap.h.

◆ m_listOfROB

ListOfROB MuonNRPC_CablingMap::m_listOfROB {}
private

full list of ROBs

Definition at line 80 of file MuonNRPC_CablingMap.h.

◆ m_offToOnline

OfflToOnlMap MuonNRPC_CablingMap::m_offToOnline {}
private

Map to cache the offline -> online conversions.

Definition at line 71 of file MuonNRPC_CablingMap.h.

◆ m_onToOffline

OnlToOfflMap MuonNRPC_CablingMap::m_onToOffline {}
private

Map to cache the online -> offline conversions.

Definition at line 69 of file MuonNRPC_CablingMap.h.

◆ m_ROBHashes

ROBToChamberMap MuonNRPC_CablingMap::m_ROBHashes {}
private

Definition at line 74 of file MuonNRPC_CablingMap.h.

◆ m_rpcIdHelper

const RpcIdHelper* MuonNRPC_CablingMap::m_rpcIdHelper {}
private

Pointer to the RpcIdHelper.

Definition at line 77 of file MuonNRPC_CablingMap.h.


The documentation for this class was generated from the following files:
NrpcTdcStripRange::firstStrip
uint8_t firstStrip
First strip covered by the Tdc chip.
Definition: NrpcCablingData.h:98
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
NrpcCablingOfflineID
Representation of the offline Identifier in a more tangible format.
Definition: NrpcCablingData.h:34
MuonIdHelper::is_rpc
bool is_rpc(const Identifier &id) const
Definition: MuonIdHelper.cxx:792
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
MuonNRPC_CablingMap::m_offToOnline
OfflToOnlMap m_offToOnline
Map to cache the offline -> online conversions.
Definition: MuonNRPC_CablingMap.h:71
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
calibdata.chamber
chamber
Definition: calibdata.py:32
RpcIdHelper::doubletZ
int doubletZ(const Identifier &id) const
Definition: RpcIdHelper.cxx:1062
MuonNRPC_CablingMap::m_chambROBs
ChamberToROBMap m_chambROBs
Definition: MuonNRPC_CablingMap.h:73
skel.it
it
Definition: skel.GENtoEVGEN.py:423
RpcIdHelper::measuresPhi
bool measuresPhi(const Identifier &id) const override
Definition: RpcIdHelper.cxx:1068
MuonNRPC_CablingMap::m_listOfROB
ListOfROB m_listOfROB
full list of ROBs
Definition: MuonNRPC_CablingMap.h:80
createCablingJSON.cabling_data
dictionary cabling_data
Definition: createCablingJSON.py:18
MuonIdHelper::stationName
int stationName(const Identifier &id) const
Definition: MuonIdHelper.cxx:804
RpcIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
Definition: RpcIdHelper.cxx:940
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
RpcIdHelper::gasGap
int gasGap(const Identifier &id) const override
get the hashes
Definition: RpcIdHelper.cxx:1066
calibdata.valid
list valid
Definition: calibdata.py:45
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
RpcIdHelper::doubletR
int doubletR(const Identifier &id) const
Definition: RpcIdHelper.cxx:1060
TrigConf::MSGTC::ALWAYS
@ ALWAYS
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:29
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
NrpcCablingData
Cabling information shipped around the Digi <-> Rdo conversions.
Definition: NrpcCablingData.h:121
MuonNRPC_CablingMap::getROBId
uint32_t getROBId(const IdentifierHash &stationCode, MsgStream &log) const
return the ROD id of a given chamber, given the hash id
Definition: MuonNRPC_CablingMap.cxx:194
RpcIdHelper::strip
int strip(const Identifier &id) const
Definition: RpcIdHelper.cxx:1070
python.xAODType.dummy
dummy
Definition: xAODType.py:4
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:814
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
NrpcTdcChannelRange::firstChannel
uint8_t firstChannel
First tdc channel.
Definition: NrpcCablingData.h:111
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:809
MuonNRPC_CablingMap::m_onToOffline
OnlToOfflMap m_onToOffline
Map to cache the online -> offline conversions.
Definition: MuonNRPC_CablingMap.h:69
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
MuonNRPC_CablingMap::m_ROBHashes
ROBToChamberMap m_ROBHashes
Definition: MuonNRPC_CablingMap.h:74
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
NrpcCablOnDataByStrip
Struct to build the offline -> online map.
Definition: NrpcCablingData.h:146
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569
MuonNRPC_CablingMap::ListOfROB
std::vector< uint32_t > ListOfROB
Definition: MuonNRPC_CablingMap.h:27
MuonNRPC_CablingMap::m_rpcIdHelper
const RpcIdHelper * m_rpcIdHelper
Pointer to the RpcIdHelper.
Definition: MuonNRPC_CablingMap.h:77
NrpcCablingOnlineID
Struct summarizing all the Identifier fields to uniquely Identify a Nrpc TDC chip.
Definition: NrpcCablingData.h:74
IdentifierHash
Definition: IdentifierHash.h:38
MuonNRPC_CablingMap::convert
bool convert(const NrpcCablingData &cabling_data, Identifier &id, bool check_valid=true) const
converts the cabling data into an identifier.
Definition: MuonNRPC_CablingMap.cxx:31
NrpcCablingData::strip
uint8_t strip
Definition: NrpcCablingData.h:123
RpcIdHelper::doubletPhi
int doubletPhi(const Identifier &id) const
Definition: RpcIdHelper.cxx:1064
RpcIdHelper::get_module_hash
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: RpcIdHelper.cxx:288