Skip to content

Update HepMcParticleLink to handle creation with GenParticle::id() as well as barcodes

John Derek Chapman requested to merge jchapman/athena:HMPL_Barcode2_main into main

Transient HepMcParticleLink objects can now be built using either GenParticle::id() or the GenParticle barcode Attribute as the unique ID for the particle. Eventually support for the barcode-based syntax will be restricted to legacy TP converter code. Until the migration is complete it is better to explicitly force the use of HepMcParticleLink::IS_BARCODE and HepMcParticleLink::IS_ID in the constructors in an attempt to ensure that the correct input is being provided.

HepMcParticleLink TP converters work for most use-cases. Some awkwardness for links to GenParticles that have been cut from the McEventCollection, mostly in deciding whether the unique ID is a barcode or an id. The value is preserved though, so the links can still be used to group EDM objects linked to the same truth particle.

Added HepMcParticleLink_p3 and HepMcParticleLinkCnv_p3 - based on GenParticle::id(). This works as well as the existing HepMcParticleLink_p1/p2 versions. New persistent versions of other EDM classes which depend on HepMcParticleLink will be added in future merge requests.

Output matches except for the output of DetailedTrackTruthBuilder. This relies on sorting by HepMcParticleLinks. The old implementation sorted based on barcode, whereas the new implementation sorts based on GenParticle::id(). In some cases (quasi-stable particle simulation) the barcode-based ordering of GenParticles sometimes differs from the id-based ordering. This means that some objects appear in a different order in the output containers. I don't think that this is an issue, but I need to discuss with Tracking experts.

Once these changes are merged then it becomes simpler to migrate clients to be id()-based. It should be possible to do this in multiple smaller merge requests.


Edited by John Derek Chapman

Merge request reports