JeffersonLab / JANA2

Multi-threaded HENP Event Reconstruction
https://jeffersonlab.github.io/JANA2/
Other
6 stars 9 forks source link

API inconsistency: Set vs Insert vs SetSingle #254

Open nathanwbrei opened 10 months ago

nathanwbrei commented 10 months ago

This aggregates a number of earlier complaints about part of our API. These all need to be solved at the same time, and would constitute a major breaking change.

Overall, I'd say it mostly makes sense how we got here. However, the mismatch between the JANA+PODIO parts and the PODIO-free parts is definitely higher than I'd like, and naming things "Insert" some of the time (particularly when they don't have full insert semantics) was a mistake.

nathanwbrei commented 10 months ago

There are several different places we can go from here. Some of these are mutually exclusive.

  1. We can rename ALL Insert()s and Set()s to SetData() with appropriate overloads, and drop the questionable insert semantics to begin with.
  2. We can attempt to add support for true Insert() semantics for PODIO types by maintaining a mutable collection under the hood, and only handing it over to the podio Frame after JFactory::Process() has finished.
  3. We could give up supporting accessing PODIO data using classical JANA Get/Set. If we did this, JFactoryPodioT would no longer need to inherit from JFactoryT (eliminating these weird Set and Insert calls the users probably shouldn't use anyhow) and we would have a lot fewer headaches with mData. In EICrecon, we set a convention of only accessing PODIO data as collections. Maybe this convention should be enforced in the API as well?
  4. Maybe we could just upgrade everybody to using Omnifactories and no longer have ANY user calls to Set or Insert. I would be weirdly happy doing this. One thing about the GlueX port that bothers me is that the JANA2 API doesn't look any nicer (and in some respects looks worse) than the JANA1 API it is replacing. Omnifactories are genuinely nicer to look at
faustus123 commented 10 months ago

I'm not sure if I'm following this completely. It seems the PODIO immutable collection issue places some practical limitations on what can be done with inserts from the JANA side. I would not want to lose the ability to Insert() single objects or vectors of objects into an event for non-PODIO applications. We may need to discuss it in person if it is more complicated than that.

nathanwbrei commented 10 months ago

Yeah, this is a "big" discussion. Not happening overnight.

nathanwbrei commented 10 months ago

@faustus123 In terms of functionality we would lose if we pursued (0), it's not much: