12#ifndef O2_FRAMEWORK_ASOA_H_
13#define O2_FRAMEWORK_ASOA_H_
16#error "Please do not include this file in ROOT dictionary generation"
31#include <fairmq/Version.h>
32#include <arrow/array/array_binary.h>
33#include <arrow/table.h>
34#include <arrow/array.h>
35#include <arrow/util/config.h>
36#include <gandiva/selection_vector.h>
39#include <fmt/format.h>
51using ListVector = std::vector<std::vector<int64_t>>;
73 return (
c >=
'A' &&
c <=
'Z') ?
static_cast<char>(
c + 32) :
c;
76template <
typename... C>
79 return std::vector<std::shared_ptr<arrow::Field>>{C::asArrowField()...};
108 return (this->label_hash ==
other.label_hash) &&
109 (this->desc_hash ==
other.desc_hash) &&
110 (this->origin_hash ==
other.origin_hash) &&
111 (this->version ==
other.version);
116 return this->desc_hash ==
other.desc_hash;
121 return this->desc_hash == _desc_hash;
131template <
size_t N1,
size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2>
134 constexpr const int duplicates = std::ranges::count_if(ar2.begin(), ar2.end(), [&](
TableRef const&
a)
consteval { return std::any_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }); });
135 std::array<TableRef, N1 + N2 - duplicates> out;
137 auto pos = std::copy(ar1.begin(), ar1.end(), out.begin());
138 std::copy_if(ar2.begin(), ar2.end(),
pos, [&](TableRef
const&
a)
consteval { return std::none_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }); });
142template <
size_t N1,
size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2,
typename L>
145 constexpr const int to_remove = std::ranges::count_if(ar1.begin(), ar1.end(), [&](
TableRef const&
a)
consteval { return !l(a); });
146 constexpr const int duplicates = std::ranges::count_if(ar2.begin(), ar2.end(), [&](
TableRef const&
a)
consteval { return std::any_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }) || !l(
a); });
147 std::array<TableRef, N1 + N2 - duplicates - to_remove> out;
149 auto pos = std::copy_if(ar1.begin(), ar1.end(), out.begin(), [&](TableRef
const&
a)
consteval { return l(a); });
150 std::copy_if(ar2.begin(), ar2.end(),
pos, [&](TableRef
const&
a)
consteval { return std::none_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }) && l(
a); });
154template <
size_t N, std::array<TableRef, N> ar,
typename L>
157 constexpr const int to_remove = std::ranges::count_if(ar.begin(), ar.end(), [&l](
TableRef const&
e)
consteval { return l(e); });
158 std::array<
TableRef, N - to_remove> out;
159 std::copy_if(ar.begin(), ar.end(), out.begin(), [&l](
TableRef const&
e)
consteval { return !l(e); });
163template <
size_t N1,
size_t N2, std::array<TableRef, N1> ar1, std::array<TableRef, N2> ar2>
164consteval auto intersect()
166 constexpr const int duplicates = std::ranges::count_if(ar2.begin(), ar2.end(), [&](
TableRef const&
a)
consteval { return std::any_of(ar1.begin(), ar1.end(), [&](TableRef const& e) { return e == a; }); });
167 std::array<TableRef, duplicates> out;
168 std::copy_if(ar1.begin(), ar1.end(), out.begin(), [](TableRef
const&
a)
consteval { return std::find(ar2.begin(), ar2.end(), a) != ar2.end(); });
172template <
typename T,
typename... Ts>
174 requires(
sizeof...(Ts) == 1)
177 return merge<T::originals.size(), T1::originals.size(), T::originals, T1::originals>();
180template <
typename T,
typename...
Ts>
182 requires(
sizeof...(Ts) > 1)
185 return merge<T::originals.size(), tail.size(), T::originals, tail>();
188template <
typename T,
typename...
Ts>
189 requires(
sizeof...(Ts) == 1)
190consteval
auto intersectOriginals()
193 return intersect<T::originals.size(), T1::originals.size(), T::originals, T1::originals>();
196template <
typename T,
typename...
Ts>
197 requires(
sizeof...(Ts) > 1)
198consteval
auto intersectOriginals()
201 return intersect<T::originals.size(), tail.size(), T::originals, tail>();
215using is_external_index_t =
typename std::conditional_t<is_index_column<C>, std::true_type, std::false_type>;
218using is_self_index_t =
typename std::conditional_t<is_self_index_column<C>, std::true_type, std::false_type>;
225template <
typename Key,
size_t N, std::array<
bool, N> map>
226static consteval int getIndexPosToKey_impl()
228 constexpr const auto pos = std::find(map.begin(), map.end(),
true);
229 if constexpr (
pos != map.end()) {
230 return std::distance(map.begin(),
pos);
238template <
typename D,
typename... Cs>
246 template <
typename Key,
typename... PCs>
249 return std::array<
bool,
sizeof...(PCs)>{[]()
consteval {
250 if constexpr (
requires { PCs::index_targets.size(); }) {
251 return Key::template isIndexTargetOf<PCs::index_targets.size(), PCs::index_targets>();
258 template <
typename Key>
282 static constexpr char const*
const str{
""};
286template <
size_t N, std::array<soa::TableRef, N> ar,
typename Key>
289 constexpr std::array<bool, N>
test = []<
size_t... Is>(std::index_sequence<Is...>)
consteval {
290 return std::array<bool, N>{(Key::template hasOriginal<ar[Is]>() || (
o2::aod::MetadataTrait<
o2::aod::Hash<ar[Is].desc_hash>>::metadata::template getIndexPosToKey<Key>() >= 0))...};
291 }(std::make_index_sequence<N>());
292 constexpr int correct = std::ranges::count(
test.begin(),
test.end(),
true);
293 std::array<soa::TableRef, correct> out;
294 std::ranges::copy_if(ar.begin(), ar.end(), out.begin(), [&
test](
soa::TableRef const&
r)
consteval { return test[std::distance(ar.begin(), std::find(ar.begin(), ar.end(), r))]; });
299#define O2HASH(_Str_) \
301 struct Hash<_Str_ ""_h> { \
302 static constexpr void isHash() {}; \
303 static constexpr uint32_t hash = _Str_ ""_h; \
304 static constexpr char const* const str{_Str_}; \
308#define O2ORIGIN(_Str_) \
310 struct Hash<_Str_ ""_h> { \
311 static constexpr void isHash() {}; \
312 static constexpr void isOriginHash() {}; \
313 static constexpr header::DataOrigin origin{_Str_}; \
314 static constexpr uint32_t hash = _Str_ ""_h; \
315 static constexpr char const* const str{_Str_}; \
321 if (
str[0] ==
'\0') {
329 if (
str[
len - 1] ==
'\0') {
332 for (
auto i =
len + 1;
str[
i] !=
'\0'; ++
i) {
339static inline constexpr std::string_view description_str(
const char*
const str)
345 return std::string_view{
str,
len};
355 for (
auto i = 0;
i < 16; ++
i) {
358 std::memcpy(out,
str,
len);
363template <soa::TableRef R>
369template <soa::TableRef R>
375template <soa::TableRef R>
381template <soa::TableRef R>
387template <soa::TableRef R>
390 return {origin<R>(),
description(signature<R>()),
R.version};
394template <soa::TableRef R>
395static constexpr auto sourceSpec()
397 return fmt::format(
"{}/{}/{}/{}",
label<R>(), origin_str<R>(), description_str(signature<R>()),
R.version);
401template <
size_t N, std::array<soa::TableRef, N> ar, o2::aod::is_origin_hash O>
404 std::array<soa::TableRef, N>
res;
405 for (
auto i = 0U;
i < N; ++
i) {
406 res[
i].label_hash = ar[
i].label_hash;
407 res[
i].desc_hash = ar[
i].desc_hash;
408 res[
i].origin_hash = O::hash;
409 res[
i].version = ar[
i].version;
417template <aod::is_aod_hash L, aod::is_aod_hash D, aod::is_origin_hash O,
typename... Ts>
422 void const*
ptr =
nullptr;
426 template <
typename T>
430 hash = o2::framework::TypeIdHelpers::uniqueId<T>();
434 template <
typename T>
437 if (
hash == o2::framework::TypeIdHelpers::uniqueId<T>()) {
438 return static_cast<T const*
>(
ptr);
446template <
typename B,
typename E>
448 constexpr static bool value =
false;
451template <aod::is_aod_hash A, aod::is_aod_hash B>
453 constexpr static bool value =
false;
456template <
typename B,
typename E>
459template <aod::is_aod_hash A, aod::is_aod_hash B>
498template <
typename T,
typename ChunkingPolicy = Chunked>
501 static constexpr char SCALE_FACTOR = std::same_as<std::decay_t<T>,
bool> ? 3 : 0;
517 auto array = getCurrentArray();
532 auto previousArray = getCurrentArray();
535 auto array = getCurrentArray();
542 auto previousArray = getCurrentArray();
545 auto array = getCurrentArray();
567 auto array = getCurrentArray();
574 requires
std::same_as<
bool,
std::decay_t<T>>
590 decltype(
auto)
operator*()
const
591 requires((!std::same_as<bool, std::decay_t<T>>) && std::same_as<
arrow_array_for_t<T>, arrow::BinaryViewArray>)
598 decltype(
auto)
operator*()
const
621 void checkSkipChunk() const
630 void checkSkipChunk() const
638 void checkSkipChunk() const
643 auto getCurrentArray() const
647 chunkToUse = std::dynamic_pointer_cast<arrow::FixedSizeListArray>(chunkToUse)->values();
648 return std::static_pointer_cast<arrow_array_for_t<value_for_t<T>>>(chunkToUse);
651 auto getCurrentArray() const
655 chunkToUse = std::dynamic_pointer_cast<arrow::ListArray>(chunkToUse)->values();
656 return std::static_pointer_cast<arrow_array_for_t<value_for_t<T>>>(chunkToUse);
659 auto getCurrentArray() const
663 return std::static_pointer_cast<arrow_array_for_t<T>>(chunkToUse);
667template <
typename T,
typename INHERIT>
685 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
693 return std::make_shared<arrow::Field>(inherited_t::mLabel, soa::asArrowDataType<type>());
703template <
typename F,
typename INHERIT>
708 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
711template <
typename INHERIT>
717 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
720template <
typename INHERIT>
726 static constexpr const char*
const&
columnLabel() {
return INHERIT::mLabel; }
729template <
size_t M = 0>
733 constexpr inline static auto value = M;
748 static constexpr const char*
mLabel =
"Marker";
815 static constexpr const char*
mLabel =
"Index";
845 mSelectedRows(selection),
846 mMaxSelection(selection.
size()),
854 mSelectedRows = selection;
855 mMaxSelection = selection.size();
865 [[nodiscard]] std::tuple<int64_t const*, int64_t const*>
868 return std::make_tuple(&
mRowIndex, &mSelectionRow);
871 [[nodiscard]] std::tuple<uint64_t const*>
874 return std::make_tuple(&
mOffset);
881 mMaxSelection = std::min(
end, mMaxSelection);
899 return lh.mSelectionRow == rh.mSelectionRow;
912 this->mSelectionRow = this->mMaxSelection;
918 return mSelectionRow;
921 [[nodiscard]]
auto size()
const
923 return mMaxSelection;
932 inline void updateRow()
936 std::span<int64_t const> mSelectedRows;
974 [[nodiscard]] std::tuple<int64_t const*, int64_t const*>
980 [[nodiscard]] std::tuple<uint64_t const*>
983 return std::make_tuple(&
mOffset);
1020template <
typename C>
1026template <
typename C>
1029template <
typename D,
typename O,
typename IP,
typename... C>
1045 if (this->
size() != 0) {
1055 if (this->
size() != 0) {
1062 this->limitRange(this->rangeStart(), this->rangeEnd());
1068 C(static_cast<
C const&>(
other))...
1070 if (this->
size() != 0) {
1077 IP::operator=(
static_cast<IP const&
>(
other));
1078 (
void(
static_cast<C&
>(*
this) =
static_cast<C>(
other)), ...);
1079 if (this->
size() != 0) {
1086 requires std::same_as<IP, DefaultIndexPolicy>
1088 C(
static_cast<C const&
>(
other))...
1090 if (this->
size() != 0) {
1097 this->moveByIndex(1);
1110 this->moveByIndex(-1);
1125 copy.moveByIndex(inc);
1139 template <
typename CL>
1142 return CL::getCurrentRaw();
1145 template <
typename... Cs>
1148 return std::vector<o2::soa::Binding>{
static_cast<Cs const&
>(*this).getCurrentRaw()...};
1156 template <
typename... TA>
1160 (CCs::setCurrent(cur), ...);
1165 template <
typename TA>
1169 (CCs::setCurrent(cur), ...);
1173 template <
typename... Cs>
1176 (Cs::setCurrentRaw(ptrs[framework::has_type_at_v<Cs>(p)]), ...);
1179 template <
typename... Cs,
typename I>
1184 (Cs::setCurrentRaw(
b), ...);
1192 template <
typename I>
1200 [&pointerReconstructor,
this]<
typename... Cs>(
framework::pack<Cs...>) {
1201 ([&pointerReconstructor,
this]<
typename CC>() {
1203 if (pointerReconstructor) {
1204 CC::ptrRec = &pointerReconstructor;
1207 }.template operator()<Cs>(),
1214 template <
typename... PC>
1217 (PC::mColumnIterator.moveToEnd(), ...);
1226 [
this]<
soa::is_persistent_column T>(T*) ->
void { T::mColumnIterator.mCurrentPos = &this->mRowIndex; T::mColumnIterator.mGlobalOffset = &this->mOffset; },
1227 [
this]<soa::is_dynamic_column T>(T*) ->
void { bindDynamicColumn<T>(
typename T::bindings_t{}); },
1228 [
this]<
typename T>(
T*) ->
void {},
1230 (
f(
static_cast<C*
>(
nullptr)), ...);
1231 if constexpr (has_index<
C...>) {
1232 this->setIndices(this->getIndices());
1233 this->setOffsets(this->getOffsets());
1237 template <
typename DC,
typename...
B>
1240 DC::boundIterators = std::make_tuple(getDynamicBinding<B>()...);
1248 template <
typename B>
1249 requires(can_bind<self_t, B>)
1250 decltype(
auto) getDynamicBinding()
1252 static_assert(std::same_as<decltype(&(static_cast<B*>(
this)->mColumnIterator)), std::decay_t<
decltype(B::mColumnIterator)>*>,
"foo");
1253 return &(
static_cast<B*
>(
this)->mColumnIterator);
1256 template <
typename B>
1257 decltype(
auto) getDynamicBinding()
1259 return static_cast<std::decay_t<decltype(B::mColumnIterator)
>*>(
nullptr);
1274template <
size_t N1, std::array<TableRef, N1> os1,
size_t N2, std::array<TableRef, N2> os2>
1277 return []<
size_t NN2,
size_t... Is>(std::index_sequence<Is...>)
consteval {
1278 return ([]<
size_t... Ks>(std::index_sequence<Ks...>)
consteval {
1279 constexpr auto h = os1[Is].desc_hash;
1282 }(std::make_index_sequence<NN2>()) ||
1284 }.template operator()<N2>(std::make_index_sequence<N1>());
1287template <with_originals T, with_originals B>
1290 return is_compatible<T::originals.size(), T::originals, B::originals.size(), B::originals>();
1293template <
typename T,
typename B>
1294using is_binding_compatible = std::conditional_t<is_binding_compatible_v<T, typename B::binding_t>(), std::true_type, std::false_type>;
1296template <soa::is_table T>
1297static constexpr std::string getLabelForTable()
1299 return std::string{aod::label<std::decay_t<T>::originals[0]>()};
1302template <soa::is_table T>
1304static constexpr std::string getLabelFromType()
1306 return getLabelForTable<T>();
1309template <soa::is_iterator T>
1310static constexpr std::string getLabelFromType()
1312 return getLabelForTable<typename std::decay_t<T>::parent_t>();
1315template <soa::is_index_table T>
1316static constexpr std::string getLabelFromType()
1318 return getLabelForTable<typename std::decay_t<T>::first_t>();
1320template <soa::with_base_table T>
1321 requires(!soa::is_iterator<T>)
1322static constexpr std::string getLabelFromType()
1327template <
typename...
C>
1330 auto caseInsensitiveCompare = [](
const std::string_view& str1,
const std::string_view& str2) {
1331 return std::ranges::equal(
1333 [](
char c1,
char c2) {
1338 return (caseInsensitiveCompare(C::inherited_t::mLabel,
key) || ...);
1341template <TableRef ref>
1342static constexpr std::pair<bool, std::string> hasKey(std::string_view
key)
1347template <TableRef ref>
1348static constexpr std::pair<bool, framework::ConcreteDataMatcher> hasKeyM(std::string_view
key)
1356template <with_originals T,
bool OPT = false>
1357static constexpr std::string getLabelFromTypeForKey(std::string_view
key)
1359 auto locate = []<
size_t... Is>(std::index_sequence<Is...>, std::string_view
key) {
1360 return std::array{hasKey<T::originals[Is]>(
key)...} |
1361 std::views::filter([](
auto const&
x) {
return x.first; });
1362 }(std::make_index_sequence<T::originals.size()>{},
key);
1363 if (!locate.empty()) {
1364 return locate.front().second;
1367 if constexpr (!OPT) {
1375template <with_originals T,
bool OPT = false>
1378 auto locate = []<
size_t... Is>(std::index_sequence<Is...>, std::string_view
key) {
1379 return std::array{hasKeyM<T::originals[Is]>(
key)...} |
1380 std::views::filter([](
auto const&
x) {
return x.first; });
1381 }(std::make_index_sequence<T::originals.size()>{},
key);
1382 if (!locate.empty()) {
1383 return locate.front().second;
1386 if constexpr (!OPT) {
1394template <
typename B,
typename...
C>
1397 return (o2::soa::is_binding_compatible_v<B, typename C::binding_t>() || ...);
1400template <
typename B,
typename...
C>
1403 return ((C::sorted && o2::soa::is_binding_compatible_v<B, typename C::binding_t>()) || ...);
1406template <
typename B,
typename Z>
1407consteval static bool relatedByIndex()
1409 return hasIndexTo<B>(
typename Z::table_t::external_index_columns_t{});
1412template <
typename B,
typename Z>
1413consteval static bool relatedBySortedIndex()
1415 return hasSortedIndexTo<B>(
typename Z::table_t::external_index_columns_t{});
1445template <soa::is_table T, is_preslice_policy Policy,
bool OPT = false>
1454 : Policy{
PreslicePolicyBase{{o2::soa::getLabelFromTypeForKey<T, OPT>(std::string{index_.
name})},
Entry(o2::soa::getLabelFromTypeForKey<T, OPT>(std::string{index_.name}), o2::soa::getMatcherFromTypeForKey<T, OPT>(std::string{index_.name}), std::string{index_.name})}, {}}
1460 if constexpr (OPT) {
1461 if (Policy::isMissing()) {
1462 return {
nullptr, {0, 0}};
1465 return Policy::getSliceFor(
value, input);
1470 if constexpr (OPT) {
1471 if (Policy::isMissing()) {
1475 return Policy::getSliceFor(
value);
1479template <soa::is_table T>
1481template <soa::is_table T>
1483template <soa::is_table T>
1485template <soa::is_table T>
1507template <soa::is_table T>
1509template <
typename T>
1513template <
typename T>
1517template <
typename... Is>
1525template <
typename T,
typename C,
typename Policy,
bool OPT>
1526 requires std::same_as<Policy, framework::PreslicePolicySorted> && (o2::soa::is_binding_compatible_v<C, T>())
1529 if constexpr (OPT) {
1530 if (container.isMissing()) {
1535 auto t =
typename T::self_t({out});
1536 if (
t.tableSize() != 0) {
1537 table->copyIndexBindings(
t);
1538 t.bindInternalIndicesTo(table);
1543template <soa::is_filtered_table T>
1547 if (
t.tableSize() != 0) {
1549 t.bindInternalIndicesTo(table);
1550 t.intersectWithSelection(table->getSelectedRows());
1555template <soa::is_table T>
1560 if (
t.tableSize() != 0) {
1562 t.bindInternalIndicesTo(table);
1567template <
typename T,
typename C,
typename Policy,
bool OPT>
1568 requires std::same_as<Policy, framework::PreslicePolicyGeneral> && (o2::soa::is_binding_compatible_v<C, T>())
1571 if constexpr (OPT) {
1572 if (container.isMissing()) {
1582template <soa::is_filtered_table T>
1587 if (fresult.tableSize() != 0) {
1588 table->copyIndexBindings(fresult);
1594 if (fresult.tableSize() != 0) {
1595 table->copyIndexBindings(fresult);
1600template <soa::is_filtered_table T,
typename C,
bool OPT>
1601 requires(o2::soa::is_binding_compatible_v<C, T>())
1604 if constexpr (OPT) {
1605 if (container.isMissing()) {
1615template <soa::is_table T>
1621 auto t =
typename T::self_t({table->asArrowTableRef().slice({
static_cast<uint64_t>(
offset),
count})});
1622 if (
t.tableSize() != 0) {
1623 table->copyIndexBindings(
t);
1628template <soa::is_filtered_table T>
1634 return prepareFilteredSlice(table, table->asArrowTableRef().slice({static_cast<uint64_t>(offset), count}));
1637template <soa::is_table T>
1643 auto t =
typename T::self_t({table->asArrowTableRef()}, localCache.getSliceFor(
value));
1644 if (
t.tableSize() != 0) {
1645 t.intersectWithSelection(table->getSelectedRows());
1646 table->copyIndexBindings(
t);
1650 auto t =
Filtered<T>({table->asArrowTableRef()}, localCache.getSliceFor(
value));
1651 if (
t.tableSize() != 0) {
1652 table->copyIndexBindings(
t);
1658template <with_originals T>
1666template <
typename D,
typename O,
typename IP,
typename...
C>
1702 return std::array<TableRef, 1>{
ref};
1719 static constexpr const auto ref =
TableRef{L::hash, D::hash, O::hash, o2::aod::version(D::str)};
1724 static constexpr const auto originalLabels = []<
size_t N, std::array<TableRef, N> refs,
size_t... Is>(std::index_sequence<Is...>)
consteval {
1725 return std::array<const char*, N>{o2::aod::label<refs[Is]>()...};
1730 template <
size_t N, std::array<TableRef, N> bindings>
1731 requires(
ref.origin_hash ==
"CONC"_h)
1737 template <
size_t N, std::array<TableRef, N> bindings>
1738 requires(
ref.origin_hash ==
"JOIN"_h)
1743 return std::ranges::any_of(bindings, [&
r](
TableRef const&
b) {
return b ==
r; });
1747 template <
size_t N, std::array<TableRef, N> bindings>
1748 requires(!(
ref.origin_hash ==
"CONC"_h ||
ref.origin_hash ==
"JOIN"_h))
1751 return std::find(bindings.begin(), bindings.end(),
self_t::ref) != bindings.end();
1754 template <TableRef r>
1763 auto hashes = std::array{C::hash...};
1764 std::ranges::sort(hashes);
1773 template <
typename IP>
1776 template <
typename IP,
typename Parent,
typename... T>
1792 template <
typename P,
typename... Os>
1794 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1800 template <
typename P>
1807 template <
typename P>
1809 requires std::same_as<IP, DefaultIndexPolicy>
1815 template <
typename P,
typename O1,
typename... Os>
1817 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1822 template <
typename P,
typename O1,
typename... Os>
1824 requires(P::ref.desc_hash == Parent::ref.desc_hash)
1829 template <
typename P>
1835 template <
typename P>
1841 template <
typename P>
1843 requires std::same_as<IP, DefaultIndexPolicy>
1850 this->mRowIndex =
other.index;
1853 template <
typename P>
1856 this->mRowIndex =
other.mRowIndex;
1859 template <
typename P,
typename... Os>
1861 requires std::same_as<typename P::table_t, typename Parent::table_t>
1863 this->mRowIndex =
other.mRowIndex;
1866 template <
typename TI>
1869 using decayed = std::decay_t<TI>;
1871 constexpr auto idx = framework::has_type_at_v<decayed>(
bindings_pack_t{});
1873 }
else if constexpr (std::same_as<decayed, Parent>) {
1874 return this->globalIndex();
1876 return this->globalIndex();
1878 return static_cast<int32_t>(-1);
1882 template <
typename CD,
typename... CDArgs>
1885 using decayed = std::decay_t<CD>;
1887 return static_cast<decayed
>(*this).template getDynamicValue<CDArgs...>();
1890 template <
typename B,
typename CC>
1893 using COL = std::decay_t<CC>;
1895 return static_cast<B>(
static_cast<COL
>(*this).get());
1898 template <
typename B,
typename... CCs>
1901 static_assert(std::same_as<B, float> || std::same_as<B, double>,
"The common return type should be float or double");
1902 return {getValue<B, CCs>()...};
1913 copy.moveByIndex(inc);
1928 template <
typename IP,
typename Parent,
typename... T>
1931 template <
typename IP,
typename Parent>
1933 if constexpr (
sizeof...(Ts) == 0) {
1937 return iterator_template<IP, Parent>{};
1952 : mArrowTableRef(tableRef),
1955 if (mArrowTableRef.
tablePtr->num_rows() == 0) {
1957 mColumnChunks[ci] =
nullptr;
1963 mColumnChunks[ci] = lookups[ci];
1966 mBegin.bindInternalIndices(
this);
1970 Table(std::shared_ptr<arrow::Table> table)
1975 Table(std::vector<o2::soa::ArrowTableRef>&& tables)
1976 requires(
ref.origin_hash !=
"CONC"_h)
1981 Table(std::vector<o2::soa::ArrowTableRef>&& tables)
1982 requires(
ref.origin_hash ==
"CONC"_h)
1987 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables)
1988 requires(
ref.origin_hash !=
"CONC"_h)
1993 Table(std::vector<std::shared_ptr<arrow::Table>>&& tables)
1994 requires(
ref.origin_hash ==
"CONC"_h)
1999 template <
typename Key>
2002 constexpr auto map = []<
typename... Cs>(
framework::pack<Cs...>)
consteval {
2003 return std::array<
bool,
sizeof...(Cs)>{[]() {
2004 if constexpr (
requires { Cs::index_targets.size(); }) {
2005 return Key::template
isIndexTargetOf<Cs::index_targets.size(), Cs::index_targets>();
2011 constexpr auto pos = std::find(map.begin(), map.end(),
true);
2012 if constexpr (
pos != map.end()) {
2013 return mColumnChunks[std::distance(map.begin(),
pos)];
2015 static_assert(framework::always_static_assert_v<Key>,
"This table does not have an index to given Key");
2083 return mArrowTableRef;
2103 template <
typename... TA>
2108 mBegin.bindExternalIndex(cur);
2114 template <
typename TA>
2117 mBegin.bindExternalIndex(current);
2120 template <
typename I>
2123 mBegin.bindInternalIndices(
ptr);
2131 template <
typename... Cs>
2134 (
static_cast<Cs
>(mBegin).setCurrentRaw(
binding), ...);
2139 mBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
2142 template <
typename T,
typename... Cs>
2145 dest.bindExternalIndicesRaw(mBegin.getIndexBindings());
2148 template <
typename T>
2171 template <
typename T1,
typename Policy,
bool OPT>
2189 mBegin.setPointerReconstructor(pointerReconstructor);
2193 template <
typename T>
2194 arrow::ChunkedArray* lookupColumn()
2199 template <soa::is_persistent_column T>
2200 arrow::ChunkedArray* lookupColumn()
2220namespace row_helpers
2222template <
typename R,
typename T,
typename C>
2225 return static_cast<R>(
static_cast<C>(rowIterator).get());
2230template <
typename R,
typename T>
2231using ColumnGetterFunction =
R (*)(
const T&);
2233template <
typename T,
typename R>
2238 {
t.get() } -> std::convertible_to<R>;
2241template <
typename T,
typename R>
2243 {
t.get() } -> std::convertible_to<R>;
2246template <
typename R,
typename T, persistent_with_common_getter<R> C>
2247ColumnGetterFunction<R, T> createGetterPtr(
const std::string_view& targetColumnLabel)
2249 return targetColumnLabel == C::columnLabel() ? &getColumnValue<R, T, C> :
nullptr;
2252template <
typename R,
typename T, dynamic_with_common_getter<R> C>
2253ColumnGetterFunction<R, T> createGetterPtr(
const std::string_view& targetColumnLabel)
2259 if (targetColumnLabel.starts_with(
"f") && targetColumnLabel.substr(1) ==
columnLabel) {
2260 return &getColumnValue<R, T, C>;
2265 return &getColumnValue<R, T, C>;
2271template <
typename R,
typename T,
typename... Cs>
2274 ColumnGetterFunction<R, T>
func;
2276 (
void)((
func = createGetterPtr<R, T, Cs>(targetColumnLabel),
func) || ...);
2285template <
typename T,
typename R>
2286using with_common_getter_t =
typename std::conditional<persistent_with_common_getter<T, R> || dynamic_with_common_getter<T, R>, std::true_type, std::false_type>
::type;
2289template <
typename R,
typename T>
2294 if (targetColumnLabel.size() == 0) {
2298 return getColumnGetterByLabel<R, typename T::iterator>(TypesWithCommonGetter{}, targetColumnLabel);
2322#define DECLARE_EQUIVALENT_FOR_INDEX(_Base_, _Equiv_) \
2324 struct EquivalentIndexNG<o2::aod::Hash<_Base_::ref.desc_hash>, o2::aod::Hash<_Equiv_::ref.desc_hash>> { \
2325 constexpr static bool value = true; \
2328#define DECLARE_EQUIVALENT_FOR_INDEX_NG(_Base_, _Equiv_) \
2330 struct EquivalentIndexNG<o2::aod::Hash<_Base_ ""_h>, o2::aod::Hash<_Equiv_ ""_h>> { \
2331 constexpr static bool value = true; \
2334#define DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) \
2335 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2336 static constexpr const char* mLabel = _Label_; \
2337 static constexpr const uint32_t hash = compile_time_hash(o2::framework::namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2338 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2339 using base = o2::soa::Column<_Type_, _Name_>; \
2340 using type = _Type_; \
2341 using column_t = _Name_; \
2342 _Name_(arrow::ChunkedArray const* column) \
2343 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2347 _Name_() = default; \
2348 _Name_(_Name_ const& other) = default; \
2349 _Name_& operator=(_Name_ const& other) = default; \
2351 decltype(auto) _Getter_() const \
2353 return *mColumnIterator; \
2356 decltype(auto) get() const \
2358 return _Getter_(); \
2361 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2363#define DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, _Label_, _Getter_, _ConcreteType_, _CCDBQuery_, _RunDependent_, ...) \
2364 struct _Name_ : o2::soa::Column<int64_t[3], _Name_> { \
2365 static constexpr const char* mLabel = _Label_; \
2366 static constexpr const char* query = _CCDBQuery_; \
2371 static constexpr int run_dependent = _RunDependent_; \
2372 static constexpr const uint32_t hash = compile_time_hash(o2::framework::namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2373 static constexpr bool needs_ptr_rec = true; \
2379 using finaliser_t = _ConcreteType_* (*)(_ConcreteType_*); \
2380 static constexpr finaliser_t finalise = __VA_ARGS__; \
2381 std::function<std::byte*(fair::mq::shmem::MetaHeader&&)> const* ptrRec = nullptr; \
2382 using base = o2::soa::Column<int64_t[3], _Name_>; \
2383 using type = int64_t[3]; \
2384 using column_t = _Name_; \
2385 _Name_(arrow::ChunkedArray const* column) \
2386 : o2::soa::Column<int64_t[3], _Name_>(o2::soa::ColumnIterator<int64_t[3]>(column)) \
2390 _Name_() = default; \
2391 _Name_(_Name_ const& other) = default; \
2392 _Name_& operator=(_Name_ const& other) = default; \
2394 decltype(auto) _Getter_() const \
2396 auto& [handle, segment, size] = *mColumnIterator; \
2397 auto span = std::span<std::byte>{(*ptrRec)(fair::mq::shmem::MetaHeader{ \
2398 static_cast<size_t>(size), \
2400 static_cast<uint16_t>(segment), true}), \
2401 static_cast<size_t>(size)}; \
2402 if constexpr (std::same_as<_ConcreteType_, std::span<std::byte>>) { \
2405 static std::byte* payload = nullptr; \
2406 static _ConcreteType_* deserialised = nullptr; \
2407 static TClass* c = TClass::GetClass(#_ConcreteType_); \
2408 if (payload != (std::byte*)span.data()) { \
2409 payload = (std::byte*)span.data(); \
2410 delete deserialised; \
2411 TBufferFile f(TBufferFile::EMode::kRead, span.size(), (char*)span.data(), kFALSE); \
2412 auto* streamed = (_ConcreteType_*)soa::extractCCDBPayload((char*)payload, span.size(), c, "ccdb_object"); \
2415 "Could not deserialise a {} from the CCDB payload for {} ({} bytes). Check the configured " \
2416 "path (option \"ccdb:{}\") and that the object exists for this timestamp.", \
2417 #_ConcreteType_, _CCDBQuery_, span.size(), _Label_); \
2419 deserialised = finalise(streamed); \
2421 return *deserialised; \
2428 return _Getter_(); \
2436#define DECLARE_SOA_CCDB_COLUMN(_Name_, _Getter_, _ConcreteType_, _CCDBQuery_) \
2437 DECLARE_SOA_CCDB_COLUMN_FULL(_Name_, "f" #_Name_, _Getter_, _ConcreteType_, _CCDBQuery_, 0, \
2438 [](_ConcreteType_* ccdbObject) { return ccdbObject; })
2440#define DECLARE_SOA_COLUMN(_Name_, _Getter_, _Type_) \
2441 DECLARE_SOA_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_)
2445#define MAKEINT(_Size_) uint##_Size_##_t
2447#define DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, _Label_) \
2448 struct _Name_ : o2::soa::Column<MAKEINT(_Size_), _Name_> { \
2449 static constexpr const char* mLabel = _Label_; \
2450 static constexpr const uint32_t hash = compile_time_hash(o2::framework::namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2451 static_assert(!((*(mLabel + 1) == 'I' && *(mLabel + 2) == 'n' && *(mLabel + 3) == 'd' && *(mLabel + 4) == 'e' && *(mLabel + 5) == 'x')), "Index is not a valid column name"); \
2452 using base = o2::soa::Column<MAKEINT(_Size_), _Name_>; \
2453 using type = MAKEINT(_Size_); \
2454 _Name_(arrow::ChunkedArray const* column) \
2455 : o2::soa::Column<type, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2459 _Name_() = default; \
2460 _Name_(_Name_ const& other) = default; \
2461 _Name_& operator=(_Name_ const& other) = default; \
2463 decltype(auto) _Getter_##_raw() const \
2465 return *mColumnIterator; \
2468 bool _Getter_##_bit(int bit) const \
2470 return (*mColumnIterator & (static_cast<type>(1) << bit)) >> bit; \
2473 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<MAKEINT(_Size_)>() }
2475#define DECLARE_SOA_BITMAP_COLUMN(_Name_, _Getter_, _Size_) \
2476 DECLARE_SOA_BITMAP_COLUMN_FULL(_Name_, _Getter_, _Size_, "f" #_Name_)
2480#define DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_, _Expression_) \
2481 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2482 static constexpr const char* mLabel = _Label_; \
2483 static constexpr const uint32_t hash = compile_time_hash(o2::framework::namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2484 using base = o2::soa::Column<_Type_, _Name_>; \
2485 using type = _Type_; \
2486 using column_t = _Name_; \
2487 using spawnable_t = std::true_type; \
2488 _Name_(arrow::ChunkedArray const* column) \
2489 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2493 _Name_() = default; \
2494 _Name_(_Name_ const& other) = default; \
2495 _Name_& operator=(_Name_ const& other) = default; \
2497 decltype(auto) _Getter_() const \
2499 return *mColumnIterator; \
2502 decltype(auto) get() const \
2504 return _Getter_(); \
2507 static o2::framework::expressions::Projector Projector() \
2509 return _Expression_; \
2512 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2514#define DECLARE_SOA_EXPRESSION_COLUMN(_Name_, _Getter_, _Type_, _Expression_) \
2515 DECLARE_SOA_EXPRESSION_COLUMN_FULL(_Name_, _Getter_, _Type_, "f" #_Name_, _Expression_)
2519#define DECLARE_SOA_CONFIGURABLE_EXPRESSION_COLUMN(_Name_, _Getter_, _Type_, _Label_) \
2520 struct _Name_ : o2::soa::Column<_Type_, _Name_> { \
2521 static constexpr const char* mLabel = _Label_; \
2522 static constexpr const uint32_t hash = compile_time_hash(o2::framework::namespace_prefix<_Name_>(), std::string_view{#_Getter_}); \
2523 static constexpr const int32_t mHash = _Label_ ""_h; \
2524 using base = o2::soa::Column<_Type_, _Name_>; \
2525 using type = _Type_; \
2526 using column_t = _Name_; \
2527 using spawnable_t = std::true_type; \
2528 _Name_(arrow::ChunkedArray const* column) \
2529 : o2::soa::Column<_Type_, _Name_>(o2::soa::ColumnIterator<type>(column)) \
2533 _Name_() = default; \
2534 _Name_(_Name_ const& other) = default; \
2535 _Name_& operator=(_Name_ const& other) = default; \
2537 decltype(auto) _Getter_() const \
2539 return *mColumnIterator; \
2542 decltype(auto) get() const \
2544 return _Getter_(); \
2547 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_ { _Label_, _Name_::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2570template <o2::soa::is_table T>
2573 return T::originals;
2576#define DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2577 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
2578 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2579 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2580 static constexpr const char* mLabel = "fIndexSlice" _Label_ _Suffix_; \
2581 static constexpr const uint32_t hash = 0; \
2582 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
2583 using type = _Type_[2]; \
2584 using column_t = _Name_##IdSlice; \
2585 using binding_t = _Table_; \
2586 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2587 _Name_##IdSlice(arrow::ChunkedArray const* column) \
2588 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
2592 _Name_##IdSlice() = default; \
2593 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
2594 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
2595 std::array<_Type_, 2> inline getIds() const \
2597 return _Getter_##Ids(); \
2600 bool has_##_Getter_() const \
2602 auto a = *mColumnIterator; \
2603 return a[0] >= 0 && a[1] >= 0; \
2606 std::array<_Type_, 2> _Getter_##Ids() const \
2608 auto a = *mColumnIterator; \
2609 return std::array{a[0], a[1]}; \
2612 template <typename T> \
2613 auto _Getter_##_as() const \
2615 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2616 o2::soa::notBoundTable(#_Table_); \
2618 auto t = mBinding.get<T>(); \
2619 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2620 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2622 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2623 return t->emptySlice(); \
2625 auto a = *mColumnIterator; \
2626 auto r = t->rawSlice(a[0], a[1]); \
2627 t->copyIndexBindings(r); \
2628 r.bindInternalIndicesTo(t); \
2632 auto _Getter_() const \
2634 return _Getter_##_as<binding_t>(); \
2637 template <typename T> \
2638 bool setCurrent(T const* current) \
2640 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2641 assert(current != nullptr); \
2642 this->mBinding.bind(current); \
2648 bool setCurrentRaw(o2::soa::Binding current) \
2650 this->mBinding = current; \
2653 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2654 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2655 o2::soa::Binding mBinding; \
2658#define DECLARE_SOA_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2659#define DECLARE_SOA_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2660#define DECLARE_SOA_SLICE_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_SLICE_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2663#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2664 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
2665 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2666 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2667 static constexpr const char* mLabel = "fIndexArray" _Label_ _Suffix_; \
2668 static constexpr const uint32_t hash = 0; \
2669 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
2670 using type = std::vector<_Type_>; \
2671 using column_t = _Name_##Ids; \
2672 using binding_t = _Table_; \
2673 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2674 _Name_##Ids(arrow::ChunkedArray const* column) \
2675 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
2679 _Name_##Ids() = default; \
2680 _Name_##Ids(_Name_##Ids const& other) = default; \
2681 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
2683 gsl::span<const _Type_> inline getIds() const \
2685 return _Getter_##Ids(); \
2688 gsl::span<const _Type_> _Getter_##Ids() const \
2690 return *mColumnIterator; \
2693 bool has_##_Getter_() const \
2695 return !(*mColumnIterator).empty(); \
2698 template <soa::is_table T> \
2699 auto _Getter_##_as() const \
2701 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2702 o2::soa::notBoundTable(#_Table_); \
2704 auto t = mBinding.get<T>(); \
2705 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2706 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2708 auto result = std::vector<typename T::unfiltered_iterator>(); \
2709 result.reserve((*mColumnIterator).size()); \
2710 for (auto& i : *mColumnIterator) { \
2711 result.emplace_back(t->rawIteratorAt(i)); \
2716 template <soa::is_filtered_table T> \
2717 auto filtered_##_Getter_##_as() const \
2719 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2720 o2::soa::notBoundTable(#_Table_); \
2722 auto t = mBinding.get<T>(); \
2723 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2724 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2726 auto result = std::vector<typename T::iterator>(); \
2727 result.reserve((*mColumnIterator).size()); \
2728 for (auto const& i : *mColumnIterator) { \
2729 auto pos = t->isInSelectedRows(i); \
2731 result.emplace_back(t->iteratorAt(pos)); \
2737 auto _Getter_() const \
2739 return _Getter_##_as<binding_t>(); \
2742 template <typename T> \
2743 auto _Getter_##_first_as() const \
2745 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2746 o2::soa::notBoundTable(#_Table_); \
2748 auto t = mBinding.get<T>(); \
2749 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2750 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2752 return t->rawIteratorAt((*mColumnIterator)[0]); \
2755 template <typename T> \
2756 auto _Getter_##_last_as() const \
2758 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2759 o2::soa::notBoundTable(#_Table_); \
2761 auto t = mBinding.get<T>(); \
2762 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2763 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2765 return t->rawIteratorAt((*mColumnIterator).back()); \
2768 auto _Getter_first() const \
2770 return _Getter_##_first_as<binding_t>(); \
2773 auto _Getter_last() const \
2775 return _Getter_##_last_as<binding_t>(); \
2778 template <typename T> \
2779 bool setCurrent(T const* current) \
2781 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2782 assert(current != nullptr); \
2783 this->mBinding.bind(current); \
2789 bool setCurrentRaw(o2::soa::Binding current) \
2791 this->mBinding = current; \
2794 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2795 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2796 o2::soa::Binding mBinding; \
2799#define DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2800#define DECLARE_SOA_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2801#define DECLARE_SOA_ARRAY_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2804#define DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, _Label_, _Suffix_) \
2805 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2806 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2807 static_assert((*_Suffix_ == '\0') || (*_Suffix_ == '_'), "Suffix has to begin with _"); \
2808 static constexpr const char* mLabel = "fIndex" _Label_ _Suffix_; \
2809 static constexpr const uint32_t hash = compile_time_hash(o2::framework::namespace_prefix<_Name_##Id>(), std::string_view{#_Getter_ "Id"}); \
2810 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2811 using type = _Type_; \
2812 using column_t = _Name_##Id; \
2813 using binding_t = _Table_; \
2814 static constexpr auto index_targets = getIndexTargets<_Table_>(); \
2815 _Name_##Id(arrow::ChunkedArray const* column) \
2816 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2820 _Name_##Id() = default; \
2821 _Name_##Id(_Name_##Id const& other) = default; \
2822 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2823 type inline getId() const \
2825 return _Getter_##Id(); \
2828 type _Getter_##Id() const \
2830 return *mColumnIterator; \
2833 bool has_##_Getter_() const \
2835 return *mColumnIterator >= 0; \
2838 template <typename T> \
2839 auto _Getter_##_as() const \
2841 if (O2_BUILTIN_UNLIKELY(mBinding.ptr == nullptr)) { \
2842 o2::soa::notBoundTable(#_Table_); \
2844 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2845 o2::soa::accessingInvalidIndexFor(#_Getter_); \
2847 auto t = mBinding.get<T>(); \
2848 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2849 o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
2851 return t->rawIteratorAt(*mColumnIterator); \
2854 auto _Getter_() const \
2856 return _Getter_##_as<binding_t>(); \
2859 template <typename T> \
2860 bool setCurrent(T* current) \
2862 if constexpr (o2::soa::is_binding_compatible_v<T, binding_t>()) { \
2863 assert(current != nullptr); \
2864 this->mBinding.bind(current); \
2870 bool setCurrentRaw(o2::soa::Binding current) \
2872 this->mBinding = current; \
2875 binding_t const* getCurrent() const { return mBinding.get<binding_t>(); } \
2876 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2877 o2::soa::Binding mBinding; \
2879 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_ _Suffix_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2881#define DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Table_, _Suffix_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, _Type_, _Table_, #_Table_, _Suffix_)
2882#define DECLARE_SOA_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, _Name_##s, "")
2883#define DECLARE_SOA_INDEX_COLUMN_CUSTOM(_Name_, _Getter_, _Label_) DECLARE_SOA_INDEX_COLUMN_FULL_CUSTOM(_Name_, _Getter_, int32_t, _Name_##s, _Label_, "")
2886#define DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
2887 struct _Name_##Id : o2::soa::Column<_Type_, _Name_##Id> { \
2888 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2889 static constexpr const char* mLabel = "fIndex" _Label_; \
2890 static constexpr const uint32_t hash = compile_time_hash(o2::framework::namespace_prefix<_Name_##Id>(), std::string_view{#_Getter_ "Id"}); \
2891 using base = o2::soa::Column<_Type_, _Name_##Id>; \
2892 using type = _Type_; \
2893 using column_t = _Name_##Id; \
2894 using self_index_t = std::true_type; \
2895 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
2896 _Name_##Id(arrow::ChunkedArray const* column) \
2897 : o2::soa::Column<_Type_, _Name_##Id>(o2::soa::ColumnIterator<type>(column)) \
2901 _Name_##Id() = default; \
2902 _Name_##Id(_Name_##Id const& other) = default; \
2903 _Name_##Id& operator=(_Name_##Id const& other) = default; \
2904 type inline getId() const \
2906 return _Getter_##Id(); \
2909 type _Getter_##Id() const \
2911 return *mColumnIterator; \
2914 bool has_##_Getter_() const \
2916 return *mColumnIterator >= 0; \
2919 template <typename T> \
2920 auto _Getter_##_as() const \
2922 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2923 o2::soa::accessingInvalidIndexFor(#_Getter_); \
2925 auto t = mBinding.get<T>(); \
2926 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2927 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
2929 return t->rawIteratorAt(*mColumnIterator); \
2932 bool setCurrentRaw(o2::soa::Binding current) \
2934 this->mBinding = current; \
2937 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
2938 o2::soa::Binding mBinding; \
2940 [[maybe_unused]] static constexpr o2::framework::expressions::BindingNode _Getter_##Id { "fIndex" _Label_, _Name_##Id::hash, o2::framework::expressions::selectArrowType<_Type_>() }
2942#define DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
2943#define DECLARE_SOA_SELF_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, #_Name_)
2945#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
2946 struct _Name_##IdSlice : o2::soa::Column<_Type_[2], _Name_##IdSlice> { \
2947 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
2948 static constexpr const char* mLabel = "fIndexSlice" _Label_; \
2949 static constexpr const uint32_t hash = 0; \
2950 using base = o2::soa::Column<_Type_[2], _Name_##IdSlice>; \
2951 using type = _Type_[2]; \
2952 using column_t = _Name_##IdSlice; \
2953 using self_index_t = std::true_type; \
2954 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
2955 _Name_##IdSlice(arrow::ChunkedArray const* column) \
2956 : o2::soa::Column<_Type_[2], _Name_##IdSlice>(o2::soa::ColumnIterator<type>(column)) \
2960 _Name_##IdSlice() = default; \
2961 _Name_##IdSlice(_Name_##IdSlice const& other) = default; \
2962 _Name_##IdSlice& operator=(_Name_##IdSlice const& other) = default; \
2963 std::array<_Type_, 2> inline getIds() const \
2965 return _Getter_##Ids(); \
2968 bool has_##_Getter_() const \
2970 auto a = *mColumnIterator; \
2971 return a[0] >= 0 && a[1] >= 0; \
2974 std::array<_Type_, 2> _Getter_##Ids() const \
2976 auto a = *mColumnIterator; \
2977 return std::array{a[0], a[1]}; \
2980 template <typename T> \
2981 auto _Getter_##_as() const \
2983 auto t = mBinding.get<T>(); \
2984 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2985 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
2987 if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
2988 return t->emptySlice(); \
2990 auto a = *mColumnIterator; \
2991 auto r = t->rawSlice(a[0], a[1]); \
2992 t->copyIndexBindings(r); \
2993 r.bindInternalIndicesTo(t); \
2997 bool setCurrentRaw(o2::soa::Binding current) \
2999 this->mBinding = current; \
3002 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3003 o2::soa::Binding mBinding; \
3006#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3007#define DECLARE_SOA_SELF_SLICE_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_SLICE_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
3009#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, _IndexTarget_) \
3010 struct _Name_##Ids : o2::soa::Column<std::vector<_Type_>, _Name_##Ids> { \
3011 static_assert(std::is_integral_v<_Type_>, "Index type must be integral"); \
3012 static constexpr const char* mLabel = "fIndexArray" _Label_; \
3013 static constexpr const uint32_t hash = 0; \
3014 using base = o2::soa::Column<std::vector<_Type_>, _Name_##Ids>; \
3015 using type = std::vector<_Type_>; \
3016 using column_t = _Name_##Ids; \
3017 using self_index_t = std::true_type; \
3018 using compatible_signature = std::conditional<aod::is_aod_hash<_IndexTarget_>, _IndexTarget_, void>; \
3019 _Name_##Ids(arrow::ChunkedArray const* column) \
3020 : o2::soa::Column<std::vector<_Type_>, _Name_##Ids>(o2::soa::ColumnIterator<type>(column)) \
3024 _Name_##Ids() = default; \
3025 _Name_##Ids(_Name_##Ids const& other) = default; \
3026 _Name_##Ids& operator=(_Name_##Ids const& other) = default; \
3027 gsl::span<const _Type_> inline getIds() const \
3029 return _Getter_##Ids(); \
3032 gsl::span<const _Type_> _Getter_##Ids() const \
3034 return *mColumnIterator; \
3037 bool has_##_Getter_() const \
3039 return !(*mColumnIterator).empty(); \
3042 template <typename T> \
3043 auto _Getter_##_as() const \
3045 auto t = mBinding.get<T>(); \
3046 if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
3047 o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
3049 auto result = std::vector<typename T::unfiltered_iterator>(); \
3050 for (auto& i : *mColumnIterator) { \
3051 result.push_back(t->rawIteratorAt(i)); \
3056 template <typename T> \
3057 auto _Getter_##_first_as() const \
3059 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator)[0]); \
3062 template <typename T> \
3063 auto _Getter_##_last_as() const \
3065 return mBinding.get<T>()->rawIteratorAt((*mColumnIterator).back()); \
3068 bool setCurrentRaw(o2::soa::Binding current) \
3070 this->mBinding = current; \
3073 o2::soa::Binding getCurrentRaw() const { return mBinding; } \
3074 o2::soa::Binding mBinding; \
3077#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, _Type_, _Label_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_COMPLETE(_Name_, _Getter_, _Type_, _Label_, void)
3078#define DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN(_Name_, _Getter_) DECLARE_SOA_SELF_ARRAY_INDEX_COLUMN_FULL(_Name_, _Getter_, int32_t, "_" #_Name_)
3108#define DECLARE_SOA_DYNAMIC_COLUMN(_Name_, _Getter_, ...) \
3109 struct _Name_##Callback { \
3110 static inline constexpr auto getLambda() { return __VA_ARGS__; } \
3113 struct _Name_##Helper { \
3114 using callable_t = decltype(o2::framework::FunctionMetadata(std::declval<decltype(_Name_##Callback::getLambda())>())); \
3115 using return_type = typename callable_t::return_type; \
3117 template <typename... Bindings> \
3118 struct _Name_ : o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>> { \
3119 using base = o2::soa::DynamicColumn<typename _Name_##Helper::callable_t::type, _Name_<Bindings...>>; \
3120 using helper = _Name_##Helper; \
3121 using callback_holder_t = _Name_##Callback; \
3122 using callable_t = helper::callable_t; \
3123 using callback_t = callable_t::type; \
3124 static constexpr const uint32_t hash = 0; \
3126 _Name_(arrow::ChunkedArray const*) \
3129 _Name_() = default; \
3130 _Name_(_Name_ const& other) = default; \
3131 _Name_& operator=(_Name_ const& other) = default; \
3132 static constexpr const char* mLabel = #_Name_; \
3133 using type = typename callable_t::return_type; \
3135 template <typename... FreeArgs> \
3136 type _Getter_(FreeArgs... freeArgs) const \
3138 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
3140 template <typename... FreeArgs> \
3141 type getDynamicValue(FreeArgs... freeArgs) const \
3143 return boundGetter(std::make_index_sequence<std::tuple_size_v<decltype(boundIterators)>>{}, freeArgs...); \
3148 return _Getter_(); \
3151 template <size_t... Is, typename... FreeArgs> \
3152 type boundGetter(std::integer_sequence<size_t, Is...>&&, FreeArgs... freeArgs) const \
3154 return __VA_ARGS__((**std::get<Is>(boundIterators))..., freeArgs...); \
3157 using bindings_t = typename o2::framework::pack<Bindings...>; \
3158 std::tuple<o2::soa::ColumnIterator<typename Bindings::type> const*...> boundIterators; \
3161#define DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, ...) \
3162 using _Name_##Metadata = TableMetadata<Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__>;
3164#define DECLARE_SOA_TABLE_METADATA_TRAIT(_Name_, _Desc_, _Version_) \
3166 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3167 static constexpr void isMetadataTrait() {}; \
3168 using metadata = _Name_##Metadata; \
3171#define DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_) \
3172 O2HASH(_Desc_ "/" #_Version_); \
3173 template <typename O> \
3174 using _Name_##From = o2::soa::Table<Hash<_Label_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3175 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>; \
3177 struct MetadataTrait<Hash<_Desc_ "/" #_Version_ ""_h>> { \
3178 static constexpr void isMetadataTrait() {}; \
3179 using metadata = _Name_##Metadata; \
3182#define DECLARE_SOA_STAGE(_Name_, _Origin_, _Desc_, _Version_) \
3183 template <typename O> \
3184 using _Name_##From = o2::soa::Table<Hash<#_Name_ ""_h>, Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3185 using _Name_ = _Name_##From<Hash<_Origin_ ""_h>>;
3187#define DECLARE_SOA_TABLE_FULL_VERSIONED(_Name_, _Label_, _Origin_, _Desc_, _Version_, ...) \
3188 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__); \
3189 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, _Version_);
3191#define DECLARE_SOA_TABLE_FULL(_Name_, _Label_, _Origin_, _Desc_, ...) \
3193 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, 0, __VA_ARGS__); \
3194 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, _Label_, _Origin_, _Desc_, 0)
3196#define DECLARE_SOA_TABLE(_Name_, _Origin_, _Desc_, ...) \
3197 DECLARE_SOA_TABLE_FULL(_Name_, #_Name_, _Origin_, _Desc_, __VA_ARGS__)
3199#define DECLARE_SOA_TABLE_VERSIONED(_Name_, _Origin_, _Desc_, _Version_, ...) \
3201 DECLARE_SOA_TABLE_METADATA(_Name_, _Desc_, _Version_, __VA_ARGS__) \
3202 DECLARE_SOA_TABLE_FULL_VERSIONED_(_Name_, #_Name_, _Origin_, _Desc_, _Version_)
3204#define DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, _Version_, ...) \
3205 O2HASH(_Desc_ "/" #_Version_); \
3206 O2HASH(#_BaseName_); \
3207 O2HASH("Stored" #_BaseName_); \
3208 DECLARE_SOA_TABLE_METADATA(_BaseName_, _Desc_, _Version_, __VA_ARGS__); \
3209 using Stored##_BaseName_##Metadata = _BaseName_##Metadata; \
3210 DECLARE_SOA_TABLE_METADATA_TRAIT(_BaseName_, _Desc_, _Version_); \
3211 DECLARE_SOA_STAGE(_BaseName_, "AOD", _Desc_, _Version_); \
3212 DECLARE_SOA_STAGE(Stored##_BaseName_, "AOD1", _Desc_, _Version_); \
3213 using StoredEMB##_BaseName_ = Stored##_BaseName_##From<o2::aod::Hash<"EMB"_h>>;
3215#define DECLARE_SOA_TABLE_STAGED(_BaseName_, _Desc_, ...) \
3216 DECLARE_SOA_TABLE_STAGED_VERSIONED(_BaseName_, _Desc_, 0, __VA_ARGS__);
3218#define DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, _Desc_, _Version_, ...) \
3219 O2HASH(_Desc_ "/" #_Version_); \
3220 O2HASH(#_Name_ "Extension"); \
3221 template <typename O> \
3222 using _Name_##ExtensionFrom = soa::Table<o2::aod::Hash<#_Name_ "Extension"_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3223 using _Name_##Extension = _Name_##ExtensionFrom<o2::aod::Hash<"AOD"_h>>; \
3224 struct _Name_##ExtensionMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3225 using base_table_t = _OriginalTable_; \
3226 template <o2::aod::is_origin_hash O> \
3227 using extension_table_t_from = _Name_##ExtensionFrom<O>; \
3228 using extension_table_t = _Name_##Extension; \
3229 using expression_pack_t = framework::pack<__VA_ARGS__>; \
3230 static constexpr auto N = _OriginalTable_::originals.size(); \
3231 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3232 static consteval auto generateSources() \
3234 return _OriginalTable_##From<O>::originals; \
3238 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3239 static constexpr void isMetadataTrait() {}; \
3240 using metadata = _Name_##ExtensionMetadata; \
3242 template <typename O> \
3243 using _Name_##From = o2::soa::Join<_OriginalTable_##From<O>, _Name_##ExtensionFrom<O>>; \
3244 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3246#define DECLARE_SOA_EXTENDED_TABLE(_Name_, _Table_, _Description_, _Version_, ...) \
3247 DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _Table_, _Description_, _Version_, __VA_ARGS__)
3249#define DECLARE_SOA_EXTENDED_TABLE_USER(_Name_, _Table_, _Description_, ...) \
3250 DECLARE_SOA_EXTENDED_TABLE_NG(_Name_, _Table_, "EX" _Description_, 0, __VA_ARGS__)
3252#define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, _Desc_, _Version_, ...) \
3253 O2HASH(_Desc_ "/" #_Version_); \
3254 O2HASH(#_Name_ "CfgExtension"); \
3255 template <typename O> \
3256 using _Name_##CfgExtensionFrom = soa::Table<o2::aod::Hash<#_Name_ "CfgExtension"_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3257 using _Name_##CfgExtension = _Name_##CfgExtensionFrom<o2::aod::Hash<"AOD"_h>>; \
3258 struct _Name_##CfgExtensionMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3259 using base_table_t = _OriginalTable_; \
3260 template <o2::aod::is_origin_hash O> \
3261 using extension_table_t_from = _Name_##CfgExtensionFrom<O>; \
3262 using extension_table_t = _Name_##CfgExtension; \
3263 using placeholders_pack_t = framework::pack<__VA_ARGS__>; \
3264 using configurable_t = std::true_type; \
3265 static constexpr auto N = _OriginalTable_::originals.size(); \
3266 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3267 static consteval auto generateSources() \
3269 return _OriginalTable_##From<O>::originals; \
3273 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3274 static constexpr void isMetadataTrait() {}; \
3275 using metadata = _Name_##CfgExtensionMetadata; \
3277 template <typename O> \
3278 using _Name_##From = o2::soa::Join<_OriginalTable_##From<O>, _Name_##CfgExtensionFrom<O>>; \
3279 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3281#define DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE(_Name_, _OriginalTable_, _Description_, ...) \
3282 DECLARE_SOA_CONFIGURABLE_EXTENDED_TABLE_NG(_Name_, _OriginalTable_, "EX" _Description_, 0, __VA_ARGS__)
3284#define DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, _Version_, _Desc_, _Exclusive_, ...) \
3286 O2HASH(_Desc_ "/" #_Version_); \
3287 struct _Name_##Metadata : o2::aod::TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, soa::Index<>, __VA_ARGS__> { \
3288 static constexpr bool exclusive = _Exclusive_; \
3289 template <o2::aod::is_origin_hash O> \
3290 using KeyFrom = _Key_##From<O>; \
3291 using Key = _Key_; \
3292 using index_pack_t = framework::pack<__VA_ARGS__>; \
3293 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3294 static consteval auto generateSources() \
3296 return []<soa::is_index_column... Cs>(framework::pack<Cs...>) consteval { \
3297 constexpr auto first = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3298 constexpr auto second = o2::aod::filterForKey<first.size(), first, Key>(); \
3299 return o2::aod::replaceOrigin<second.size(), second, O>(); \
3300 }(framework::pack<__VA_ARGS__>{}); \
3302 static constexpr auto N = []<typename... Cs>(framework::pack<Cs...>) consteval { \
3303 constexpr auto a = o2::soa::mergeOriginals<typename Cs::binding_t...>(); \
3304 return o2::aod::filterForKey<a.size(), a, Key>(); \
3305 }(framework::pack<__VA_ARGS__>{}) \
3309 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3310 static constexpr void isMetadataTrait() {}; \
3311 using metadata = _Name_##Metadata; \
3313 template <o2::aod::is_origin_hash O> \
3314 using _Name_##From = o2::soa::IndexTable<o2::aod::Hash<#_Name_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O, _Key_##From<O>, __VA_ARGS__>; \
3315 using _Name_ = _Name_##From<o2::aod::Hash<"AOD"_h>>;
3317#define DECLARE_SOA_INDEX_TABLE(_Name_, _Key_, _Description_, ...) \
3318 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, false, __VA_ARGS__)
3320#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE(_Name_, _Key_, _Description_, ...) \
3321 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, true, __VA_ARGS__)
3323#define DECLARE_SOA_INDEX_TABLE_USER(_Name_, _Key_, _Description_, ...) \
3324 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, false, __VA_ARGS__)
3326#define DECLARE_SOA_INDEX_TABLE_EXCLUSIVE_USER(_Name_, _Key_, _Description_, ...) \
3327 DECLARE_SOA_INDEX_TABLE_NG(_Name_, _Key_, 0, _Description_, true, __VA_ARGS__)
3334#define DECLARE_SOA_TIMESTAMPED_TABLE_FULL(_Name_, _Label_, _TimestampSource_, _TimestampColumn_, _UniformitySource_, _UniformityColumn_, _Version_, _Desc_, ...) \
3335 O2HASH(_Desc_ "/" #_Version_); \
3336 template <typename O> \
3337 using _Name_##TimestampFrom = soa::Table<o2::aod::Hash<_Label_ ""_h>, o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, O>; \
3338 using _Name_##Timestamp = _Name_##TimestampFrom<o2::aod::Hash< \
3341 struct _Name_##TimestampMetadata : TableMetadata<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>, __VA_ARGS__> { \
3342 template <typename O = o2::aod::Hash<"AOD" \
3344 using base_table_t = _TimestampSource_##From<O>; \
3345 template <typename O = o2::aod::Hash<"AOD" \
3347 using extension_table_t = _Name_##TimestampFrom<O>; \
3348 static constexpr const auto ccdb_urls = []<typename... Cs>(framework::pack<Cs...>) consteval { \
3349 return std::array<std::string_view, sizeof...(Cs)>{Cs::query...}; \
3350 }(framework::pack<__VA_ARGS__>{}); \
3351 static constexpr const auto ccdb_bindings = []<typename... Cs>(framework::pack<Cs...>) consteval { \
3352 return std::array<std::string_view, sizeof...(Cs)>{o2::framework::with_namespace_prefix<Cs>()...}; \
3353 }(framework::pack<__VA_ARGS__>{}); \
3354 static constexpr const auto ccdb_run_dependent = []<typename... Cs>(framework::pack<Cs...>) consteval { \
3355 return std::array<int, sizeof...(Cs)>{Cs::run_dependent...}; \
3356 }(framework::pack<__VA_ARGS__>{}); \
3363 static constexpr auto N = o2::soa::mergeOriginals<_TimestampSource_, _UniformitySource_>().size(); \
3364 template <o2::aod::is_origin_hash O = o2::aod::Hash<"AOD"_h>> \
3365 static consteval auto generateSources() \
3367 return o2::soa::mergeOriginals<_TimestampSource_##From<O>, _UniformitySource_##From<O>>(); \
3369 static constexpr auto timestamp_column_label = _TimestampColumn_::mLabel; \
3373 static constexpr auto uniformity_column_label = _UniformityColumn_::mLabel; \
3377 struct MetadataTrait<o2::aod::Hash<_Desc_ "/" #_Version_ ""_h>> { \
3378 static constexpr void isMetadataTrait() {}; \
3379 using metadata = _Name_##TimestampMetadata; \
3381 template <typename O> \
3382 using _Name_##From = o2::soa::Join<_TimestampSource_, _Name_##TimestampFrom<O>>; \
3383 using _Name_ = _Name_##From<o2::aod::Hash< \
3393#define DECLARE_SOA_TIMESTAMPED_TABLE(_Name_, _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, ...) \
3394 O2HASH(#_Name_ "Timestamped"); \
3395 DECLARE_SOA_TIMESTAMPED_TABLE_FULL(_Name_, #_Name_ "Timestamped", _TimestampSource_, _TimestampColumn_, _TimestampSource_, _TimestampColumn_, _Version_, _Desc_, __VA_ARGS__)
3400#define DECLARE_SOA_UNIFORM_TABLE(_Name_, _TimestampSource_, _TimestampColumn_, _UniformitySource_, _UniformityColumn_, _Version_, _Desc_, ...) \
3401 O2HASH(#_Name_ "Timestamped"); \
3402 DECLARE_SOA_TIMESTAMPED_TABLE_FULL(_Name_, #_Name_ "Timestamped", _TimestampSource_, _TimestampColumn_, _UniformitySource_, _UniformityColumn_, _Version_, _Desc_, __VA_ARGS__)
3406template <
typename...
Ts>
3407struct Join :
Table<o2::aod::Hash<"JOIN"_h>, o2::aod::Hash<"JOIN/0"_h>, o2::aod::Hash<"JOIN"_h>, Ts...> {
3411 Join(std::vector<ArrowTableRef>&& tables)
3424 template <
typename... TA>
3468 template <
typename T1,
typename Policy,
bool OPT>
3496 template <
typename T>
3499 return []<
size_t... Is>(std::index_sequence<Is...>)
constexpr {
3500 return (std::ranges::any_of(
originals, [](
TableRef const&
ref)
constexpr {
return ref.desc_hash == T::originals[Is].desc_hash; }) && ...);
3501 }(std::make_index_sequence<T::originals.size()>());
3505template <
typename...
Ts>
3511template <
typename T>
3514template <
typename...
Ts>
3515struct Concat :
Table<o2::aod::Hash<"CONC"_h>, o2::aod::Hash<"CONC/0"_h>, o2::aod::Hash<"CONC"_h>, Ts...> {
3540 using base::originals;
3542 using base::bindExternalIndices;
3543 using base::bindInternalIndicesTo;
3557template <
typename...
Ts>
3563template <
typename S>
3566template <soa::is_table T>
3574 static constexpr const uint32_t binding_origin = T::binding_origin;
3576 template <
typename... TA>
3580 if constexpr (binding_origin == TA::binding_origin) {
3581 this->bindExternalIndex(cur);
3582 mFilteredBegin.bindExternalIndex(cur);
3591 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3596 : T{
std::move(tables)}
3598 adoptSelection(selection);
3599 if (this->tableSize() != 0) {
3600 mFilteredBegin = table_t::filtered_begin(mSelectedRows);
3603 mFilteredBegin.bindInternalIndices(
this);
3630 return mFilteredBegin;
3635 return mFilteredBegin;
3640 return mFilteredBegin +
i;
3645 return mSelectedRows.size();
3650 return this->asArrowTableRef().range.size;
3655 return mSelectedRows;
3662 std::iota(newSelection.begin(), newSelection.end(),
start);
3663 return self_t{{this->asArrowTableRef()}, std::move(newSelection)};
3673 if (sel ==
nullptr) {
3674 return std::span<int64_t const>{};
3676 auto array = std::static_pointer_cast<arrow::Int64Array>(sel->ToArray());
3679 return std::span{
start, stop};
3686 mFilteredBegin.bindExternalIndicesRaw(std::forward<std::vector<o2::soa::Binding>>(ptrs));
3689 template <
typename I>
3692 mFilteredBegin.bindInternalIndices(
ptr);
3695 template <
typename T1,
typename... Cs>
3698 dest.bindExternalIndicesRaw(mFilteredBegin.getIndexBindings());
3701 template <
typename T1>
3707 template <
typename T1>
3723 template <
typename T1,
bool OPT>
3729 template <
typename T1,
bool OPT>
3738 copyIndexBindings(
t);
3744 auto locate = std::find(mSelectedRows.begin(), mSelectedRows.end(),
i);
3745 if (locate == mSelectedRows.end()) {
3748 return static_cast<int>(std::distance(mSelectedRows.begin(), locate));
3755 std::ranges::set_union(mSelectedRows, selection, std::back_inserter(rowsUnion));
3756 mSelectedRowsCache.clear();
3757 mSelectedRowsCache = rowsUnion;
3765 std::ranges::set_intersection(mSelectedRows, selection, std::back_inserter(intersection));
3766 mSelectedRowsCache.clear();
3767 mSelectedRowsCache = intersection;
3778 mFilteredBegin.setPointerReconstructor(pointerReconstructor);
3785 mSelectedRows = std::span{mSelectedRowsCache};
3789 mFilteredBegin = *mFilteredEnd;
3791 mFilteredBegin.resetSelection(mSelectedRows);
3795 template <
typename S>
3796 inline void adoptSelection(
S)
3800 template <
typename S>
3802 inline void adoptSelection(
S selection)
3804 mSelectedRows = getSpan(selection);
3808 template <
typename S>
3810 inline void adoptSelection(
S selection)
3812 mSelectedRowsCache = std::move(selection);
3813 mSelectedRows = std::span{mSelectedRowsCache};
3817 template <
typename S>
3818 requires(std::same_as<std::decay_t<S>, std::span<int64_t const>>)
3819 inline void adoptSelection(
S selection)
3821 mSelectedRows = selection;
3825 std::span<int64_t const> mSelectedRows;
3827 bool mCached =
false;
3828 iterator mFilteredBegin;
3829 std::shared_ptr<RowViewSentinel> mFilteredEnd;
3832template <
typename T>
3841 using iterator = T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3847 return iterator(this->cached_begin());
3856 :
FilteredBase<T>{std::move(tables), std::forward<decltype(selection)>(selection)} {}
3872 this->sumWithSelection(selection);
3878 return operator+=(
other.getSelectedRows());
3890 return operator*(
other.getSelectedRows());
3895 this->intersectWithSelection(selection);
3901 return operator*=(
other.getSelectedRows());
3917 std::iota(newSelection.begin(), newSelection.end(),
start);
3918 return self_t{{this->asArrowTableRef()}, std::move(newSelection)};
3926 template <
typename T1>
3942 template <
typename T1,
bool OPT>
3948 template <
typename T1,
bool OPT>
3957 copyIndexBindings(
t);
3962template <
typename T>
3971 using iterator =
typename T::template iterator_template_o<FilteredIndexPolicy, self_t>;
3977 return iterator(this->cached_begin());
3986 :
FilteredBase<typename T::
table_t>(
std::move(extractTablesFromFiltered(tables)),
std::forward<decltype(selection)>(selection))
3988 for (
auto& table : tables) {
4007 this->sumWithSelection(selection);
4013 return operator+=(
other.getSelectedRows());
4019 copy.intersectionWithSelection(selection);
4025 return operator*(
other.getSelectedRows());
4030 this->intersectWithSelection(selection);
4036 return operator*=(
other.getSelectedRows());
4050 std::iota(newSelection.begin(), newSelection.end(),
start);
4051 return self_t{{this->asArrowTableRef()}, std::move(newSelection)};
4069 template <
typename T1,
bool OPT>
4075 template <
typename T1,
bool OPT>
4082 std::vector<ArrowTableRef> extractTablesFromFiltered(std::vector<
Filtered<T>>& tables)
4084 std::vector<ArrowTableRef> outTables;
4085 for (
auto& table : tables) {
4086 outTables.push_back(table.asArrowTableRef());
4097template <
typename L,
typename D,
typename O,
typename Key,
typename H,
typename...
Ts>
4108 static constexpr const uint32_t binding_origin = Key::binding_origin;
4111 template <
typename... TA>
4115 if constexpr (binding_origin == TA::binding_origin) {
4116 this->bindExternalIndex(cur);
4141template <
typename T,
bool APPLY>
4144 static constexpr bool applyFilters = APPLY;
4150template <
typename T>
4153template <
typename T>
header::DataDescription description
#define O2HASH(_Str_)
Pre-declare Hash specialization for a generic string.
#define O2ORIGIN(_Str_)
Pre-declare Hash specialization for an origin string.
consteval auto getIndexTargets()
SLICE.
o2::monitoring::tags::Key Key
#define O2_BUILTIN_UNREACHABLE
#define O2_BUILTIN_LIKELY(x)
#define O2_BUILTIN_UNLIKELY(x)
std::unique_ptr< expressions::Node > node
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font auto
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions false
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc bool
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc true
std::vector< o2::MCCompLabel > labels
Class for time synchronization of RawReader instances.
int64_t const * mCurrentPos
ColumnIterator(arrow::ChunkedArray const *column)
ColumnIterator(ColumnIterator< T, ChunkingPolicy > const &)=default
uint64_t const * mGlobalOffset
void moveToEnd()
Move the iterator to the end of the column.
ColumnIterator< T > & moveToPos()
ColumnIterator< T, ChunkingPolicy > & operator=(ColumnIterator< T, ChunkingPolicy > const &)=default
unwrap_t< T > const * mCurrent
unwrap_t< T > const * mLast
ColumnIterator(ColumnIterator< T, ChunkingPolicy > &&)=default
arrow::ChunkedArray const * mColumn
ColumnIterator< T, ChunkingPolicy > & operator=(ColumnIterator< T, ChunkingPolicy > &&)=default
void moveToChunk(int chunk)
void nextChunk() const
Move the iterator to the next chunk.
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
int64_t tableSize() const
typename T::external_index_columns_t external_index_columns_t
auto select(framework::expressions::Filter const &f) const
static auto getSpan(gandiva::Selection const &sel)
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
void copyIndexBindings(T1 &dest) const
auto const & getSelectedRows() const
void setPointerReconstructor(framework::PointerReconstructor const &pointerReconstructor)
typename T::columns_t columns_t
void bindExternalIndices(TA *... current)
void sumWithSelection(is_a_selection auto selection)
void bindInternalIndicesTo(I const *ptr)
FilteredBase(std::vector< ArrowTableRef > &&tables, is_a_selection auto selection)
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
auto rawSlice(uint64_t start, uint64_t end) const
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
iterator iteratorAt(uint64_t i) const
typename T::table_t table_t
typename T::persistent_columns_t persistent_columns_t
static constexpr void isFilteredBase()
RowViewSentinel end() const
void intersectWithSelection(is_a_selection auto selection)
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
const_iterator begin() const
unfiltered_iterator rawIteratorAt(uint64_t i) const
int isInSelectedRows(int i) const
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
void doCopyIndexBindings(framework::pack< Cs... >, T1 &dest) const
auto const & cached_begin() const
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
Filtered(std::vector< Filtered< T > > &&tables, is_a_selection auto selection)
typename FilteredBase< typename T::table_t >::table_t table_t
typename T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
typename T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
typename T::columns_t columns_t
const_iterator begin() const
Filtered< Filtered< T > > operator+=(is_a_selection auto selection)
Filtered< Filtered< T > > operator*(is_a_selection auto selection)
Filtered< Filtered< T > > operator+(is_a_selection auto selection)
unfiltered_iterator rawIteratorAt(uint64_t i) const
Filtered< Filtered< T > > operator*=(is_a_selection auto selection)
Filtered< Filtered< T > > operator+=(Filtered< T > const &other)
auto rawSlice(uint64_t start, uint64_t end) const
Filtered< Filtered< T > > operator+(Filtered< T > const &other)
Filtered< Filtered< T > > operator*=(Filtered< T > const &other)
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Filtered< Filtered< T > > operator*(Filtered< T > const &other)
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Filtered< T > operator+=(Filtered< T > const &other)
Filtered(std::vector< ArrowTableRef > &&tables, is_a_selection auto selection)
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicyGeneral, OPT > const &container, int value) const
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
Filtered< T > operator+(Filtered< T > const &other)
const_iterator begin() const
Filtered< T > operator+(is_a_selection auto selection)
T::template iterator_template_o< FilteredIndexPolicy, self_t > iterator
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
auto select(framework::expressions::Filter const &f) const
Filtered< T > operator*(is_a_selection auto selection)
T::template iterator_template_o< DefaultIndexPolicy, self_t > unfiltered_iterator
unfiltered_iterator rawIteratorAt(uint64_t i) const
Filtered< T > operator*=(Filtered< T > const &other)
Filtered< T > operator*(Filtered< T > const &other)
auto rawSliceBy(o2::framework::Preslice< T1 > const &container, int value) const
auto rawSlice(uint64_t start, uint64_t end) const
auto sliceBy(o2::framework::PresliceBase< T1, framework::PreslicePolicySorted, OPT > const &container, int value) const
typename T::table_t table_t
typename T::columns_t columns_t
Filtered< T > operator+=(is_a_selection auto selection)
Filtered< T > operator*=(is_a_selection auto selection)
void bindInternalIndicesExplicit(o2::soa::Binding binding)
decltype([]< typename... C >(framework::pack< C... > &&) consteval -> framework::selected_pack< soa::is_persistent_column_t, C... > {}(columns_t{})) persistent_columns_t
void setPointerReconstructor(framework::PointerReconstructor const &pointerReconstructor)
iterator iteratorAt(uint64_t i) const
static constexpr const auto ref
auto offset() const
Return offset.
static consteval bool hasOriginal()
unfiltered_iterator begin()
int64_t tableSize() const
auto rawSlice(uint64_t start, uint64_t end) const
Table(std::vector< o2::soa::ArrowTableRef > &&tables)
void bindExternalIndices(TA *... current)
auto select(framework::expressions::Filter const &f) const
decltype([]< typename... C >(framework::pack< C... >) consteval -> framework::pack< typename C::type... > {}(persistent_columns_t{})) column_types
unfiltered_iterator unfiltered_const_iterator
decltype([]() { if constexpr(sizeof...(Ts)==0) { return iterator_template< IP, Parent >{} iterator_template_o
auto const & cached_begin() const
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
TableIteratorBase< IP, Parent, T... > iterator_template
static constexpr header::DataOrigin binding_origin_
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
auto sliceBy(o2::framework::PresliceBase< T1, Policy, OPT > const &container, int value) const
iterator unfiltered_iterator
void bindExternalIndex(TA *current)
std::shared_ptr< arrow::Table > asArrowTable() const
Return a type erased arrow table backing store for / the type safe table.
filtered_iterator filtered_begin(std::span< int64_t const > selection)
void doCopyIndexBindings(framework::pack< Cs... >, T &dest) const
int64_t size() const
Size of the table, in rows.
static constexpr auto column_hashes
decltype(getColumns< ref, Ts... >()) columns_t
arrow::ChunkedArray * getIndexToKey()
decltype([]< typename... C >(framework::pack< C... > &&) consteval -> framework::selected_pack< soa::is_external_index_t, C... > {}(columns_t{})) external_index_columns_t
ArrowTableRef asArrowTableRef() const
static constexpr const uint32_t binding_origin
static consteval auto isIndexTargetOf()
std::shared_ptr< arrow::Table > asArrowTableConstrained() const
iterator_template_o< FilteredIndexPolicy, table_t > filtered_iterator
unfiltered_const_iterator begin() const
void copyIndexBindings(T &dest) const
static constexpr const auto originalLabels
Table< L, D, O, Ts... > self_t
static consteval auto isIndexTargetOf()
void doBindInternalIndicesExplicit(framework::pack< Cs... >, o2::soa::Binding binding)
static constexpr const auto originals
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables)
decltype([]< typename... C >(framework::pack< C... > &&) consteval -> framework::selected_pack< soa::is_self_index_t, C... > {}(columns_t{})) internal_index_columns_t
Table(std::shared_ptr< arrow::Table > table)
Table(o2::soa::ArrowTableRef tableRef)
Table(std::vector< std::shared_ptr< arrow::Table > > &&tables)
RowViewSentinel end() const
static constexpr void isSOATable()
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
void bindInternalIndicesTo(I const *ptr)
unfiltered_iterator rawIteratorAt(uint64_t i) const
Table(std::vector< o2::soa::ArrowTableRef > &&tables)
iterator_template_o< DefaultIndexPolicy, table_t > iterator
GLuint GLsizei const GLuint const GLintptr * offsets
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
GLuint GLsizei GLsizei * length
GLuint GLsizei const GLchar * label
GLsizei GLenum const void * indices
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLenum GLsizei len
GLboolean GLboolean GLboolean GLboolean a
std::shared_ptr< gandiva::SelectionVector > Selection
consteval const char * origin_str()
consteval const char * signature()
consteval auto replaceOrigin()
Replace origins in the TableRef array.
constexpr framework::ConcreteDataMatcher matcher()
consteval auto filterForKey()
Filter TableRef array for compatibility with Key table.
consteval const char * label()
consteval header::DataOrigin origin()
gandiva::Selection createSelection(std::shared_ptr< arrow::Table > const &table, Filter const &expression)
Function for creating gandiva selection from our internal filter tree.
Defining ITS Vertex explicitly as messageable.
std::decay_t< decltype(select_pack< Condition >(pack<>{}, Pack{}, CondPack{}))> selected_pack_multicondition
std::decay_t< decltype(prune_voids_pack(pack<>{}, with_condition_pack< Condition, Types... >{}))> selected_pack
std::function< std::byte *(fair::mq::shmem::MetaHeader &&)> PointerReconstructor
decltype(intersected_pack(Ps{}...)) full_intersected_pack_t
typename pack_element< I, T >::type pack_element_t
consteval size_t has_type_at_v(pack< Ts... >)
constexpr std::size_t pack_size(pack< Ts... > const &)
template function to determine number of types in a pack
decltype(concatenate_pack_unique(Ps{}...)) concatenated_pack_unique_t
std::string strToUpper(std::string &&str)
typename pack_element< 0, T >::type pack_head_t
std::string cutString(std::string &&str)
std::vector< std::vector< int64_t > > ListVector
R getColumnValue(const T &rowIterator)
ColumnGetterFunction< R, typename T::iterator > getColumnGetterByLabel(const std::string_view &targetColumnLabel)
void * extractCCDBPayload(char *payload, size_t size, TClass const *cl, const char *what)
consteval auto computeOriginals()
auto createFieldsFromColumns(framework::pack< C... >)
SelectionVector selectionToVector(gandiva::Selection const &sel)
constexpr bool is_persistent_v
column identification
constexpr bool is_ng_index_equivalent_v
consteval auto remove_if(L l)
constexpr auto join(Ts const &... t)
auto doSliceBy(T const *table, o2::framework::PresliceBase< C, Policy, OPT > const &container, int value)
void notBoundTable(const char *tableName)
SelectionVector sliceSelection(std::span< int64_t const > const &mSelectedRows, int64_t nrows, uint64_t offset)
auto doFilteredSliceBy(T const *table, o2::framework::PresliceBase< C, framework::PreslicePolicySorted, OPT > const &container, int value)
constexpr auto concat(Ts const &... t)
consteval auto intersectOriginals()
consteval auto getColumns()
std::vector< int64_t > SelectionVector
std::conditional_t< is_binding_compatible_v< T, typename B::binding_t >(), std::true_type, std::false_type > is_binding_compatible
consteval auto mergeOriginals()
constexpr bool is_soa_filtered_v
typename std::conditional_t< is_index_column< C >, std::true_type, std::false_type > is_external_index_t
void missingFilterDeclaration(int hash, int ai)
auto doSliceByCachedUnsorted(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
auto doSliceByCached(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
void accessingInvalidIndexFor(const char *getter)
auto select(T const &t, framework::expressions::Filter const &f)
consteval auto base_iter(framework::pack< C... > &&) -> TableIterator< D, O, IP, C... >
constexpr bool is_index_equivalent_v
constexpr bool is_soa_join_v
void dereferenceWithWrongType(const char *getter, const char *target)
consteval bool is_binding_compatible_v()
typename unwrap< T >::type unwrap_t
auto prepareFilteredSlice(T const *table, o2::soa::ArrowTableRef slice)
void getterNotFound(const char *targetColumnLabel)
auto doFilteredSliceByCached(T const *table, framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache)
void missingOptionalPreslice(const char *label, const char *key)
constexpr char asciiToLower(char c)
auto doSliceByHelper(T const *table, std::span< const int64_t > const &selection)
std::function< framework::ConcreteDataMatcher(framework::ConcreteDataMatcher &&)> originReplacement(header::DataOrigin newOrigin)
consteval bool is_compatible()
arrow::ChunkedArray * getIndexFromLabel(arrow::Table *table, std::string_view label)
consteval auto merge()
Helpers to manipulate TableRef arrays.
consteval auto merge_if(L l)
std::conditional_t< is_persistent_column< C >, std::true_type, std::false_type > is_persistent_column_t
typename arrow_array_for< T >::type arrow_array_for_t
void notFoundColumn(const char *label, const char *key)
std::conditional_t< is_dynamic_column< T >, std::true_type, std::false_type > is_dynamic_t
pack filtering helpers
typename std::conditional_t< is_self_index_column< C >, std::true_type, std::false_type > is_self_index_t
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
FIXME: do not use data model tables.
static constexpr uint32_t hash
static constexpr char const *const str
static constexpr void isHash()
SliceInfoUnsortedPtr getCacheUnsortedFor(Entry const &bindingKey) const
header::DataOrigin newOrigin
SliceInfoPtr getCacheFor(Entry const &bindingKey) const
static constexpr bool optional
PresliceBase(expressions::BindingNode index_)
std::span< const int64_t > getSliceFor(int value) const
const std::string binding
o2::soa::ArrowTableRef getSliceFor(int value, o2::soa::ArrowTableRef const &input) const
static constexpr void isPresliceContainer()
static constexpr void isPresliceGroup()
tracks origin in bindingKey matcher to handle the correct arguments
const std::string binding
Entry const & getBindingKey() const
static constexpr void isPreslicePolicy()
SliceInfoUnsortedPtr sliceInfo
std::span< const int64_t > getSliceFor(int value) const
void updateSliceInfo(SliceInfoUnsortedPtr &&si)
o2::soa::ArrowTableRef getSliceFor(int value, o2::soa::ArrowTableRef const &input) const
void updateSliceInfo(SliceInfoPtr &&si)
ArrowTableSlicingCache * ptr
std::pair< int64_t, int64_t > getSliceFor(int value) const
An expression tree node corresponding to a column binding.
A struct, containing the root of the expression tree.
From https://en.cppreference.com/w/cpp/utility/variant/visit.
static o2::soa::ArrowTableRef concatTables(std::vector< std::shared_ptr< arrow::Table > > &&tables)
static o2::soa::ArrowTableRef joinTables(std::vector< std::shared_ptr< arrow::Table > > &&tables)
static o2::soa::ArrowTableRef concatTables(std::vector< o2::soa::ArrowTableRef > &&tables)
ArrowTableRef makeEmpty() const
std::shared_ptr< arrow::Table > tablePtr
ArrowTableRef slice(ArrowRange newRange) const
Type-checking index column binding.
void bind(T const *table)
static constexpr bool chunked
arrow::ChunkedArray * second
Column(ColumnIterator< T > const &it)
static constexpr const char *const & columnLabel()
ColumnIterator< T > const & getIterator() const
Column & operator=(Column const &)=default
Column(Column &&)=default
static auto asArrowField()
Column & operator=(Column &&)=default
Column(Column const &)=default
static constexpr void isIteratableColumn()
ColumnIterator< T > mColumnIterator
Concat(std::shared_ptr< arrow::Table > table)
table_t::template iterator_template< DefaultIndexPolicy, self_t, Ts... > iterator
typename table_t::persistent_columns_t persistent_columns_t
typename table_t::columns_t columns_t
Concat(std::vector< ArrowTableRef > &&tables)
const_iterator unfiltered_const_iterator
iterator unfiltered_iterator
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
Concat(ArrowTableRef table)
filtered_iterator filtered_const_iterator
DefaultIndexPolicy(int64_t nRows, uint64_t offset)
friend bool operator==(DefaultIndexPolicy const &lh, DefaultIndexPolicy const &rh)
bool operator==(RowViewSentinel const &sentinel) const
static constexpr void isDefaultIndexPolicy()
DefaultIndexPolicy(FilteredIndexPolicy const &other)
std::tuple< uint64_t const * > getOffsets() const
DefaultIndexPolicy & operator=(DefaultIndexPolicy &&)=default
void setCursor(int64_t i)
void limitRange(int64_t start, int64_t end)
DefaultIndexPolicy(DefaultIndexPolicy &&)=default
DefaultIndexPolicy(DefaultIndexPolicy const &)=default
DefaultIndexPolicy & operator=(DefaultIndexPolicy const &)=default
std::tuple< int64_t const *, int64_t const * > getIndices() const
DefaultIndexPolicy()=default
Needed to be able to copy the policy.
void moveByIndex(int64_t i)
static constexpr const char *const & columnLabel()
static constexpr void isDynamicColumn()
FilteredIndexPolicy & operator=(FilteredIndexPolicy &&)=default
std::tuple< int64_t const *, int64_t const * > getIndices() const
FilteredIndexPolicy & operator=(FilteredIndexPolicy const &)=default
auto getSelectionRow() const
FilteredIndexPolicy()=default
FilteredIndexPolicy(std::span< int64_t const > selection, int64_t rows, uint64_t offset=0)
friend bool operator==(FilteredIndexPolicy const &lh, FilteredIndexPolicy const &rh)
void resetSelection(std::span< int64_t const > selection)
void setCursor(int64_t i)
static constexpr void isFilteredIndexPolicy()
FilteredIndexPolicy(FilteredIndexPolicy const &)=default
bool operator==(RowViewSentinel const &sentinel) const
std::tuple< uint64_t const * > getOffsets() const
void limitRange(int64_t start, int64_t end)
FilteredIndexPolicy(FilteredIndexPolicy &&)=default
void moveByIndex(int64_t i)
static constexpr bool chunked
static constexpr const char *const & columnLabel()
static constexpr void isEnumeratingColumn()
static constexpr const uint32_t hash
uint64_t mOffset
Offset within a larger table.
int64_t mRowIndex
Position inside the current table.
static constexpr void isIndexTable()
void bindExternalIndices(TA *... current)
IndexTable(ArrowTableRef table)
typename base_t::template iterator_template_o< DefaultIndexPolicy, self_t > iterator
filtered_iterator const_filtered_iterator
IndexTable(IndexTable &&)=default
IndexTable(std::vector< ArrowTableRef > &&tables)
IndexTable & operator=(IndexTable const &)=default
IndexTable & operator=(IndexTable &&)=default
typename H::binding_t first_t
typename base_t::template iterator_template_o< FilteredIndexPolicy, self_t > filtered_iterator
IndexTable(IndexTable const &)=default
Index(Index const &)=default
void setIndices(std::tuple< int64_t const *, int64_t const * > indices)
Index & operator=(Index &&)=default
Index(arrow::ChunkedArray const *)
int64_t filteredIndex() const
constexpr int64_t rangeEnd()
constexpr int64_t rangeStart()
Index & operator=(Index const &)=default
int64_t globalIndex() const
std::tuple< int64_t const *, int64_t const * > rowIndices
void setOffsets(std::tuple< uint64_t const * > offsets)
static constexpr const char * mLabel
std::tuple< uint64_t const * > rowOffsets
auto sliceBy(o2::framework::PresliceBase< T1, Policy, OPT > const &container, int value) const
static constexpr const auto originalLabels
static constexpr const auto originals
iterator rawIteratorAt(uint64_t i) const
static constexpr const uint32_t binding_origin
auto sliceByCached(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
const_iterator unfiltered_const_iterator
typename table_t::columns_t columns_t
Table< o2::aod::Hash<"JOIN"_h >, o2::aod::Hash<"JOIN/0"_h >, o2::aod::Hash<"JOIN"_h >, Ts... > base
iterator iteratorAt(uint64_t i) const
typename table_t::persistent_columns_t persistent_columns_t
const_iterator begin() const
void bindExternalIndices(TA *... current)
table_t::template iterator_template< DefaultIndexPolicy, self_t, Ts... > iterator
static consteval bool contains()
static constexpr void isJoin()
Join(std::vector< ArrowTableRef > &&tables)
table_t::template iterator_template< FilteredIndexPolicy, self_t, Ts... > filtered_iterator
auto sliceByCachedUnsorted(framework::expressions::BindingNode const &node, int value, o2::framework::SliceCache &cache) const
auto rawSlice(uint64_t start, uint64_t end) const
static constexpr const header::DataOrigin binding_origin_
iterator unfiltered_iterator
filtered_iterator filtered_const_iterator
static constexpr const uint32_t hash
static constexpr const char *const & columnLabel()
static constexpr void isMarkingColumn()
Marker & operator=(Marker const &)=default
static constexpr auto value
static constexpr const char * mLabel
Marker(arrow::ChunkedArray const *)
Marker(Marker const &)=default
Marker & operator=(Marker &&)=default
Marker(Marker &&)=default
static constexpr void isRowViewSentinel()
SmallGroupsBase(std::vector< ArrowTableRef > &&tables, is_a_selection auto selection)
static constexpr void isSmallGroups()
framework::selected_pack< soa::is_persistent_column_t, C... > persistent_columns_t
void doSetCurrentIndexRaw(framework::pack< Cs... > p, std::vector< o2::soa::Binding > &&ptrs)
void bindInternalIndices(I const *table)
TableIterator(TableIterator< D, O, FilteredIndexPolicy, C... > const &other)
TableIterator(self_t const &other)
TableIterator operator-(int64_t dec) const
TableIterator(arrow::ChunkedArray *columnData[sizeof...(C)], IP &&policy)
TableIterator & operator=(TableIterator other)
TableIterator & operator++()
void bindExternalIndex(TA *current)
void doSetCurrentInternal(framework::pack< Cs... >, I const *ptr)
decltype([]< typename... Cs >(framework::pack< Cs... >) consteval -> framework::pack< typename Cs::binding_t... > {}(external_index_columns_t{})) bindings_pack_t
auto getIndexBindingsImpl(framework::pack< Cs... >) const
TableIterator operator--(int)
void bindExternalIndicesRaw(std::vector< o2::soa::Binding > &&ptrs)
TableIterator(arrow::ChunkedArray *columnData[sizeof...(C)], IP &&policy)
void bindExternalIndices(TA *... current)
TableIterator & operator--()
framework::selected_pack< soa::is_external_index_t, C... > external_index_columns_t
TableIterator const & operator*() const
static constexpr void isTableIterator()
TableIterator operator++(int)
framework::selected_pack< soa::is_self_index_t, C... > internal_index_columns_t
auto getIndexBindings() const
void setPointerReconstructor(framework::PointerReconstructor const &pointerReconstructor)
TableIterator operator+(int64_t inc) const
Allow incrementing by more than one the iterator.
Generic identifier for a table type.
constexpr TableRef & operator=(TableRef const &)=default
constexpr bool descriptionCompatible(uint32_t _desc_hash) const noexcept
constexpr bool operator==(TableRef const &other) const noexcept
constexpr TableRef(TableRef &&)=default
constexpr TableRef(TableRef const &)=default
consteval TableRef(uint32_t _label, uint32_t _desc, uint32_t _origin, uint32_t _version)
constexpr bool descriptionCompatible(TableRef const &other) const noexcept
constexpr TableRef & operator=(TableRef &&)=default
TableIteratorBase const & operator*() const
TableIteratorBase(TableIteratorBase< IP, P, T... > const &other)
typename Parent::columns_t columns_t
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > const &other)
typename Parent::external_index_columns_t external_index_columns_t
TableIteratorBase operator-(int64_t dec) const
void matchTo(TableIteratorBase< IP, P, T... > const &other)
auto getDynamicColumn() const
TableIteratorBase()=default
void matchTo(TableIteratorBase< IP, P, Os... > const &other)
TableIteratorBase(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
std::array< B, sizeof...(CCs)> getValues() const
static constexpr auto originals
TableIteratorBase(TableIteratorBase< IP, P, T... > &&other) noexcept
TableIteratorBase & operator=(TableIteratorBase< IP, P, Os... > other)
TableIteratorBase(TableIteratorBase< IP, P, O1, Os... > &&other) noexcept
TableIteratorBase & operator=(RowViewSentinel const &other)
decltype([]< typename... C >(framework::pack< C... >) consteval -> framework::pack< typename C::binding_t... > {}(external_index_columns_t{})) bindings_pack_t
TableIteratorBase(arrow::ChunkedArray *columnData[framework::pack_size(columns_t{})], IP &&policy)
TableIteratorBase & operator=(TableIteratorBase< IP, P, T... > other)
TableIteratorBase operator+(int64_t inc) const
Allow incrementing by more than one the iterator.
TableIteratorBase & operator=(TableIteratorBase< FilteredIndexPolicy, P, T... > other)
VectorOfTObjectPtrs other
std::vector< ReadoutWindowData > rows