eic / EICrecon

EIC Reconstruction - JANA based
https://eic.github.io/EICrecon
GNU Lesser General Public License v3.0
5 stars 24 forks source link

Consistent implementation optional input/output collections for factories #1235

Open veprbl opened 6 months ago

veprbl commented 6 months ago

We have a few use cases for collections that may be missing in the input files:

Those omitted collections may trigger omissions in the output collections. We would like to be able to gracefully handle those cases while performing as much sanity checks for the collections that we expect to be present. Unfortunately, it is not even clear if we can have both at the same time.

The current code largely relies on muting exceptions to achieve this, e.g.: https://github.com/eic/EICrecon/blob/0e78fb424555577f3ed28e11b0289d5483037b8b/src/factories/tracking/TrackerHitCollector_factory.cc#L27-L30 and #1069

cc @nathanwbrei

simonge commented 2 weeks ago

Following on from this conversation https://github.com/eic/EICrecon/pull/1503#issuecomment-2187015715 in the related issue rather than a closed PR.

It's present in the upstreamed version of OmniFactory that lives under JANA/Omni/JOmniFactory. Both PodioInputs and VariationalPodioInputs accept an is_optional flag. If you set this flag to true, the collection pointers will be allowed to be null, so you have to check for that. I haven't updated EICrecon to use the upstreamed version of OmniFactory anywhere yet, but you could experiment with it if you like, and report back any problems you find.

Note that if you use the upstreamed JOmniFactory, you'll probably have to use the upstreamed JOmniFactoryGenerator that goes with it. Both of these live in the jana::omni namespace, so they hopefully shouldn't conflict with the EICrecon version.

I haven't been able to simply swap the jana::omni version of the factory in for an individual/subset of factories. Probably a lack of understanding on my part whether it's possible to do this for individual factories/plugins or if it has to be done across the whole codebase. My short term goal is just to convert all instances of CollectionCollector factories so that it doesn't matter if some collections aren't available.