Skip to content

Commit

Permalink
Reshape Podio event model
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Nov 5, 2024
1 parent a649228 commit 94a4506
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 21 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
[![Actions Status](https://github.com/JeffersonLab/tdis/workflows/Ubuntu/badge.svg)](https://github.com/JeffersonLab/tdis/actions)
[![Actions Status](https://github.com/JeffersonLab/tdis/workflows/Style/badge.svg)](https://github.com/JeffersonLab/tdis/actions)
[![Actions Status](https://github.com/JeffersonLab/tdis/workflows/Install/badge.svg)](https://github.com/JeffersonLab/tdis/actions)
[![codecov](https://codecov.io/gh/JeffersonLab/tdis/branch/main/graph/badge.svg)](https://codecov.io/gh/JeffersonLab/tdis)

["Use Docker" documentation to setup environment and run](use_docker.md)

To run
Expand Down
355 changes: 339 additions & 16 deletions source/tdis/layout.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,256 @@
---
# A more complete example is provided by podio under tests/datalayout.yaml
# A lot has been taken from EDM4HEP and EDM4EIC. Please find them here:
# - https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml
# - https://github.com/eic/EDM4eic/blob/main/edm4eic.yaml

# Schema version is of 100*major + minor. Major has to be changed every time the schema changes
schema_version: 100

schema_version: 1
options :
# should getters / setters be prefixed with get / set?
getSyntax: False
# should POD members be exposed with getters/setters in classes that have them as members?
exposePODMembers: True
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:

edm4hep::Vector4f:
Description: "Generic vector for storing classical 4D coordinates in memory. Four momentum helper functions are in edm4hep::utils"
Members:
- float x
- float y
- float z
- float t
ExtraCode:
includes: "#include <cstddef>"
declaration: "
constexpr Vector4f() : x(0),y(0),z(0),t(0) {}\n
constexpr Vector4f(float xx, float yy, float zz, float tt) : x(xx),y(yy),z(zz),t(tt) {}\n
constexpr Vector4f(const float* v) : x(v[0]),y(v[1]),z(v[2]),t(v[3]) {}\n
constexpr bool operator==(const Vector4f& v) const { return (x==v.x&&y==v.y&&z==v.z&&t==v.t) ; }\n
constexpr bool operator!=(const Vector4f& v) const { return !(*this == v) ; }\n
constexpr float operator[](unsigned i) const {\n
static_assert(\n
(offsetof(Vector4f,x)+sizeof(Vector4f::x) == offsetof(Vector4f,y)) &&\n
(offsetof(Vector4f,y)+sizeof(Vector4f::y) == offsetof(Vector4f,z)) &&\n
(offsetof(Vector4f,z)+sizeof(Vector4f::z) == offsetof(Vector4f,t)),\n
\"operator[] requires no padding\");\n
return *( &x + i ) ; }\n
"

edm4hep::Vector3f:
Members:
- float x
- float y
- float z
ExtraCode:
includes: "#include <cstddef>"
declaration: "
constexpr Vector3f() : x(0),y(0),z(0) {}\n
constexpr Vector3f(float xx, float yy, float zz) : x(xx),y(yy),z(zz) {}\n
constexpr Vector3f(const float* v) : x(v[0]),y(v[1]),z(v[2]) {}\n
constexpr bool operator==(const Vector3f& v) const { return (x==v.x&&y==v.y&&z==v.z) ; }\n
constexpr bool operator!=(const Vector3f& v) const { return !(*this == v) ; }\n
constexpr float operator[](unsigned i) const {\n
static_assert(\n
(offsetof(Vector3f,x)+sizeof(Vector3f::x) == offsetof(Vector3f,y)) &&\n
(offsetof(Vector3f,y)+sizeof(Vector3f::y) == offsetof(Vector3f,z)),\n
\"operator[] requires no padding\");\n
return *( &x + i ) ; }\n
"

edm4hep::Vector2f:
Members:
- float a
- float b
ExtraCode:
includes: "#include <cstddef>"
declaration: "
constexpr Vector2f() : a(0),b(0) {}\n
constexpr Vector2f(float aa,float bb) : a(aa),b(bb) {}\n
constexpr Vector2f(const float* v) : a(v[0]), b(v[1]) {}\n
constexpr bool operator==(const Vector2f& v) const { return (a==v.a&&b==v.b) ; }\n
constexpr bool operator!=(const Vector2f& v) const { return !(*this == v) ; }\n
constexpr float operator[](unsigned i) const {\n
static_assert(\n
offsetof(Vector2f,a)+sizeof(Vector2f::a) == offsetof(Vector2f,b),\n
\"operator[] requires no padding\");\n
return *( &a + i ) ; }\n
"

edm4eic::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
"

edm4eic::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
"

edm4eic::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
"

edm4eic::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
"

edm4eic::Cov6f:
Members:
- std::array<float, 21> covariance // 6d triangular packed covariance matrix
ExtraCode:
declaration: "
Cov6f() : covariance{} {}\n
Cov6f(std::array<float, 21> vcov) : covariance{vcov}{}\n
float operator()(unsigned i, unsigned j) const {\n
if(i > j) {\n
std::swap(i, j);\n
}\n
return covariance[i + 1 + (j + 1) * (j) / 2 - 1];\n
}\n
float& operator()(unsigned i, unsigned j) {\n
if(i > j) {\n
std::swap(i, j);\n
}\n
return covariance[i + 1 + (j + 1) * (j) / 2 - 1];\n
}\n
"

## A point along a track
edm4eic::TrackPoint:
Members:
- uint64_t surface // Surface track was propagated to (possibly multiple per detector)
- uint32_t system // Detector system track was propagated to
- edm4hep::Vector3f position // Position of the trajectory point [mm]
- edm4eic::Cov3f positionError // Error on the position
- edm4hep::Vector3f momentum // 3-momentum at the point [GeV]
- edm4eic::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]
- edm4eic::Cov2f directionError // Error on the polar and azimuthal angles
- float pathlength // Pathlength from the origin to this point
- float pathlengthError // Error on the pathlength

## PID hypothesis from Cherenkov detectors
edm4eic::CherenkovParticleIDHypothesis:
Members:
- int32_t PDG // PDG code
- float npe // Overall photoelectron count
- float weight // Weight of this hypothesis, such as likelihood, moment, etc.

## Representation of surfaces, including dynamic perigee surfaces (identical to ActsPodioEdm::Surface)
edm4eic::Surface:
Members:
- int surfaceType // Cone = 0, Cylinder = 1, Disc = 2, Perigee = 3, Plane = 4, Straw = 5, Curvilinear = 6, Other = 7
- int boundsType // eCone = 0, eCylinder = 1, eDiamond = 2, eDisc = 3, eEllipse = 4, eLine = 5, eRectangle = 6, eTrapezoid = 7, eTriangle = 8, eDiscTrapezoid = 9, eConvexPolygon = 10, eAnnulus = 11, eBoundless = 12, eOther = 13
- uint64_t geometryId // bit pattern volume:8,boundary:8,layer:12,approach:8,sensitive:20,extra:8
- uint64_t identifier // identifier of associated detector element, if available
- std::array<double,10> boundValues // bound values, e.g. for RectangleBounds, BoundValues are eMinX = 0, eMinY = 1, eMaxX = 2, eMaxY = 3, eSize = 4
- uint32_t boundValuesSize // size of bound values
- std::array<double,16> transform // row-wise 4x4 affine transform [R T; 0 1] with 3x3 rotation matrix R and translation column 3-vector T

datatypes :
EventInfo:
Description : "Event info"
Expand Down Expand Up @@ -48,24 +290,105 @@ datatypes :
- int plane // - Plane(id of z plane from 0 upstream to 9 downstream)
- double zToGem // - ZtoGEM (m)

edm4eic::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 [mm]
- edm4eic::CovDiag3f positionError // Covariance Matrix
- float time // Hit time [ns]
- float timeError // Error on the time
- float edep // Energy deposit in this hit [GeV]
- float edepError // Error on the energy deposit [GeV]
OneToOneRelations:
- edm4eic::RawTrackerHit rawHit // Related raw tracker hit
-
edm4eic::Measurement2D:
Description: "2D measurement (on an arbitrary surface)"
Author: "W. Deconinck"
Members:
- uint64_t surface // Surface for bound coordinates (geometryID)
- edm4hep::Vector2f loc // 2D location on surface
- float time // Measurement time
- edm4eic::Cov3f covariance // Covariance on location and time
VectorMembers:
- float weights // Weight for each of the hits, mirrors hits array
OneToManyRelations:
- edm4eic::TrackerHit hits // Hits in this measurement (single or clustered)

edm4eic::TrackSeed:
Description: "Seed info from the realistic seed finder"
Author: "S. Li, B. Schmookler, J. Osborn"
Members:
- edm4hep::Vector3f perigee // Vector for the perigee (line surface)
OneToManyRelations:
- edm4eic::TrackerHit hits // Tracker hits triplet for seeding
OneToOneRelations:
- edm4eic::TrackParameters params // Initial track parameters

ExampleHit :
Description : "Example Hit"
Author : "B. Hegner"
edm4eic::Trajectory:
Description: "Raw trajectory from the tracking algorithm. What is called hit here is 2d measurement indeed."
Author: "S. Joosten, S. Li"
Members:
- unsigned long long cellID // cellID
- double x // x-coordinate
- double y // y-coordinate
- double z // z-coordinate
- double energy // measured energy deposit
- uint64_t time // ticks since start of timeframe
- 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
- 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
OneToManyRelations:
- edm4eic::TrackParameters trackParameters // Associated track parameters, if any
- edm4eic::Measurement2D measurements_deprecated // Measurements that were used for this track. Will move this to the edm4eic::Track
- edm4eic::Measurement2D outliers_deprecated // Measurements that were not used for this track. Will move this to the edm4eic::Track
OneToOneRelations:
- edm4eic::TrackSeed seed // Corresponding track seed

ExampleCluster :
Description : "Cluster"
Author : "B. Hegner"
edm4eic::TrackParameters:
Description: "ACTS Bound Track parameters"
Author: "W. Armstrong, S. Joosten, J. Osborn"
Members:
- double energy // cluster energy
- int32_t type // Type of track parameters (-1/seed, 0/head, ...)
- uint64_t surface // Surface for bound parameters (geometryID)
- edm4hep::Vector2f loc // 2D location on surface
- float theta // Track polar angle [rad]
- float phi // Track azimuthal angle [rad]
- float qOverP // [e/GeV]
- float time // Track time [ns]
- int32_t pdg // pdg pid for these parameters
- edm4eic::Cov6f covariance // Full covariance in basis [l0,l1,theta,phi,q/p,t]


edm4eic::Track:
Description: "Track information at the vertex"
Author: "S. Joosten, J. Osborn"
Members:
- int32_t type // Flag that defines the type of track
- edm4hep::Vector3f position // Track 3-position at the vertex
- edm4hep::Vector3f momentum // Track 3-momentum at the vertex [GeV]
- edm4eic::Cov6f positionMomentumCovariance // Covariance matrix in basis [x,y,z,px,py,pz]
- float time // Track time at the vertex [ns]
- float timeError // Error on the track vertex time
- float charge // Particle charge
- float chi2 // Total chi2
- uint32_t ndf // Number of degrees of freedom
- int32_t pdg // PDG particle ID hypothesis
OneToOneRelations:
- edm4eic::Trajectory trajectory // Trajectory of this track
OneToManyRelations:
- ExampleHit Hits // hits contained in the cluster
- ExampleCluster Clusters // sub clusters used to create this cluster
- edm4eic::Measurement2D measurements // Measurements that were used for this track
- edm4eic::Track tracks // Tracks (segments) that have been combined to create this track

edm4eic::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:
- edm4eic::Track track // Track used for this projection
VectorMembers:
- edm4eic::TrackPoint points // Points where the track parameters were evaluated

0 comments on commit 94a4506

Please sign in to comment.