Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 27 additions & 9 deletions Framework/Core/include/Framework/ASoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ consteval static bool relatedBySortedIndex()

namespace o2::framework
{

/// FIXME: has to track origin to handle the correct arguments
struct PreslicePolicyBase {
const std::string binding;
Entry bindingKey;
Expand All @@ -1547,7 +1547,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 +1580,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 @@ -1744,7 +1744,13 @@ auto doFilteredSliceBy(T const* table, o2::framework::PresliceBase<C, framework:
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({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m) {
if ((m.origin == header::DataOrigin{"AOD"}) && (o != header::DataOrigin{"AOD"})) {
m.origin = o;
}
return m;
}(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 +1762,13 @@ 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({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m) {
if ((m.origin == header::DataOrigin{"AOD"}) && (o != header::DataOrigin{"AOD"})) {
m.origin = o;
}
return m;
}(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 +1777,13 @@ 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({"", [&o = cache.ptr->newOrigin](framework::ConcreteDataMatcher&& m) {
if ((m.origin == header::DataOrigin{"AOD"}) && (o != header::DataOrigin{"AOD"})) {
m.origin = o;
}
return m;
}(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
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