CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/EventFilter/CSCRawToDigi/src/CSCTMBBlockedCFEB.cc

Go to the documentation of this file.
00001 //_________________________________________________________
00002 //
00003 //  CSCTMBBlockedCFEB July 2010  Alexander Sakharov                            
00004 //  Unpacks TMB Logic Blocked CFEB Analyzer and stores in CSCTMBBlockedCFEB.h  
00005 //_________________________________________________________
00006 //
00007 #include "EventFilter/CSCRawToDigi/interface/CSCTMBBlockedCFEB.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include <iostream>
00010 
00011 CSCTMBBlockedCFEB::CSCTMBBlockedCFEB(unsigned short *buf,int Line6BCB,int Line6ECB) {
00012 
00013   size_ = UnpackBlockedCFEB(buf,Line6BCB,Line6ECB);
00014 
00015 } 
00016 
00017 
00018 int CSCTMBBlockedCFEB::UnpackBlockedCFEB(unsigned short *buf,int Line6BCB,int Line6ECB) {
00019 
00020   if((Line6ECB-Line6BCB) != 0) {
00021      
00022       for(int i=0; i<(Line6ECB-Line6BCB-1); i++){
00023          BlockedCFEBdata.push_back(buf[Line6BCB+1+i]);
00024       }
00025 
00026   }
00027 
00028   //print();
00029   return (Line6ECB-Line6BCB + 1);
00030 
00031 } 
00032 
00033 std::vector< std::vector<int> > CSCTMBBlockedCFEB::getSingleCFEBList(int CFEBn) const{
00034      
00035      std::vector< std::vector<int> > CFEBnByLayers;
00036      CFEBnByLayers.clear();             
00037      std::vector<int> CFEBnData;
00038      CFEBnData.clear();
00039      int idCFEB=-1;
00040      
00042      for(int i=0; i<(int)getData().size(); ++i){
00043         idCFEB = (getData()[i] >> 12) & 0x7;
00044         if(idCFEB==CFEBn){
00045           CFEBnData.push_back(getData()[i] & 0xFFF);
00046         }
00047         idCFEB = -1;
00048      }
00049      
00050      std::vector<int> Layer0, Layer1, Layer2, Layer3, Layer4, Layer5;
00051      Layer0.clear(); Layer1.clear(); Layer2.clear(); Layer3.clear(); Layer4.clear(); Layer5.clear();
00052      
00053      for(int k=0; k<(int)CFEBnData.size(); ++k){
00054         for(int j=0; j<12; j++){
00055            int DiStr=0;
00056            DiStr = (CFEBnData[k] >> j) & 0x1;
00057            if( (DiStr !=0) && (j<8) && (k==0) ){
00058              Layer0.push_back(j);
00059            }
00060            if((DiStr !=0) && (j>7) && (j<12) && (k==0)){
00061              Layer1.push_back(j);
00062            }
00063            if((DiStr !=0) && (j<4) && (k==1)){
00064              Layer1.push_back(j);
00065            }
00066            if((DiStr !=0) && (j>3) && (j<12) && (k==1)){
00067              Layer2.push_back(j);
00068            }
00069            if( (DiStr !=0) && (j<8) && (k==2) ){
00070              Layer3.push_back(j);
00071            }
00072            if((DiStr !=0) && (j>7) && (j<12) && (k==2)){
00073              Layer4.push_back(j);
00074            }
00075            if((DiStr !=0) && (j<4) && (k==3)){
00076              Layer4.push_back(j);
00077            }
00078            if((DiStr !=0) && (j>3) && (j<12) && (k==3)){
00079              Layer5.push_back(j);
00080            }
00081         }
00082      }
00083      
00084      CFEBnByLayers.push_back(Layer0); 
00085      CFEBnByLayers.push_back(Layer1);
00086      CFEBnByLayers.push_back(Layer2);
00087      CFEBnByLayers.push_back(Layer3);
00088      CFEBnByLayers.push_back(Layer4);
00089      CFEBnByLayers.push_back(Layer5);
00090      
00091 return CFEBnByLayers;
00092 }
00093 
00094 void CSCTMBBlockedCFEB::print() const {
00095      
00096 std::cout << " Blocked CFEB DiStrips List Content " << std::endl;
00097      for(int i=0; i<(int)getData().size(); ++i){
00098         std::cout << " word " << i << " : " << std::hex << getData()[i] << std::dec << std::endl;
00099      }
00100 
00101 std::vector< std::vector<int> > anyCFEB;
00102 anyCFEB.clear();
00103 std::vector <int> anyLayer;
00104 anyLayer.clear();
00105 std::cout << std::endl;
00106 std::cout << " Blocked DiStrips by CFEB and Layers unpacked " << std::endl;
00107 for(int z=0; z<5; ++z){
00108 anyCFEB = getSingleCFEBList(z);
00109 std::cout << " CFEB# " << z << std::endl; 
00110 int LayerCnt=0;
00111 for(std::vector< std::vector<int> >::const_iterator layerIt=anyCFEB.begin(); layerIt !=anyCFEB.end(); layerIt++){
00112     anyLayer=*layerIt;
00113     std::cout << " Layer: " << LayerCnt;
00114     if(anyLayer.size() !=0){
00115       for(int i=0; i<(int)anyLayer.size(); i++){
00116        std::cout << " " << anyLayer[i];
00117       }
00118     }
00119     else
00120     std::cout << " No Blocked DiStrips on the Layer ";
00121     std::cout << std::endl;
00122     LayerCnt++;
00123     anyLayer.clear();
00124 }
00125 anyCFEB.clear();
00126 }
00127      
00128 }