CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCCFEBStatusDigi.cc
Go to the documentation of this file.
1 
7 
8 #include <iostream>
9 #include <stdint.h>
10 
12 int CSCCFEBStatusDigi::ShiftSel(int nmb,int nshift,int nsel) const {
13  int tmp=nmb;
14  tmp=tmp>>nshift;
15  return tmp= tmp & nsel;
16 }
18 std::vector<uint16_t> CSCCFEBStatusDigi::getSCAFullCond() const {
19  /* std::vector<int> vec(4,0);
20  vec[0]=ShiftSel(SCAFullCond_,0,15); // 4-bit FIFO1 word count
21  vec[1]=ShiftSel(SCAFullCond_,4,15); // 4-bit Block Number if Error Code=1
22  // (CFEB: SCA Capacitors Full)
23  // 4-bit FIFO3 word count if Error Code=2
24  // (CFEB: FPGA FIFO full)
25  vec[2]=ShiftSel(SCAFullCond_,9,7); // Error Code
26  vec[3]=ShiftSel(SCAFullCond_,12,15); // DDU Code, should be 0xB
27  return vec;*/
28  return bWords_;
29 }
31 std::vector<int> CSCCFEBStatusDigi::getTS_FLAG() const {
32  std::vector<int> vec(contrWords_.size(),0);
33  int nmb;
34  for(unsigned int i=0;i<vec.size();i++) {
35  nmb=contrWords_[i];
36  vec[i]=ShiftSel(nmb,15,1);
37  }
38  return vec;
39 }
40 
42 std::vector<int> CSCCFEBStatusDigi::getSCA_FULL() const {
43  std::vector<int> vec(contrWords_.size(),0);
44  int nmb;
45  for(unsigned int i=0;i<vec.size();i++) {
46  nmb=contrWords_[i];
47  vec[i]=ShiftSel(nmb,14,1);
48  }
49  return vec;
50 }
51 
53 std::vector<int> CSCCFEBStatusDigi::getLCT_PHASE() const {
54  std::vector<int> vec(contrWords_.size(),0);
55  int nmb;
56  for(unsigned int i=0;i<vec.size();i++) {
57  nmb=contrWords_[i];
58  vec[i]=ShiftSel(nmb,13,1);
59  }
60  return vec;
61 }
62 
64 std::vector<int> CSCCFEBStatusDigi::getL1A_PHASE() const {
65  std::vector<int> vec(contrWords_.size(),0);
66  int nmb;
67  for(unsigned int i=0;i<vec.size();i++) {
68  nmb=contrWords_[i];
69  vec[i]=ShiftSel(nmb,12,1);
70  }
71  return vec;
72 }
73 
75 std::vector<int> CSCCFEBStatusDigi::getSCA_BLK() const {
76  std::vector<int> vec(contrWords_.size(),0);
77  int nmb;
78  for(unsigned int i=0;i<vec.size();i++) {
79  nmb=contrWords_[i];
80  vec[i]=ShiftSel(nmb,8,15);
81  }
82  return vec;
83 }
84 
86 std::vector<int> CSCCFEBStatusDigi::getTRIG_TIME() const {
87  std::vector<int> vec(contrWords_.size(),0);
88  int nmb;
89  for(unsigned int i=0;i<vec.size();i++) {
90  nmb=contrWords_[i];
91  vec[i]=ShiftSel(nmb,0,255);
92  }
93  return vec;
94 }
95 
98  std::cout << "CSC CFEB # : " << getCFEBNmb() <<"\n";
99  std::cout << " SCAFullCond: ";
100  if(getSCAFullCond().size()!=0){
101  for (size_t i = 0; i<4; ++i ){
102  std::cout <<" " <<(getSCAFullCond())[i]; }
103  }
104  else {
105  std::cout << " " <<"BWORD is not valied";
106  }
107  std::cout << "\n";
108  std::cout << " CRC: ";
109  for (size_t i = 0; i<getCRC().size(); ++i ){
110  std::cout <<" " <<(getCRC())[i]; }
111  std::cout<<"\n";
112  std::cout << " TS_FLAG: ";
113  for (size_t i = 0; i<getTS_FLAG().size(); ++i ){
114  std::cout <<" " <<(getTS_FLAG())[i]; }
115  std::cout<<"\n";
116  std::cout << " SCA_FULL: ";
117  for (size_t i = 0; i<getSCA_FULL().size(); ++i ){
118  std::cout <<" " <<(getSCA_FULL())[i]; }
119  std::cout<<"\n";
120  std::cout << " LCT_PHASE: ";
121  for (size_t i = 0; i<getLCT_PHASE().size(); ++i ){
122  std::cout <<" " <<(getLCT_PHASE())[i]; }
123  std::cout<<"\n";
124  std::cout << " L1A_PHASE: ";
125  for (size_t i = 0; i<getL1A_PHASE().size(); ++i ){
126  std::cout <<" " <<(getL1A_PHASE())[i]; }
127  std::cout<<"\n";
128  std::cout << " SCA_BLK: ";
129  for (size_t i = 0; i<getSCA_BLK().size(); ++i ){
130  std::cout <<" " <<(getSCA_BLK())[i]; }
131  std::cout<<"\n";
132  std::cout << " TRIG_TIME: ";
133  for (size_t i = 0; i<getTRIG_TIME().size(); ++i ){
134  std::cout <<" " <<(getTRIG_TIME())[i]; }
135  std::cout<<"\n";
136 }
137 
138 std::ostream & operator<<(std::ostream & o, const CSCCFEBStatusDigi& digi) {
139  o << " " << digi.getCFEBNmb()<<"\n";
140  for (size_t i = 0; i<4; ++i ){
141  o <<" " <<(digi.getSCAFullCond())[i]; }
142  o <<"\n";
143  for (size_t i = 0; i<digi.getCRC().size(); ++i ){
144  o <<" " <<(digi.getCRC())[i]; }
145  o<<"\n";
146  for (size_t i = 0; i<digi.getTS_FLAG().size(); ++i ){
147  o <<" " <<(digi.getTS_FLAG())[i]; }
148  o<<"\n";
149  for (size_t i = 0; i<digi.getSCA_FULL().size(); ++i ){
150  o <<" " <<(digi.getSCA_FULL())[i]; }
151  o<<"\n";
152  for (size_t i = 0; i<digi.getLCT_PHASE().size(); ++i ){
153  o <<" " <<(digi.getLCT_PHASE())[i]; }
154  o<<"\n";
155  for (size_t i = 0; i<digi.getL1A_PHASE().size(); ++i ){
156  o <<" " <<(digi.getL1A_PHASE())[i]; }
157  o<<"\n";
158  for (size_t i = 0; i<digi.getSCA_BLK().size(); ++i ){
159  o <<" " <<(digi.getSCA_BLK())[i]; }
160  o<<"\n";
161  for (size_t i = 0; i<digi.getTRIG_TIME().size(); ++i ){
162  o <<" " <<(digi.getTRIG_TIME())[i]; }
163  o<<"\n";
164 
165  return o;
166 }
167 
int i
Definition: DBlmapReader.cc:9
std::vector< int > getTS_FLAG() const
Get TS_FLAG 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::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
std::vector< int > getL1A_PHASE() const
Get L1A_PHASE bit from SCA Controller data per each time slice.
std::vector< int > getLCT_PHASE() const
Get LCT_PHASE bit from SCA Controller data per each time slice.
int getCFEBNmb() const
Get the CFEB number.
std::vector< uint16_t > getSCAFullCond() const
Get SCA Full Condition.
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< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::vector< int > getTRIG_TIME() const
Get TRIG_TIME 8 bit word from SCA Controller data per each time slice.
tuple cout
Definition: gather_cfg.py:121
std::vector< uint16_t > contrWords_
std::vector< uint16_t > bWords_
tuple size
Write out results.
void print() const
Print content of digi.