@@ -148,6 +148,38 @@ struct AnalysisDataProcessorBuilder {
148148 }.template operator ()<A::originals.size (), std::decay_t <A>::originals>(std::make_index_sequence<std::decay_t <A>::originals.size ()>());
149149 }
150150
151+ // / helpers to append InputSpect for a single argument with grouping
152+ template <soa::is_iterator G, soa::is_table A>
153+ requires (soa::relatedByIndex<std::decay_t <G>, std::decay_t <A>>())
154+ static void addSlicingInput (const char * name, bool value, std::vector<InputSpec>& inputs, header::DataOrigin&& newOrigin = header::DataOrigin{" AOD" })
155+ {
156+ auto key = std::string{" fIndex" } + o2::framework::cutString (soa::getLabelFromType<std::decay_t <G>>());
157+ Entry entry{soa::getLabelFromTypeForKey<std::decay_t <A>>(key), soa::getMatcherFromTypeForKey<std::decay_t <A>>(key), key, value};
158+ // replace the origin of the sliced table first, so that both the slicer source and the slice info carry the new origin
159+ bool originReplaced = (entry.matcher .origin == header::DataOrigin{" AOD" }) && (newOrigin != header::DataOrigin{" AOD" });
160+ if (originReplaced) {
161+ entry.matcher = replaceOrigin (entry.matcher , newOrigin);
162+ }
163+ auto spec = inputForEntry (entry, !o2::soa::is_smallgroups<std::decay_t <A>>);
164+ spec.metadata .emplace_back (ConfigParamSpec{std::string{" control:" } + name, VariantType::Bool, value, {" \"\" " }});
165+ if (originReplaced) {
166+ spec.metadata .emplace_back (ConfigParamSpec{" aod-origin-replaced" , VariantType::Bool, true , {" \"\" " }});
167+ }
168+
169+ DataSpecUtils::updateInputList (inputs, std::move (spec));
170+ }
171+
172+ template <soa::is_iterator G, soa::is_table A>
173+ requires (!soa::relatedByIndex<std::decay_t <G>, std::decay_t <A>>())
174+ static void addSlicingInput (const char *, bool , std::vector<InputSpec>&, header::DataOrigin&&)
175+ {
176+ }
177+
178+ template <soa::is_table G, soa::is_table A>
179+ static void addSlicingInput (const char *, bool , std::vector<InputSpec>&, header::DataOrigin&&)
180+ {
181+ }
182+
151183 // / helper to append the inputs and expression information for normalized arguments
152184 template <soa::is_table... As>
153185 static void addInputsAndExpressions (uint32_t hash, const char * name, bool value, std::vector<InputSpec>& inputs, std::vector<ExpressionInfo>& eInfos, std::vector<InputInfo>& iInfos, header::DataOrigin&& newOrigin = header::DataOrigin{" AOD" })
@@ -162,6 +194,17 @@ struct AnalysisDataProcessorBuilder {
162194 ...);
163195 }
164196
197+ // / helper to append the slicing inputs
198+ template <soa::is_iterator G, soa::is_table... As>
199+ static void addSlicingInputs (const char * name, bool value, std::vector<InputSpec>& inputs, header::DataOrigin&& newOrigin = header::DataOrigin{" AOD" })
200+ {
201+ ([&name,&value,&inputs,newOrigin]() mutable {
202+ using T = std::decay_t <As>;
203+ addSlicingInput<G, T>(name, value, inputs, std::move (newOrigin));
204+ }(),
205+ ...);
206+ }
207+
165208 // / helper to parse the process arguments
166209 template <typename T>
167210 inline static bool requestInputsFromArgs (T&, std::string const &, std::vector<InputSpec>&, std::vector<ExpressionInfo>&, std::vector<InputInfo>&, header::DataOrigin)
@@ -200,7 +243,11 @@ struct AnalysisDataProcessorBuilder {
200243 requires (std::is_lvalue_reference_v<A> && (std::is_lvalue_reference_v<Args> && ...))
201244 {
202245 constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<void (C::*)(A, Args...)>();
203- addInputsAndExpressions<typename std::decay_t <A>::parent_t , Args...>(hash, name, value, inputs, eInfos, iInfos, std::move (newOrigin));
246+ // here we also add slicing inputs with the same constrol config param spec as normal inputs, so it can be removed in adjust topology
247+ // step if the process function is disabled
248+ auto newOriginCopy = newOrigin;
249+ addSlicingInputs<A, Args...>(name, value, inputs, std::move (newOrigin));
250+ addInputsAndExpressions<typename std::decay_t <A>::parent_t , Args...>(hash, name, value, inputs, eInfos, iInfos, std::move (newOriginCopy));
204251 }
205252
206253 // / 3. generic case
0 commit comments