File indexing completed on 2024-09-07 04:36:17
0001 #ifndef EventFilter_Utilities_FRDStreamSource_h
0002 #define EventFilter_Utilities_FRDStreamSource_h
0003
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/LuminosityBlock.h"
0007 #include "FWCore/Framework/interface/Run.h"
0008 #include "FWCore/Framework/interface/InputSourceMacros.h"
0009
0010 #include "FWCore/Sources/interface/ProducerSourceFromFiles.h"
0011
0012 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0013 #include "DataFormats/Provenance/interface/Timestamp.h"
0014
0015 #include <unistd.h>
0016 #include <string>
0017 #include <vector>
0018 #include <fstream>
0019
0020 class FRDStreamSource : public edm::ProducerSourceFromFiles {
0021 public:
0022
0023 FRDStreamSource(edm::ParameterSet const& pset, edm::InputSourceDescription const& desc);
0024 ~FRDStreamSource() override {}
0025
0026 private:
0027
0028 bool setRunAndEventInfo(edm::EventID& id,
0029 edm::TimeValue_t& theTime,
0030 edm::EventAuxiliary::ExperimentType& eType) override;
0031 void produce(edm::Event& e) override;
0032
0033 bool openFile(const std::string& fileName);
0034
0035 private:
0036
0037 std::vector<std::string> fileNames_;
0038 std::vector<std::string>::const_iterator itFileName_;
0039 std::vector<std::string>::const_iterator endFileName_;
0040 std::ifstream fin_;
0041 std::unique_ptr<FEDRawDataCollection> rawData_;
0042 std::vector<char> buffer_;
0043 const bool verifyAdler32_;
0044 const bool verifyChecksum_;
0045 const bool useL1EventID_;
0046 uint16_t detectedFRDversion_ = 0;
0047 uint16_t flags_ = 0;
0048 };
0049
0050 #endif