46 #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh"
71 inline void fillPresent(
unsigned int fedId,
bool present);
121 : rawDataTag_ (iConfig.getParameter<edm::
InputTag>(
"RawDataTag"))
122 , dirName_ (iConfig.getUntrackedParameter<std::
string>(
"DirName",
"SiStrip/FEDIntegrity/"))
123 , printDebug_ (iConfig.getUntrackedParameter<bool>(
"PrintDebugMessages",
false))
124 , doPLOTfedsPresent_ (iConfig.getParameter<bool>(
"doPLOTfedsPresent") )
125 , doPLOTfedFatalErrors_ (iConfig.getParameter<bool>(
"doPLOTfedFatalErrors") )
126 , doPLOTfedNonFatalErrors_ (iConfig.getParameter<bool>(
"doPLOTfedNonFatalErrors"))
127 , doPLOTnFEDinVsLS_ (iConfig.getParameter<bool>(
"doPLOTnFEDinVsLS") )
128 , doPLOTnFEDinWdataVsLS_ (iConfig.getParameter<bool>(
"doPLOTnFEDinWdataVsLS") )
129 , fedsPresent_ (
NULL)
130 , fedFatalErrors_ (
NULL)
131 , fedNonFatalErrors_(
NULL)
133 , nFEDinWdataVsLS_ (
NULL)
134 , updateFrequency_(iConfig.getUntrackedParameter<unsigned int>(
"HistogramUpdateFrequency",0))
135 , fedsPresentBinContents_ (
FEDNumbering::MAXSiStripFEDID+1,0)
136 , fedFatalErrorBinContents_ (
FEDNumbering::MAXSiStripFEDID+1,0)
137 , fedNonFatalErrorBinContents_(
FEDNumbering::MAXSiStripFEDID+1,0)
139 , doPayloadChecks_ (iConfig.getUntrackedParameter<bool>(
"DoPayloadChecks",
true))
140 , checkChannelLengths_ (iConfig.getUntrackedParameter<bool>(
"CheckChannelLengths",
true))
141 , checkPacketCodes_ (iConfig.getUntrackedParameter<bool>(
"CheckChannelPacketCodes",
true))
142 , checkFELengths_ (iConfig.getUntrackedParameter<bool>(
"CheckFELengths",
true))
143 , checkChannelStatusBits_(iConfig.getUntrackedParameter<bool>(
"CheckChannelStatus",
true))
144 , verbose_ (iConfig.getUntrackedParameter<bool>(
"verbose",
false))
149 std::stringstream
ss;
150 ss <<
"Payload checks are disabled but individual payload checks have been enabled. The following payload checks will be skipped: ";
188 if (
verbose_)
std::cout <<
"[SiStripFEDCheckPlugin::analyze] gotData ? " << (gotData ?
"YES" :
"NOPE") << std::endl;
196 FEDErrors lFedErrors;
200 size_t nFEDinWdata = 0;
209 if (!fedData.
size() || !fedData.
data()) {
216 if (fedData.
size()) nFEDin++;
217 if (fedData.
size() && fedData.
data()) nFEDinWdata++;
224 bool hasFatalErrors =
false;
225 float rateNonFatal = 0;
227 std::auto_ptr<const sistrip::FEDBuffer> buffer;
229 if (!lFedErrors.fillFatalFEDErrors(fedData,0)) {
230 hasFatalErrors =
true;
239 bool channelLengthsOK =
checkChannelLengths_ ? buffer->checkChannelLengthsMatchBufferLength() :
true;
240 bool channelPacketCodesOK =
checkPacketCodes_ ? buffer->checkChannelPacketCodes() :
true;
241 bool feLengthsOK =
checkFELengths_ ? buffer->checkFEUnitLengths() :
true;
242 if ( !channelLengthsOK ||
243 !channelPacketCodesOK ||
245 hasFatalErrors =
true;
252 if (hasFatalErrors) {
256 edm::LogInfo(
"SiStripFEDCheck") <<
"Fatal error with FED ID " << fedId <<
". Check summary: "
257 << std::endl << buffer->checkSummary() << std::endl;
258 std::stringstream
ss;
269 edm::LogInfo(
"SiStripFEDCheck") <<
"Non-fatal error with FED ID " << fedId
270 <<
" for " << rateNonFatal <<
" of the channels. Check summary: "
271 << std::endl << buffer->checkSummary() << std::endl;
272 std::stringstream
ss;
279 if (
verbose_)
std::cout <<
"nFEDin: " << nFEDin <<
" nFEDinWdata: " << nFEDinWdata << std::endl;
291 double xFEDmin = siStripFedIdMin_-0.5;
299 "Number of times FED buffer is present in data",
300 nFED, xFEDmin, xFEDmax);
306 "Number of fatal errors in FED buffer",
307 nFED, xFEDmin, xFEDmax);
313 "Number of non fatal errors in FED buffer",
314 nFED, xFEDmin, xFEDmax);
324 "number of FED in Vs LS",
326 nFED, xFEDmin, xFEDmax);
333 "number of FED in (with data) Vs LS",
335 nFED, xFEDmin, xFEDmax);
401 unsigned int entriesFedsPresent = 0;
402 unsigned int entriesFatalErrors = 0;
403 unsigned int entriesNonFatalErrors = 0;
407 entriesFedsPresent += fedsPresentBin;
410 entriesFatalErrors += fedFatalErrorsBin;
413 entriesNonFatalErrors += fedNonFatalErrorsBin;
431 desc.
addUntracked<
unsigned int>(
"HistogramUpdateFrequency",1000);
434 desc.
add<
bool>(
"doPLOTfedsPresent",
true);
435 desc.
add<
bool>(
"doPLOTfedFatalErrors",
true);
436 desc.
add<
bool>(
"doPLOTfedNonFatalErrors",
true);
437 desc.
add<
bool>(
"doPLOTnFEDinVsLS",
false);
438 desc.
add<
bool>(
"doPLOTnFEDinWdataVsLS",
false);
446 desc.
addUntracked<
bool>(
"CheckChannelPacketCodes",
true);
451 desc.
add<
int> (
"LSBin",5000);
452 desc.
add<
double> (
"LSMin", 0.5);
453 desc.
add<
double> (
"LSMax",5000.5);
T getParameter(std::string const &) const
bool doPLOTnFEDinWdataVsLS_
MonitorElement * nFEDinWdataVsLS_
bool checkChannelLengths_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void fillFatalError(unsigned int fedId, bool fatalError)
edm::InputTag rawDataTag_
bool doPLOTfedNonFatalErrors_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
MonitorElement * bookProfile(Args &&...args)
unsigned int siStripFedIdMax_
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_
LuminosityBlockNumber_t luminosityBlock() const
size_t size() const
Lenght of the data buffer in bytes.
virtual void endRun(edm::Run const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void addDefault(ParameterSetDescription const &psetDescription)
unsigned int updateFrequency_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * book1D(Args &&...args)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< unsigned int > fedFatalErrorBinContents_
std::vector< unsigned int > fedsPresentBinContents_
unsigned int siStripFedIdMin_
void setCurrentFolder(const std::string &fullpath)
Constants and enumerated types for FED/FEC systems.
MonitorElement * nFEDinVsLS_
bool hasFatalError(const FEDRawData &fedData, unsigned int fedId) const
T const * product() const
bool doPLOTfedFatalErrors_
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)