44 #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh"
59 virtual void endJob()
override;
66 inline void fillPresent(
unsigned int fedId,
bool present);
108 : rawDataTag_(iConfig.getParameter<edm::InputTag>(
"RawDataTag")),
109 dirName_(iConfig.getUntrackedParameter<std::
string>(
"DirName",
"SiStrip/FEDIntegrity/")),
110 printDebug_(iConfig.getUntrackedParameter<bool>(
"PrintDebugMessages",
false)),
111 writeDQMStore_(iConfig.getUntrackedParameter<bool>(
"WriteDQMStore",
false)),
112 updateFrequency_(iConfig.getUntrackedParameter<unsigned int>(
"HistogramUpdateFrequency",0)),
113 fedsPresentBinContents_(
FEDNumbering::MAXSiStripFEDID+1,0),
114 fedFatalErrorBinContents_(
FEDNumbering::MAXSiStripFEDID+1,0),
115 fedNonFatalErrorBinContents_(
FEDNumbering::MAXSiStripFEDID+1,0),
117 doPayloadChecks_(iConfig.getUntrackedParameter<bool>(
"DoPayloadChecks",
true)),
118 checkChannelLengths_(iConfig.getUntrackedParameter<bool>(
"CheckChannelLengths",
true)),
119 checkPacketCodes_(iConfig.getUntrackedParameter<bool>(
"CheckChannelPacketCodes",
true)),
120 checkFELengths_(iConfig.getUntrackedParameter<bool>(
"CheckFELengths",
true)),
121 checkChannelStatusBits_(iConfig.getUntrackedParameter<bool>(
"CheckChannelStatus",
true)),
126 std::stringstream ss;
127 ss <<
"Payload checks are disabled but individual payload checks have been enabled. The following payload checks will be skipped: ";
172 FEDErrors lFedErrors;
175 for (
unsigned int fedId = siStripFedIdMin; fedId <= siStripFedIdMax; fedId++) {
180 lFedErrors.initialiseFED(fedId,
cabling_,tTopo,
false);
184 if (!fedData.
size() || !fedData.
data()) {
193 bool hasFatalErrors =
false;
194 float rateNonFatal = 0;
196 std::auto_ptr<const sistrip::FEDBuffer> buffer;
198 if (!lFedErrors.fillFatalFEDErrors(fedData,0)) {
199 hasFatalErrors =
true;
208 bool channelLengthsOK =
checkChannelLengths_ ? buffer->checkChannelLengthsMatchBufferLength() :
true;
209 bool channelPacketCodesOK =
checkPacketCodes_ ? buffer->checkChannelPacketCodes() :
true;
210 bool feLengthsOK =
checkFELengths_ ? buffer->checkFEUnitLengths() :
true;
211 if ( !channelLengthsOK ||
212 !channelPacketCodesOK ||
214 hasFatalErrors =
true;
221 if (hasFatalErrors) {
225 edm::LogInfo(
"SiStripFEDCheck") <<
"Fatal error with FED ID " << fedId <<
". Check summary: "
226 << std::endl << buffer->checkSummary() << std::endl;
227 std::stringstream ss;
238 edm::LogInfo(
"SiStripFEDCheck") <<
"Non-fatal error with FED ID " << fedId
239 <<
" for " << rateNonFatal <<
" of the channels. Check summary: "
240 << std::endl << buffer->checkSummary() << std::endl;
241 std::stringstream ss;
265 "Number of times FED buffer is present in data",
266 siStripFedIdMax-siStripFedIdMin+1,
267 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
270 "Number of fatal errors in FED buffer",
271 siStripFedIdMax-siStripFedIdMin+1,
272 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
275 "Number of non fatal errors in FED buffer",
276 siStripFedIdMax-siStripFedIdMin+1,
277 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
348 unsigned int entriesFedsPresent = 0;
349 unsigned int entriesFatalErrors = 0;
350 unsigned int entriesNonFatalErrors = 0;
351 for (
unsigned int fedId = siStripFedIdMin,
bin = 1; fedId < siStripFedIdMax+1; fedId++,
bin++) {
354 entriesFedsPresent += fedsPresentBin;
357 entriesFatalErrors += fedFatalErrorsBin;
360 entriesNonFatalErrors += fedNonFatalErrorsBin;
bool checkChannelLengths_
void fillFatalError(unsigned int fedId, bool fatalError)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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.
virtual void beginJob() override
virtual void endJob() override
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned int updateFrequency_
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
std::vector< unsigned int > fedFatalErrorBinContents_
std::vector< unsigned int > fedsPresentBinContents_
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 setCurrentFolder(const std::string &fullpath)
void fillPresent(unsigned int fedId, bool present)