Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.0 breaking changes #261

Closed
wants to merge 13 commits into from
Closed
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ A generic event data model for future HEP collider experiments.
| | | |
|-|-|-|
| [Vector4f](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L9) | [Vector3f](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L26) | [Vector3d](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L41) |
| [Vector2i](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L57) | [Vector2f](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L71) | [TrackState](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L85) |
| [ObjectID](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L108) | [Quantity](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L120) | [Hypothesis](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L128) |
| [HitLevelData](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L135) | | |
| [Vector2i](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L60) | [Vector2f](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L74) | [TrackState](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L88) |
| [ObjectID](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L111) | [Quantity](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L123) | [Hypothesis](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L131) |
| [HitLevelData](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L138) | | |


**Datatypes**

| | | |
|-|-|-|
| [EventHeader](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L145) | [MCParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L155) | [SimTrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L224) |
| [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#L354) | [RawTimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L375) |
| [Track](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L388) | [Vertex](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L407) | [ReconstructedParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L424) |
| [SimPrimaryIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L528) | [TrackerPulse](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L546) | [RecIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L559) |
| [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L570) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L582) | |
| [EventHeader](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L148) | [MCParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L158) | [SimTrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L227) |
| [CaloHitContribution](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L261) | [SimCalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L273) | [RawCalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L285) |
| [CalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L294) | [ParticleID](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L306) | [Cluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L319) |
| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L340) | [TrackerHitPlane](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L357) | [RawTimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L378) |
| [Track](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L391) | [Vertex](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L410) | [ReconstructedParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L427) |
| [SimPrimaryIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L531) | [TrackerPulse](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L549) | [RecIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L562) |
| [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L573) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L585) | |

**Associations**

| | | |
|-|-|-|
| [MCRecoParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L454) | [MCRecoCaloAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L463) | [MCRecoTrackerAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L472) |
| [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) | |
| [MCRecoParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L459) | [MCRecoCaloAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L468) | [MCRecoTrackerAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L477) |
| [MCRecoTrackerHitPlaneAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L486) | [MCRecoCaloParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L495) | [MCRecoClusterParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L504) |
| [MCRecoTrackParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L513) | [RecoParticleVertexAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L522) | |

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

Expand Down
84 changes: 55 additions & 29 deletions edm4hep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ components:
- double y
- double z
ExtraCode:
includes: "#include <edm4hep/Vector3f.h>"
declaration: "
constexpr Vector3d() : x(0),y(0),z(0) {}\n
constexpr Vector3d(double xx, double yy, double zz) : x(xx),y(yy),z(zz) {}\n
constexpr Vector3d(const double* v) : x(v[0]),y(v[1]),z(v[2]) {}\n
constexpr Vector3d(const float* v) : x(v[0]),y(v[1]),z(v[2]) {}\n
[[ deprecated(\"This constructor will be removed again it is mainly here for an easier transition\") ]]\n
constexpr Vector3d(const Vector3f& v) : x(v.x), y(v.y), z(v.z) {}\n
constexpr bool operator==(const Vector3d& v) const { return (x==v.x&&y==v.y&&z==v.z) ; }\n
constexpr double operator[](unsigned i) const { return *( &x + i ) ; }\n
"
Expand Down Expand Up @@ -104,18 +107,6 @@ components:
static const int LastLocation = AtVertex ;\n
"

#------ ObjectID helper struct for references/relations
edm4hep::ObjectID:
Members:
- int32_t index
- int32_t collectionID
ExtraCode:
includes: "#include <podio/ObjectID.h>\n"
declaration: "
ObjectID() = default;\n
ObjectID(const podio::ObjectID& id ): index(id.index), collectionID(id.collectionID) {}\n
"

# quantity with an identifier, a value and an error
edm4hep::Quantity:
Members:
Expand Down Expand Up @@ -149,8 +140,9 @@ datatypes:
- int32_t eventNumber //event number
- int32_t runNumber //run number
- uint64_t timeStamp //time stamp
- float weight // event weight

- double weight // event weight
VectorMembers:
- double weights // event weights in case there are multiple. **NOTE that weights[0] might not be the same as weight!** Event weight names should be stored using the edm4hep::EventWeights name in the file level metadata.

edm4hep::MCParticle:
Description: "The Monte Carlo particle - based on the lcio::MCParticle."
Expand All @@ -164,8 +156,8 @@ datatypes:
- double mass //mass of the particle in [GeV]
- edm4hep::Vector3d vertex //production vertex of the particle in [mm].
- edm4hep::Vector3d endpoint //endpoint of the particle in [mm]
- edm4hep::Vector3f momentum //particle 3-momentum at the production vertex in [GeV]
- edm4hep::Vector3f momentumAtEndpoint //particle 3-momentum at the endpoint in [GeV]
- edm4hep::Vector3d momentum //particle 3-momentum at the production vertex in [GeV]
- edm4hep::Vector3d momentumAtEndpoint //particle 3-momentum at the endpoint in [GeV]
- edm4hep::Vector3f spin //spin (helicity) vector of the particle.
- edm4hep::Vector2i colorFlow //color flow as defined by the generator
OneToManyRelations:
Expand Down Expand Up @@ -233,15 +225,21 @@ datatypes:
- edm4hep::Vector3d position //the hit position in [mm].
- edm4hep::Vector3f momentum //the 3-momentum of the particle at the hits position in [GeV]
OneToOneRelations:
- edm4hep::MCParticle MCParticle //MCParticle that caused the hit.
- edm4hep::MCParticle particle //MCParticle that caused the hit.
MutableExtraCode:
includes: "#include <cmath>"
includes: "
#include <cmath>\n
#include <edm4hep/MCParticle.h>\n
"
declaration: "
int32_t set_bit(int32_t val, int num, bool bitval){ return (val & ~(1<<num)) | (bitval << num); }\n
void setOverlay(bool val) { setQuality( set_bit( getQuality() , BITOverlay , val ) ) ; }\n
void setProducedBySecondary(bool val) { setQuality( set_bit( getQuality() , BITProducedBySecondary , val ) ) ; }\n
[[deprecated(\"use setParticle instead\")]]
void setMCParticle(edm4hep::MCParticle particle) { setParticle(std::move(particle)); }\n
"
ExtraCode:
includes: "#include <edm4hep/MCParticle.h>\n"
declaration: "
static const int BITOverlay = 31;\n
static const int BITProducedBySecondary = 30;\n
Expand All @@ -251,6 +249,8 @@ datatypes:
double y() const {return getPosition()[1];}\n
double z() const {return getPosition()[2];}\n
double rho() const {return sqrt(x()*x() + y()*y());}\n
[[deprecated(\"use getParticle instead\")]]
edm4hep::MCParticle getMCParticle() const { return getParticle(); }\n
"


Expand Down Expand Up @@ -310,7 +310,8 @@ datatypes:
- float likelihood //likelihood of this hypothesis - in a user defined normalization.
VectorMembers:
- float parameters //parameters associated with this hypothesis. Check/set collection parameters ParameterNames_PIDAlgorithmTypeName for decoding the indices.

OneToOneRelations:
- edm4hep::ReconstructedParticle particle // the particle from which this PID has been computed

#------ Cluster
edm4hep::Cluster:
Expand All @@ -331,10 +332,9 @@ datatypes:
OneToManyRelations:
- edm4hep::Cluster clusters //clusters that have been combined to this cluster.
- edm4hep::CalorimeterHit hits //hits that have been combined to this cluster.
- edm4hep::ParticleID particleIDs //particle IDs (sorted by their likelihood)

#------------- TrackerHit
edm4hep::TrackerHit:
edm4hep::TrackerHit3D:
Description: "Tracker hit"
Author: "F.Gaede, DESY"
Members:
Expand All @@ -346,9 +346,6 @@ datatypes:
- float eDepError //error measured on EDep [GeV].
- edm4hep::Vector3d position //hit position in [mm].
- std::array<float,6> covMatrix //covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) , cov(y,x) , cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
VectorMembers:
- edm4hep::ObjectID rawHits //raw data hits. Check getType to get actual data type.


#------------- TrackerHitPlane
edm4hep::TrackerHitPlane:
Expand All @@ -367,8 +364,6 @@ datatypes:
- float dv //measurement error along the direction
- edm4hep::Vector3d position //hit position in [mm].
- std::array<float,6> covMatrix //covariance of the position (x,y,z), stored as lower triangle matrix. i.e. cov(x,x) , cov(y,x) , cov(y,y) , cov(z,x) , cov(z,y) , cov(z,z)
VectorMembers:
- edm4hep::ObjectID rawHits //raw data hits. Check getType to get actual data type.


#---------- RawTimeSeries
Expand Down Expand Up @@ -435,12 +430,10 @@ datatypes:
- std::array<float,10> covMatrix //cvariance matrix of the reconstructed particle 4vector (10 parameters). Stored as lower triangle matrix of the four momentum (px,py,pz,E), i.e. cov(px,px), cov(py,##
OneToOneRelations:
- edm4hep::Vertex startVertex //start vertex associated to this particle
- edm4hep::ParticleID particleIDUsed //particle Id used for the kinematics of this particle
OneToManyRelations:
- edm4hep::Cluster clusters //clusters that have been used for this particle.
- edm4hep::Track tracks //tracks that have been used for this particle.
- edm4hep::ReconstructedParticle particles //reconstructed particles that have been combined to this particle.
- edm4hep::ParticleID particleIDs //particle Ids (not sorted by their likelihood)
ExtraCode:
declaration: "
bool isCompound() const { return particles_size() > 0 ;}\n
Expand Down Expand Up @@ -540,7 +533,23 @@ datatypes:
- float pulseTime //the pulse's time in the lab frame [ns].
- float pulseAmplitude //the pulse's amplitude [fC].
OneToOneRelations:
- edm4hep::MCParticle MCParticle //the particle that caused the ionizing collisions.
- edm4hep::MCParticle particle //the particle that caused the ionizing collisions.
MutableExtraCode:
includes: "
#include <cmath>\n
#include <edm4hep/MCParticle.h>\n
"
declaration: "
[[deprecated(\"use setParticle instead\")]]
void setMCParticle(edm4hep::MCParticle particle) { setParticle(std::move(particle)); }\n
"

ExtraCode:
includes: "#include <edm4hep/MCParticle.h>\n"
declaration: "
[[deprecated(\"use getParticle instead\")]]
edm4hep::MCParticle getMCParticle() const { return getParticle(); }\n
"

#---------- TrackerPulse
edm4hep::TrackerPulse:
Expand Down Expand Up @@ -591,3 +600,20 @@ 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
- std::array<float, 6> covMatrix // covariance of the position (x,y,z) stored as lower triangle matrix, i.e. cov(x,x), cov(y, x), cov(y, y), cov(z, x), cov(z, y), cov(z, z)
Types:
- edm4hep::TrackerHit3D
- edm4hep::TrackerHitPlane
1 change: 1 addition & 0 deletions include/edm4hep/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace edm4hep {
static constexpr const char* CellIDEncoding = "CellIDEncoding";
static constexpr const char* EventHeaderName = "EventHeader";
static constexpr const char* EventWeights = "EventWeightNames";
} // namespace edm4hep

#endif // EDM4HEP_CONSTANTS_H
4 changes: 2 additions & 2 deletions test/utils/test_kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def test_p4(self):
125.0, # charge
edm4hep.Vector3d(0, 0, 0), # vertex
edm4hep.Vector3d(0, 0, 0), # endpoint
edm4hep.Vector3f(1.0, 2.0, 3.0), # momentum
edm4hep.Vector3f(0, 0, 0), # momentumAtEndpoint
edm4hep.Vector3d(1.0, 2.0, 3.0), # momentum
edm4hep.Vector3d(0, 0, 0), # momentumAtEndpoint
edm4hep.Vector3f(0, 0, 0), # spin
edm4hep.Vector2i(0, 0) # colorFlow
)
Expand Down
6 changes: 3 additions & 3 deletions tools/include/edm4hep2json.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -92,8 +92,8 @@ nlohmann::json processEvent(const podio::Frame& frame, std::vector<std::string>&
insertIntoJson<edm4hep::ParticleIDCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::ClusterCollection") {
insertIntoJson<edm4hep::ClusterCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::TrackerHitCollection") {
insertIntoJson<edm4hep::TrackerHitCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::TrackerHit3DCollection") {
insertIntoJson<edm4hep::TrackerHit3DCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::TrackerHitPlaneCollection") {
insertIntoJson<edm4hep::TrackerHitPlaneCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::RawTimeSeriesCollection") {
Expand Down
4 changes: 2 additions & 2 deletions utils/src/dataframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);
Expand Down
Loading