File indexing completed on 2024-04-06 12:19:14
0001 #ifndef DaqSource_DTDDUFileReader_h
0002 #define DaqSource_DTDDUFileReader_h
0003
0004
0005
0006
0007
0008
0009
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
0025 DTDDUFileReader(const edm::ParameterSet& pset);
0026
0027
0028 ~DTDDUFileReader() override;
0029
0030
0031 virtual int fillRawData(edm::Event& e,
0032
0033 FEDRawDataCollection*& data);
0034
0035 void produce(edm::Event&, edm::EventSetup const&) override;
0036
0037
0038 bool isHeader(uint64_t word, bool dataTag);
0039
0040
0041 bool isTrailer(uint64_t word, bool dataTag, unsigned int wordCount);
0042
0043
0044
0045 uint64_t dmaUnpack(bool& isData, int& nread);
0046
0047
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