ATLAS Offline Software
ITkPixelCablingData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 #include <iostream>
13 
14 
15 bool
17  return m_offline2OnlineMap.empty();
18 }
19 
20 std::size_t
22  return m_offline2OnlineMap.size();
23 }
24 
27  const ITkPixelOnlineId invalidId;
28  const auto result = m_offline2OnlineMap.find(id);
29  if (result == m_offline2OnlineMap.end()) return invalidId;
30  return result->second;
31 }
32 
33 //stream extraction to read value from stream into ITkPixelCablingData
34 std::istream&
35 operator>>(std::istream & is, ITkPixelCablingData & cabling){
36  unsigned int onlineInt{}, offlineInt{};
37  //very primitive, should refine with regex and value range checking
38  while(is>>offlineInt>>onlineInt){
39  const Identifier offlineId(offlineInt);
40  const ITkPixelOnlineId onlineId(onlineInt);
41  cabling.m_offline2OnlineMap[offlineId] = onlineId;
42  }
43  return is;
44 }
45 
46 //stream insertion to output cabling map values
47 std::ostream&
48 operator<<(std::ostream & os, const ITkPixelCablingData & cabling){
49  for (const auto & [offlineId, onlineId]:cabling.m_offline2OnlineMap){
50  os<<offlineId<<", "<<onlineId<<"\n";
51  }
52  os<<std::endl;
53  return os;
54 }
operator<<
std::ostream & operator<<(std::ostream &os, const ITkPixelCablingData &cabling)
Definition: ITkPixelCablingData.cxx:48
get_generator_info.result
result
Definition: get_generator_info.py:21
ITkPixelCablingData.h
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
ITkPixelCablingData::m_offline2OnlineMap
std::unordered_map< Identifier, ITkPixelOnlineId > m_offline2OnlineMap
Definition: ITkPixelCablingData.h:34
ITkPixelCablingData::size
std::size_t size() const
Definition: ITkPixelCablingData.cxx:21
ITkPixelCablingData::empty
bool empty() const
Definition: ITkPixelCablingData.cxx:16
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
operator>>
std::istream & operator>>(std::istream &is, ITkPixelCablingData &cabling)
Definition: ITkPixelCablingData.cxx:35
ITkPixelCablingData
Definition: ITkPixelCablingData.h:23
ITkPixelCablingData::onlineId
ITkPixelOnlineId onlineId(const Identifier &id) const
Definition: ITkPixelCablingData.cxx:26
ITkPixelOnlineId
Definition: ITkPixelOnlineId.h:16
Identifier
Definition: IdentifierFieldParser.cxx:14