11#ifndef ROOT_RDF_RTREECOLUMNREADER
12#define ROOT_RDF_RTREECOLUMNREADER
71 bool fCopyWarningPrinted =
false;
75 auto &readerArray = *fTreeArray;
80 const auto arrSize = readerArray.GetSize();
81 if (EStorageType::kUnknown == fStorageType && arrSize > 1) {
83 fStorageType = EStorageType::kContiguous;
84 for (
auto i = 0u; i < arrSize - 1; ++i) {
85 if ((
char *)&readerArray[i + 1] - (
char *)&readerArray[i] !=
sizeof(T)) {
86 fStorageType = EStorageType::kSparse;
92 const auto readerArraySize = readerArray.GetSize();
93 if (EStorageType::kContiguous == fStorageType ||
94 (EStorageType::kUnknown == fStorageType && readerArray.GetSize() < 2)) {
95 if (readerArraySize > 0) {
99 auto readerArrayAddr = &readerArray.At(0);
100 RVec<T> rvec(readerArrayAddr, readerArraySize);
101 std::swap(fRVec, rvec);
104 std::swap(fRVec, emptyVec);
109 if (!fCopyWarningPrinted) {
110 Warning(
"RTreeColumnReader::Get",
111 "Branch %s hangs from a non-split branch. A copy is being performed in order "
112 "to properly read the content.",
113 readerArray.GetBranchName());
114 fCopyWarningPrinted =
true;
117 (
void)fCopyWarningPrinted;
119 if (readerArraySize > 0) {
120 RVec<T> rvec(readerArray.begin(), readerArray.end());
121 std::swap(fRVec, rvec);
124 std::swap(fRVec, emptyVec);
158 auto &readerArray = *fTreeArray;
159 const auto readerArraySize = readerArray.GetSize();
160 if (readerArraySize > 0) {
162 RVec<bool> rvec(readerArray.begin(), readerArray.end());
163 std::swap(fRVec, rvec);
166 std::swap(fRVec, emptyVec);
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
typedef void((*Func_t)())
std::unique_ptr< TTreeReaderArray< T > > fTreeArray
RTreeColumnReader(TTreeReader &r, const std::string &colName)
EStorageType
Enumerator for the memory layout of the branch.
~RTreeColumnReader()
See the other class template specializations for an explanation.
RVec< T > fRVec
We return a reference to this RVec to clients, to guarantee a stable address and contiguous memory la...
void * GetImpl(Long64_t) final
RVec< bool > fRVec
We return a reference to this RVec to clients, to guarantee a stable address and contiguous memory la...
~RTreeColumnReader()
See the other class template specializations for an explanation.
std::unique_ptr< TTreeReaderArray< bool > > fTreeArray
RTreeColumnReader(TTreeReader &r, const std::string &colName)
void * GetImpl(Long64_t) final
RTreeColumnReader specialization for TTree values read via TTreeReaderValues.
RTreeColumnReader(TTreeReader &r, const std::string &colName)
Construct the RTreeColumnReader. Actual initialization is performed lazily by the Init method.
~RTreeColumnReader()
The dtor resets the TTreeReaderValue object.
void * GetImpl(Long64_t) final
std::unique_ptr< TTreeReaderValue< T > > fTreeValue
A "std::vector"-like collection of values implementing handy operation to analyse them.
An interface for reading collections stored in ROOT columnar datasets.
An interface for reading values stored in ROOT columnar datasets.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...