File indexing completed on 2024-04-06 12:18:40
0001
0002
0003
0004
0005
0006
0007 #include "FWCore/Framework/interface/Event.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "FWCore/Framework/interface/EventSetup.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0013 #include "DataFormats/Common/interface/Handle.h"
0014 #include "DataFormats/DTDigi/interface/DTDDUWords.h"
0015 #include "HLTDTROMonitorFilter.h"
0016
0017 using namespace edm;
0018
0019 HLTDTROMonitorFilter::HLTDTROMonitorFilter(const edm::ParameterSet& pset) {
0020 auto inputLabel = pset.getParameter<InputTag>("inputLabel");
0021 inputToken = consumes<FEDRawDataCollection>(inputLabel);
0022 }
0023
0024 HLTDTROMonitorFilter::~HLTDTROMonitorFilter() = default;
0025
0026 void HLTDTROMonitorFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0027 edm::ParameterSetDescription desc;
0028 desc.add<edm::InputTag>("inputLabel", edm::InputTag("source"));
0029 descriptions.add("hltDTROMonitorFilter", desc);
0030 }
0031
0032 bool HLTDTROMonitorFilter::filter(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const {
0033
0034 edm::Handle<FEDRawDataCollection> rawdata;
0035 event.getByToken(inputToken, rawdata);
0036
0037
0038 int FEDIDmin = FEDNumbering::MINDTFEDID;
0039 int FEDIDMax = FEDNumbering::MAXDTFEDID;
0040
0041
0042 const int wordSize_32 = 4;
0043 const int wordSize_64 = 8;
0044
0045 for (int dduID = FEDIDmin; dduID <= FEDIDMax; ++dduID) {
0046 const FEDRawData& feddata = rawdata->FEDData(dduID);
0047 const int datasize = feddata.size();
0048 if (datasize) {
0049 const unsigned int* index32 = reinterpret_cast<const unsigned int*>(feddata.data());
0050 const int numberOf32Words = datasize / wordSize_32;
0051
0052 const unsigned char* index8 = reinterpret_cast<const unsigned char*>(index32);
0053
0054
0055 for (int rosId = 0; rosId < 12; rosId++) {
0056 int wordIndex8 = numberOf32Words * wordSize_32 - 3 * wordSize_64 + rosId;
0057 DTDDUFirstStatusWord statusWord(index8[wordIndex8]);
0058
0059 if (statusWord.errorFromROS() != 0 || statusWord.eventTrailerLost() != 0)
0060 return true;
0061 }
0062 }
0063 }
0064
0065
0066 return false;
0067 }
0068
0069
0070 #include "FWCore/Framework/interface/MakerMacros.h"
0071 DEFINE_FWK_MODULE(HLTDTROMonitorFilter);