File indexing completed on 2025-01-18 10:01:14
0001
0002
0003
0004
0005
0006 #ifndef HEPMC3_READERROOTTREE_H
0007 #define HEPMC3_READERROOTTREE_H
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <string>
0022 #include "HepMC3/Reader.h"
0023 #include "HepMC3/GenEvent.h"
0024 #include "HepMC3/Data/GenEventData.h"
0025 #include "HepMC3/Data/GenRunInfoData.h"
0026
0027
0028 #include "TFile.h"
0029 #include "TTree.h"
0030 #include "TBranch.h"
0031
0032 namespace HepMC3
0033 {
0034
0035 class ReaderRootTree : public Reader
0036 {
0037
0038
0039
0040 public:
0041
0042 ReaderRootTree(const std::string &filename);
0043
0044 ReaderRootTree(const std::string &filename, const std::string &treename, const std::string &branchname);
0045
0046
0047
0048
0049 public:
0050
0051 bool skip(const int) override;
0052
0053
0054
0055
0056
0057 bool read_event(GenEvent &evt) override;
0058
0059
0060 void close() override;
0061
0062
0063 bool failed() override;
0064
0065 private:
0066
0067 bool init();
0068
0069
0070
0071 private:
0072 TFile* m_file = nullptr;
0073 public:
0074 TTree* m_tree = nullptr;
0075 private:
0076 int m_events_count = 0;
0077 GenEventData* m_event_data = nullptr;
0078 GenRunInfoData* m_run_info_data = nullptr;
0079 std::string m_tree_name;
0080 std::string m_branch_name;
0081 };
0082
0083 }
0084
0085 #endif