Skip to content

Revise how GenParticle status is set for particles created during the simulation

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

HepMC3 does not natively support the barcode property for GenParticle or GenVertex. For the initial migration from HepMC2 to HepMC3, then the solution was to add barcode as an IntAttribute. This worked, but had performance penalties.

The longer term solution is to migrate to using a combination of GenParticle/Vertex::id() and GenParticle/Vertex::status() to hold the information currently held in the barcode attribute.

The first step of this is to use the new status code scheme to encode origin information.

  • Origin information currently held in barcodes:
    • a) Particle produced during Evgen or Simulation (barcode > 200k)
    • b) Link back to original parent Particle when particles survive interactions (barcode%1M)
    • c) Number of interactions survived by particle (int(barcode/1M))
    • d) Vertex produced during Evgen or Simulation (barcode < -200k)

Sketch of how GenParticle status should be updated for the new scheme.

Scenario Old status Old barcode New status
Nth Truth particle created+decayed during evgen 2 N 2
Nth Truth Particle created, but not decayed during evgen 1 N 1
Nth Secondary particle created by an interaction/decay during sim 1 200000 + N 20001
Generator created particle with has survived M interactions during sim (B = original barcode) 1 B + M*1000000 1 + M*100000
Secondary particle created during sim, which has survived M interactions (B = original barcode) 1 B + M*1000000 20001 + M*100000

Sketch of how GenVertex status should be updated for the new scheme.

Scenario Old status Old barcode New status
Nth Truth vertex created during evgen <1000 (generator specific) -N <1000 (same as old scheme)
Nth Truth vertex created during sim 1000 + G4 process -200000 - N 20000 + 1000 + G4 process

The new status scheme can be used to obtain (a), (c) and (d), but (b) will be determined by stepping back through the tree.

This merge request migrates the transient GenEvent classes to use the new status scheme. Barcodes remain unchanged. Persistient GenEvent classes remain unchanged and xAOD::Truth classes remain unchanged.

A more detailed discussion can be found here.

The next step will be to implement the new helper function for (b).

Tagging @averbyts, @pclark

Edited by John Derek Chapman

Merge request reports