EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
JEventSourcePODIO.h
Go to the documentation of this file.
1// Copyright 2022, David Lawrence
2// Subject to the terms in the LICENSE file found in the top-level directory.
3//
4
5#pragma once
6
7#include <JANA/JApplicationFwd.h>
8#include <JANA/JEventSource.h>
9#include <JANA/JEventSourceGeneratorT.h>
10#include <podio/Frame.h>
11#include <podio/Reader.h>
12#include <spdlog/logger.h>
13#include <cstddef>
14#include <memory>
15#include <string>
16#include <string_view>
17#include <vector>
18
19class JEventSourcePODIO : public JEventSource {
20
21public:
22 JEventSourcePODIO(std::string resource_name, JApplication* app);
23
24 virtual ~JEventSourcePODIO();
25
26 void Open() override;
27
28 void Close() override;
29
30 Result Emit(JEvent& event) override;
31
32 static std::string GetDescription();
33
34 void PrintCollectionTypeTable(void);
35
36 std::vector<std::string_view> getAvailableCategories() const;
37 std::size_t getEntries(const std::string& category) const;
38 podio::Frame getFrame(const std::string& category, std::size_t index) const;
39
40protected:
41 std::unique_ptr<podio::Reader> m_reader;
42
43 std::size_t Nevents_in_file = 0;
44 std::size_t Nevents_read = 0;
45
46 bool m_run_forever = false;
48
49 std::shared_ptr<spdlog::logger> m_log;
50};
51
52template <> double JEventSourceGeneratorT<JEventSourcePODIO>::CheckOpenable(std::string);
Definition JEventSourcePODIO.h:19
std::vector< std::string_view > getAvailableCategories() const
Definition JEventSourcePODIO.cc:173
std::shared_ptr< spdlog::logger > m_log
Definition JEventSourcePODIO.h:49
static std::string GetDescription()
Definition JEventSourcePODIO.cc:237
std::size_t Nevents_read
Definition JEventSourcePODIO.h:44
void Open() override
Open the root file and read in metadata.
Definition JEventSourcePODIO.cc:124
Result Emit(JEvent &event) override
Definition JEventSourcePODIO.cc:192
virtual ~JEventSourcePODIO()
Definition JEventSourcePODIO.cc:115
std::size_t Nevents_in_file
Definition JEventSourcePODIO.h:43
std::size_t getEntries(const std::string &category) const
Definition JEventSourcePODIO.cc:177
std::unique_ptr< podio::Reader > m_reader
Definition JEventSourcePODIO.h:41
void PrintCollectionTypeTable(void)
Definition JEventSourcePODIO.cc:287
void Close() override
Definition JEventSourcePODIO.cc:168
bool m_use_event_headers
Definition JEventSourcePODIO.h:47
podio::Frame getFrame(const std::string &category, std::size_t index) const
Definition JEventSourcePODIO.cc:181
bool m_run_forever
Definition JEventSourcePODIO.h:46