File indexing completed on 2024-04-06 12:00:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "CaloOnlineTools/EcalTools/plugins/EcalFEDErrorFilter.h"
0020
0021
0022
0023
0024 EcalFEDErrorFilter::EcalFEDErrorFilter(const edm::ParameterSet& iConfig)
0025 : HLTFilter(iConfig),
0026 dataToken_(consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("InputLabel"))) {
0027
0028 fedUnpackList_ = iConfig.getUntrackedParameter<std::vector<int> >("FEDs", std::vector<int>());
0029 if (fedUnpackList_.empty())
0030 for (int i = FEDNumbering::MINECALFEDID; i <= FEDNumbering::MAXECALFEDID; i++)
0031 fedUnpackList_.push_back(i);
0032 }
0033
0034 EcalFEDErrorFilter::~EcalFEDErrorFilter() {
0035
0036
0037 }
0038
0039
0040
0041
0042
0043
0044 bool EcalFEDErrorFilter::hltFilter(edm::Event& iEvent,
0045 const edm::EventSetup& iSetup,
0046 trigger::TriggerFilterObjectWithRefs& filterproduct) const {
0047 using namespace edm;
0048
0049 const edm::Handle<FEDRawDataCollection>& rawdata = iEvent.getHandle(dataToken_);
0050
0051
0052
0053
0054 for (std::vector<int>::const_iterator i = fedUnpackList_.begin(); i != fedUnpackList_.end(); i++) {
0055
0056 const FEDRawData& fedData = rawdata->FEDData(*i);
0057 int length = fedData.size() / sizeof(uint64_t);
0058
0059
0060
0061 if (length >= 1) {
0062 uint64_t* pData = (uint64_t*)(fedData.data());
0063
0064 uint64_t* fedTrailer = pData + (length - 1);
0065 bool crcError = (*fedTrailer >> 2) & 0x1;
0066 if (crcError) {
0067 edm::LogVerbatim("EcalTools") << "CRCERROR in FED " << *i << " trailer is " << std::setw(8) << std::hex
0068 << (*fedTrailer) << std::dec;
0069 return true;
0070 }
0071 }
0072 }
0073
0074 return false;
0075 }