Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:10

0001 /*
0002  * =====================================================================================
0003  *
0004  *       Filename:  CSCDCCFormatStatusDigi.h
0005  *
0006  *    Description:  CSC DCC Format error, status and payload flags for a single DCC
0007  *
0008  *        Version:  1.0
0009  *        Created:  02/12/2009 03:22:34 PM
0010  *       Revision:  none
0011  *       Compiler:  gcc
0012  *
0013  *         Author:  Valdas Rapsevicius (VR), valdas.rapsevicius@cern.ch,
0014  *                  Victor Barashko (VB), victor.barashko@cern.ch
0015  *        Company:  CERN, CH
0016  *  
0017  * =====================================================================================
0018  */
0019 
0020 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h"
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 #include <iostream>
0023 #include <iomanip>
0024 
0025 /**
0026    * @brief  setExaminerInfo 
0027    * @param  fDCC_MASK_ DCC Examiner mask used (for information purposes).
0028    * @param  fCSC_MASK_ Examiner mask per chamber
0029    * @param  fDDU_SUMMARY_ERRORS_ Cumulative DDUs errors status
0030    * @param  mDDU_ERRORS_ List of errors per DDU
0031    * @param  mCSC_ERRORS_ List of errors per CSC
0032    * @param  mCSC_PAYLOADS_ List of payloads per CSC
0033    * @param  mCSC_STATUS_ List of statuses per CSC
0034    */
0035 void CSCDCCFormatStatusDigi::setDCCExaminerInfo(const ExaminerMaskType fDCC_MASK_,
0036                                                 const ExaminerMaskType fCSC_MASK_,
0037                                                 const ExaminerStatusType fDDU_SUMMARY_ERRORS_,
0038                                                 const std::map<DDUIdType, ExaminerStatusType>& mDDU_ERRORS_,
0039                                                 const std::map<CSCIdType, ExaminerStatusType>& mCSC_ERRORS_,
0040                                                 const std::map<CSCIdType, ExaminerStatusType>& mCSC_PAYLOADS_,
0041                                                 const std::map<CSCIdType, ExaminerStatusType>& mCSC_STATUS_) {
0042   fDCC_MASK = fDCC_MASK_;
0043   fCSC_MASK = fCSC_MASK_;
0044   fDDU_SUMMARY_ERRORS = fDDU_SUMMARY_ERRORS_;
0045   mDDU_ERRORS = mDDU_ERRORS_;
0046   mCSC_ERRORS = mCSC_ERRORS_;
0047   mCSC_PAYLOADS = mCSC_PAYLOADS_;
0048   mCSC_STATUS = mCSC_STATUS_;
0049 }
0050 
0051 /// Debug
0052 void CSCDCCFormatStatusDigi::print() const {
0053   // Keep original code in case I messed up the formatting in some subtle way when switching to MessageLogger
0054   //
0055   //   std::cout << "CSCDCCFormatStatusDigi: DCC=" << std::dec << getDCCId()
0056   //    << " DCCMask=0x" << std::hex << std::setw(8) << std::setfill('0') << getDCCMask()
0057   //    << " CSCMask=0x" << std::hex << std::setw(8) << std::setfill('0') << getCSCMask()
0058   //    << " DCCErrors=0x" << std::hex << std::setw(8) << std::setfill('0') << getDDUSummaryErrors()
0059   //    << std::dec << "\n";
0060   //   std::set<DDUIdType> ddu_list = getListOfDDUs();
0061   //   for (std::set<DDUIdType>::iterator itr=ddu_list.begin(); itr != ddu_list.end(); ++itr) {
0062   //    std::cout << "DDU_" << std::dec << ((*itr)&0xFF)
0063   //    << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') << getDDUErrors(*itr) << "\n";
0064   //   }
0065   //   std::set<CSCIdType> csc_list = getListOfCSCs();
0066   //   for (std::set<CSCIdType>::iterator itr=csc_list.begin(); itr != csc_list.end(); ++itr) {
0067   //
0068   //        std::cout << "CSC_" << std::dec << (((*itr)>>4)&0xFF) << "_" << ((*itr)&0xF)
0069   //        << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') << getCSCErrors(*itr)
0070   //        << " Payload=0x" << std::setw(8) << std::setfill('0') << getCSCPayload(*itr)
0071   //        << " Status=0x" << std::setw(8) << std::setfill('0') << getCSCStatus(*itr) << "\n";
0072   //   }
0073 
0074   edm::LogVerbatim("CSCDigi") << "CSCDCCFormatStatusDigi: DCC=" << std::dec << getDCCId() << " DCCMask=0x" << std::hex
0075                               << std::setw(8) << std::setfill('0') << getDCCMask() << " CSCMask=0x" << std::hex
0076                               << std::setw(8) << std::setfill('0') << getCSCMask() << " DCCErrors=0x" << std::hex
0077                               << std::setw(8) << std::setfill('0') << getDDUSummaryErrors() << std::dec;
0078 
0079   std::ostringstream ost;
0080 
0081   std::set<DDUIdType> ddu_list = getListOfDDUs();
0082   for (std::set<DDUIdType>::iterator itr = ddu_list.begin(); itr != ddu_list.end(); ++itr) {
0083     ost << "DDU_" << std::dec << ((*itr) & 0xFF) << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0')
0084         << getDDUErrors(*itr);
0085     edm::LogVerbatim("CSCDigi") << ost.str();
0086     ost.clear();
0087   }
0088 
0089   std::set<CSCIdType> csc_list = getListOfCSCs();
0090   for (std::set<CSCIdType>::iterator itr = csc_list.begin(); itr != csc_list.end(); ++itr) {
0091     ost << "CSC_" << std::dec << (((*itr) >> 4) & 0xFF) << "_" << ((*itr) & 0xF) << " Errors=0x" << std::hex
0092         << std::setw(8) << std::setfill('0') << getCSCErrors(*itr) << " Payload=0x" << std::setw(8) << std::setfill('0')
0093         << getCSCPayload(*itr) << " Status=0x" << std::setw(8) << std::setfill('0') << getCSCStatus(*itr);
0094     edm::LogVerbatim("CSCDigi") << ost.str();
0095     ost.clear();
0096   }
0097 }
0098 
0099 std::ostream& operator<<(std::ostream& o, const CSCDCCFormatStatusDigi& digi) {
0100   o << "CSCDCCFormatStatusDigi: DCC=" << std::dec << digi.getDCCId() << " DCCMask=0x" << std::hex << std::setw(8)
0101     << std::setfill('0') << digi.getDCCMask() << " CSCMask=0x" << std::hex << std::setw(8) << std::setfill('0')
0102     << digi.getCSCMask() << " DCCErrors=0x" << std::hex << std::setw(8) << std::setfill('0')
0103     << digi.getDDUSummaryErrors() << std::dec << "\n";
0104   std::set<DDUIdType> ddu_list = digi.getListOfDDUs();
0105   for (std::set<DDUIdType>::iterator itr = ddu_list.begin(); itr != ddu_list.end(); ++itr) {
0106     o << "DDU_" << std::dec << ((*itr) & 0xFF) << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0')
0107       << digi.getDDUErrors(*itr) << "\n";
0108   }
0109   std::set<CSCIdType> csc_list = digi.getListOfCSCs();
0110   for (std::set<CSCIdType>::iterator itr = csc_list.begin(); itr != csc_list.end(); ++itr) {
0111     o << "CSC_" << std::dec << (((*itr) >> 4) & 0xFF) << "_" << ((*itr) & 0xF) << " Errors=0x" << std::hex
0112       << std::setw(8) << std::setfill('0') << digi.getCSCErrors(*itr) << " Payload=0x" << std::setw(8)
0113       << std::setfill('0') << digi.getCSCPayload(*itr) << " Status=0x" << std::setw(8) << std::setfill('0')
0114       << digi.getCSCStatus(*itr) << "\n";
0115   }
0116   return o;
0117 }