CMS 3D CMS Logo

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