44 #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh"
66 inline void fillPresent(
unsigned int fedId,
bool present);
106 : rawDataTag_(iConfig.getParameter<edm::InputTag>(
"RawDataTag")),
107 dirName_(iConfig.getUntrackedParameter<std::
string>(
"DirName",
"SiStrip/FEDIntegrity/")),
108 printDebug_(iConfig.getUntrackedParameter<bool>(
"PrintDebugMessages",
false)),
109 updateFrequency_(iConfig.getUntrackedParameter<unsigned int>(
"HistogramUpdateFrequency",0)),
110 fedsPresentBinContents_(
FEDNumbering::MAXSiStripFEDID+1,0),
111 fedFatalErrorBinContents_(
FEDNumbering::MAXSiStripFEDID+1,0),
112 fedNonFatalErrorBinContents_(
FEDNumbering::MAXSiStripFEDID+1,0),
114 doPayloadChecks_(iConfig.getUntrackedParameter<bool>(
"DoPayloadChecks",
true)),
115 checkChannelLengths_(iConfig.getUntrackedParameter<bool>(
"CheckChannelLengths",
true)),
116 checkPacketCodes_(iConfig.getUntrackedParameter<bool>(
"CheckChannelPacketCodes",
true)),
117 checkFELengths_(iConfig.getUntrackedParameter<bool>(
"CheckFELengths",
true)),
118 checkChannelStatusBits_(iConfig.getUntrackedParameter<bool>(
"CheckChannelStatus",
true)),
123 std::stringstream
ss;
124 ss <<
"Payload checks are disabled but individual payload checks have been enabled. The following payload checks will be skipped: ";
168 FEDErrors lFedErrors;
171 for (
unsigned int fedId = siStripFedIdMin; fedId <= siStripFedIdMax; fedId++) {
176 lFedErrors.initialiseFED(fedId,
cabling_,tTopo,
false);
180 if (!fedData.
size() || !fedData.
data()) {
189 bool hasFatalErrors =
false;
190 float rateNonFatal = 0;
192 std::auto_ptr<const sistrip::FEDBuffer> buffer;
194 if (!lFedErrors.fillFatalFEDErrors(fedData,0)) {
195 hasFatalErrors =
true;
204 bool channelLengthsOK =
checkChannelLengths_ ? buffer->checkChannelLengthsMatchBufferLength() :
true;
205 bool channelPacketCodesOK =
checkPacketCodes_ ? buffer->checkChannelPacketCodes() :
true;
206 bool feLengthsOK =
checkFELengths_ ? buffer->checkFEUnitLengths() :
true;
207 if ( !channelLengthsOK ||
208 !channelPacketCodesOK ||
210 hasFatalErrors =
true;
217 if (hasFatalErrors) {
221 edm::LogInfo(
"SiStripFEDCheck") <<
"Fatal error with FED ID " << fedId <<
". Check summary: "
222 << std::endl << buffer->checkSummary() << std::endl;
223 std::stringstream
ss;
234 edm::LogInfo(
"SiStripFEDCheck") <<
"Non-fatal error with FED ID " << fedId
235 <<
" for " << rateNonFatal <<
" of the channels. Check summary: "
236 << std::endl << buffer->checkSummary() << std::endl;
237 std::stringstream
ss;
259 "Number of times FED buffer is present in data",
260 siStripFedIdMax-siStripFedIdMin+1,
261 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
264 "Number of fatal errors in FED buffer",
265 siStripFedIdMax-siStripFedIdMin+1,
266 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
269 "Number of non fatal errors in FED buffer",
270 siStripFedIdMax-siStripFedIdMin+1,
271 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
334 unsigned int entriesFedsPresent = 0;
335 unsigned int entriesFatalErrors = 0;
336 unsigned int entriesNonFatalErrors = 0;
337 for (
unsigned int fedId = siStripFedIdMin,
bin = 1; fedId < siStripFedIdMax+1; fedId++,
bin++) {
340 entriesFedsPresent += fedsPresentBin;
343 entriesFatalErrors += fedFatalErrorsBin;
346 entriesNonFatalErrors += fedNonFatalErrorsBin;
bool checkChannelLengths_
void fillFatalError(unsigned int fedId, bool fatalError)
edm::InputTag rawDataTag_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const SiStripFedCabling * cabling_
#define DEFINE_FWK_MODULE(type)
bool hasNonFatalError(const FEDRawData &fedData, unsigned int fedId) const
MonitorElement * fedNonFatalErrors_
size_t size() const
Lenght of the data buffer in bytes.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned int updateFrequency_
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * book1D(Args &&...args)
std::vector< unsigned int > fedFatalErrorBinContents_
std::vector< unsigned int > fedsPresentBinContents_
void setCurrentFolder(const std::string &fullpath)
Constants and enumerated types for FED/FEC systems.
bool hasFatalError(const FEDRawData &fedData, unsigned int fedId) const
T const * product() const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
SiStripFEDCheckPlugin(const edm::ParameterSet &)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void updateCabling(const edm::EventSetup &eventSetup)
MonitorElement * fedFatalErrors_
volatile std::atomic< bool > shutdown_flag false
MonitorElement * fedsPresent_
bool checkChannelStatusBits_
void fillNonFatalError(unsigned int fedId, float nonFatalError)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::vector< unsigned int > fedNonFatalErrorBinContents_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void fillPresent(unsigned int fedId, bool present)