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

Add edm4hep::Tensor type for use in ML training and inference #388

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ A generic event data model for future HEP collider experiments.
| [CalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L394) | [ParticleID](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L405) | [Cluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L419) |
| [TrackerHit3D](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L451) | [TrackerHitPlane](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L477) | [RawTimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L507) |
| [Track](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L521) | [Vertex](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L538) | [ReconstructedParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L584) |
| [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L813) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L825) | |
| [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L813) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L835) | |

**Links**

Expand All @@ -41,14 +41,14 @@ A generic event data model for future HEP collider experiments.

| | | |
|-|-|-|
| [GeneratorEventParameters](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L837) | | |
| [GeneratorPdfInfo](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L853) | | |
| [GeneratorEventParameters](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L847) | | |
| [GeneratorPdfInfo](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L863) | | |

**Interfaces**

| | | |
|-|-|-|
| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L864) | | |
| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L874) | | |

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

Expand Down
10 changes: 10 additions & 0 deletions edm4hep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,16 @@ datatypes:
- float amplitude // calibrated detector data


edm4hep::Tensor:
Description: "Tensor type for use in training/inference for ML models"
Author: "EDM4hep authors"
Members:
- int32_t elementType // Data type in the same encoding as "ONNXTensorElementDataType", 1 - float, 7 - int64
VectorMembers:
- int64_t shape // Vector of tensor lengths along its axes
- float floatData // Iff elementType==1, values are stored here
- int64_t int64Data // Iff elementType==7, values are stored here


edm4hep::RecDqdx:
Description: "dN/dx or dE/dx info of a Track"
Expand Down
3 changes: 3 additions & 0 deletions tools/include/edm4hep2json.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "edm4hep/ReconstructedParticleCollection.h"
#include "edm4hep/SimCalorimeterHitCollection.h"
#include "edm4hep/SimTrackerHitCollection.h"
#include "edm4hep/TensorCollection.h"
#include "edm4hep/TimeSeriesCollection.h"
#include "edm4hep/TrackCollection.h"
#include "edm4hep/TrackerHit3DCollection.h"
Expand Down Expand Up @@ -102,6 +103,8 @@ nlohmann::json processEvent(const podio::Frame& frame, std::vector<std::string>&
insertIntoJson<edm4hep::ReconstructedParticleCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::TimeSeriesCollection") {
insertIntoJson<edm4hep::TimeSeriesCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::Tensor") {
insertIntoJson<edm4hep::TensorCollection>(jsonDict, coll, collList[i]);
} else if (coll->getTypeName() == "edm4hep::RecDqdxCollection") {
insertIntoJson<edm4hep::RecDqdxCollection>(jsonDict, coll, collList[i]);
}
Expand Down
Loading