File indexing completed on 2025-06-30 08:34:31
0001
0002
0003
0004
0005 #pragma once
0006
0007 #include <JANA/JApplicationFwd.h>
0008 #include <JANA/JEvent.h>
0009 #include <JANA/JEventSource.h>
0010 #include <JANA/JEventSourceGeneratorT.h>
0011 #include <podio/ROOTReader.h>
0012 #include <spdlog/logger.h>
0013 #include <cstddef>
0014 #include <memory>
0015 #include <string>
0016
0017 #if ((JANA_VERSION_MAJOR == 2) && (JANA_VERSION_MINOR >= 3)) || (JANA_VERSION_MAJOR > 2)
0018 #define JANA_NEW_CALLBACK_STYLE 1
0019 #else
0020 #define JANA_NEW_CALLBACK_STYLE 0
0021 #endif
0022
0023 class JEventSourcePODIO : public JEventSource {
0024
0025 public:
0026 JEventSourcePODIO(std::string resource_name, JApplication* app);
0027
0028 virtual ~JEventSourcePODIO();
0029
0030 void Open() override;
0031
0032 void Close() override;
0033
0034 #if JANA_NEW_CALLBACK_STYLE
0035 Result Emit(JEvent& event) override;
0036 #else
0037 void GetEvent(std::shared_ptr<JEvent>) override;
0038 #endif
0039
0040 static std::string GetDescription();
0041
0042 void PrintCollectionTypeTable(void);
0043
0044 protected:
0045 podio::ROOTReader m_reader;
0046
0047 std::size_t Nevents_in_file = 0;
0048 std::size_t Nevents_read = 0;
0049
0050 bool m_run_forever = false;
0051 bool m_use_event_headers = true;
0052
0053 private:
0054 std::shared_ptr<spdlog::logger> m_log;
0055 };
0056
0057 template <> double JEventSourceGeneratorT<JEventSourcePODIO>::CheckOpenable(std::string);