Skip to content
Snippets Groups Projects
Commit a4f6ba1d authored by Sylvester Joosten's avatar Sylvester Joosten
Browse files

Simplify the data model to converge towards EDM4hep

 - Remove VectorPolar, Direction, FloatPair
 - Migrate away from using eic::Index in favor of explicit relations
 - Rework and simplify the calorimetry data model
parent 48103863
No related branches found
No related tags found
No related merge requests found
Pipeline #28072 failed
...@@ -41,7 +41,7 @@ components: ...@@ -41,7 +41,7 @@ components:
bool operator==(const eic::Index& rhs) const {return equals(rhs);}\n bool operator==(const eic::Index& rhs) const {return equals(rhs);}\n
bool operator!=(const eic::Index& rhs) const {return !equals(rhs);}\n bool operator!=(const eic::Index& rhs) const {return !equals(rhs);}\n
bool operator<(const eic::Index& rhs) const {return long_form() < rhs.long_form();}\n bool operator<(const eic::Index& rhs) const {return long_form() < rhs.long_form();}\n
int64_t long_form() const {int64_t l = static_cast<int64_t>(source) << 32 | value; return l;}\n uint64_t long_form() const {int64_t l = static_cast<int64_t>(source) << 32 | value; return l;}\n
explicit operator bool() const {return valid();} explicit operator bool() const {return valid();}
" "
...@@ -57,24 +57,6 @@ components: ...@@ -57,24 +57,6 @@ components:
operator float() const {return value;} operator float() const {return value;}
" "
## first-second pair of float s
eic::FloatPair:
Members:
- float first
- float second
ExtraCode:
includes: "#include <tuple>"
declaration: "
FloatPair() : first{0}, second{0} {}\n
FloatPair(double a, double b) : first{static_cast<float>(a)}, second{static_cast<float>(b)} {}\n
FloatPair(const std::pair<float, float>& p) : first{p.first}, second{p.second} {}\n
FloatPair& operator=(const std::pair<float, float>& p) {first = p.first; second = p.second; return *this;}\n
float& operator[](unsigned i) {return *(&first + i);}\n
const float& operator[](unsigned i) const {return *(&first + i);}\n
operator std::pair<float, float>() const {return {first, second};}\n
"
eic::VectorXY: eic::VectorXY:
Members: Members:
- float x // [mm] or [GeV] - float x // [mm] or [GeV]
...@@ -96,25 +78,6 @@ components: ...@@ -96,25 +78,6 @@ components:
VectorXY scale(double f) const {return {f*x, f*y};}\n VectorXY scale(double f) const {return {f*x, f*y};}\n
" "
eic::Direction:
Members:
- float theta // [rad, 0->pi]
- float phi // [rad, -pi->pi]
ExtraCode:
includes: "#include <cmath>\n#include <tuple>"
declaration: "
Direction() : theta{0}, phi{0} {}\n
Direction(double th, double ph) : theta{static_cast<float>(th)}, phi{static_cast<float>(ph)} {}\n
Direction(double x, double y, double z)\n
: theta{static_cast<float>(acos(z/std::hypot(x,y,z)))}\n
, phi{static_cast<float>(atan2(y,x))} {}\n
template <class VectorType> Direction(const VectorType& v) : Direction(v.theta(), v.phi()) {}\n
operator std::pair<float, float>() const {return {theta, phi};}\n
float eta() const {return -log(tan(0.5*theta));}\n
Direction add(const Direction& rhs) const {return {theta+rhs.theta, phi+rhs.phi};}\n
Direction subtract(const Direction& rhs) const {return {theta-rhs.theta, phi-rhs.phi};}\n
"
eic::VectorXYZ: eic::VectorXYZ:
Members: Members:
- float x // [mm] or [GeV] - float x // [mm] or [GeV]
...@@ -125,7 +88,6 @@ components: ...@@ -125,7 +88,6 @@ components:
declaration: " declaration: "
VectorXYZ() : x{0}, y{0}, z{0} {}\n VectorXYZ() : x{0}, y{0}, z{0} {}\n
VectorXYZ(double xx, double yy, double zz) : x{static_cast<float>(xx)}, y{static_cast<float>(yy)}, z{static_cast<float>(zz)} {}\n VectorXYZ(double xx, double yy, double zz) : x{static_cast<float>(xx)}, y{static_cast<float>(yy)}, z{static_cast<float>(zz)} {}\n
template<class VectorPolarType> VectorXYZ(const VectorPolarType& v) : VectorXYZ(v.x(), v.y(), v.z()) {}\n
float& operator[](unsigned i) {return *(&x + i);}\n float& operator[](unsigned i) {return *(&x + i);}\n
const float& operator[](unsigned i) const {return *(&x + i);}\n const float& operator[](unsigned i) const {return *(&x + i);}\n
float mag() const {return std::hypot(x, y, z);}\n float mag() const {return std::hypot(x, y, z);}\n
...@@ -138,24 +100,11 @@ components: ...@@ -138,24 +100,11 @@ components:
VectorXYZ add(const VectorXYZ& rhs) const {return {x+rhs.x, y+rhs.y, z+rhs.z};}\n VectorXYZ add(const VectorXYZ& rhs) const {return {x+rhs.x, y+rhs.y, z+rhs.z};}\n
VectorXYZ subtract(const VectorXYZ& rhs) const {return {x-rhs.x, y-rhs.y, z-rhs.z};}\n VectorXYZ subtract(const VectorXYZ& rhs) const {return {x-rhs.x, y-rhs.y, z-rhs.z};}\n
VectorXYZ scale(double f) const {return {f*x, f*y, f*z};}\n VectorXYZ scale(double f) const {return {f*x, f*y, f*z};}\n
" static VectorXYZ fromSpherical(const double r, const double theta, const double phi) {\n
eic::VectorPolar: return {r * cos(phi) * sin(theta), \n
Members: r * sin(phi) * sin(theta), \n
- float r // [mm] or [GeV] r * cos(theta)}; \n
- float theta // [rad, 0->pi] }
- float phi // [rad, -pi->pi]
ExtraCode:
includes: "#include <cmath>\n#include<tuple>"
declaration: "
VectorPolar() : r{0}, theta{0}, phi{0} {}\n
VectorPolar(double rr, double th, double ph) : r{static_cast<float>(rr)}, theta{static_cast<float>(th)}, phi{static_cast<float>(ph)} {}\n
template<class VectorXYZType> VectorPolar(const VectorXYZType& v) : VectorPolar(v.r(), v.theta(), v.phi()) {}\n
float mag() const {return r;}\n
float x() const {return r * cos(phi) * sin(theta);}\n
float y() const {return r * sin(phi) * sin(theta);}\n
float z() const {return r * cos(theta);}\n
float eta() const {return -log(tan(0.5*theta));}\n
operator std::tuple<float, float, float>() {return {r, theta, phi};}\n
" "
eic::VectorXYZT: eic::VectorXYZT:
...@@ -265,12 +214,6 @@ components: ...@@ -265,12 +214,6 @@ components:
return *(&xy + i + j - 1);\n return *(&xy + i + j - 1);\n
}\n }\n
" "
## ProtoCluster hit relation
eic::ProtoClusterHit:
Members:
- eic::Index ID // ID of the hit
- uint32_t index // Raw index of the hit in the relevant array
- eic::Weight weight // weight of the hit
## A point along a track ## A point along a track
eic::TrackPoint: eic::TrackPoint:
...@@ -334,7 +277,8 @@ datatypes: ...@@ -334,7 +277,8 @@ datatypes:
- int16_t status // Status code - int16_t status // Status code
- int16_t charge // Particle charge (or sign) - int16_t charge // Particle charge (or sign)
- eic::Weight weight // Particle weight, e.g. from PID algorithm [0-1] - eic::Weight weight // Particle weight, e.g. from PID algorithm [0-1]
- eic::Direction direction // Direction (theta/phi of this particle [rad]) - float theta // Polar angle of this particle [rad]
- float phi // Azimuthal angle of this particle [rad]
- float momentum // particle 3-momentum magnitude [GeV] - float momentum // particle 3-momentum magnitude [GeV]
- float energy // Particle energy, consistent with PID assigment [GeV] - float energy // Particle energy, consistent with PID assigment [GeV]
- float mass // The mass of the particle in [GeV] - float mass // The mass of the particle in [GeV]
...@@ -353,22 +297,19 @@ datatypes: ...@@ -353,22 +297,19 @@ datatypes:
Description: "Raw (digitized) calorimeter hit" Description: "Raw (digitized) calorimeter hit"
Author: "W. Armstrong, S. Joosten" Author: "W. Armstrong, S. Joosten"
Members: Members:
- eic::Index ID // Unique hit ID. For MC, the value equals the Geant4 hit index. - uint64_t cellID // The detector specific (geometrical) cell id.
- int64_t cellID // The detector specific (geometrical) cell id. - uint64_t amplitude // The amplitude of the hit in ADC counts.
- int64_t amplitude // The amplitude of the hit in ADC counts. - uint64_t timeStamp // Timing in TDC
- int64_t time // Timing in TDC
eic::CalorimeterHit: eic::CalorimeterHit:
Description: "Calorimeter hit" Description: "Calorimeter hit"
Author: "W. Armstrong, S. Joosten" Author: "W. Armstrong, S. Joosten"
Members: Members:
- eic::Index ID // Unique hit ID, same as one of the involved raw hits. - uint64_t cellID // The detector specific (geometrical) cell id.
- int64_t cellID // The detector specific (geometrical) cell id.
- int32_t layer // Layer for this hit
- int32_t sector // Sector for this hit
- float energy // The energy for this hit in [GeV]. - float energy // The energy for this hit in [GeV].
- float energyError // Error on energy [GeV]. - float energyError // Error on energy [GeV].
- float time // The time of the hit in [ns]. - float time // The time of the hit in [ns].
- float timeError // Error on the time
- eic::VectorXYZ position // The global position of the hit in world coordinates [mm]. - eic::VectorXYZ position // The global position of the hit in world coordinates [mm].
- eic::VectorXYZ local // The local position of the hit in detector coordinates [mm]. - eic::VectorXYZ local // The local position of the hit in detector coordinates [mm].
- eic::VectorXYZ dimension // The dimension information of the cell [mm]. - eic::VectorXYZ dimension // The dimension information of the cell [mm].
...@@ -381,52 +322,42 @@ datatypes: ...@@ -381,52 +322,42 @@ datatypes:
## ========================================================================== ## ==========================================================================
eic::ProtoCluster: eic::ProtoCluster:
Description: "Relational info linking hits to their associated cluster" Description: "Collection of hits identified by the clustering algorithm to belong together"
Author: "S. Joosten" Author: "S. Joosten"
Members: OneToManyRelations:
- eic::Index ID // ID of the cluster - eic::CalorimeterHit hits // Hits associated with this cluster
VectorMembers:
- eic::ProtoClusterHit hits // List of hits associated with the cluster
eic::Cluster: eic::Cluster:
Description: "EIC cluster" Description: "EIC hit cluster, reworked to more closely resemble EDM4hep"
Author: "W. Armstrong, S. Joosten, C.Peng" Author: "W. Armstrong, S. Joosten, C.Peng"
Members: Members:
- eic::Index ID // Unique ID for this cluster, value identical to ProtoCluster ID # main variables
- int32_t type // Flagword that defines the type of the cluster
- float energy // Reconstructed energy of the cluster [GeV]. - float energy // Reconstructed energy of the cluster [GeV].
- float energyError // Error on the cluster energy [GeV] - float energyError // Error on the cluster energy [GeV]
- float time // [ns] - float time // [ns]
- float timeError // Error on the cluster time
- uint32_t nhits // Number of hits in the cluster. - uint32_t nhits // Number of hits in the cluster.
- eic::VectorXYZ position // Global position of the cluster [mm]. - eic::VectorXYZ position // Global position of the cluster [mm].
- eic::CovXYZ positionError // Covariance matrix of the position (6 Parameters). - eic::CovXYZ positionError // Covariance matrix of the position (6 Parameters).
- float radius // Shower radius [mm] - float intrinsicTheta // Intrinsic cluster propagation direction polar angle [rad]
- float skewness // Shower skewness [unitless] - float intrinsicPhi // Intrinsic cluster propagation direction azimuthal angle [rad]
- eic::VectorPolar polar // Cluster position polar information - eic::CovXY intrinsicDirectionError // Error on the intrinsic cluster propagation direction
# extra utility variables to facilitate analysis
- float theta // Cluster polar angle
- float phi // Cluster azimuthal angle
- float eta // Cluster pseudorapidity - float eta // Cluster pseudorapidity
- eic::Direction direction // Intrinsic direction of the cluster propagation [rad, 0->pi, -pi->pi] # this link is deprecated and will be replaced with a more EDM4hep-style link
# TODO
- eic::Index mcID // For MC only - associated MC particle - eic::Index mcID // For MC only - associated MC particle
VectorMembers:
eic::ClusterLayer: - float shapeParameters // Should be set in metadata, for now radius/skewness
Description: "2D Cluster in a single layer for a multi-layer detector" - float hitContributions // Energy contributions of the hits. Runs parallel to ::hits()
Author: "S. Joosten, C. Peng" - float subdetectorEnergies // Energies observed in each subdetector used for this cluster.
Members: OneToManyRelations:
- eic::Index ID // Unique layer ID - eic::Cluster clusters // Clusters that have been combined to form this cluster
- eic::Index clusterID // Associated full 3D cluster, -1 if none - eic::CalorimeterHit hits // Hits that have been combined to form this cluster
- int32_t layer // Layer number for this cluster layer #- eic::ParticleID particleIDs // Particle IDs sorted by likelihood, TODO
- uint32_t nhits // Number of hits
- float energy // Energy in this cluster layer [GeV]
- float energyError // Error on energy [GeV]
- float radius // Shower radius [mm]
- float skewness // Skewness of hits distribution
- eic::VectorXYZ position // Global center position. [mm]
eic::MergedClusterRelations:
Description: "Relational info between a merged cluster and its parents"
Author: "S. Joosten"
Members:
- eic::Index clusterID // Associated cluster ID
- uint32_t size // Number of valid parents
- std::array<eic::Index, 4> parent // (Up to 4) parents for this cluster
## ========================================================================== ## ==========================================================================
## RICH/Cherenkov data structures ## RICH/Cherenkov data structures
...@@ -437,7 +368,7 @@ datatypes: ...@@ -437,7 +368,7 @@ datatypes:
Author: "S. Joosten, C. Peng" Author: "S. Joosten, C. Peng"
Members: Members:
- eic::Index ID // Unique hit ID. For MC, the value equals the Geant4 hit index. - eic::Index ID // Unique hit ID. For MC, the value equals the Geant4 hit index.
- int64_t cellID // The detector specific (geometrical) cell id. - uint64_t cellID // The detector specific (geometrical) cell id.
- uint32_t amplitude // PMT signal amplitude [ADC] - uint32_t amplitude // PMT signal amplitude [ADC]
- uint32_t time // PMT signal time [TDC] - uint32_t time // PMT signal time [TDC]
...@@ -446,7 +377,7 @@ datatypes: ...@@ -446,7 +377,7 @@ datatypes:
Author: "S. Joosten, C. Peng" Author: "S. Joosten, C. Peng"
Members: Members:
- eic::Index ID // Unique hit ID, same as one of the involved raw hits. - eic::Index ID // Unique hit ID, same as one of the involved raw hits.
- int64_t cellID // The detector specific (geometrical) cell id. - uint64_t cellID // The detector specific (geometrical) cell id.
- float npe // Estimated number of photo-electrons [#] - float npe // Estimated number of photo-electrons [#]
- float time // Time [ns] - float time // Time [ns]
- float timeError // Error on the time [ns] - float timeError // Error on the time [ns]
...@@ -476,7 +407,7 @@ datatypes: ...@@ -476,7 +407,7 @@ datatypes:
Author: "W. Armstrong, S. Joosten" Author: "W. Armstrong, S. Joosten"
Members: Members:
- eic::Index ID // Unique hit ID. For MC, the value equals the Geant4 hit index. - eic::Index ID // Unique hit ID. For MC, the value equals the Geant4 hit index.
- int64_t cellID // The detector specific (geometrical) cell id. - uint64_t cellID // The detector specific (geometrical) cell id.
- int32_t time // TDC value. - int32_t time // TDC value.
- int32_t charge // ADC value - int32_t charge // ADC value
...@@ -485,7 +416,7 @@ datatypes: ...@@ -485,7 +416,7 @@ datatypes:
Author: "W. Armstrong, S. Joosten" Author: "W. Armstrong, S. Joosten"
Members: Members:
- eic::Index ID // Unique hit ID, same as one of the involved raw hits. - eic::Index ID // Unique hit ID, same as one of the involved raw hits.
- int64_t cellID // The detector specific (geometrical) cell id. - uint64_t cellID // The detector specific (geometrical) cell id.
- eic::VectorXYZ position // Hit (cell) position and time [mm, ns] - eic::VectorXYZ position // Hit (cell) position and time [mm, ns]
- eic::CovDiagXYZ positionError // Covariance Matrix - eic::CovDiagXYZ positionError // Covariance Matrix
- float time // Hit time - float time // Hit time
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment