EICd
EIC data model
EICd - EIC data model

A data model for EIC defined with podio and based on EDM4hep.

Full Description File

The entire data model is defined with a single YAML file, eic_data.yml.

---
options :
  # should getters / setters be prefixed with get / set?
  getSyntax: True
  # should POD members be exposed with getters/setters in classes that have them as members?
  exposePODMembers: False
  includeSubfolder: True

## Some guidance:
##  - Ensure data products usable without library dependencies (favor PODness where
##    possible).
##  - Move towards EDM4hep compatibility (to allow a transition to mainly use EDM4hep).
##        - migrate away from custom indices in favor of podio relations
##  - Use float most of the time except for 4-vectors where ppm precision is important.
##  - Data alignment: 
##        - data should be aligned with a 64-bit structure where possible.
##        - when using 32 bit values, use them in pairs (or after all 64-bit variables are defined). 
##        - same goes for 16-bit values (keep them aligned with the largest following component)
##  - Explicitly specify the integer length (use the typedefs from <cstdint>, 
##    such as int32_t etc)

components:

  eicd::CovDiag3f:
    Members:
      - float xx
      - float yy
      - float zz
    ExtraCode:
      declaration: "
        CovDiag3f() : xx{0}, yy{0}, zz{0} {}\n
        CovDiag3f(double x, double y, double z)\n
          : xx{static_cast<float>(x)}, yy{static_cast<float>(y)}, zz{static_cast<float>(z)} {}\n
        float operator()(unsigned i, unsigned j) const {return (i == j) ? *(&xx + i) : 0.;}\n
        "

  eicd::Cov2f:
    Members:
      - float xx
      - float yy
      - float xy
    ExtraCode:
      declaration: "
        Cov2f() : xx{0}, yy{0}, xy{0} {}\n
        Cov2f(double vx, double vy, double vxy = 0)\n
          : xx{static_cast<float>(vx)}, yy{static_cast<float>(vy)}, xy{static_cast<float>(vxy)} {}\n
        float operator()(unsigned i, unsigned j) const {\n
          // diagonal\n
          if (i == j) {\n
            return *(&xx + i);\n
          }\n
          // off-diagonal\n
          // we have as options (0, 1), and (1, 0)\n
          // note that, starting from xy, we find the correct element at (i+j+1)/2)\n
          return *(&xy + (i + j + 1) / 2);\n
        }\n
      "

  eicd::Cov3f:
    Members:
      - float xx
      - float yy
      - float zz
      - float xy
      - float xz
      - float yz
    ExtraCode:
      declaration: "
        Cov3f() : xx{0}, yy{0}, zz{0}, xy{0}, xz{0}, yz{0} {}\n
        Cov3f(double vx, double vy, double vz, double vxy = 0, double vxz = 0, double vyz = 0)\n
          : xx{static_cast<float>(vx)}, yy{static_cast<float>(vy)}, zz{static_cast<float>(vz)},\n
            xy{static_cast<float>(vxy)}, xz{static_cast<float>(vxz)}, yz{static_cast<float>(vyz)} {}\n
        float operator()(unsigned i, unsigned j) const {\n
          // diagonal\n
          if (i == j) {\n
            return *(&xx + i);\n
          }\n
          // off-diagonal\n
          // we have as options (0, 1), (0, 2) and (1, 2) (and mirrored)\n
          // note that, starting from xy, we find the correct element at (i+j-1)\n
          return *(&xy + i + j - 1);\n
        }\n
      "

  eicd::Cov4f:
    Members:
      - float xx 
      - float yy
      - float zz
      - float tt
      - float xy
      - float xz
      - float xt
      - float yz
      - float yt
      - float zt
    ExtraCode:
      declaration: "
        Cov4f() : xx{0}, yy{0}, zz{0}, tt{0}, xy{0}, xz{0}, xt{0}, yz{0}, yt{0}, zt{0} {}\n
        Cov4f(double vx, double vy, double vz, double vt,\n
              double vxy = 0, double vxz = 0, double vxt = 0,\n
              double vyz = 0, double vyt = 0, double vzt = 0)\n
          : xx{static_cast<float>(vx)}, yy{static_cast<float>(vy)}, zz{static_cast<float>(vz)}, tt{static_cast<float>(vt)},\n
            xy{static_cast<float>(vxy)}, xz{static_cast<float>(vxz)}, xt{static_cast<float>(vxt)},\n
            yz{static_cast<float>(vyz)}, yt{static_cast<float>(vyt)}, zt{static_cast<float>(vzt)} {}\n
        float operator()(unsigned i, unsigned j) const {\n
          // diagonal\n
          if (i == j) {\n
            return *(&xx + i);\n
          // off-diagonal, can probably be done with less if statements \n
          } else {\n
            if (i > j) { \n
              std::swap(i,j); \n
            } \n
            if (i == 0) { \n
              return *(&xy + j - 1); \n
            } else if (i == 1) { \n
              return *(&yz + j - 2); \n
            } else { \n
              return zt; \n
            } \n
          } \n
        }\n
      "

  ## A point along a track
  eicd::TrackPoint:
    Members:
      - edm4hep::Vector3f position        // Position of the trajectory point [mm]
      - eicd::Cov3f       positionError   // Error on the position
      - edm4hep::Vector3f momentum        // 3-momentum at the point [GeV]
      - eicd::Cov3f       momentumError   // Error on the 3-momentum
      - float             time            // Time at this point [ns]
      - float             timeError       // Error on the time at this point
      - float             theta           // polar direction of the track at the surface [rad]
      - float             phi             // azimuthal direction of the track at the surface [rad]
      - eicd::Cov2f       directionError  // Error on the polar and azimuthal angles
      - float             pathlength      // Pathlength from the origin to this point
      - float             pathlengthError // Error on the pathlenght
 
datatypes:

  ## ==========================================================================
  ## Particle info
  ## ==========================================================================

  eicd::ReconstructedParticle:
    Description: "EIC Reconstructed Particle"
    Author: "W. Armstrong, S. Joosten, F. Gaede"
    Members:
      - int32_t           type              // type of reconstructed particle. Check/set collection parameters ReconstructedParticleTypeNames and ReconstructedParticleTypeValues.
      - float             energy            // [GeV] energy of the reconstructed particle. Four momentum state is not kept consistent internally.
      - edm4hep::Vector3f momentum          // [GeV] particle momentum. Four momentum state is not kept consistent internally.
      - edm4hep::Vector3f referencePoint    // [mm] reference, i.e. where the particle has been measured
      - float             charge            // charge of the reconstructed particle.
      - float             mass              // [GeV] mass of the reconstructed particle, set independently from four vector. Four momentum state is not kept consistent internally.
      - float             goodnessOfPID     // overall goodness of the PID on a scale of [0;1]
      - eicd::Cov4f       covMatrix         // cvariance matrix of the reconstructed particle 4vector (10 parameters).
      ##@TODO: deviation from EDM4hep: store explicit PDG ID here. Needs to be discussed how we
      ##       move forward as this could easiliy become unwieldy without this information here.
      ##       The only acceptable alternative would be to store reconstructed identified 
      ##       particles in separate collections for the different particle types (which would
      ##       require some algorithmic changes but might work. Doing both might even make
      ##       sense. Needs some discussion, note that PID is more emphasized in NP than
      ##       HEP).
      - int32_t           PDG               // PDG code for this particle
      ## @TODO: Do we need timing info? Or do we rely on the start vertex time?
    OneToOneRelations:
      - eicd::Vertex      startVertex       // Start vertex associated to this particle
      - edm4hep::ParticleID  particleIDUsed    // particle ID used for the kinematics of this particle
    OneToManyRelations:
      - eicd::Cluster     clusters          // Clusters used for this particle
      - eicd::Track       tracks            // Tracks used for this particle
      - eicd::ReconstructedParticle particles // Reconstructed particles that have been combined to this particle
      - edm4hep::ParticleID  particleIDs       // All associated particle IDs for this particle (not sorted by likelihood)
    ExtraCode:
      declaration: "
        bool isCompound() const {return particles_size() > 0;}\n
        "

  ## ==========================================================================
  ## Calorimetry
  ## ==========================================================================
  eicd::RawCalorimeterHit:
    Description: "Raw (digitized) calorimeter hit"
    Author: "W. Armstrong, S. Joosten"
    Members:
      - uint64_t           cellID            // The detector specific (geometrical) cell id.
      - uint64_t           amplitude         // The magnitude of the hit in ADC counts.
        ## @TODO: should we also add integral and time-over-threshold (ToT) here? Or should
        ##        those all be different raw sensor types? Amplitude is
        ##        really not what most calorimetry sensors will give us AFAIK...
      - uint64_t           timeStamp         // Timing in TDC

  eicd::CalorimeterHit:
    Description: "Calorimeter hit"
    Author: "W. Armstrong, S. Joosten"
    Members:
      - uint64_t          cellID            // The detector specific (geometrical) cell id.
      - float             energy            // The energy for this hit in [GeV].
      - float             energyError       // Error on energy [GeV].
      - float             time              // The time of the hit in [ns].
      - float             timeError         // Error on the time
      - edm4hep::Vector3f position          // The global position of the hit in world coordinates [mm].
      - edm4hep::Vector3f dimension         // The dimension information of the cell [mm].
      - int32_t           sector            // Sector that this hit occured in
      - int32_t           layer             // Layer that the hit occured in
      - edm4hep::Vector3f local             // The local coordinates of the hit in the detector segment [mm]. 

  ## ==========================================================================
  ## Clustering
  ## ==========================================================================
  
  eicd::ProtoCluster:
    Description: "Collection of hits identified by the clustering algorithm to belong together"
    Author: "S. Joosten"
    OneToManyRelations:
      - eicd::CalorimeterHit hits            // Hits associated with this cluster
    VectorMembers:
      - float             weights           // Weight for each of the hits, mirrors hits array

  eicd::Cluster:
    Description: "EIC hit cluster, reworked to more closely resemble EDM4hep"
    Author: "W. Armstrong, S. Joosten, C.Peng"
    Members:
      # main variables
      - int32_t           type              // Flagword that defines the type of the cluster
      - float             energy            // Reconstructed energy of the cluster [GeV].
      - float             energyError       // Error on the cluster energy [GeV]
      - float             time              // [ns]
      - float             timeError         // Error on the cluster time
      - uint32_t          nhits             // Number of hits in the cluster.
      - edm4hep::Vector3f position          // Global position of the cluster [mm].
      - eicd::Cov3f       positionError     // Covariance matrix of the position (6 Parameters).
      - float             intrinsicTheta    // Intrinsic cluster propagation direction polar angle [rad]
      - float             intrinsicPhi      // Intrinsic cluster propagation direction azimuthal angle [rad]
      - eicd::Cov2f       intrinsicDirectionError // Error on the intrinsic cluster propagation direction
    VectorMembers:
      - float             shapeParameters   // Should be set in metadata, for now radius/skewness
      - float             hitContributions  // Energy contributions of the hits. Runs parallel to ::hits()
      - float             subdetectorEnergies // Energies observed in each subdetector used for this cluster.
    OneToManyRelations:
      - eicd::Cluster     clusters          // Clusters that have been combined to form this cluster
      - eicd::CalorimeterHit hits           // Hits that have been combined to form this cluster
      - edm4hep::ParticleID  particleIDs       // Particle IDs sorted by likelihood

  ## ==========================================================================
  ## RICH/Cherenkov and PID
  ## ==========================================================================

  eicd::RawPMTHit:
    Description: "EIC Raw PMT hit"
    Author: "S. Joosten, C. Peng"
    Members:
      - uint64_t          cellID            // The detector specific (geometrical) cell id.
      - uint32_t          integral          // PMT signal integral [ADC]
      ## @TODO: same question as posed by RawCalorimeterHits, needs revisiting
      ##        when we increase realism
      - uint32_t          timeStamp         // PMT signal time [TDC]

  eicd::PMTHit:
    Description: "EIC PMT hit"
    Author: "S. Joosten, C. Peng"
    Members:
      - uint64_t          cellID            // The detector specific (geometrical) cell id.
      - float             npe               // Estimated number of photo-electrons [#]
      # @TODO do we need an uncertainty on NPE?
      - float             time              // Time [ns]
      - float             timeError         // Error on the time [ns]
      - edm4hep::Vector3f position          // PMT hit position [mm]
      - edm4hep::Vector3f dimension         // The dimension information of the pixel [mm].
      - int32_t           sector            // The sector this hit occured in
      - edm4hep::Vector3f local             // The local position of the hit in detector coordinates (relative to the sector) [mm]

  eicd::RingImage:
    ##@TODO: RICH reconstruction still needs an overhaul
    Description: "EIC Ring Image Cluster"
    Author: "S. Joosten, C. Peng"
    Members:
      - float             npe               // Number of photo-electrons [#]
      - edm4hep::Vector3f position          // Global position of the cluster [mm]
      - edm4hep::Vector3f positionError     // Error on the position
      - float             theta             // Opening angle of the ring [rad, 0->pi]
      - float             thetaError        // Error on the opening angle
      - float             radius            // Radius of the best fit ring [mm]
      - float             radiusError       // Estimated error from the fit [mm]

  ## ==========================================================================
  ## Tracking
  ## ==========================================================================
  
  eicd::RawTrackerHit:
    Description: "Raw (digitized) tracker hit"
    Author: "W. Armstrong, S. Joosten"
    Members:
      - uint64_t          cellID            // The detector specific (geometrical) cell id.
      - int32_t           charge            // ADC value
      ## @TODO: is charge appropriate here? Needs revisiting.
      - int32_t           timeStamp         // TDC value.

  eicd::TrackerHit:
    Description: "Tracker hit (reconstructed from Raw)"
    Author: "W. Armstrong, S. Joosten"
    Members:
      - uint64_t          cellID            // The detector specific (geometrical) cell id.
      - edm4hep::Vector3f position          // Hit (cell) position and time [mm, ns]
      - eicd::CovDiag3f   positionError     // Covariance Matrix
      - float             time              // Hit time
      - float             timeError         // Error on the time
      - float             edep              // Energy deposit in this hit [GeV]
      - float             edepError         // Error on the energy deposit [GeV]

  eicd::Trajectory:
    Description: "Raw trajectory from the tracking algorithm"
    Author: "S. Joosten, S. Li"
    Members:
      - uint32_t          type              // 0 (does not have good track fit), 1 (has good track fit)
      - uint32_t          nStates           // Number of tracking steps
      - uint32_t          nMeasurements     // Number of hits used 
      - uint32_t          nOutliers         // Number of hits not considered 
      - uint32_t          nHoles            // Number of missing hits
      - float             chi2              // Total chi2
      - uint32_t          ndf               // Number of degrees of freedom
      - uint32_t          nSharedHits       // Number of shared hits with other trajectories
    VectorMembers:
      - float             measurementChi2   // Chi2 for each of the measurements
      - float             outlierChi2       // Chi2 for each of the outliers
    OneToOneRelations:
      - eicd::TrackParameters trackParameters // Associated track parameters, if any
    OneToManyRelations:
      - eicd::TrackerHit  measurementHits   // Measurement hits used in this trajectory
      - eicd::TrackerHit  outlierHits       // Outlier hits not used in this trajectory
  
  eicd::TrackParameters:
    Description: "ACTS Bound Track parameters"
    Author: "W. Armstrong, S. Joosten"
    Members:
      - int32_t           type              // Type of track parameters (-1/seed, 0/head, ...)
      - edm4hep::Vector2f loc               // 2D location on surface
      - eicd::Cov2f       locError          // Covariance on loc
      - float             theta             // Track polar angle [rad]
      - float             phi               // Track azimuthal angle [rad]
      - float             qOverP            // [e/GeV]
      - eicd::Cov3f       momentumError     // Covariance on theta, phi and qOverP
      - float             time              // Track time [ns]    
      - float             timeError         // Error on the time
      - float             charge            // Particle charge
    OneToOneRelations:
      - eicd::Trajectory  trajectory        // Trajectory associated with these track parameters

  eicd::Track:
    Description: "Track information at the vertex"
    Author: "S. Joosten"
    Members:
      - int32_t           type              // Flag that defines the type of track
      - float             chi2              // Total chi2 (sum) of the track fit
      - int32_t           ndf               // Numbers of degrees of freedom of the track fit
      - edm4hep::Vector3f momentum          // Track 3-momentum at the vertex [GeV]
      - eicd::Cov3f       momentumError     // Covariance matrix on the momentum
      - float             time              // Track time at the vertex [ns]
      - float             timeError         // Error on the track vertex time
      - float             charge            // Particle charge
    OneToManyRelations:
      - eicd::TrackParameters parameters    // Track fit parameters, the first entry (if present) is evaluated at the track head
      - eicd::TrackerHit  trackerHits       // Hits that were used for this track
      - eicd::Track       tracks            // Tracks (segments) that have been combined to create this track

  eicd::TrackSegment:
    Description: "A track segment defined by one or more points along a track."
    Author: "S. Joosten"
    Members:
      - float             length            // Pathlength from the first to the last point
      - float             lengthError       // Error on the segment length
    OneToOneRelations:
      - eicd::Track       track             // Track used for this projection
    VectorMembers:
      - eicd::TrackPoint  points            // Points where the track parameters were evaluated

  ## ==========================================================================
  ## Vertexing
  ## ==========================================================================

  eicd::Vertex:
    Description: "EIC vertex"
    Author: "W. Armstrong, S. Joosten, based off EDM4hep"
    Members:
      - int32_t             primary       // Boolean flag, if vertex is the primary vertex of the event
      - float               chi2          // Chi-squared of the vertex fit
      - float               probability   // Probability of the vertex fit
      - edm4hep::Vector3f   position      // [mm] position of the vertex.
      ## this is named "covMatrix" in EDM4hep, renamed for consistency with the rest of EICD
      - eicd::Cov3f         positionError // Covariance matrix of the position 
      - int32_t             algorithmType // Type code for the algorithm that has been used to create the vertex - check/set the collection parameters AlgorithmName and AlgorithmType. 
      ## Additional parameter not in EDM4hep: vertex time
      - float               time          // Vertex time
    VectorMembers:
      - float               parameters    // Additional parameters related to this vertex - check/set the collection parameter "VertexParameterNames" for the parameters meaning. 
    OneToOneRelations:
      ## @TODO: why one and not multiple particles?
      - eicd::ReconstructedParticle associatedParticle // reconstructed particle associated to this vertex.

  ## ==========================================================================
  ## Kinematic reconstruction
  ## ==========================================================================

  eicd::InclusiveKinematics:
    Description: "Kinematic variables for DIS events"
    Author: "S. Joosten, W. Deconinck"
    Members:
      - float             x                 // Bjorken x (Q2/2P.q)
      - float             Q2                // Four-momentum transfer squared [GeV^2]
      - float             W                 // Invariant mass of final state [GeV]
      - float             y                 // Inelasticity (P.q/P.k)
      - float             nu                // Energy transfer P.q/M [GeV]
    OneToOneRelations:
      - eicd::ReconstructedParticle scat    // Associated scattered electron (if identified)
      ## @TODO: Spin state?
      ## - phi_S?

  ## ==========================================================================
  ## Data-Montecarlo relations
  ## ==========================================================================

  eicd::MCRecoParticleAssociation:
    Description: "Used to keep track of the correspondence between MC and reconstructed particles"
    Author: "S. Joosten"
    Members:
      - uint32_t          simID             // Index of corresponding MCParticle (position in MCParticles array)
      - uint32_t          recID             // Index of corresponding ReconstructedParticle (position in ReconstructedParticles array)
      - float             weight            // weight of this association
    OneToOneRelations :
      - eicd::ReconstructedParticle  rec    // reference to the reconstructed particle
      - edm4hep::MCParticle sim             // reference to the Monte-Carlo particle

  eicd::MCRecoClusterParticleAssociation:
    Description: "Association between a Cluster and a MCParticle"
    Author : "S. Joosten"
    Members:
      - uint32_t          simID             // Index of corresponding MCParticle (position in MCParticles array)
      - uint32_t          recID             // Index of corresponding Cluster (position in Clusters array)
      - float             weight            // weight of this association
    OneToOneRelations:
      - eicd::Cluster     rec               // reference to the cluster
      - edm4hep::MCParticle sim             // reference to the Monte-Carlo particle

  eicd::MCRecoTrackParticleAssociation:
    Description: "Association between a Track and a MCParticle"
    Author : "S. Joosten"
    Members:
      - uint32_t          simID             // Index of corresponding MCParticle (position in MCParticles array)
      - uint32_t          recID             // Index of corresponding Track (position in Tracks array)
      - float             weight            // weight of this association
    OneToOneRelations:
      - eicd::Track       rec               // reference to the track
      - edm4hep::MCParticle sim             // reference to the Monte-Carlo particle

  eicd::MCRecoVertexParticleAssociation:
    Description: "Association between a Vertex and a MCParticle"
    Author : "S. Joosten"
    Members:
      - uint32_t          simID             // Index of corresponding MCParticle (position in MCParticles array)
      - uint32_t          recID             // Index of corresponding Vertex (position in Vertices array)
      - float             weight            // weight of this association
    OneToOneRelations:
      - eicd::Vertex        rec             // reference to the vertex
      - edm4hep::MCParticle sim             // reference to the Monte-Carlo particle

Installing

To install the data model into ~/local, use the following commands:

git clone https://github.com/eic/eicd
cd eicd
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=~/local
cmake --build build
cmake --install build