Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:06

0001 #ifndef DaqSource_DaqFakeReader_h
0002 #define DaqSource_DaqFakeReader_h
0003 
0004 /** \class DaqFakeReader
0005  *  Generates empty FEDRawData of random size for all FEDs
0006  *  Proper headers and trailers are included; but the payloads are all 0s
0007  *  \author N. Amapane - CERN
0008  */
0009 
0010 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0011 #include "FWCore/Framework/interface/one/EDProducer.h"
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/EventSetup.h"
0014 #include "FWCore/Framework/interface/LuminosityBlock.h"
0015 #include "FWCore/Framework/interface/EventSetup.h"
0016 #include "DataFormats/Provenance/interface/EventID.h"
0017 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0018 #include <algorithm>
0019 
0020 class DaqFakeReader : public edm::one::EDProducer<> {
0021 public:
0022   //
0023   // construction/destruction
0024   //
0025   DaqFakeReader(const edm::ParameterSet& pset);
0026   ~DaqFakeReader() override;
0027 
0028   //
0029   // public member functions
0030   //
0031 
0032   // Generate and fill FED raw data for a full event
0033   virtual int fillRawData(edm::Event& e, FEDRawDataCollection*& data);
0034 
0035   void produce(edm::Event&, edm::EventSetup const&) override;
0036 
0037   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0038 
0039 private:
0040   //
0041   // private member functions
0042   //
0043   void fillFEDs(const int, const int, edm::EventID& eID, FEDRawDataCollection& data, float meansize, float width);
0044   void fillTCDSFED(edm::EventID& eID, FEDRawDataCollection& data, uint32_t ls, timeval* now);
0045   virtual void beginLuminosityBlock(edm::LuminosityBlock const& iL, edm::EventSetup const& iE);
0046 
0047 private:
0048   //
0049   // member data
0050   //
0051   edm::RunNumber_t runNum;
0052   edm::EventNumber_t eventNum;
0053   bool empty_events;
0054   bool fillRandom_;
0055   unsigned int meansize;  // in bytes
0056   unsigned int width;
0057   unsigned int injected_errors_per_million_events;
0058   unsigned int tcdsFEDID_;
0059   unsigned int modulo_error_events;
0060   unsigned int fakeLs_ = 0;
0061 };
0062 
0063 #endif