Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:18

0001 #include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h"
0002 
0003 HcalUnpackerReport::HcalUnpackerReport()
0004     : unmappedDigis_(0),
0005       unmappedTPDigis_(0),
0006       spigotFormatErrors_(0),
0007       badqualityDigis_(0),
0008       totalDigis_(0),
0009       totalTPDigis_(0),
0010       totalHOTPDigis_(0),
0011       unsuppressed_(false),
0012       emptyEventSpigots_(0),
0013       ofwSpigots_(0),
0014       busySpigots_(0) {}
0015 
0016 bool HcalUnpackerReport::errorFree() const { return FEDsError_.empty() && spigotFormatErrors_ == 0; }
0017 
0018 bool HcalUnpackerReport::anyValidHCAL() const { return !FEDsUnpacked_.empty(); }
0019 
0020 void HcalUnpackerReport::addUnpacked(int fed) { FEDsUnpacked_.push_back(fed); }
0021 
0022 void HcalUnpackerReport::addError(int fed) { FEDsError_.push_back(fed); }
0023 
0024 void HcalUnpackerReport::countDigi() { totalDigis_++; }
0025 void HcalUnpackerReport::countTPDigi(bool ho) {
0026   if (ho)
0027     totalHOTPDigis_++;
0028   else
0029     totalTPDigis_++;
0030 }
0031 
0032 void HcalUnpackerReport::countUnmappedDigi() { unmappedDigis_++; }
0033 void HcalUnpackerReport::countUnmappedTPDigi() { unmappedTPDigis_++; }
0034 void HcalUnpackerReport::countSpigotFormatError() { spigotFormatErrors_++; }
0035 void HcalUnpackerReport::countEmptyEventSpigot() { emptyEventSpigots_++; }
0036 void HcalUnpackerReport::countOFWSpigot() { ofwSpigots_++; }
0037 void HcalUnpackerReport::countBusySpigot() { busySpigots_++; }
0038 
0039 void HcalUnpackerReport::countBadQualityDigi() { badqualityDigis_++; }
0040 void HcalUnpackerReport::countBadQualityDigi(const DetId& id) {
0041   badqualityDigis_++;
0042   badqualityIds_.push_back(id);
0043 }
0044 void HcalUnpackerReport::countUnmappedDigi(const HcalElectronicsId& eid) {
0045   unmappedDigis_++;
0046   unmappedIds_.push_back(eid);
0047 }
0048 void HcalUnpackerReport::countUnmappedTPDigi(const HcalElectronicsId& eid) {
0049   unmappedTPDigis_++;
0050   unmappedIds_.push_back(eid);
0051 }
0052 
0053 HcalCalibrationEventType HcalUnpackerReport::fedCalibType(uint16_t fed) const {
0054   std::vector<uint16_t>::size_type i;
0055   uint16_t retval = 0;
0056   for (i = 0; i < fedInfo_.size(); i += 2)
0057     if (fedInfo_[i] == fed) {
0058       retval = fedInfo_[i + 1];
0059       break;
0060     }
0061   return HcalCalibrationEventType(retval);
0062 }
0063 
0064 void HcalUnpackerReport::setFedCalibInfo(uint16_t fed, HcalCalibrationEventType ctype) {
0065   std::vector<uint16_t>::size_type i;
0066   for (i = 0; i < fedInfo_.size(); i += 2)
0067     if (fedInfo_[i] == fed) {
0068       fedInfo_[i + 1] = uint16_t(ctype);
0069       break;
0070     }
0071   if (i >= fedInfo_.size()) {
0072     fedInfo_.push_back(fed);
0073     fedInfo_.push_back(uint16_t(ctype));
0074   }
0075 }
0076 
0077 void HcalUnpackerReport::setUnsuppressed(bool isSup) { unsuppressed_ = isSup; }
0078 
0079 static const std::string ReportSeparator("==>");
0080 
0081 void HcalUnpackerReport::setReportInfo(const std::string& name, const std::string& value) {
0082   reportInfo_.push_back(name + "==>" + value);
0083 }
0084 
0085 bool HcalUnpackerReport::hasReportInfo(const std::string& name) const {
0086   std::string searchFor = name + ReportSeparator;
0087   std::vector<std::string>::const_iterator i;
0088   for (i = reportInfo_.begin(); i != reportInfo_.end(); i++)
0089     if (i->find(searchFor) == 0)
0090       break;
0091   return (i != reportInfo_.end());
0092 }
0093 std::string HcalUnpackerReport::getReportInfo(const std::string& name) const {
0094   std::string searchFor = name + ReportSeparator;
0095   std::vector<std::string>::const_iterator i;
0096   for (i = reportInfo_.begin(); i != reportInfo_.end(); i++)
0097     if (i->find(searchFor) == 0)
0098       break;
0099   std::string retval;
0100   if (i != reportInfo_.end()) {
0101     retval = i->substr(searchFor.length());
0102   }
0103   return retval;
0104 }
0105 
0106 std::vector<std::string> HcalUnpackerReport::getReportKeys() const {
0107   std::vector<std::string> retval;
0108   std::vector<std::string>::const_iterator i;
0109   for (i = reportInfo_.begin(); i != reportInfo_.end(); i++)
0110     retval.push_back(i->substr(0, i->find(ReportSeparator)));
0111   return retval;
0112 }