From 96d4ab8111bb53c0d873f243785be1255138afe1 Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Fri, 23 Feb 2024 09:32:50 +0100 Subject: [PATCH] Use interface types for TrackerHit (#252) * Rename existing tracker hit * Introduce TrackerHit interface class * Fix include * Remove the 3D covariance matrix from interface * Update README to include new interface type --------- Co-authored-by: jmcarcell --- README.md | 11 ++++++++--- edm4hep.yaml | 18 +++++++++++++++++- tools/include/edm4hep2json.hxx | 6 +++--- utils/src/dataframe.cc | 4 ++-- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cf47c3d0c..6653837f6 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,10 @@ A generic event data model for future HEP collider experiments. **Datatypes** -| | | | -|-|-|-| | [EventHeader](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L136) | [MCParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L148) | [SimTrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L216) | | [CaloHitContribution](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L258) | [SimCalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L270) | [RawCalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L282) | | [CalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L291) | [ParticleID](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L303) | [Cluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L316) | -| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L337) | [TrackerHitPlane](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L352) | [RawTimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L371) | +| [TrackerHit3D](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L337) | [TrackerHitPlane](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L352) | [RawTimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L371) | | [Track](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L384) | [Vertex](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L403) | [ReconstructedParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L420) | | [SimPrimaryIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L528) | [TrackerPulse](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L562) | [RecIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L575) | | [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L586) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L598) | | @@ -37,6 +35,13 @@ A generic event data model for future HEP collider experiments. | [MCRecoTrackerHitPlaneAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L481) | [MCRecoCaloParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L490) | [MCRecoClusterParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L499) | | [MCRecoTrackParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L508) | [RecoParticleVertexAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L517) | | +**Interfaces** + +| | | | +|-|-|-| +| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#625) | | | + + The tests and examples in the `tests` directory show how to read, write, and use these types in your code. diff --git a/edm4hep.yaml b/edm4hep.yaml index 8a3050893..6607a0ae9 100644 --- a/edm4hep.yaml +++ b/edm4hep.yaml @@ -334,7 +334,7 @@ datatypes: - edm4hep::ParticleID particleIDs // particle IDs (sorted by their likelihood) #------------- TrackerHit - edm4hep::TrackerHit: + edm4hep::TrackerHit3D: Description: "Tracker hit" Author: "EDM4hep authors" Members: @@ -607,3 +607,19 @@ datatypes: - edm4hep::HitLevelData hitData // hit level data OneToOneRelations: - edm4hep::Track track // the corresponding track + +interfaces: + edm4hep::TrackerHit: + Description: "Tracker hit interface class" + Author: "Thomas Madlener, DESY" + Members: + - uint64_t cellID // ID of the sensor that created this hit + - int32_t type // type of the raw data hit + - int32_t quality // quality bit flag of the hit + - float time [ns] // time of the hit + - float eDep [GeV] // energy deposited on the hit + - float eDepError [GeV] // error measured on eDep + - edm4hep::Vector3d position [mm] // hit position + Types: + - edm4hep::TrackerHit3D + - edm4hep::TrackerHitPlane diff --git a/tools/include/edm4hep2json.hxx b/tools/include/edm4hep2json.hxx index 50dbe0f3f..0849453de 100644 --- a/tools/include/edm4hep2json.hxx +++ b/tools/include/edm4hep2json.hxx @@ -18,7 +18,7 @@ #include "edm4hep/SimTrackerHitCollection.h" #include "edm4hep/TimeSeriesCollection.h" #include "edm4hep/TrackCollection.h" -#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackerHit3DCollection.h" #include "edm4hep/TrackerHitPlaneCollection.h" #include "edm4hep/TrackerPulseCollection.h" #include "edm4hep/VertexCollection.h" @@ -92,8 +92,8 @@ nlohmann::json processEvent(const podio::Frame& frame, std::vector& insertIntoJson(jsonDict, coll, collList[i]); } else if (coll->getTypeName() == "edm4hep::ClusterCollection") { insertIntoJson(jsonDict, coll, collList[i]); - } else if (coll->getTypeName() == "edm4hep::TrackerHitCollection") { - insertIntoJson(jsonDict, coll, collList[i]); + } else if (coll->getTypeName() == "edm4hep::TrackerHit3DCollection") { + insertIntoJson(jsonDict, coll, collList[i]); } else if (coll->getTypeName() == "edm4hep::TrackerHitPlaneCollection") { insertIntoJson(jsonDict, coll, collList[i]); } else if (coll->getTypeName() == "edm4hep::RawTimeSeriesCollection") { diff --git a/utils/src/dataframe.cc b/utils/src/dataframe.cc index ef12f0342..1948191a2 100644 --- a/utils/src/dataframe.cc +++ b/utils/src/dataframe.cc @@ -6,7 +6,7 @@ #include "edm4hep/ReconstructedParticleData.h" #include "edm4hep/SimCalorimeterHitData.h" #include "edm4hep/SimTrackerHitData.h" -#include "edm4hep/TrackerHitData.h" +#include "edm4hep/TrackerHit3DData.h" #include "edm4hep/TrackerHitPlaneData.h" #include "edm4hep/VertexData.h" @@ -77,7 +77,7 @@ INST_MOMENTUM_FUNCS(edm4hep::ReconstructedParticleData); INST_MOMENTUM_FUNCS(edm4hep::SimTrackerHitData); INST_POSITION_FUNCS(edm4hep::SimTrackerHitData); -INST_POSITION_FUNCS(edm4hep::TrackerHitData); +INST_POSITION_FUNCS(edm4hep::TrackerHit3DData); INST_POSITION_FUNCS(edm4hep::TrackerHitPlaneData); INST_POSITION_FUNCS(edm4hep::SimCalorimeterHitData); INST_POSITION_FUNCS(edm4hep::CalorimeterHitData);