ATLAS Offline Software
L1CaloRxCoolChannelId.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <sstream>
8 #include <iostream>
9 
17 //==============================================================================
18 // constructor
19 //==============================================================================
24  : m_id(0),
25  m_bOutputIsSet(false),
26  m_outputConn(0),
27  m_outputPair(0)
28 {
29 }
30 
31 //==============================================================================
32 // constructor
33 //==============================================================================
38  unsigned int module,
39  unsigned int inputConn,
40  unsigned int inputPair)
41  : m_id(0),
42  m_bOutputIsSet(false),
43  m_outputConn(0),
44  m_outputPair(0)
45 {
46  this->setId(crate, module, inputConn, inputPair);
47 }
48 
49 L1CaloRxCoolChannelId::L1CaloRxCoolChannelId(unsigned int crate, unsigned int module, unsigned int inputConn, unsigned int inputPair, unsigned int outputConn, unsigned int outputPair): m_id(0),
50  m_bOutputIsSet(false),
51  m_outputConn(0),
52  m_outputPair(0)
53 {
54  this->setId(crate, module, inputConn, inputPair);
55  this->outputAttributes(outputConn, outputPair);
56 }
57 
58 //==============================================================================
59 // constructor
60 //==============================================================================
65  : m_id(id),
66  m_bOutputIsSet(false),
67  m_outputConn(0),
68  m_outputPair(0)
69 {
70 }
71 
72 //==============================================================================
73 // copy constructor
74 //==============================================================================
79  : m_id(id.m_id),
80  m_bOutputIsSet(id.m_bOutputIsSet),
81  m_outputConn(id.m_outputConn),
82  m_outputPair(id.m_outputPair)
83 {
84 }
85 
86 //==============================================================================
87 // setId
88 //==============================================================================
92 void
93 L1CaloRxCoolChannelId::setId(unsigned int crate,
94  unsigned int module,
95  unsigned int inputConn,
96  unsigned int inputPair)
97 {
98 
99  m_id = inputPair + inputConn*16 + module * 64 + crate*1024;
100 }
101 
102 
104  return m_id<id.m_id;
105 }
106 
108  return m_id==id.m_id;
109 }
110 
111 
112 void L1CaloRxCoolChannelId::outputAttributes(unsigned int conn, unsigned int pair) {
113  if(m_bOutputIsSet) {
114  std::cout<<"Output attributes are already set for this channel: "<<this->id()<<". They cannot be modified"<<std::endl;
115  return;
116  }
117  m_outputConn = conn;
118  m_outputPair = pair;
119  m_bOutputIsSet = true;
120 }
121 
122 unsigned int L1CaloRxCoolChannelId::outputConn() const {
123  if(!m_bOutputIsSet) {
124  std::cout<<"outputConn has not been set for channel "<< this->id() <<". You should not call this method."<<std::endl;
125  }
126  return m_outputConn;
127 }
128 
129 unsigned int L1CaloRxCoolChannelId::outputPair() const {
130  if(!m_bOutputIsSet) {
131  std::cout<<"outputPair has not been set for channel "<< this->id() <<". You should not call this method."<<std::endl;
132  }
133  return m_outputPair;
134 }
135 
136 std::ostream& operator<<(std::ostream& output, const L1CaloRxCoolChannelId& r) {
137  output << "rxChannelId: 0x" << std::hex <<r.id() << std::dec <<", crate: "<<r.crate()<<", module: "<<r.module()<<", inputConn: "<<r.inputConn()<<", inputPair: "<<r.inputPair()<<" ( outputConn: "<< r.outputConn()<<", outputPair: "<<r.outputPair()<<")";
138  return output;
139 }
operator<<
std::ostream & operator<<(std::ostream &output, const L1CaloRxCoolChannelId &r)
Definition: L1CaloRxCoolChannelId.cxx:136
beamspotman.r
def r
Definition: beamspotman.py:676
L1CaloRxCoolChannelId::outputPair
unsigned int outputPair() const
Definition: L1CaloRxCoolChannelId.cxx:129
L1CaloRxCoolChannelId.h
checkCorrelInHIST.conn
conn
Definition: checkCorrelInHIST.py:25
L1CaloRxCoolChannelId::m_id
unsigned int m_id
Definition: L1CaloRxCoolChannelId.h:45
L1CaloRxCoolChannelId::id
unsigned int id() const
Definition: L1CaloRxCoolChannelId.h:27
L1CaloRxCoolChannelId::m_outputPair
unsigned int m_outputPair
Definition: L1CaloRxCoolChannelId.h:49
L1CaloRxCoolChannelId::setId
void setId(unsigned int crate, unsigned int module, unsigned int inputConn, unsigned int inputPair)
Set the CoolChannelId value from its component fields.
Definition: L1CaloRxCoolChannelId.cxx:93
L1CaloRxCoolChannelId::inputConn
unsigned int inputConn() const
Definition: L1CaloRxCoolChannelId.h:24
L1CaloRxCoolChannelId::outputConn
unsigned int outputConn() const
Definition: L1CaloRxCoolChannelId.cxx:122
python.PyAthena.module
module
Definition: PyAthena.py:134
L1CaloRxCoolChannelId::inputPair
unsigned int inputPair() const
Definition: L1CaloRxCoolChannelId.h:25
L1CaloRxCoolChannelId
Definition: L1CaloRxCoolChannelId.h:10
L1CaloRxCoolChannelId::operator==
bool operator==(const L1CaloRxCoolChannelId &id) const
Definition: L1CaloRxCoolChannelId.cxx:107
L1CaloRxCoolChannelId::outputAttributes
void outputAttributes(unsigned int conn, unsigned int pair)
Definition: L1CaloRxCoolChannelId.cxx:112
L1CaloRxCoolChannelId::crate
unsigned int crate() const
Definition: L1CaloRxCoolChannelId.h:22
merge.output
output
Definition: merge.py:17
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
L1CaloRxCoolChannelId::operator<
bool operator<(const L1CaloRxCoolChannelId &id) const
Definition: L1CaloRxCoolChannelId.cxx:103
L1CaloRxCoolChannelId::module
unsigned int module() const
Definition: L1CaloRxCoolChannelId.h:23
L1CaloRxCoolChannelId::m_bOutputIsSet
bool m_bOutputIsSet
Definition: L1CaloRxCoolChannelId.h:47
L1CaloRxCoolChannelId::L1CaloRxCoolChannelId
L1CaloRxCoolChannelId()
Create a L1CaloRxCoolChannelId from the integer ID field.
Definition: L1CaloRxCoolChannelId.cxx:23
L1CaloRxCoolChannelId::m_outputConn
unsigned int m_outputConn
Definition: L1CaloRxCoolChannelId.h:48