Skip to content

key4hep/EDM4hep

Repository files navigation

key4hep linux

EDM4hep

A generic event data model for future HEP collider experiments.

Components

Vector4f Vector3f Vector3d
Vector2i Vector2f TrackState
Quantity CovMatrix2f CovMatrix3f
CovMatrix4f CovMatrix6f

Datatypes

EventHeader MCParticle SimTrackerHit
CaloHitContribution SimCalorimeterHit RawCalorimeterHit
CalorimeterHit ParticleID Cluster
TrackerHit3D TrackerHitPlane RawTimeSeries
Track Vertex ReconstructedParticle
TimeSeries RecDqdx

Links

RecoMCParticleLink CaloHitSimCaloHitLink TrackerHitSimTrackerHitLink
CaloHitMCParticleLink ClusterMCParticleLink TrackMCParticleLink
VertexRecoParticleLink

Generator related (meta-)data

GeneratorEventParameters
GeneratorPdfInfo

Interfaces

TrackerHit

The tests and examples in the tests directory show how to read, write, and use these types in your code.

Status

This project is in a beta stage -- feedback and use of it in production is encouraged, but expect changes until a stable version is released.

Dependencies

Required:

Optional:

  • Doxygen (to build code reference)
  • HepMC (integration test)
  • HepPDT (integration test)

Build and Install

This project follows the key4hep guidelines and can be built with CMake:

source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh
git clone https://github.com/key4hep/EDM4hep
cd EDM4hep; mkdir build; cd build
cmake ..
make
make test

The library files and dictionaries (libedm4hep.so, ...) must be put somewhere in LD_LIBRARY_PATH.

Python bindings

There are python bindings for all the classes in the datamodel for working with the classes individually (for working with collections podio has its own bindings). Make sure that <CMAKE_INSTALL_PREFIX>/lib is in LD_LIBRARY_PATH, <CMAKE_PREFIX_PATH>/python is in PYTHONPATH and <CMAKE_INSTALL_PREFIX>/include is in ROOT_INCLUDE_PATH:

import edm4hep
particle = edm4hep.MCParticle() # default initialized particle
particle.getCharge() # 0.0

series = edm4hep.TimeSeries(1, 2, 3) # classes can be constructed with non-default parameters
series.getCellID() # 1
series.getTime() # 2.0
series.getInterval() # 3.0

mc = edm4hep.MutableMCParticle() # mutable classes can also be modified
mc.setPDG(2212)
mc.getPDG() # 2212

In an interactive session (with python or ipython, for example) it's possible to see all the classes by typing edm4hep. and then pressing TAB.

Dumping to JSON

The edm4hep2json tool can be used to dump the contents of an EMD4hep file in JSON format. E.g.

edm4hep2json some_events.edm4hep.root

This will produce an output file some_events.edm4hep.json. That has the following structure

{
  "Event <N>": {
     "<CollectionName>": {
       "collID": <ID>,
       "collType": <collectionType>,
       "collection": [
         <elements>
       ]
    },
  }
}

As also stated in the podio documentation there is no plan to support reading JSON back in once it is dumped, so this should not be seen as a way to persistify data, but rather to interface it with tools that consume JSON.

Use edm4hep2json --help to see the available options for selecting which parts of the input file should be part of the output.

Example files

Example EDM4hep files can be obtained from the Continuous Integration (CI) workflows. From the EDM4hep github page, go to Actions -> Key4hep build, click one of the runs (the latest scheduled is preferred) and they will appear at the bottom, under Artifacts.

Contributing

Contributions and bug reports are welcome! See our contributing guidelines if you want to contribute code to EDM4hep.