CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCTMBBlockedCFEB.cc
Go to the documentation of this file.
1 //_________________________________________________________
2 //
3 // CSCTMBBlockedCFEB July 2010 Alexander Sakharov
4 // Unpacks TMB Logic Blocked CFEB Analyzer and stores in CSCTMBBlockedCFEB.h
5 //_________________________________________________________
6 //
9 #include <iostream>
10 
11 CSCTMBBlockedCFEB::CSCTMBBlockedCFEB(const uint16_t *buf, int Line6BCB, int Line6ECB) {
12  size_ = UnpackBlockedCFEB(buf, Line6BCB, Line6ECB);
13 
14 }
15 
16 int CSCTMBBlockedCFEB::UnpackBlockedCFEB(const uint16_t *buf, int Line6BCB, int Line6ECB) {
17  if ((Line6ECB - Line6BCB) != 0) {
18  for (int i = 0; i < (Line6ECB - Line6BCB - 1); i++) {
19  BlockedCFEBdata.push_back(buf[Line6BCB + 1 + i]);
20  }
21  }
22 
23  //print();
24  return (Line6ECB - Line6BCB + 1);
25 
26 }
27 
28 std::vector<std::vector<int> > CSCTMBBlockedCFEB::getSingleCFEBList(int CFEBn) const {
29  std::vector<std::vector<int> > CFEBnByLayers;
30  CFEBnByLayers.clear();
31  std::vector<int> CFEBnData;
32  CFEBnData.clear();
33  int idCFEB = -1;
34 
36  for (int i = 0; i < (int)getData().size(); ++i) {
37  idCFEB = (getData()[i] >> 12) & 0x7;
38  if (idCFEB == CFEBn) {
39  CFEBnData.push_back(getData()[i] & 0xFFF);
40  }
41  // idCFEB = -1; /* =VB= Commented out to please static analyzer */
42  }
43 
44  std::vector<int> Layer0, Layer1, Layer2, Layer3, Layer4, Layer5;
45  Layer0.clear();
46  Layer1.clear();
47  Layer2.clear();
48  Layer3.clear();
49  Layer4.clear();
50  Layer5.clear();
51 
52  for (int k = 0; k < (int)CFEBnData.size(); ++k) {
53  for (int j = 0; j < 12; j++) {
54  int DiStr = 0;
55  DiStr = (CFEBnData[k] >> j) & 0x1;
56  if ((DiStr != 0) && (j < 8) && (k == 0)) {
57  Layer0.push_back(j);
58  }
59  if ((DiStr != 0) && (j > 7) && (j < 12) && (k == 0)) {
60  Layer1.push_back(j);
61  }
62  if ((DiStr != 0) && (j < 4) && (k == 1)) {
63  Layer1.push_back(j);
64  }
65  if ((DiStr != 0) && (j > 3) && (j < 12) && (k == 1)) {
66  Layer2.push_back(j);
67  }
68  if ((DiStr != 0) && (j < 8) && (k == 2)) {
69  Layer3.push_back(j);
70  }
71  if ((DiStr != 0) && (j > 7) && (j < 12) && (k == 2)) {
72  Layer4.push_back(j);
73  }
74  if ((DiStr != 0) && (j < 4) && (k == 3)) {
75  Layer4.push_back(j);
76  }
77  if ((DiStr != 0) && (j > 3) && (j < 12) && (k == 3)) {
78  Layer5.push_back(j);
79  }
80  }
81  }
82 
83  CFEBnByLayers.push_back(Layer0);
84  CFEBnByLayers.push_back(Layer1);
85  CFEBnByLayers.push_back(Layer2);
86  CFEBnByLayers.push_back(Layer3);
87  CFEBnByLayers.push_back(Layer4);
88  CFEBnByLayers.push_back(Layer5);
89 
90  return CFEBnByLayers;
91 }
92 
94  std::cout << " Blocked CFEB DiStrips List Content " << std::endl;
95  for (int i = 0; i < (int)getData().size(); ++i) {
96  std::cout << " word " << i << " : " << std::hex << getData()[i] << std::dec << std::endl;
97  }
98 
99  std::vector<std::vector<int> > anyCFEB;
100  anyCFEB.clear();
101  std::vector<int> anyLayer;
102  anyLayer.clear();
103  std::cout << std::endl;
104  std::cout << " Blocked DiStrips by CFEB and Layers unpacked " << std::endl;
105  for (int z = 0; z < 5; ++z) {
106  anyCFEB = getSingleCFEBList(z);
107  std::cout << " CFEB# " << z << std::endl;
108  int LayerCnt = 0;
109  for (std::vector<std::vector<int> >::const_iterator layerIt = anyCFEB.begin(); layerIt != anyCFEB.end();
110  layerIt++) {
111  anyLayer = *layerIt;
112  std::cout << " Layer: " << LayerCnt;
113  if (!anyLayer.empty()) {
114  for (int i = 0; i < (int)anyLayer.size(); i++) {
115  std::cout << " " << anyLayer[i];
116  }
117  } else
118  std::cout << " No Blocked DiStrips on the Layer ";
119  std::cout << std::endl;
120  LayerCnt++;
121  anyLayer.clear();
122  }
123  anyCFEB.clear();
124  }
125 }
unsigned size_
stores all mini scope data
std::vector< int > BlockedCFEBdata
std::vector< int > getData() const
std::vector< std::vector< int > > getSingleCFEBList(int CFEBn) const
UnpackBlockedCFEB.
tuple cout
Definition: gather_cfg.py:144
int UnpackBlockedCFEB(const uint16_t *buf, int Line6BCB, int Line6ECB)
CSCTMBMiniScope.