Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:14

0001 #ifndef DaqSource_DTDDUFileReader_h
0002 #define DaqSource_DTDDUFileReader_h
0003 
0004 /** \class DTDDUFileReader
0005  *  Read DT ROS8 raw data files
0006  *
0007  *  $Date: 2010/02/03 16:58:24 $
0008  *  $Revision: 1.11 $
0009  *  \author M. Zanetti - INFN Padova
0010  */
0011 #include "FWCore/Framework/interface/one/EDProducer.h"
0012 #include "IORawData/DTCommissioning/plugins/RawFile.h"
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "DataFormats/Provenance/interface/EventID.h"
0016 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0017 
0018 #include <ostream>
0019 #include <fstream>
0020 #include <cstdint>
0021 
0022 class DTDDUFileReader : public edm::one::EDProducer<> {
0023 public:
0024   /// Constructor
0025   DTDDUFileReader(const edm::ParameterSet& pset);
0026 
0027   /// Destructor
0028   ~DTDDUFileReader() override;
0029 
0030   /// Generate and fill FED raw data for a full event
0031   virtual int fillRawData(edm::Event& e,
0032                           //              edm::Timestamp& tstamp,
0033                           FEDRawDataCollection*& data);
0034 
0035   void produce(edm::Event&, edm::EventSetup const&) override;
0036 
0037   /// check for a 64 bits word to be a DDU header
0038   bool isHeader(uint64_t word, bool dataTag);
0039 
0040   /// check for a 64 bits word to be a DDU trailer
0041   bool isTrailer(uint64_t word, bool dataTag, unsigned int wordCount);
0042 
0043   /// pre-unpack the data if read via DMA
0044   //  std::pair<uint64_t,bool> dmaUnpack();
0045   uint64_t dmaUnpack(bool& isData, int& nread);
0046 
0047   /// swapping the lsBits with the msBits
0048   void swap(uint64_t& word);
0049 
0050   virtual bool checkEndOfFile();
0051 
0052 private:
0053   RawFile inputFile;
0054 
0055   edm::RunNumber_t runNumber;
0056   edm::EventNumber_t eventNumber;
0057 
0058   int dduID;
0059 
0060   bool readFromDMA;
0061   int skipEvents;
0062   int numberOfHeaderWords;
0063 
0064   static const int dduWordLength = 8;
0065 };
0066 #endif