CMS 3D CMS Logo

EcalFEDErrorFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalFEDErrorFilter
4 // Class: EcalFEDErrorFilter
5 //
13 //
14 // Original Author: Giovanni FRANZONI
15 // Created: Tue Jan 22 13:55:00 CET 2008
16 //
17 //
18 
20 
21 //
22 // constructors and destructor
23 //
25  //now do what ever initialization is needed
26 
27  DataLabel_ = iConfig.getParameter<edm::InputTag>("InputLabel");
28  fedUnpackList_ = iConfig.getUntrackedParameter<std::vector<int> >("FEDs", std::vector<int>());
29  if (fedUnpackList_.empty())
31  fedUnpackList_.push_back(i);
32 }
33 
35  // do anything here that needs to be done at desctruction time
36  // (e.g. close files, deallocate resources etc.)
37 }
38 
39 //
40 // member functions
41 //
42 
43 // ------------ method called on each new Event ------------
45  const edm::EventSetup& iSetup,
46  trigger::TriggerFilterObjectWithRefs& filterproduct) const {
47  using namespace edm;
48 
50  iEvent.getByLabel(DataLabel_, rawdata);
51 
52  // get fed raw data and SM id
53 
54  // loop over FEDS
55  for (std::vector<int>::const_iterator i = fedUnpackList_.begin(); i != fedUnpackList_.end(); i++) {
56  // get fed raw data and SM id
57  const FEDRawData& fedData = rawdata->FEDData(*i);
58  int length = fedData.size() / sizeof(uint64_t);
59 
60  // LogDebug("EcalRawToDigi") << "raw data length: " << length ;
61  //if data size is not null interpret data
62  if (length >= 1) {
63  uint64_t* pData = (uint64_t*)(fedData.data());
64  //When crc error is found return true
65  uint64_t* fedTrailer = pData + (length - 1);
66  bool crcError = (*fedTrailer >> 2) & 0x1;
67  if (crcError) {
68  std::cout << "CRCERROR in FED " << *i << " trailer is " << std::setw(8) << std::hex << (*fedTrailer)
69  << std::endl;
70  return true;
71  }
72  }
73  }
74 
75  return false;
76 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
~EcalFEDErrorFilter() override
bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
std::vector< int > fedUnpackList_
int iEvent
Definition: GenABIO.cc:224
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
unsigned long long uint64_t
Definition: Time.h:15
HLT enums.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
EcalFEDErrorFilter(const edm::ParameterSet &)
edm::InputTag DataLabel_