File indexing completed on 2024-04-06 12:10:26
0001
0002
0003
0004
0005
0006
0007 #include "EventFilter/CSCRawToDigi/interface/CSCTMBBlockedCFEB.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include <iostream>
0010
0011 CSCTMBBlockedCFEB::CSCTMBBlockedCFEB(const uint16_t *buf, int Line6BCB, int Line6ECB) {
0012 size_ = UnpackBlockedCFEB(buf, Line6BCB, Line6ECB);
0013
0014 }
0015
0016 int CSCTMBBlockedCFEB::UnpackBlockedCFEB(const uint16_t *buf, int Line6BCB, int Line6ECB) {
0017 if ((Line6ECB - Line6BCB) != 0) {
0018 for (int i = 0; i < (Line6ECB - Line6BCB - 1); i++) {
0019 BlockedCFEBdata.push_back(buf[Line6BCB + 1 + i]);
0020 }
0021 }
0022
0023
0024 return (Line6ECB - Line6BCB + 1);
0025
0026 }
0027
0028 std::vector<std::vector<int> > CSCTMBBlockedCFEB::getSingleCFEBList(int CFEBn) const {
0029 std::vector<std::vector<int> > CFEBnByLayers;
0030 CFEBnByLayers.clear();
0031 std::vector<int> CFEBnData;
0032 CFEBnData.clear();
0033 int idCFEB = -1;
0034
0035
0036 for (int i = 0; i < (int)getData().size(); ++i) {
0037 idCFEB = (getData()[i] >> 12) & 0x7;
0038 if (idCFEB == CFEBn) {
0039 CFEBnData.push_back(getData()[i] & 0xFFF);
0040 }
0041
0042 }
0043
0044 std::vector<int> Layer0, Layer1, Layer2, Layer3, Layer4, Layer5;
0045 Layer0.clear();
0046 Layer1.clear();
0047 Layer2.clear();
0048 Layer3.clear();
0049 Layer4.clear();
0050 Layer5.clear();
0051
0052 for (int k = 0; k < (int)CFEBnData.size(); ++k) {
0053 for (int j = 0; j < 12; j++) {
0054 int DiStr = 0;
0055 DiStr = (CFEBnData[k] >> j) & 0x1;
0056 if ((DiStr != 0) && (j < 8) && (k == 0)) {
0057 Layer0.push_back(j);
0058 }
0059 if ((DiStr != 0) && (j > 7) && (j < 12) && (k == 0)) {
0060 Layer1.push_back(j);
0061 }
0062 if ((DiStr != 0) && (j < 4) && (k == 1)) {
0063 Layer1.push_back(j);
0064 }
0065 if ((DiStr != 0) && (j > 3) && (j < 12) && (k == 1)) {
0066 Layer2.push_back(j);
0067 }
0068 if ((DiStr != 0) && (j < 8) && (k == 2)) {
0069 Layer3.push_back(j);
0070 }
0071 if ((DiStr != 0) && (j > 7) && (j < 12) && (k == 2)) {
0072 Layer4.push_back(j);
0073 }
0074 if ((DiStr != 0) && (j < 4) && (k == 3)) {
0075 Layer4.push_back(j);
0076 }
0077 if ((DiStr != 0) && (j > 3) && (j < 12) && (k == 3)) {
0078 Layer5.push_back(j);
0079 }
0080 }
0081 }
0082
0083 CFEBnByLayers.push_back(Layer0);
0084 CFEBnByLayers.push_back(Layer1);
0085 CFEBnByLayers.push_back(Layer2);
0086 CFEBnByLayers.push_back(Layer3);
0087 CFEBnByLayers.push_back(Layer4);
0088 CFEBnByLayers.push_back(Layer5);
0089
0090 return CFEBnByLayers;
0091 }
0092
0093 void CSCTMBBlockedCFEB::print() const {
0094 std::cout << " Blocked CFEB DiStrips List Content " << std::endl;
0095 for (int i = 0; i < (int)getData().size(); ++i) {
0096 std::cout << " word " << i << " : " << std::hex << getData()[i] << std::dec << std::endl;
0097 }
0098
0099 std::vector<std::vector<int> > anyCFEB;
0100 anyCFEB.clear();
0101 std::vector<int> anyLayer;
0102 anyLayer.clear();
0103 std::cout << std::endl;
0104 std::cout << " Blocked DiStrips by CFEB and Layers unpacked " << std::endl;
0105 for (int z = 0; z < 5; ++z) {
0106 anyCFEB = getSingleCFEBList(z);
0107 std::cout << " CFEB# " << z << std::endl;
0108 int LayerCnt = 0;
0109 for (std::vector<std::vector<int> >::const_iterator layerIt = anyCFEB.begin(); layerIt != anyCFEB.end();
0110 layerIt++) {
0111 anyLayer = *layerIt;
0112 std::cout << " Layer: " << LayerCnt;
0113 if (!anyLayer.empty()) {
0114 for (int i = 0; i < (int)anyLayer.size(); i++) {
0115 std::cout << " " << anyLayer[i];
0116 }
0117 } else
0118 std::cout << " No Blocked DiStrips on the Layer ";
0119 std::cout << std::endl;
0120 LayerCnt++;
0121 anyLayer.clear();
0122 }
0123 anyCFEB.clear();
0124 }
0125 }