Skip to content

Avoid removing particles from the GenEvent after SimHit creation has started

John Derek Chapman requested to merge jchapman/athena:QSSimRefactor_23.0 into 23.0

In order to complete the switch from using GenParticle barcodes to GenParticle id to link GenParticles within a GenEvent to other persistent EDM objects (SimHits), then we cannot remove GenParticles from the GenEvent during the actual simulation process as this can alter the ids of other GenParticles which may have already been linked to SimHits. Any removal has to happen before the first SimHits are created.

Initial approach

  1. Read in BeamTruthEvent McEventCollection as previously. Copy BeamTruthEvent to shadowTruth McEventCollection (not saved to StoreGate).
  2. For each GenEvent in shadowTruth:
    a) Apply ZeroLifetimePositioner to deal with the issue of oscillating neutral mesons.
    b) Apply TruthPreselectionTool. This makes a copy of the GenEvent, identifies all particles (including quasi-stable particles) in the GenEvent held in the BeamTruthEvent McEventCollection which will be passed to the Simulators and add a ShadowParticleId Attribute holding the id of the GenParticle in the shadowTruth version of the GenEvent to them. It then loops over the GenParticle and GenVertex objects in the GenEvent copy and removes all objects with an ancestor which has the ShadowParticleId Attribute (effectively this removes the decay trees downstream of quasi-stable particles). This modified copy of the GenEvent is stored in the TruthEvent McEventCollection (saved to StoreGate).
  3. As previously pass the GenEvent object(s) in TruthEvent to InputConverter::convert. As the selection of GenParticle objects has already been done though, this now just creates ISFParticle objects from GenParticle objects with the ShadowParticleId Attribute.
  4. During the building of the G4Event, when converting a quasi-stable particle (identified as a GenParticle with status==2 and no end GenVertex) to a G4PrimaryParticle, the predefined decay chain is taken from the _shadowTruth GenEvent instead of the GenEvent from the TruthEvent McEventCollection. We also avoid linking G4PrimaryParticle objects in the predefined decay chain to any HepMC truth.
  5. Simulation then proceeds as before, the only difference is in the barcodes assigned to particles produced in predefined decays and in the ordering of GenParticle and GenVertex objects in the output GenEvent.

Notes:

  • The implementation of TruthPreselectionTool could be improved. Consider integrating with the InputConverter directly?
  • After this is validated and switched on by default it should be possible to simplify the TruthSvc implementation considerably.
Edited by John Derek Chapman

Merge request reports