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