CMS 3D CMS Logo

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(unsigned short *buf,int Line6BCB,int Line6ECB)
12 {
13 
14  size_ = UnpackBlockedCFEB(buf,Line6BCB,Line6ECB);
15 
16 }
17 
18 
19 int CSCTMBBlockedCFEB::UnpackBlockedCFEB(unsigned short *buf,int Line6BCB,int Line6ECB)
20 {
21 
22  if ((Line6ECB-Line6BCB) != 0)
23  {
24 
25  for (int i=0; i<(Line6ECB-Line6BCB-1); i++)
26  {
27  BlockedCFEBdata.push_back(buf[Line6BCB+1+i]);
28  }
29 
30  }
31 
32  //print();
33  return (Line6ECB-Line6BCB + 1);
34 
35 }
36 
37 std::vector< std::vector<int> > CSCTMBBlockedCFEB::getSingleCFEBList(int CFEBn) const
38 {
39 
40  std::vector< std::vector<int> > CFEBnByLayers;
41  CFEBnByLayers.clear();
42  std::vector<int> CFEBnData;
43  CFEBnData.clear();
44  int idCFEB=-1;
45 
47  for (int i=0; i<(int)getData().size(); ++i)
48  {
49  idCFEB = (getData()[i] >> 12) & 0x7;
50  if (idCFEB==CFEBn)
51  {
52  CFEBnData.push_back(getData()[i] & 0xFFF);
53  }
54  // idCFEB = -1; /* =VB= Commented out to please static analyzer */
55  }
56 
57  std::vector<int> Layer0, Layer1, Layer2, Layer3, Layer4, Layer5;
58  Layer0.clear();
59  Layer1.clear();
60  Layer2.clear();
61  Layer3.clear();
62  Layer4.clear();
63  Layer5.clear();
64 
65  for (int k=0; k<(int)CFEBnData.size(); ++k)
66  {
67  for (int j=0; j<12; j++)
68  {
69  int DiStr=0;
70  DiStr = (CFEBnData[k] >> j) & 0x1;
71  if ( (DiStr !=0) && (j<8) && (k==0) )
72  {
73  Layer0.push_back(j);
74  }
75  if ((DiStr !=0) && (j>7) && (j<12) && (k==0))
76  {
77  Layer1.push_back(j);
78  }
79  if ((DiStr !=0) && (j<4) && (k==1))
80  {
81  Layer1.push_back(j);
82  }
83  if ((DiStr !=0) && (j>3) && (j<12) && (k==1))
84  {
85  Layer2.push_back(j);
86  }
87  if ( (DiStr !=0) && (j<8) && (k==2) )
88  {
89  Layer3.push_back(j);
90  }
91  if ((DiStr !=0) && (j>7) && (j<12) && (k==2))
92  {
93  Layer4.push_back(j);
94  }
95  if ((DiStr !=0) && (j<4) && (k==3))
96  {
97  Layer4.push_back(j);
98  }
99  if ((DiStr !=0) && (j>3) && (j<12) && (k==3))
100  {
101  Layer5.push_back(j);
102  }
103  }
104  }
105 
106  CFEBnByLayers.push_back(Layer0);
107  CFEBnByLayers.push_back(Layer1);
108  CFEBnByLayers.push_back(Layer2);
109  CFEBnByLayers.push_back(Layer3);
110  CFEBnByLayers.push_back(Layer4);
111  CFEBnByLayers.push_back(Layer5);
112 
113  return CFEBnByLayers;
114 }
115 
117 {
118 
119  std::cout << " Blocked CFEB DiStrips List Content " << std::endl;
120  for (int i=0; i<(int)getData().size(); ++i)
121  {
122  std::cout << " word " << i << " : " << std::hex << getData()[i] << std::dec << std::endl;
123  }
124 
125  std::vector< std::vector<int> > anyCFEB;
126  anyCFEB.clear();
127  std::vector <int> anyLayer;
128  anyLayer.clear();
129  std::cout << std::endl;
130  std::cout << " Blocked DiStrips by CFEB and Layers unpacked " << std::endl;
131  for (int z=0; z<5; ++z)
132  {
133  anyCFEB = getSingleCFEBList(z);
134  std::cout << " CFEB# " << z << std::endl;
135  int LayerCnt=0;
136  for (std::vector< std::vector<int> >::const_iterator layerIt=anyCFEB.begin(); layerIt !=anyCFEB.end(); layerIt++)
137  {
138  anyLayer=*layerIt;
139  std::cout << " Layer: " << LayerCnt;
140  if (!anyLayer.empty())
141  {
142  for (int i=0; i<(int)anyLayer.size(); i++)
143  {
144  std::cout << " " << anyLayer[i];
145  }
146  }
147  else
148  std::cout << " No Blocked DiStrips on the Layer ";
149  std::cout << std::endl;
150  LayerCnt++;
151  anyLayer.clear();
152  }
153  anyCFEB.clear();
154  }
155 
156 }
157 
unsigned size_
stores all mini scope data
int k[5][pyjets_maxn]
std::vector< int > BlockedCFEBdata
int UnpackBlockedCFEB(unsigned short *buf, int Line6BCB, int Line6ECB)
CSCTMBMiniScope.
std::vector< int > getData() const
std::vector< std::vector< int > > getSingleCFEBList(int CFEBn) const
UnpackBlockedCFEB.