Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:11:07

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