@@ -137,6 +137,38 @@ struct AnalysisDataProcessorBuilder {
137137 }.template operator ()<A::originals.size (), std::decay_t <A>::originals>(std::make_index_sequence<std::decay_t <A>::originals.size ()>());
138138 }
139139
140+ // / helpers to append InputSpect for a single argument with grouping
141+ template <soa::is_iterator G, soa::is_table A>
142+ requires (soa::relatedByIndex<std::decay_t <G>, std::decay_t <A>>())
143+ static void addSlicingInput (const char * name, bool value, std::vector<InputSpec>& inputs, header::DataOrigin&& newOrigin = header::DataOrigin{" AOD" })
144+ {
145+ auto key = std::string{" fIndex" } + o2::framework::cutString (soa::getLabelFromType<std::decay_t <G>>());
146+ Entry entry{soa::getLabelFromTypeForKey<std::decay_t <A>>(key), soa::getMatcherFromTypeForKey<std::decay_t <A>>(key), key, value};
147+ // replace the origin of the sliced table first, so that both the slicer source and the slice info carry the new origin
148+ bool originReplaced = (entry.matcher .origin == header::DataOrigin{" AOD" }) && (newOrigin != header::DataOrigin{" AOD" });
149+ if (originReplaced) {
150+ entry.matcher = replaceOrigin (entry.matcher , newOrigin);
151+ }
152+ auto spec = inputForEntry (entry, !o2::soa::is_smallgroups<std::decay_t <A>>);
153+ spec.metadata .emplace_back (ConfigParamSpec{std::string{" control:" } + name, VariantType::Bool, value, {" \"\" " }});
154+ if (originReplaced) {
155+ spec.metadata .emplace_back (ConfigParamSpec{" aod-origin-replaced" , VariantType::Bool, true , {" \"\" " }});
156+ }
157+
158+ DataSpecUtils::updateInputList (inputs, std::move (spec));
159+ }
160+
161+ template <soa::is_iterator G, soa::is_table A>
162+ requires (!soa::relatedByIndex<std::decay_t <G>, std::decay_t <A>>())
163+ static void addSlicingInput (const char *, bool , std::vector<InputSpec>&, header::DataOrigin&&)
164+ {
165+ }
166+
167+ template <soa::is_table G, soa::is_table A>
168+ static void addSlicingInput (const char *, bool , std::vector<InputSpec>&, header::DataOrigin&&)
169+ {
170+ }
171+
140172 // / helper to append the inputs and expression information for normalized arguments
141173 template <soa::is_table... As>
142174 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" })
@@ -151,6 +183,17 @@ struct AnalysisDataProcessorBuilder {
151183 ...);
152184 }
153185
186+ // / helper to append the slicing inputs
187+ template <soa::is_iterator G, soa::is_table... As>
188+ static void addSlicingInputs (const char * name, bool value, std::vector<InputSpec>& inputs, header::DataOrigin&& newOrigin = header::DataOrigin{" AOD" })
189+ {
190+ ([&name,&value,&inputs,newOrigin]() mutable {
191+ using T = std::decay_t <As>;
192+ addSlicingInput<G, T>(name, value, inputs, std::move (newOrigin));
193+ }(),
194+ ...);
195+ }
196+
154197 // / helper to parse the process arguments
155198 template <typename T>
156199 inline static bool requestInputsFromArgs (T&, std::string const &, std::vector<InputSpec>&, std::vector<ExpressionInfo>&, std::vector<InputInfo>&, header::DataOrigin)
@@ -189,7 +232,11 @@ struct AnalysisDataProcessorBuilder {
189232 requires (std::is_lvalue_reference_v<A> && (std::is_lvalue_reference_v<Args> && ...))
190233 {
191234 constexpr auto hash = o2::framework::TypeIdHelpers::uniqueId<void (C::*)(A, Args...)>();
192- addInputsAndExpressions<typename std::decay_t <A>::parent_t , Args...>(hash, name, value, inputs, eInfos, iInfos, std::move (newOrigin));
235+ // here we also add slicing inputs with the same constrol config param spec as normal inputs, so it can be removed in adjust topology
236+ // step if the process function is disabled
237+ auto newOriginCopy = newOrigin;
238+ addSlicingInputs<A, Args...>(name, value, inputs, std::move (newOrigin));
239+ addInputsAndExpressions<typename std::decay_t <A>::parent_t , Args...>(hash, name, value, inputs, eInfos, iInfos, std::move (newOriginCopy));
193240 }
194241
195242 // / 3. generic case
0 commit comments