forked from hep-cce2/root_serialization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepeatingRootSource.h
More file actions
58 lines (46 loc) · 2.02 KB
/
RepeatingRootSource.h
File metadata and controls
58 lines (46 loc) · 2.02 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
51
52
53
54
55
56
57
58
#if !defined(RepeatingRootSource_h)
#define RepeatingRootSource_h
#include <string>
#include <memory>
#include <optional>
#include <vector>
#include "DataProductRetriever.h"
#include "DelayedProductRetriever.h"
#include "EventAuxReader.h"
#include "SharedSourceBase.h"
#include "TFile.h"
class TBranch;
class TTree;
namespace cce::tf {
class RepeatingRootDelayedRetriever : public DelayedProductRetriever {
void getAsync(DataProductRetriever&, int index, TaskHolder) override {}
};
class RepeatingRootSource : public SharedSourceBase {
public:
RepeatingRootSource(std::string const& iName, unsigned int iNUniqueEvents, unsigned int iNLanes, unsigned long long iNEvents,
std::string const& iBranchToRead);
RepeatingRootSource(RepeatingRootSource&&) = default;
RepeatingRootSource(RepeatingRootSource const&) = default;
~RepeatingRootSource() final;
size_t numberOfDataProducts() const final {return dataProductsPerLane_[0].size();}
std::vector<DataProductRetriever>& dataProducts(unsigned int iLane, long iEventIndex ) final { return dataProductsPerLane_[iLane]; }
EventIdentifier eventIdentifier(unsigned int iLane, long iEventIndex) final { return identifierPerEvent_[iEventIndex % nUniqueEvents_];}
void printSummary() const final;
std::chrono::microseconds accumulatedTime() const { return std::chrono::microseconds(accumulatedTime_.load());}
void readEventAsync(unsigned int iLane, long iEventIndex, OptionalTaskHolder) final;
struct BufferInfo {
BufferInfo(void* iAddress, size_t iSize): address_{iAddress}, size_{iSize} {}
void* address_;
size_t size_;
};
private:
void fillBuffer(int iEntry, std::vector<BufferInfo>& , std::vector<TBranch*>&);
unsigned int nUniqueEvents_;
RepeatingRootDelayedRetriever delayedReader_;
std::vector<std::vector<DataProductRetriever>> dataProductsPerLane_;
std::vector<std::vector<BufferInfo>> dataBuffersPerEvent_;
std::vector<EventIdentifier> identifierPerEvent_;
std::atomic<std::chrono::microseconds::rep> accumulatedTime_;
};
}
#endif