File indexing completed on 2024-04-06 12:11:04
0001 #ifndef EventFilter_Utilities_DAQSourceModels_h
0002 #define EventFilter_Utilities_DAQSourceModels_h
0003
0004 #include <condition_variable>
0005 #include <cstdio>
0006 #include <filesystem>
0007 #include <memory>
0008 #include <mutex>
0009 #include <thread>
0010
0011 #include "tbb/concurrent_queue.h"
0012 #include "tbb/concurrent_vector.h"
0013
0014 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
0015 #include "DataFormats/Provenance/interface/Timestamp.h"
0016 #include "EventFilter/Utilities/interface/EvFDaqDirector.h"
0017 #include "FWCore/Sources/interface/RawInputSource.h"
0018 #include "FWCore/Framework/interface/EventPrincipal.h"
0019 #include "FWCore/Sources/interface/DaqProvenanceHelper.h"
0020 #include "FWCore/ServiceRegistry/interface/Service.h"
0021 #include "IOPool/Streamer/interface/FRDEventMessage.h"
0022
0023 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0024 #include "DataFormats/Provenance/interface/LuminosityBlockAuxiliary.h"
0025
0026
0027 #include "EventFilter/Utilities/interface/FedRawDataInputSource.h"
0028
0029 class DAQSource;
0030
0031
0032 class DataMode {
0033 public:
0034 DataMode(DAQSource* daqSource) : daqSource_(daqSource) {}
0035 virtual ~DataMode() = default;
0036 virtual std::vector<std::shared_ptr<const edm::DaqProvenanceHelper>>& makeDaqProvenanceHelpers() = 0;
0037 virtual void readEvent(edm::EventPrincipal& eventPrincipal) = 0;
0038 virtual int dataVersion() const = 0;
0039 virtual void detectVersion(unsigned char* fileBuf, uint32_t fileHeaderOffset) = 0;
0040 virtual uint32_t headerSize() const = 0;
0041 virtual bool versionCheck() const = 0;
0042 virtual uint64_t dataBlockSize() const = 0;
0043 virtual void makeDataBlockView(unsigned char* addr,
0044 size_t maxSize,
0045 std::vector<uint64_t> const& fileSizes,
0046 size_t fileHeaderSize) = 0;
0047 virtual bool nextEventView() = 0;
0048 virtual bool checksumValid() = 0;
0049 virtual std::string getChecksumError() const = 0;
0050 virtual bool isRealData() const = 0;
0051 virtual uint32_t run() const = 0;
0052 virtual bool dataBlockCompleted() const = 0;
0053 virtual bool requireHeader() const = 0;
0054 virtual bool fitToBuffer() const = 0;
0055
0056 virtual bool dataBlockInitialized() const = 0;
0057 virtual void setDataBlockInitialized(bool) = 0;
0058
0059 virtual void setTCDSSearchRange(uint16_t, uint16_t) = 0;
0060 virtual std::pair<bool, std::vector<std::string>> defineAdditionalFiles(std::string const& primaryName,
0061 bool fileListMode) const = 0;
0062
0063 virtual bool isMultiDir() { return false; }
0064 virtual void makeDirectoryEntries(std::vector<std::string> const& baseDirs,
0065 std::vector<int> const& numSources,
0066 std::string const& runDir) = 0;
0067 void setTesting(bool testing) { testing_ = testing; }
0068
0069 protected:
0070 DAQSource* daqSource_;
0071 bool testing_ = false;
0072 };
0073
0074 #endif