Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
28374b8
DPL Analysis: introduce InputInfo for AnalysisTask
aalkin May 5, 2026
fc0a414
add fixmes
aalkin May 6, 2026
6e6a392
use runtime matchers for spawns/builds
aalkin May 8, 2026
ffcc7c9
add runtime output matcher to produces
aalkin May 8, 2026
abe2e16
add output matchers to tableTransform; add fixmes
aalkin May 8, 2026
a3b87a2
streamline option building (based on #15320)
aalkin May 11, 2026
5a31371
fixup! streamline option building (based on #15320)
aalkin May 11, 2026
bf9f90e
add aod-origin-replace option
aalkin May 11, 2026
2450e27
complete baseline origin replacement
aalkin May 12, 2026
8386eea
track the former aod inputs/outpus with metadata
aalkin May 13, 2026
e4b98db
make grouping aware of the origin change; fix exception in treeName g…
aalkin May 15, 2026
3bb80e5
remove comments
aalkin May 15, 2026
03c7a67
fixup! remove comments
aalkin May 15, 2026
127ee43
Please consider the following formatting changes
alibuild May 15, 2026
21b91b5
missing return
aalkin May 18, 2026
0b8e345
binding is not needed
aalkin May 19, 2026
d3c55ed
avoid copying a vector; start adapting GroupSlicer to use matchers
aalkin May 19, 2026
f35d088
format
aalkin May 20, 2026
104477d
do not use external matchers in GroupSlicer
aalkin May 20, 2026
8b9f58c
fixup! do not use external matchers in GroupSlicer
aalkin May 20, 2026
77f84c5
array instead of vector; missing static; remove obsolete FIXMEs
aalkin May 21, 2026
f556235
fixup! array instead of vector; missing static; remove obsolete FIXMEs
aalkin May 21, 2026
419a9b1
fixup! array instead of vector; missing static; remove obsolete FIXMEs
aalkin May 21, 2026
fdc8a93
obsolete FIXME; use helpers where required
aalkin May 21, 2026
09a002f
cleanups
aalkin May 21, 2026
8946f03
minor improvement
aalkin May 21, 2026
9f93f44
fixup! minor improvement
aalkin May 21, 2026
df88cf8
remove redundant check
aalkin May 21, 2026
75d7b17
extract function
aalkin May 21, 2026
009202c
account for pre-replaced origins
aalkin May 27, 2026
fb502cd
add constness
aalkin May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Framework/AnalysisSupport/src/AODJAlienReaderHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback(ConfigContext const
// create header
auto concrete = DataSpecUtils::asConcreteDataMatcher(route.matcher);
auto dh = header::DataHeader(concrete.description, concrete.origin, concrete.subSpec);
bool wasAOD = std::ranges::any_of(route.matcher.metadata, [](ConfigParamSpec const& p) { return p.name.starts_with("aod-origin-replaced"); });

if (!didir->readTree(outputs, dh, fcnt, ntf, totalSizeCompressed, totalSizeUncompressed)) {
if (!didir->readTree(outputs, dh, fcnt, ntf, totalSizeCompressed, totalSizeUncompressed, wasAOD)) {
if (first) {
// check if there is a next file to read
fcnt += device.maxInputTimeslices;
Expand All @@ -255,7 +256,7 @@ AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback(ConfigContext const
}
// get first folder of next file
ntf = 0;
if (!didir->readTree(outputs, dh, fcnt, ntf, totalSizeCompressed, totalSizeUncompressed)) {
if (!didir->readTree(outputs, dh, fcnt, ntf, totalSizeCompressed, totalSizeUncompressed, wasAOD)) {
LOGP(fatal, "Can not retrieve tree for table {}: fileCounter {}, timeFrame {}", concrete.origin.as<std::string>(), fcnt, ntf);
throw std::runtime_error("Processing is stopped!");
}
Expand Down
4 changes: 2 additions & 2 deletions Framework/AnalysisSupport/src/DataInputDirector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ uint64_t DataInputDirector::getTimeFrameNumber(header::DataHeader dh, int counte
return didesc->getTimeFrameNumber(counter, numTF, wantedLevel, origin);
}

bool DataInputDirector::readTree(DataAllocator& outputs, header::DataHeader dh, int counter, int numTF, size_t& totalSizeCompressed, size_t& totalSizeUncompressed)
bool DataInputDirector::readTree(DataAllocator& outputs, header::DataHeader dh, int counter, int numTF, size_t& totalSizeCompressed, size_t& totalSizeUncompressed, bool wasAOD)
{
std::string treename;

Expand All @@ -913,7 +913,7 @@ bool DataInputDirector::readTree(DataAllocator& outputs, header::DataHeader dh,
// . filename from defaultDataInputDescriptor
// . treename from DataHeader
didesc = mdefaultDataInputDescriptor;
treename = aod::datamodel::getTreeName(dh);
treename = aod::datamodel::getTreeName(dh, wasAOD);
}
std::string origin = dh.dataOrigin.as<std::string>();

Expand Down
2 changes: 1 addition & 1 deletion Framework/AnalysisSupport/src/DataInputDirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class DataInputDirector
int getNumberInputDescriptors() { return mdataInputDescriptors.size(); }
void createDefaultDataInputDescriptor();

bool readTree(DataAllocator& outputs, header::DataHeader dh, int counter, int numTF, size_t& totalSizeCompressed, size_t& totalSizeUncompressed);
bool readTree(DataAllocator& outputs, header::DataHeader dh, int counter, int numTF, size_t& totalSizeCompressed, size_t& totalSizeUncompressed, bool wasAOD);
uint64_t getTimeFrameNumber(header::DataHeader dh, int counter, int numTF);
arrow::dataset::FileSource getFileFolder(header::DataHeader dh, int counter, int numTF);
int getTimeFramesInFile(header::DataHeader dh, int counter);
Expand Down
89 changes: 35 additions & 54 deletions Framework/Core/include/Framework/ASoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -1410,9 +1410,9 @@ static constexpr std::string getLabelFromType()
}

template <typename... C>
static constexpr auto hasColumnForKey(framework::pack<C...>, std::string const& key)
static constexpr auto hasColumnForKey(framework::pack<C...>, std::string_view key)
{
auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string& str2) {
auto caseInsensitiveCompare = [](const std::string_view& str1, const std::string_view& str2) {
return std::ranges::equal(
str1, str2,
[](char c1, char c2) {
Expand All @@ -1424,43 +1424,31 @@ static constexpr auto hasColumnForKey(framework::pack<C...>, std::string const&
}

template <TableRef ref>
static constexpr std::pair<bool, std::string> hasKey(std::string const& key)
static constexpr std::pair<bool, std::string> hasKey(std::string_view key)
{
return {hasColumnForKey(typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>::metadata::columns{}, key), aod::label<ref>()};
}

template <TableRef ref>
static constexpr std::pair<bool, framework::ConcreteDataMatcher> hasKeyM(std::string const& key)
static constexpr std::pair<bool, framework::ConcreteDataMatcher> hasKeyM(std::string_view key)
{
return {hasColumnForKey(typename aod::MetadataTrait<o2::aod::Hash<ref.desc_hash>>::metadata::columns{}, key), aod::matcher<ref>()};
}

template <typename... C>
static constexpr auto haveKey(framework::pack<C...>, std::string const& key)
{
return std::vector{hasKey<C>(key)...};
}

void notFoundColumn(const char* label, const char* key);
void missingOptionalPreslice(const char* label, const char* key);

template <with_originals T, bool OPT = false>
static constexpr std::string getLabelFromTypeForKey(std::string const& key)
static constexpr std::string getLabelFromTypeForKey(std::string_view key)
{
if constexpr (T::originals.size() == 1) {
auto locate = hasKey<T::originals[0]>(key);
if (locate.first) {
return locate.second;
}
} else {
auto locate = [&]<size_t... Is>(std::index_sequence<Is...>) {
return std::vector{hasKey<T::originals[Is]>(key)...};
}(std::make_index_sequence<T::originals.size()>{});
auto it = std::find_if(locate.begin(), locate.end(), [](auto const& x) { return x.first; });
if (it != locate.end()) {
return it->second;
}
auto locate = []<size_t... Is>(std::index_sequence<Is...>, std::string_view key) {
return std::array{hasKey<T::originals[Is]>(key)...} |
std::views::filter([](auto const& x) { return x.first; });
}(std::make_index_sequence<T::originals.size()>{}, key);
if (!locate.empty()) {
return locate.front().second;
}

if constexpr (!OPT) {
notFoundColumn(getLabelFromType<std::decay_t<T>>().data(), key.data());
} else {
Expand All @@ -1470,22 +1458,16 @@ static constexpr std::string getLabelFromTypeForKey(std::string const& key)
}

template <with_originals T, bool OPT = false>
static constexpr framework::ConcreteDataMatcher getMatcherFromTypeForKey(std::string const& key)
static constexpr framework::ConcreteDataMatcher getMatcherFromTypeForKey(std::string_view key)
{
if constexpr (T::originals.size() == 1) {
auto locate = hasKeyM<T::originals[0]>(key);
if (locate.first) {
return locate.second;
}
} else {
auto locate = [&]<size_t... Is>(std::index_sequence<Is...>) {
return std::vector{hasKeyM<T::originals[Is]>(key)...};
}(std::make_index_sequence<T::originals.size()>{});
auto it = std::find_if(locate.begin(), locate.end(), [](auto const& x) { return x.first; });
if (it != locate.end()) {
return it->second;
}
auto locate = []<size_t... Is>(std::index_sequence<Is...>, std::string_view key) {
return std::array{hasKeyM<T::originals[Is]>(key)...} |
std::views::filter([](auto const& x) { return x.first; });
}(std::make_index_sequence<T::originals.size()>{}, key);
if (!locate.empty()) {
return locate.front().second;
}

if constexpr (!OPT) {
notFoundColumn(getLabelFromType<std::decay_t<T>>().data(), key.data());
} else {
Expand Down Expand Up @@ -1521,7 +1503,7 @@ consteval static bool relatedBySortedIndex()

namespace o2::framework
{

/// tracks origin in bindingKey matcher to handle the correct arguments
struct PreslicePolicyBase {
const std::string binding;
Entry bindingKey;
Expand All @@ -1547,7 +1529,7 @@ struct PreslicePolicyGeneral : public PreslicePolicyBase {
template <typename T>
concept is_preslice_policy = std::derived_from<T, PreslicePolicyBase>;

template <typename T, is_preslice_policy Policy, bool OPT = false>
template <soa::is_table T, is_preslice_policy Policy, bool OPT = false>
struct PresliceBase : public Policy {
constexpr static bool optional = OPT;
using target_t = T;
Expand Down Expand Up @@ -1580,13 +1562,13 @@ struct PresliceBase : public Policy {
}
};

template <typename T>
template <soa::is_table T>
using PresliceUnsorted = PresliceBase<T, PreslicePolicyGeneral, false>;
template <typename T>
template <soa::is_table T>
using PresliceUnsortedOptional = PresliceBase<T, PreslicePolicyGeneral, true>;
template <typename T>
template <soa::is_table T>
using Preslice = PresliceBase<T, PreslicePolicySorted, false>;
template <typename T>
template <soa::is_table T>
using PresliceOptional = PresliceBase<T, PreslicePolicySorted, true>;

template <typename T>
Expand Down Expand Up @@ -1741,10 +1723,13 @@ auto doFilteredSliceBy(T const* table, o2::framework::PresliceBase<C, framework:
return prepareFilteredSlice(table, slice, offset);
}

std::function<framework::ConcreteDataMatcher(framework::ConcreteDataMatcher&&)> originReplacement(header::DataOrigin newOrigin);

template <soa::is_table T>
auto doSliceByCached(T const* table, framework::expressions::BindingNode const& node, int value, o2::framework::SliceCache& cache)
{
auto localCache = cache.ptr->getCacheFor({"", o2::soa::getMatcherFromTypeForKey<T>(node.name), node.name});
auto localCache = cache.ptr->getCacheFor({"", originReplacement(cache.ptr->newOrigin)(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
node.name});
auto [offset, count] = localCache.getSliceFor(value);
auto t = typename T::self_t({table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count)}, static_cast<uint64_t>(offset));
if (t.tableSize() != 0) {
Expand All @@ -1756,7 +1741,8 @@ auto doSliceByCached(T const* table, framework::expressions::BindingNode const&
template <soa::is_filtered_table T>
auto doFilteredSliceByCached(T const* table, framework::expressions::BindingNode const& node, int value, o2::framework::SliceCache& cache)
{
auto localCache = cache.ptr->getCacheFor({"", o2::soa::getMatcherFromTypeForKey<T>(node.name), node.name});
auto localCache = cache.ptr->getCacheFor({"", originReplacement(cache.ptr->newOrigin)(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
node.name});
auto [offset, count] = localCache.getSliceFor(value);
auto slice = table->asArrowTable()->Slice(static_cast<uint64_t>(offset), count);
return prepareFilteredSlice(table, slice, offset);
Expand All @@ -1765,7 +1751,8 @@ auto doFilteredSliceByCached(T const* table, framework::expressions::BindingNode
template <soa::is_table T>
auto doSliceByCachedUnsorted(T const* table, framework::expressions::BindingNode const& node, int value, o2::framework::SliceCache& cache)
{
auto localCache = cache.ptr->getCacheUnsortedFor({"", o2::soa::getMatcherFromTypeForKey<T>(node.name), node.name});
auto localCache = cache.ptr->getCacheUnsortedFor({"", originReplacement(cache.ptr->newOrigin)(o2::soa::getMatcherFromTypeForKey<T>(node.name)),
node.name});
if constexpr (soa::is_filtered_table<T>) {
auto t = typename T::self_t({table->asArrowTable()}, localCache.getSliceFor(value));
if (t.tableSize() != 0) {
Expand Down Expand Up @@ -1837,12 +1824,6 @@ consteval auto computeOriginals()
return o2::soa::mergeOriginals<Ts...>();
}

// template <size_t N, std::array<TableRef, N> refs>
// consteval auto commonOrigin()
// {
// return (refs | std::ranges::views::filter([](TableRef const& r) { return (!(r.origin_hash == "DYN"_h || r.origin_hash == "IDX"_h)); })).front().origin_hash;
// }

/// A Table class which observes an arrow::Table and provides
/// It is templated on a set of Column / DynamicColumn types.
template <aod::is_aod_hash L, aod::is_aod_hash D, aod::is_origin_hash O, typename... Ts>
Expand Down Expand Up @@ -4285,7 +4266,7 @@ using SmallGroupsUnfiltered = SmallGroupsBase<T, false>;

template <typename T>
concept is_smallgroups = requires {
[]<typename B, bool A>(SmallGroupsBase<B, A>*) {}(std::declval<T*>());
[]<typename B, bool A>(SmallGroupsBase<B, A>*) {}(std::declval<std::decay_t<T>*>());
};
} // namespace o2::soa

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

namespace o2::aod::datamodel
{
std::string getTreeName(header::DataHeader dh);
std::string getTreeName(header::DataHeader dh, bool wasAOD);
} // namespace o2::aod::datamodel
#endif // O2_FRAMEWORK_ANALYSISDATAMODELHELPERS_H_
Loading