CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DataFormats/CSCDigi/src/CSCCFEBStatusDigi.cc

Go to the documentation of this file.
00001 
00008 #include <DataFormats/CSCDigi/interface/CSCCFEBStatusDigi.h>
00009 
00010 #include <iostream>
00011 #include <stdint.h>
00012 
00014 int CSCCFEBStatusDigi::ShiftSel(int nmb,int nshift,int nsel) const {
00015     int tmp=nmb;
00016     tmp=tmp>>nshift;
00017     return tmp= tmp & nsel;
00018 }
00020 std::vector<uint16_t> CSCCFEBStatusDigi::getSCAFullCond() const {
00021   /*    std::vector<int> vec(4,0);
00022     vec[0]=ShiftSel(SCAFullCond_,0,15);  // 4-bit FIFO1 word count
00023     vec[1]=ShiftSel(SCAFullCond_,4,15);  // 4-bit Block Number if Error Code=1
00024                                          // (CFEB: SCA Capacitors Full)
00025                                          // 4-bit FIFO3 word count if Error Code=2
00026                                          // (CFEB: FPGA FIFO full)
00027     vec[2]=ShiftSel(SCAFullCond_,9,7);   // Error Code
00028     vec[3]=ShiftSel(SCAFullCond_,12,15); // DDU Code, should be 0xB
00029     return vec;*/
00030   return bWords_;
00031 }
00033 std::vector<int> CSCCFEBStatusDigi::getTS_FLAG() const {
00034     std::vector<int> vec(contrWords_.size(),0);
00035     int nmb;
00036     for(unsigned int i=0;i<vec.size();i++) {
00037       nmb=contrWords_[i];
00038       vec[i]=ShiftSel(nmb,15,1);
00039     }
00040     return vec;
00041 }
00042 
00044 std::vector<int> CSCCFEBStatusDigi::getSCA_FULL() const {
00045     std::vector<int> vec(contrWords_.size(),0);
00046     int nmb;
00047     for(unsigned int i=0;i<vec.size();i++) {
00048       nmb=contrWords_[i];
00049       vec[i]=ShiftSel(nmb,14,1);
00050     }
00051     return vec;
00052 }
00053 
00055 std::vector<int> CSCCFEBStatusDigi::getLCT_PHASE() const {
00056     std::vector<int> vec(contrWords_.size(),0);
00057     int nmb;
00058     for(unsigned int i=0;i<vec.size();i++) {
00059       nmb=contrWords_[i];
00060       vec[i]=ShiftSel(nmb,13,1);
00061     }
00062     return vec;
00063 }
00064 
00066 std::vector<int> CSCCFEBStatusDigi::getL1A_PHASE() const {
00067     std::vector<int> vec(contrWords_.size(),0);
00068     int nmb;
00069     for(unsigned int i=0;i<vec.size();i++) {
00070       nmb=contrWords_[i];
00071       vec[i]=ShiftSel(nmb,12,1);
00072     }
00073     return vec;
00074 }
00075  
00077 std::vector<int> CSCCFEBStatusDigi::getSCA_BLK() const {
00078     std::vector<int> vec(contrWords_.size(),0);
00079     int nmb;
00080     for(unsigned int i=0;i<vec.size();i++) {
00081       nmb=contrWords_[i];
00082       vec[i]=ShiftSel(nmb,8,15);
00083     }
00084     return vec;
00085 }
00086 
00088 std::vector<int> CSCCFEBStatusDigi::getTRIG_TIME() const {
00089     std::vector<int> vec(contrWords_.size(),0);
00090     int nmb;
00091     for(unsigned int i=0;i<vec.size();i++) {
00092       nmb=contrWords_[i];
00093       vec[i]=ShiftSel(nmb,0,255);
00094     }
00095     return vec;
00096 }
00097 
00099 void CSCCFEBStatusDigi::print() const {
00100     std::cout << "CSC CFEB # : " << getCFEBNmb() <<"\n";
00101     std::cout << " SCAFullCond: ";
00102     if(getSCAFullCond().size()!=0){
00103     for (size_t i = 0; i<4; ++i ){
00104         std::cout <<" " <<(getSCAFullCond())[i]; }
00105         }
00106     else {
00107     std::cout << " " <<"BWORD is not valied";
00108     }   
00109     std::cout << "\n";
00110     std::cout << " CRC: ";
00111     for (size_t i = 0; i<getCRC().size(); ++i ){
00112         std::cout <<" " <<(getCRC())[i]; }
00113     std::cout<<"\n";
00114     std::cout << " TS_FLAG: ";
00115     for (size_t i = 0; i<getTS_FLAG().size(); ++i ){
00116         std::cout <<" " <<(getTS_FLAG())[i]; }
00117     std::cout<<"\n";
00118     std::cout << " SCA_FULL: ";
00119     for (size_t i = 0; i<getSCA_FULL().size(); ++i ){
00120         std::cout <<" " <<(getSCA_FULL())[i]; }
00121     std::cout<<"\n";
00122     std::cout << " LCT_PHASE: ";
00123     for (size_t i = 0; i<getLCT_PHASE().size(); ++i ){
00124         std::cout <<" " <<(getLCT_PHASE())[i]; }
00125     std::cout<<"\n";
00126     std::cout << " L1A_PHASE: ";
00127     for (size_t i = 0; i<getL1A_PHASE().size(); ++i ){
00128         std::cout <<" " <<(getL1A_PHASE())[i]; }
00129     std::cout<<"\n";
00130     std::cout << " SCA_BLK: ";
00131     for (size_t i = 0; i<getSCA_BLK().size(); ++i ){
00132         std::cout <<" " <<(getSCA_BLK())[i]; }
00133     std::cout<<"\n";
00134     std::cout << " TRIG_TIME: ";
00135     for (size_t i = 0; i<getTRIG_TIME().size(); ++i ){
00136         std::cout <<" " <<(getTRIG_TIME())[i]; }
00137     std::cout<<"\n";
00138 }
00139 
00140 std::ostream & operator<<(std::ostream & o, const CSCCFEBStatusDigi& digi) {
00141   o << " " << digi.getCFEBNmb()<<"\n";
00142   for (size_t i = 0; i<4; ++i ){
00143         o <<" " <<(digi.getSCAFullCond())[i]; }
00144   o <<"\n";
00145   for (size_t i = 0; i<digi.getCRC().size(); ++i ){
00146     o <<" " <<(digi.getCRC())[i]; }
00147   o<<"\n";
00148   for (size_t i = 0; i<digi.getTS_FLAG().size(); ++i ){
00149     o <<" " <<(digi.getTS_FLAG())[i]; }
00150   o<<"\n";
00151   for (size_t i = 0; i<digi.getSCA_FULL().size(); ++i ){
00152     o <<" " <<(digi.getSCA_FULL())[i]; }
00153   o<<"\n";
00154   for (size_t i = 0; i<digi.getLCT_PHASE().size(); ++i ){
00155     o <<" " <<(digi.getLCT_PHASE())[i]; }
00156   o<<"\n";
00157   for (size_t i = 0; i<digi.getL1A_PHASE().size(); ++i ){
00158     o <<" " <<(digi.getL1A_PHASE())[i]; }
00159   o<<"\n";
00160   for (size_t i = 0; i<digi.getSCA_BLK().size(); ++i ){
00161     o <<" " <<(digi.getSCA_BLK())[i]; }
00162   o<<"\n";
00163   for (size_t i = 0; i<digi.getTRIG_TIME().size(); ++i ){
00164     o <<" " <<(digi.getTRIG_TIME())[i]; }
00165   o<<"\n";
00166 
00167   return o;
00168 }
00169