Go to the documentation of this file.00001 #include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h"
00002
00003 HcalUnpackerReport::HcalUnpackerReport() :
00004 unmappedDigis_(0), unmappedTPDigis_(0),
00005 spigotFormatErrors_(0), badqualityDigis_(0),
00006 totalDigis_(0),totalTPDigis_(0),totalHOTPDigis_(0), unsuppressed_(false),
00007 emptyEventSpigots_(0),ofwSpigots_(0),busySpigots_(0)
00008 {
00009 }
00010
00011 bool HcalUnpackerReport::errorFree() const {
00012 return FEDsError_.empty() && spigotFormatErrors_==0;
00013 }
00014
00015 bool HcalUnpackerReport::anyValidHCAL() const {
00016 return !FEDsUnpacked_.empty();
00017 }
00018
00019 void HcalUnpackerReport::addUnpacked(int fed) {
00020 FEDsUnpacked_.push_back(fed);
00021 }
00022
00023 void HcalUnpackerReport::addError(int fed) {
00024 FEDsError_.push_back(fed);
00025 }
00026
00027 void HcalUnpackerReport::countDigi() {
00028 totalDigis_++;
00029 }
00030 void HcalUnpackerReport::countTPDigi(bool ho) {
00031 if (ho) totalHOTPDigis_++;
00032 else totalTPDigis_++;
00033 }
00034
00035 void HcalUnpackerReport::countUnmappedDigi() {
00036 unmappedDigis_++;
00037 }
00038 void HcalUnpackerReport::countUnmappedTPDigi() {
00039 unmappedTPDigis_++;
00040 }
00041 void HcalUnpackerReport::countSpigotFormatError() {
00042 spigotFormatErrors_++;
00043 }
00044 void HcalUnpackerReport::countEmptyEventSpigot() { emptyEventSpigots_++; }
00045 void HcalUnpackerReport::countOFWSpigot() { ofwSpigots_++; }
00046 void HcalUnpackerReport::countBusySpigot() { busySpigots_++; }
00047
00048 void HcalUnpackerReport::countBadQualityDigi() {
00049 badqualityDigis_++;
00050 }
00051 void HcalUnpackerReport::countBadQualityDigi(const DetId& id) {
00052 badqualityDigis_++;
00053 badqualityIds_.push_back(id);
00054 }
00055 void HcalUnpackerReport::countUnmappedDigi(const HcalElectronicsId& eid) {
00056 unmappedDigis_++;
00057 unmappedIds_.push_back(eid);
00058 }
00059 void HcalUnpackerReport::countUnmappedTPDigi(const HcalElectronicsId& eid) {
00060 unmappedTPDigis_++;
00061 unmappedIds_.push_back(eid);
00062 }
00063
00064 HcalCalibrationEventType HcalUnpackerReport::fedCalibType(uint16_t fed) const {
00065 std::vector<uint16_t>::size_type i;
00066 uint16_t retval=0;
00067 for (i=0; i<fedInfo_.size(); i+=2)
00068 if (fedInfo_[i]==fed) {
00069 retval=fedInfo_[i+1];
00070 break;
00071 }
00072 return HcalCalibrationEventType(retval);
00073 }
00074
00075 void HcalUnpackerReport::setFedCalibInfo(uint16_t fed, HcalCalibrationEventType ctype) {
00076 std::vector<uint16_t>::size_type i;
00077 for (i=0; i<fedInfo_.size(); i+=2)
00078 if (fedInfo_[i]==fed) {
00079 fedInfo_[i+1]=uint16_t(ctype);
00080 break;
00081 }
00082 if (i>=fedInfo_.size()) {
00083 fedInfo_.push_back(fed);
00084 fedInfo_.push_back(uint16_t(ctype));
00085 }
00086 }
00087
00088 void HcalUnpackerReport::setUnsuppressed(bool isSup) {
00089 unsuppressed_=isSup;
00090 }
00091
00092 static const std::string ReportSeparator("==>");
00093
00094 void HcalUnpackerReport::setReportInfo(const std::string& name, const std::string& value) {
00095 reportInfo_.push_back(name+"==>"+value);
00096 }
00097
00098 bool HcalUnpackerReport::hasReportInfo(const std::string& name) const {
00099 std::string searchFor=name+ReportSeparator;
00100 std::vector<std::string>::const_iterator i;
00101 for (i=reportInfo_.begin(); i!=reportInfo_.end(); i++)
00102 if (i->find(searchFor)==0) break;
00103 return (i!=reportInfo_.end());
00104 }
00105 std::string HcalUnpackerReport::getReportInfo(const std::string& name) const {
00106 std::string searchFor=name+ReportSeparator;
00107 std::vector<std::string>::const_iterator i;
00108 for (i=reportInfo_.begin(); i!=reportInfo_.end(); i++)
00109 if (i->find(searchFor)==0) break;
00110 std::string retval;
00111 if (i!=reportInfo_.end()) {
00112 retval=i->substr(searchFor.length());
00113 }
00114 return retval;
00115 }
00116
00117 std::vector<std::string> HcalUnpackerReport::getReportKeys() const {
00118 std::vector<std::string> retval;
00119 std::vector<std::string>::const_iterator i;
00120 for (i=reportInfo_.begin(); i!=reportInfo_.end(); i++)
00121 retval.push_back(i->substr(0,i->find(ReportSeparator)));
00122 return retval;
00123 }