epic-drich-beam-test-analysis
ePIC dRICH beam test analysis framework
Loading...
Searching...
No Matches
alcor_data_streamer.h
Go to the documentation of this file.
1#pragma once
2
12#include <string>
13#include "TFile.h"
14#include "TTree.h"
15#include "alcor_data.h"
16
18{
19public:
20 // -------------------------------------------------------------------------
22
23
28 explicit alcor_data_streamer(const std::string &fname);
29
35
42
45
47 ~alcor_data_streamer() noexcept;
48
50
51 // -------------------------------------------------------------------------
53
54
56 bool is_valid() const noexcept;
57
59 bool eof() const noexcept;
60
62
63 // -------------------------------------------------------------------------
65
66
68 std::string get_filename() const noexcept;
69
71 const alcor_data &current() const noexcept;
72
74 alcor_data &current() noexcept;
75
77 Long64_t entry() const noexcept;
78
80 Long64_t entries() const noexcept;
81
83
84 // -------------------------------------------------------------------------
86
87
89 bool read_next() noexcept;
90
92 void rewind() noexcept;
93
95
96private:
97 // -------------------------------------------------------------------------
99
100
101 std::string filename;
102 TFile *file = nullptr;
103 TTree *tree = nullptr;
104 alcor_data data;
105 Long64_t n_entries = 0;
106 Long64_t cursor = 0;
107 bool valid = false;
108
110};
Data structures and utilities for ALCOR hit-level data handling.
Definition alcor_data_streamer.h:18
~alcor_data_streamer() noexcept
Reset branch addresses, close and delete the underlying TFile.
Definition alcor_data_streamer.cxx:45
std::string get_filename() const noexcept
Path of the underlying ROOT file.
Definition alcor_data_streamer.cxx:63
alcor_data_streamer & operator=(alcor_data_streamer &&other) noexcept
Move-assign; source is left invalid after the operation.
Definition alcor_data_streamer.cxx:26
void rewind() noexcept
Reset the cursor to 0 without re-opening the file.
Definition alcor_data_streamer.cxx:79
bool is_valid() const noexcept
true if the file and TTree were opened successfully.
Definition alcor_data_streamer.cxx:58
bool eof() const noexcept
true once the cursor has passed the last entry.
Definition alcor_data_streamer.cxx:59
Long64_t entries() const noexcept
Total number of entries in the TTree.
Definition alcor_data_streamer.cxx:67
alcor_data & current() noexcept
Mutable view of the entry last loaded by read_next().
Definition alcor_data_streamer.cxx:65
Long64_t entry() const noexcept
Zero-based index of the entry that will be read next.
Definition alcor_data_streamer.cxx:66
bool read_next() noexcept
Load the next entry into current(); returns false at EOF or on error.
Definition alcor_data_streamer.cxx:71
First-level I/O helper class from the ALCOR decoder.
Definition alcor_data.h:124