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: ";
171 FEDErrors lFedErrors;
174 for (
unsigned int fedId = siStripFedIdMin; fedId <= siStripFedIdMax; fedId++) {
179 lFedErrors.initialiseFED(fedId,
cabling_,tTopo,
false);
183 if (!fedData.
size() || !fedData.
data()) {
192 bool hasFatalErrors =
false;
193 float rateNonFatal = 0;
195 std::auto_ptr<const sistrip::FEDBuffer> buffer;
197 if (!lFedErrors.fillFatalFEDErrors(fedData,0)) {
198 hasFatalErrors =
true;
207 bool channelLengthsOK =
checkChannelLengths_ ? buffer->checkChannelLengthsMatchBufferLength() :
true;
208 bool channelPacketCodesOK =
checkPacketCodes_ ? buffer->checkChannelPacketCodes() :
true;
209 bool feLengthsOK =
checkFELengths_ ? buffer->checkFEUnitLengths() :
true;
210 if ( !channelLengthsOK ||
211 !channelPacketCodesOK ||
213 hasFatalErrors =
true;
220 if (hasFatalErrors) {
224 edm::LogInfo(
"SiStripFEDCheck") <<
"Fatal error with FED ID " << fedId <<
". Check summary: "
225 << std::endl << buffer->checkSummary() << std::endl;
226 std::stringstream ss;
237 edm::LogInfo(
"SiStripFEDCheck") <<
"Non-fatal error with FED ID " << fedId
238 <<
" for " << rateNonFatal <<
" of the channels. Check summary: "
239 << std::endl << buffer->checkSummary() << std::endl;
240 std::stringstream ss;
264 "Number of times FED buffer is present in data",
265 siStripFedIdMax-siStripFedIdMin+1,
266 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
269 "Number of fatal errors in FED buffer",
270 siStripFedIdMax-siStripFedIdMin+1,
271 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
274 "Number of non fatal errors in FED buffer",
275 siStripFedIdMax-siStripFedIdMin+1,
276 siStripFedIdMin-0.5,siStripFedIdMax+0.5);
347 unsigned int entriesFedsPresent = 0;
348 unsigned int entriesFatalErrors = 0;
349 unsigned int entriesNonFatalErrors = 0;
350 for (
unsigned int fedId = siStripFedIdMin,
bin = 1; fedId < siStripFedIdMax+1; fedId++,
bin++) {
353 entriesFedsPresent += fedsPresentBin;
356 entriesFatalErrors += fedFatalErrorsBin;
359 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)