CMS 3D CMS Logo

PixelHdwAddress.cc
Go to the documentation of this file.
1 //
2 //
3 //
4 //
5 //
6 
8 #include <string>
9 #include <cassert>
10 #include <ostream>
11 #include <iostream>
12 
13 using namespace pos;
14 
15 //====================================================================================
17  : mfec_(0),
18  mfecchannel_(0),
19  portaddress_(0),
20  hubaddress_(0),
21  rocid_(0),
22  fednumber_(0),
23  fedchannel_(0),
24  fedrocnumber_(0) {}
25 
26 //====================================================================================
28  int mfec,
29  int mfecchannel,
30  int hubaddress,
31  int portaddress,
32  int rocid,
33  int fednumber,
34  int fedchannel,
35  int fedrocnumber)
36  : fecnumber_(fecnumber),
37  mfec_(mfec),
38  mfecchannel_(mfecchannel),
39  portaddress_(portaddress),
40  hubaddress_(hubaddress),
41  rocid_(rocid),
42  fednumber_(fednumber),
43  fedchannel_(fedchannel),
44  fedrocnumber_(fedrocnumber) {
45  //std::cout << "Created PixelHdwAddress:"<<std::endl;
46  //std::cout << *this << std::endl;
47 }
48 
49 //====================================================================================
50 std::ostream& pos::operator<<(std::ostream& s, const PixelHdwAddress& pixelroc) {
51  s << "[PixelHdwAddress::operator<<]" << std::endl;
52  s << "fecnumber :" << pixelroc.fecnumber_ << std::endl;
53  s << "mfec :" << pixelroc.mfec_ << std::endl;
54  s << "mfecchannel :" << pixelroc.mfecchannel_ << std::endl;
55  s << "portaddress :" << pixelroc.portaddress_ << std::endl;
56  s << "hubaddress :" << pixelroc.hubaddress_ << std::endl;
57  s << "rocid :" << pixelroc.rocid_ << std::endl;
58  s << "fednumber :" << pixelroc.fednumber_ << std::endl;
59  s << "fedchannel :" << pixelroc.fedchannel_ << std::endl;
60  s << "fedrocnumber:" << pixelroc.fedrocnumber_ << std::endl;
61 
62  return s;
63 }
64 
65 //====================================================================================
67  fecnumber_ = aROC.fecnumber_;
68  mfec_ = aROC.mfec_;
71  hubaddress_ = aROC.hubaddress_;
72  rocid_ = aROC.rocid_;
73  fednumber_ = aROC.fednumber_;
74  fedchannel_ = aROC.fedchannel_;
76 
77  return *this;
78 }
79 
80 //====================================================================================
81 // Added by Dario
83  std::string mthn = "[PixelHdwAddress::setAddress()]\t\t\t ";
84  if (what == "fecnumber") {
85  fecnumber_ = value;
86  } else if (what == "mfec") {
87  mfec_ = value;
88  } else if (what == "mfecchannel") {
90  } else if (what == "portaddress") {
92  } else if (what == "hubaddress") {
94  } else if (what == "rocid") {
95  rocid_ = value;
96  } else if (what == "fednumber") {
97  fednumber_ = value;
98  } else if (what == "fedchannel") {
100  } else if (what == "fedrocnumber") {
102  } else {
103  std::cout << __LINE__ << "]\t" << mthn << "Could not set a value for " << what << " (invalid keyword)" << std::endl;
104  assert(0);
105  }
106 }
107 
108 //====================================================================================
109 void PixelHdwAddress::compare(std::string what, bool& changed, unsigned int newValue, unsigned int& oldValue) {
110  std::string mthn = "[PixelHdwAddress::compare()]\t\t\t ";
111  changed = false;
112  oldValue = 0;
113 
114  if (what == "fecnumber") {
115  if (fecnumber_ != newValue) {
116  changed = true;
117  oldValue = fecnumber_;
118  return;
119  }
120  } else if (what == "mfec") {
121  if (mfec_ != newValue) {
122  changed = true;
123  oldValue = mfec_;
124  return;
125  }
126  } else if (what == "mfecchannel") {
127  if (mfecchannel_ != newValue) {
128  changed = true;
129  oldValue = mfecchannel_;
130  return;
131  }
132  } else if (what == "portaddress") {
133  if (portaddress_ != newValue) {
134  changed = true;
135  oldValue = portaddress_;
136  return;
137  }
138  } else if (what == "hubaddress") {
139  if (hubaddress_ != newValue) {
140  changed = true;
141  oldValue = hubaddress_;
142  return;
143  }
144  } else if (what == "rocid") {
145  if (rocid_ != newValue) {
146  changed = true;
147  oldValue = rocid_;
148  return;
149  }
150  } else if (what == "fednumber") {
151  if (fednumber_ != newValue) {
152  changed = true;
153  oldValue = fednumber_;
154  return;
155  }
156  } else if (what == "fedchannel") {
157  if (fedchannel_ != newValue) {
158  changed = true;
159  oldValue = fedchannel_;
160  return;
161  }
162  } else if (what == "fedrocnumber") {
163  if (fedrocnumber_ != newValue) {
164  changed = true;
165  oldValue = fedrocnumber_;
166  return;
167  }
168  } else {
169  std::cout << __LINE__ << "]\t" << mthn << "Could not compare value for " << what << " (invalid keyword)"
170  << std::endl;
171  assert(0);
172  }
173 }
174 
175 //====================================================================================
176 bool PixelHdwAddress::operator()(const PixelHdwAddress& roc1, const PixelHdwAddress& roc2) const {
177  if (roc1.fednumber_ < roc2.fednumber_)
178  return true;
179  if (roc1.fednumber_ > roc2.fednumber_)
180  return false;
181  if (roc1.fedchannel_ < roc2.fedchannel_)
182  return true;
183  if (roc1.fedchannel_ > roc2.fedchannel_)
184  return false;
185 
186  return (roc1.fedrocnumber_ < roc2.fedrocnumber_);
187 }
pos::PixelHdwAddress::compare
void compare(std::string what, bool &changed, unsigned int newValue, unsigned int &oldValue)
Definition: PixelHdwAddress.cc:109
pos::PixelHdwAddress::mfec_
unsigned int mfec_
Definition: PixelHdwAddress.h:77
pos::PixelHdwAddress::fedchannel_
unsigned int fedchannel_
Definition: PixelHdwAddress.h:83
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
cms::cuda::assert
assert(be >=bs)
PixelHdwAddress.h
Store mfec, mfecchannel etc.
alignCSCRings.s
s
Definition: alignCSCRings.py:92
pos::PixelHdwAddress::fedrocnumber_
unsigned int fedrocnumber_
Definition: PixelHdwAddress.h:84
pos::PixelHdwAddress::PixelHdwAddress
PixelHdwAddress()
Definition: PixelHdwAddress.cc:16
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pos::PixelHdwAddress::fecnumber_
unsigned int fecnumber_
Definition: PixelHdwAddress.h:76
pos::PixelHdwAddress::rocid_
unsigned int rocid_
Definition: PixelHdwAddress.h:81
pos::operator<<
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
Definition: PixelCalibConfiguration.cc:1325
value
Definition: value.py:1
pos::PixelHdwAddress
Store mfec, mfecchannel etc.
Definition: PixelHdwAddress.h:23
pos::PixelHdwAddress::fednumber_
unsigned int fednumber_
Definition: PixelHdwAddress.h:82
pos::PixelHdwAddress::operator=
const PixelHdwAddress & operator=(const PixelHdwAddress &aROC)
Definition: PixelHdwAddress.cc:66
pos::PixelHdwAddress::portaddress_
unsigned int portaddress_
Definition: PixelHdwAddress.h:79
pos::PixelHdwAddress::hubaddress_
unsigned int hubaddress_
Definition: PixelHdwAddress.h:80
pos::PixelHdwAddress::setAddress
void setAddress(std::string what, int value)
Definition: PixelHdwAddress.cc:82
relativeConstraints.value
value
Definition: relativeConstraints.py:53
pos::PixelHdwAddress::mfecchannel_
unsigned int mfecchannel_
Definition: PixelHdwAddress.h:78
pos::PixelHdwAddress::operator()
bool operator()(const PixelHdwAddress &roc1, const PixelHdwAddress &roc2) const
Definition: PixelHdwAddress.cc:176