forked from hep-cce2/root_serialization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRootSource.h
More file actions
50 lines (40 loc) · 1.2 KB
/
RootSource.h
File metadata and controls
50 lines (40 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#if !defined(RootSource_h)
#define RootSource_h
#include <string>
#include <memory>
#include <optional>
#include <vector>
#include "DataProductRetriever.h"
#include "DelayedProductRetriever.h"
#include "EventAuxReader.h"
#include "SourceBase.h"
#include "TFile.h"
class TBranch;
class TTree;
namespace cce::tf {
class RootDelayedRetriever : public DelayedProductRetriever {
void getAsync(DataProductRetriever&, int index, TaskHolder) override {}
};
class RootSource : public SourceBase {
public:
RootSource(std::string const& iName);
RootSource(RootSource&&) = default;
RootSource(RootSource const&) = default;
size_t numberOfDataProducts() const final {return dataProducts_.size();}
std::vector<DataProductRetriever>& dataProducts() final { return dataProducts_; }
EventIdentifier eventIdentifier() final;
bool readEvent(long iEventIndex) final;
private:
long numberOfEvents();
std::unique_ptr<TFile> file_;
TTree* events_;
RootDelayedRetriever delayedReader_;
EventAuxReader eventAuxReader_;
TBranch* eventIDBranch_ = nullptr;
TBranch* eventAuxBranch_ = nullptr;
EventIdentifier id_;
std::vector<DataProductRetriever> dataProducts_;
std::vector<TBranch*> branches_;
};
}
#endif