ATLAS Offline Software
ModuleID.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <iostream>
6 #include "L1TopoRDO/ModuleID.h"
7 #include "L1TopoRDO/Helpers.h"
8 
9 namespace L1Topo {
10 
11  ModuleID::ModuleID(unsigned int link, unsigned int module, unsigned int roiDaq)
12  :m_link(link), m_module(module), m_roiDaq(roiDaq), m_id(0) {
13  this->encode();
14  }
15 
17  :m_link(0), m_module(0), m_roiDaq(0), m_id(id) {
18  this->decode();
19  }
20 
22  return m_roiDaq;
23  }
24 
25  bool ModuleID::isDAQ() const {
26  return m_roiDaq==0;
27  }
28 
29  bool ModuleID::isROI() const {
30  return m_roiDaq==1;
31  }
32 
34  return m_module;
35  }
36 
38  return m_link;
39  }
40 
42  return m_id;
43  }
44 
46  m_id = (m_roiDaq & 0x1) << 7;
47  m_id |= (m_module & 0x7) << 4;
48  m_id |= (m_link & 0xf);
49  }
50 
52  m_roiDaq = (m_id >> 7) & 0x1;
53  m_module = (m_id >> 4) & 0x7;
54  m_link = m_id & 0xf;
55  }
56 
57  std::ostream& operator<<(std::ostream& os, const ModuleID& m) {
58  os << "ModuleID: " << " " << formatHex4(m.id()) << " 0b" << std::bitset<8>(m.id()) << " link " << m.link() << " " << " module " << m.module();
59  if (m.isDAQ()){
60  os << " DAQ";
61  }
62  else if (m.isROI()){
63  os << " ROI";
64  }
65  return os;
66  }
67 
68 } // namespace L1Topo
69 
L1Topo::ModuleID::module
uint16_t module() const
access method
Definition: ModuleID.cxx:33
L1Topo::ModuleID::isDAQ
bool isDAQ() const
True if this is a DAQ module.
Definition: ModuleID.cxx:25
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
L1Topo::operator<<
std::ostream & operator<<(std::ostream &, const Error)
Helper to print errors as text rather than numbers.
Definition: Error.cxx:8
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
L1Topo::ModuleID::decode
void decode()
method used by constructor to decode word
Definition: ModuleID.cxx:51
ModuleID.h
L1Topo::ModuleID::isROI
bool isROI() const
True if this is a ROI module.
Definition: ModuleID.cxx:29
L1Topo::ModuleID::m_roiDaq
uint16_t m_roiDaq
Definition: ModuleID.h:54
python.PyAthena.module
module
Definition: PyAthena.py:131
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
L1Topo::ModuleID::link
uint16_t link() const
access method
Definition: ModuleID.cxx:37
L1Topo::ModuleID::ModuleID
ModuleID(unsigned int link, unsigned int module, unsigned int roiDaq)
Construct from constituent parts and encode word.
Definition: ModuleID.cxx:11
L1Topo::formatHex4
std::string formatHex4(uint32_t word)
Helper function to format a 32-bit integer as a 4-digit hex number for printing.
Definition: Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx:117
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
L1Topo::ModuleID::m_link
uint16_t m_link
Definition: ModuleID.h:52
L1Topo::ModuleID
Represents the L1Topo module ID, with decoder and encoder.
Definition: ModuleID.h:28
L1Topo::ModuleID::roiDaq
uint16_t roiDaq() const
access method
Definition: ModuleID.cxx:21
L1Topo::ModuleID::m_module
uint16_t m_module
Definition: ModuleID.h:53
L1Topo::ModuleID::m_id
uint16_t m_id
Definition: ModuleID.h:55
L1Topo
Definition: BlockTypes.h:11
L1Topo::ModuleID::id
uint16_t id() const
access method
Definition: ModuleID.cxx:41
Helpers.h
L1Topo::ModuleID::encode
void encode()
method used by constructor to encode word
Definition: ModuleID.cxx:45