Draft: Allow v1/v2 Particle backend selection in standard_particles
Rather than address #275 (closed) directly, this MR goes in the direction of converting all v1-backed makers in Hlt2Conf.standard_particles
to makers which can dynamically switch between creating v1 or v2 Particle objects.
The configuration for switching looks like this:
from Hlt2Conf.standard_particles import make_hasrich_long_pions
from Hlt2Conf.standard_particles.helpers import default_particle_backend
# Default is still v1 for now
particles_v1 = make_hasrich_long_pions()
with default_particle_backend.bind(backend='v2'):
particles_v2 = make_hasrich_long_pions()
Combined with the v1/v2 backend switching provided in Hlt2Conf.algorithms_thor
, the goal of the MR is to enable easy testing of HLT2 lines between v1 and v2 backends.
Specific implementation steps:
- Hide v1/v2 charged basic Particle backend creation behind a unified
helper.
- Specialised v2 makers are then removed.
- Create helper methods for upstream, downstream, and long charged basic makers, and use these in hypothesis-specific charged basic makers.
- Move particle types (charged basic, neutral basic, and composite) to modules under
Hlt2Conf.standard_particles
(e.g.Hlt2Conf.standard_particles.charged_basics
).- Update consumers of
Hlt2Conf.standard_particles
to reflect the new interface.
- Update consumers of
- Add v2 combiner configuration to
Hlt2Conf.algorithms_thor
.
To do
The most recent change was the introduction of the Hlt2Conf.test_hlt2_standard_v2_particles
test. This tests the full v1-to-v2 switching architecture to verify that we can indeed run a full HLT2-line-like selection with either backend with no configuration change (except for the bind
).
This test runs but the counters are significantly different. This surprised me because the selection only applies the PT
functor at the moment. I haven't had a chance to dig deeper into things yet.