CMS 3D CMS Logo

CSCCFEBStatusDigi.cc
Go to the documentation of this file.
1 
8 #include <iostream>
9 #include <cstdint>
10 
12 int CSCCFEBStatusDigi::ShiftSel(int nmb, int nshift, int nsel) const { return (nmb >> nshift) & nsel; }
14 std::vector<uint16_t> CSCCFEBStatusDigi::getSCAFullCond() const {
15  /* std::vector<int> vec(4,0);
16  vec[0]=ShiftSel(SCAFullCond_,0,15); // 4-bit FIFO1 word count
17  vec[1]=ShiftSel(SCAFullCond_,4,15); // 4-bit Block Number if Error Code=1
18  // (CFEB: SCA Capacitors Full)
19  // 4-bit FIFO3 word count if Error Code=2
20  // (CFEB: FPGA FIFO full)
21  vec[2]=ShiftSel(SCAFullCond_,9,7); // Error Code
22  vec[3]=ShiftSel(SCAFullCond_,12,15); // DDU Code, should be 0xB
23  return vec;*/
24  return bWords_;
25 }
27 std::vector<int> CSCCFEBStatusDigi::getTS_FLAG() const {
28  std::vector<int> vec(contrWords_.size(), 0);
29  int nmb;
30  for (unsigned int i = 0; i < vec.size(); i++) {
31  nmb = contrWords_[i];
32  vec[i] = ShiftSel(nmb, 15, 1);
33  }
34  return vec;
35 }
36 
38 std::vector<int> CSCCFEBStatusDigi::getSCA_FULL() const {
39  std::vector<int> vec(contrWords_.size(), 0);
40  int nmb;
41  for (unsigned int i = 0; i < vec.size(); i++) {
42  nmb = contrWords_[i];
43  vec[i] = ShiftSel(nmb, 14, 1);
44  }
45  return vec;
46 }
47 
49 std::vector<int> CSCCFEBStatusDigi::getLCT_PHASE() const {
50  std::vector<int> vec(contrWords_.size(), 0);
51  int nmb;
52  for (unsigned int i = 0; i < vec.size(); i++) {
53  nmb = contrWords_[i];
54  vec[i] = ShiftSel(nmb, 13, 1);
55  }
56  return vec;
57 }
58 
60 std::vector<int> CSCCFEBStatusDigi::getL1A_PHASE() const {
61  std::vector<int> vec(contrWords_.size(), 0);
62  int nmb;
63  for (unsigned int i = 0; i < vec.size(); i++) {
64  nmb = contrWords_[i];
65  vec[i] = ShiftSel(nmb, 12, 1);
66  }
67  return vec;
68 }
69 
71 std::vector<int> CSCCFEBStatusDigi::getSCA_BLK() const {
72  std::vector<int> vec(contrWords_.size(), 0);
73  int nmb;
74  for (unsigned int i = 0; i < vec.size(); i++) {
75  nmb = contrWords_[i];
76  vec[i] = ShiftSel(nmb, 8, 15);
77  }
78  return vec;
79 }
80 
82 std::vector<int> CSCCFEBStatusDigi::getTRIG_TIME() const {
83  std::vector<int> vec(contrWords_.size(), 0);
84  int nmb;
85  for (unsigned int i = 0; i < vec.size(); i++) {
86  nmb = contrWords_[i];
87  vec[i] = ShiftSel(nmb, 0, 255);
88  }
89  return vec;
90 }
91 
94  edm::LogVerbatim("CSCDigi") << "CSC CFEB # : " << getCFEBNmb();
95 
96  std::ostringstream ost;
97  ost << " SCAFullCond: ";
98  if (!getSCAFullCond().empty()) {
99  for (size_t i = 0; i < 4; ++i) {
100  ost << " " << (getSCAFullCond())[i];
101  }
102  } else {
103  ost << " "
104  << "BWORD is not valid";
105  }
106  edm::LogVerbatim("CSCDigi") << ost.str();
107 
108  ost.clear();
109  ost << " CRC: ";
110  for (size_t i = 0; i < getCRC().size(); ++i) {
111  ost << " " << (getCRC())[i];
112  }
113  edm::LogVerbatim("CSCDigi") << ost.str();
114 
115  ost.clear();
116  ost << " TS_FLAG: ";
117  for (size_t i = 0; i < getTS_FLAG().size(); ++i) {
118  ost << " " << (getTS_FLAG())[i];
119  }
120  edm::LogVerbatim("CSCDigi") << ost.str();
121 
122  ost.clear();
123  ost << " SCA_FULL: ";
124  for (size_t i = 0; i < getSCA_FULL().size(); ++i) {
125  ost << " " << (getSCA_FULL())[i];
126  }
127  edm::LogVerbatim("CSCDigi") << ost.str();
128 
129  ost.clear();
130  ost << " LCT_PHASE: ";
131  for (size_t i = 0; i < getLCT_PHASE().size(); ++i) {
132  ost << " " << (getLCT_PHASE())[i];
133  }
134  edm::LogVerbatim("CSCDigi") << ost.str();
135 
136  ost.clear();
137  ost << " L1A_PHASE: ";
138  for (size_t i = 0; i < getL1A_PHASE().size(); ++i) {
139  ost << " " << (getL1A_PHASE())[i];
140  }
141  edm::LogVerbatim("CSCDigi") << ost.str();
142 
143  ost.clear();
144  ost << " SCA_BLK: ";
145  for (size_t i = 0; i < getSCA_BLK().size(); ++i) {
146  ost << " " << (getSCA_BLK())[i];
147  }
148  edm::LogVerbatim("CSCDigi") << ost.str();
149 
150  ost.clear();
151  ost << " TRIG_TIME: ";
152  for (size_t i = 0; i < getTRIG_TIME().size(); ++i) {
153  ost << " " << (getTRIG_TIME())[i];
154  }
155  edm::LogVerbatim("CSCDigi") << ost.str();
156 }
157 
158 std::ostream& operator<<(std::ostream& o, const CSCCFEBStatusDigi& digi) {
159  o << " " << digi.getCFEBNmb() << "\n";
160  for (size_t i = 0; i < 4; ++i) {
161  o << " " << (digi.getSCAFullCond())[i];
162  }
163  o << "\n";
164  for (size_t i = 0; i < digi.getCRC().size(); ++i) {
165  o << " " << (digi.getCRC())[i];
166  }
167  o << "\n";
168  for (size_t i = 0; i < digi.getTS_FLAG().size(); ++i) {
169  o << " " << (digi.getTS_FLAG())[i];
170  }
171  o << "\n";
172  for (size_t i = 0; i < digi.getSCA_FULL().size(); ++i) {
173  o << " " << (digi.getSCA_FULL())[i];
174  }
175  o << "\n";
176  for (size_t i = 0; i < digi.getLCT_PHASE().size(); ++i) {
177  o << " " << (digi.getLCT_PHASE())[i];
178  }
179  o << "\n";
180  for (size_t i = 0; i < digi.getL1A_PHASE().size(); ++i) {
181  o << " " << (digi.getL1A_PHASE())[i];
182  }
183  o << "\n";
184  for (size_t i = 0; i < digi.getSCA_BLK().size(); ++i) {
185  o << " " << (digi.getSCA_BLK())[i];
186  }
187  o << "\n";
188  for (size_t i = 0; i < digi.getTRIG_TIME().size(); ++i) {
189  o << " " << (digi.getTRIG_TIME())[i];
190  }
191  o << "\n";
192 
193  return o;
194 }
Log< level::Info, true > LogVerbatim
std::vector< int > getSCA_FULL() const
Get SCA_FULL bit from SCA Controller data per each time slice.
std::vector< uint16_t > getCRC() const
Get CRC per each time sample.
int ShiftSel(int nmb, int nshift, int nsel) const
Shift and select.
std::vector< int > getLCT_PHASE() const
Get LCT_PHASE bit from SCA Controller data per each time slice.
std::vector< int > getTS_FLAG() const
Get TS_FLAG bit from SCA Controller data per each time slice.
std::ostream & operator<<(std::ostream &o, const CSCCFEBStatusDigi &digi)
void print() const
Print content of digi.
std::vector< int > getL1A_PHASE() const
Get L1A_PHASE bit from SCA Controller data per each time slice.
std::vector< int > getSCA_BLK() const
Get SCA_BLK 4 bit word from SCA Controller data per each time slice.
std::vector< int > getTRIG_TIME() const
Get TRIG_TIME 8 bit word from SCA Controller data per each time slice.
std::vector< uint16_t > contrWords_
std::vector< uint16_t > bWords_
std::vector< uint16_t > getSCAFullCond() const
Get SCA Full Condition.
int getCFEBNmb() const
Get the CFEB number.