Skip to content

Conversation

@tmadlener
Copy link
Member

@tmadlener tmadlener commented Nov 20, 2025

BEGINRELEASENOTES

  • Introduce the type subcommand to the outputCommands grammar to keep / drop all collections of a given datatype.

ENDRELEASENOTES

This functionality was also present for LCIO / Marlin and I think it's quite useful, because it just allows one to write e.g. drop type edm4hep::SimTrackerHitCollection to drop all sim tracker hits without having to know all names first.

I have implemented this here instead of podio, because I think it fits better here.

For now I have also kept the overload of KeepDropSwitch::isOn that only takes a single string, but I don't think there are any users outside for which backwards compatibility would be a concern (see also #351 where the KeepDropSwitch was moved into the k4FWCore namespace). Removing that would require touching the existing unit tests, but that would not be a real problem, I think.

There is also some initial refactoring of the KeepDropSwitch that could in principle be pulled into a separate PR if necessary.

@BrieucF
Copy link
Contributor

BrieucF commented Nov 20, 2025

This will indeed be very useful!

@tmadlener
Copy link
Member Author

I am fairly happy with the syntax / grammar for the output commands here. The main question I still have is whether it should be keep type XYZCollection or whether we shorten it to only keep type XYZ. The main problem with that is that podio::UserDataCollection become only, e.g. float, or int which looks slightly weird, IMO.

@jmcarcell
Copy link
Member

jmcarcell commented Nov 26, 2025

I am fairly happy with the syntax / grammar for the output commands here. The main question I still have is whether it should be keep type XYZCollection or whether we shorten it to only keep type XYZ. The main problem with that is that podio::UserDataCollection become only, e.g. float, or int which looks slightly weird, IMO.

I would say, leave it as it is now, with the namespace.

@tmadlener tmadlener linked an issue Dec 2, 2025 that may be closed by this pull request
tmadlener and others added 12 commits December 16, 2025 10:08
It's a bit confusing that the string contradicts what is actually
tested.
The way we use it we call it once per collection. Additionally, when
adding support for keeping and dropping based on types the caching
starts to become more complicated.
Using "type" as second element of an output command will now make the
KeepDropSwitch take decisions on types as well. The isOn command gets a
second overload that takes a type name as well. Type names are matched
exactly without support for wildcards. We keep the old isOn overload
that only takes a single argument for easier testing without types and
for some backwards compatibility.
This makes it possible to keep / drop collections based on type in
addition to the existintg name based selection
Co-authored-by: Juan Miguel Carceller <[email protected]>
Co-authored-by: Juan Miguel Carceller <[email protected]>
@tmadlener tmadlener force-pushed the output-commands-drop-type branch from 43dd2bc to cc2ab0a Compare December 16, 2025 09:08
@tmadlener
Copy link
Member Author

I think now all comments should be addressed and this could be merged.

@jmcarcell jmcarcell merged commit f4724fa into key4hep:main Dec 19, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeepDropSwitch should support dropping all collections of a given type

3 participants