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