Skip to content

Overhaul of physics event model

Thomas Boettcher requested to merge thboettc_physics_event_model into master

Currently, selections are made based on ParKalmanFilter::FittedTrack and VertexFit::TrackMVAVertex objects. In this MR, these are replaced by BasicParticle and CompositeParticle views. The views include pointers to Kalman/vertex fit results and the PV associated to the particle. BasicParticles also include pointers to particle ID information and information about the hits used to create the underlying tracks. CompositeParticles are composable and (in theory) can be constructed from arbitrary combinations of BasicParticles and other CompositeParticles.

Because of difficulties handling recursive function calls in HIP, the CompositeParticle member functions only explicitly handle two levels of recursion, for example a composition that looks like:

CompositeParticle
    CompositeParticle
        BasicParticle
        BasicParticle
    BasicParticle

CompositeParticles with arbitrary substructure can still be constructed and used in selections, but some built-in member functions will not be able to traverse the decay tree automatically.

The new event model consists of the following views:

  • SciFi views similar to those used in the VELO and UT event models (also introduced in !678 (closed))
  • Allen::Views::Physics::KalmanState: a view for accessing kalman fit results
  • Allen::Views::Physics::KalmanStates: a view for accessing all KalmanStates in an event
  • Allen::Views::Physics::SecondaryVertex: a view for accessing SV fit results
  • Allen::Views::Physics::SecondaryVertices: a view of accessing all SecondaryVertexs in an event
  • Allen::Views::Physics::Track: Includes pointers to the velo, UT, and SciFi segments of a track, if they exist. This was introduced in order to avoid using virtual functions to access LHCbIDs, which was causing compilation errors with HIP and runtime failures with CUDA.
  • Allen::Views::Physics::Particle: Base particle struct. Has a data member for storing the number of substructures. If a Particle has 1 substructure, it is always a BasicParticle. If it has more than 1 substructure, it is always a CompositeParticle
  • Allen::Views::Physics::ParticleContainer: A view for accessing all of the Particles in an event.
  • Allen::Views::Physics::IMultiEventParticleContainer: A view for accessing particles from multiple events.
  • Allen::Views::Physics::BasicParticle: A charged particle view. Includes pointers to the underlying Track, KalmanState, lepton ID results, and associated PV (minimum IP chi2)
  • Allen::Views::Physics::BasicParticles: A view for accessing all BasicParticles in an event
  • Allen::Views::Physics::MultiEventBasicParticles: A view for accessing BasicParticles from multiple events. The input particle container for 1-track lines.
  • Allen::Views::Physics::CompositeParticle: A composite particle view. Includes pointers to pointers to the constituent particles, a SecondaryVertex, and the associated PV (minimum FD chi2)
  • Allen::Views::Physics::CompositeParticles: A view for accessing all CompositeParticles in an event
  • Allen::Views::Physics::MultiEventCompositeParticles: A view for accessing CompositeParticles from multiple events. The input particle container for 2-track lines.

A few new algorithms are introduced:

  • make_lepton_id: Combines electron ID and muon ID results. See note below on lepton ID.
  • make_long_track_particles: Creates BasicParticle and BasicParticles views from SciFi tracks, kalman fit results, and associated PVs
  • particle_container_life_support: Dummy algorithm that is used to trick the sequence into keeping particle containers alive until after the SelReports are created

There are some other changes in this MR to note:

  • BasicParticle::ip() returns the IP with respect to the PV that minimizes IP chi2, not the PV that minimizes IP. This is because only the pointer to the associated PV is stored. The minimum IP could still be calculated within a selection if it's necessary.
  • Electron ID and muon ID results are now stored as uint8_t. The muon ID result is stored in the first bit and the electron ID result is stored in the second bit. The algorithm make_lepton_id combines them into a single uint8_t. This allows BasicParticles to be constructed in a single algorithm make_long_track_particles regardless of whether or not electron ID was performed. This change does not affect selection rates.
  • The TwoKsLine has been almost completely rewritten. The event model changes make this line extremely slow without some optimization.

All selections have been updated to use the new event model, but not all unused Parameters have been removed from the selection header files. The SelReport writer has been generalized to handle arbitrary CompositeParticles, as well as particle containers from multiple different reconstruction sequences. This will allow creating SelReports for a high-pT muon line running with no GEC, for example. In addition, the more flexible event model can produce SelReports for tracks missing a UT segment. This solves all remaining to-do items for #173 (closed), except for implementing SelReports for ECAL clusters.

For now, the old ParKalmanFilter::FittedTrack and VertexFit::TrackMVAVertex objects are still created so they can still be used in checkers and converters.

FYI @dcampora

Edited by Thomas Boettcher

Merge request reports