Skip to content

Commit e8854d7

Browse files
committed
add aod-origin-replace option
1 parent 07bef59 commit e8854d7

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
@@ -525,6 +525,18 @@ DataProcessorSpec adaptAnalysisTask(ConfigContext const& ctx, Args&&... args)
525525
std::vector<ExpressionInfo> expressionInfos;
526526
std::vector<InputInfo> inputInfos;
527527

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

530542
/// 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)