Skip to content

Commit 2f32f8e

Browse files
committed
add aod-origin-replace option
1 parent fd7f4ed commit 2f32f8e

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct IndexBuilder {
6969

7070
namespace o2::framework
7171
{
72+
void wrongOriginReplacement(std::string_view replacement);
7273
std::shared_ptr<arrow::Table> makeEmptyTableImpl(const char* name, std::shared_ptr<arrow::Schema>& schema);
7374

7475
template <soa::is_table T>

Framework/Core/include/Framework/AnalysisTask.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,18 @@ DataProcessorSpec adaptAnalysisTask(ConfigContext const& ctx, Args&&... args)
526526
std::vector<ExpressionInfo> expressionInfos;
527527
std::vector<InputInfo> inputInfos;
528528

529+
std::string replacementOrigin;
530+
header::DataOrigin newOrigin{"AOD"};
531+
if (ctx.options().hasOption("aod-origin-replace")) {
532+
replacementOrigin = ctx.options().get<std::string>("aod-origin-replace");
533+
if (replacementOrigin.size() > 4UL) {
534+
wrongOriginReplacement(replacementOrigin);
535+
}
536+
}
537+
if (!replacementOrigin.empty()) {
538+
newOrigin.runtimeInit(replacementOrigin.c_str(), std::min(replacementOrigin.size(), 4UL));
539+
}
540+
529541
constexpr const int numElements = nested_brace_constructible_size<false, std::decay_t<T>>() / 10;
530542

531543
/// make sure options and configurables are set before expression infos are created

Framework/Core/src/AnalysisHelpers.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ std::shared_ptr<arrow::Table> IndexBuilder::materialize(std::vector<framework::I
7979

8080
namespace o2::framework
8181
{
82+
void wrongOriginReplacement(std::string_view replacement)
83+
{
84+
throw framework::runtime_error_f("Provided origin replacement string is longer than 4 symbols: %s", replacement.data());
85+
}
86+
8287
std::shared_ptr<arrow::Table> makeEmptyTableImpl(const char* name, std::shared_ptr<arrow::Schema>& schema)
8388
{
8489
schema = schema->WithMetadata(std::make_shared<arrow::KeyValueMetadata>(std::vector{std::string{"label"}}, std::vector{std::string{name}}));

Framework/Core/src/WorkflowCustomizationHelpers.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ std::vector<ConfigParamSpec> WorkflowCustomizationHelpers::requiredWorkflowOptio
6767
{"aod-writer-resmode", VariantType::String, "RECREATE", {"Creation mode of the result files: NEW, CREATE, RECREATE, UPDATE"}},
6868
{"aod-writer-ntfmerge", VariantType::Int, -1, {"Number of time frames to merge into one file"}},
6969
{"aod-writer-keep", VariantType::String, "", {"Comma separated list of ORIGIN/DESCRIPTION/SUBSPECIFICATION:treename:col1/col2/..:filename"}},
70+
// options to manipulate origins
71+
{"aod-origin-replace", VariantType::String, "", {"Replace AOD origin with the string provided"}},
7072

7173
{"fairmq-rate-logging", VariantType::Int, 0, {"Rate logging for FairMQ channels"}},
7274
{"fairmq-recv-buffer-size", VariantType::Int, 4, {"recvBufferSize option for FairMQ channels"}},

0 commit comments

Comments
 (0)