12#ifndef ROOT_RDF_RTREECOLUMNREADER
13#define ROOT_RDF_RTREECOLUMNREADER
45 std::unique_ptr<ROOT::Internal::TTreeReaderOpaqueValue>
fTreeValue;
76 bool fCopyWarningPrinted =
false;
80 if (entry == fLastEntry)
83 auto &readerArray = *fTreeArray;
88 const auto readerArraySize = readerArray.GetSize();
94 if (EStorageType::kUnknown == fStorageType && readerArraySize > 1) {
96 fStorageType = EStorageType::kContiguous;
97 for (
auto i = 0u; i < readerArraySize - 1; ++i) {
98 if ((
char *)&readerArray[i + 1] - (
char *)&readerArray[i] !=
sizeof(T)) {
99 fStorageType = EStorageType::kSparse;
105 if (EStorageType::kContiguous == fStorageType ||
106 (EStorageType::kUnknown == fStorageType && readerArray.GetSize() < 2)) {
107 if (readerArraySize > 0) {
111 auto readerArrayAddr = &readerArray.At(0);
112 RVec<T> rvec(readerArrayAddr, readerArraySize);
116 swap(fRVec, emptyVec);
121 if (!fCopyWarningPrinted) {
122 Warning(
"RTreeColumnReader::Get",
123 "Branch %s hangs from a non-split branch. A copy is being performed in order "
124 "to properly read the content.",
125 readerArray.GetBranchName());
126 fCopyWarningPrinted =
true;
129 (void)fCopyWarningPrinted;
131 if (readerArraySize > 0) {
132 RVec<T> rvec(readerArray.begin(), readerArray.end());
136 swap(fRVec, emptyVec);
168 auto &readerArray = *fTreeArray;
169 const auto readerArraySize = readerArray.GetSize();
170 if (readerArraySize > 0) {
172 RVec<bool> rvec(readerArray.begin(), readerArray.end());
176 swap(fRVec, emptyVec);
191template <
typename T, std::
size_t N>
193 std::unique_ptr<TTreeReaderArray<T>> fTreeArray;
202 if (entry == fLastEntry)
203 return fArray.
data();
206 RVec<T> view{&fTreeArray->At(0), fTreeArray->GetSize()};
213 return fArray.
data();
217 RTreeColumnReader(
TTreeReader &
r,
const std::string &colName)
#define R__unlikely(expr)
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
void * GetImpl(Long64_t entry) final
std::unique_ptr< TTreeReaderArray< T > > fTreeArray
RTreeColumnReader(TTreeReader &r, const std::string &colName)
EStorageType
Enumerator for the memory layout of the branch.
RVec< T > fRVec
We return a reference to this RVec to clients, to guarantee a stable address and contiguous memory la...
RVec< bool > fRVec
We return a reference to this RVec to clients, to guarantee a stable address and contiguous memory la...
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.
void * GetImpl(Long64_t) final
std::unique_ptr< TTreeReaderValue< T > > fTreeValue
std::unique_ptr< ROOT::Internal::TTreeReaderOpaqueValue > fTreeValue
RTreeOpaqueColumnReader(TTreeReader &r, const std::string &colName)
Construct the RTreeColumnReader. Actual initialization is performed lazily by the Init method.
void * GetImpl(Long64_t) final
Read a value in a branch without knowledge of its type.
@ kReadError
Problem reading data.
pointer data() noexcept
Return a pointer to the vector's buffer, even if empty().
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...