Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-12 23:41:43

0001 #ifndef DaqSource_DTHFakeReader_h
0002 #define DaqSource_DTHFakeReader_h
0003 
0004 /** \class DTHFakeReader
0005  *  Fills FedRawData with DTH orbits for writeout to emulate EVB file writing
0006  *  Proper Phase-2 headers and trailers are included;
0007  */
0008 
0009 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0010 #include "FWCore/Framework/interface/one/EDProducer.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/Framework/interface/LuminosityBlock.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "DataFormats/Provenance/interface/EventID.h"
0016 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0017 #include "EventFilter/Utilities/interface/DTHHeaders.h"
0018 #include <algorithm>
0019 
0020 namespace evf {
0021 
0022   class DTHFakeReader : public edm::one::EDProducer<> {
0023   public:
0024     DTHFakeReader(const edm::ParameterSet& pset);
0025     ~DTHFakeReader() override {}
0026 
0027     void produce(edm::Event&, edm::EventSetup const&) override;
0028 
0029     static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0030 
0031   private:
0032     // Generate and fill FED raw data for a full event
0033     void fillRawData(edm::Event& e, FEDRawDataCollection*& data);
0034 
0035     uint32_t fillSLRFED(unsigned char* buf,
0036                         const uint32_t sourceId,
0037                         edm::EventNumber_t eventId,
0038                         const uint32_t orbitId,
0039                         uint32_t size,
0040                         uint32_t& accum_crc32c);
0041     uint32_t fillFED(
0042         unsigned char* buf, const int sourceId, edm::EventNumber_t eventId, uint32_t size, uint32_t& accum_crc32c);
0043     //void fillTCDSFED(edm::EventID& eID, FEDRawDataCollection& data, uint32_t ls, timeval* now);
0044     virtual void beginLuminosityBlock(edm::LuminosityBlock const& iL, edm::EventSetup const& iE);
0045 
0046   private:
0047     bool fillRandom_;
0048     unsigned int meansize_;  // in bytes
0049     unsigned int width_;
0050     unsigned int injected_errors_per_million_events_;
0051     std::vector<unsigned int> sourceIdList_;
0052     unsigned int modulo_error_events_;
0053     unsigned int fakeLs_ = 0;
0054   };
0055 }  //namespace evf
0056 
0057 #endif