sandreco  1.0.8
A modular reconstruction software for SAND
edep_reader.hpp
1 #pragma once
2 
3 #include <common/data.h>
4 #include <edep_reader/EDEPTree.h>
5 
6 #include <EDepSim/TG4Event.h>
7 
8 class TFile;
9 class TTree;
10 
11 namespace sand {
12 
14  : public EDEPTree
15  , public ufw::data::base<ufw::data::complex_tag, ufw::data::unique_tag, ufw::data::context_tag> {
16  TG4Event* m_event{nullptr};
17 
18  using EDEPTree::EDEPTree;
19  friend class ufw::data::factory<sand::edep_reader>;
20 
21  public:
22  TG4Event const& event() const {
23  if (m_event != nullptr) {
24  return *m_event;
25  }
26  UFW_ERROR("Event not initialized");
27  }
28  };
29 
30 } // namespace sand
31 
32 UFW_DECLARE_COMPLEX_DATA(sand::edep_reader);
33 
34 template <>
35 class ufw::data::factory<sand::edep_reader> {
36  public:
37  factory(const ufw::config&);
38  ~factory();
39  sand::edep_reader& instance(ufw::context_id);
40 
41  private:
42  sand::edep_reader reader;
43  std::unique_ptr<TFile> input_file;
44  TTree* input_tree;
45  std::unique_ptr<TG4Event> event_owner;
46  TG4Event* event;
47  ufw::context_id m_id;
48 };
Tree of the trajectories of an edep-sim event. The tree itself is the (id -1) root,...
Definition: EDEPTree.h:24
Definition: edep_reader.hpp:15