Skip to content

Commit

Permalink
Rename MCParticle relations to particle to avoid clashes with type na…
Browse files Browse the repository at this point in the history
…mes (#256)

* Rename MCParticle relations to particle

Avoids clash with type-name

* Immediately deprecate compatibility overloads

* Update README links

* Immediately deprecate compatibility overloads
  • Loading branch information
tmadlener authored Feb 22, 2024
1 parent 60ad463 commit cb738b0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ A generic event data model for future HEP collider experiments.
| | | |
|-|-|-|
| [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) | |
| [CaloHitContribution](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L266) | [SimCalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L278) | [RawCalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L290) |
| [CalorimeterHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L299) | [ParticleID](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L311) | [Cluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L324) |
| [TrackerHit](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L345) | [TrackerHitPlane](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L362) | [RawTimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L383) |
| [Track](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L396) | [Vertex](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L415) | [ReconstructedParticle](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L432) |
| [SimPrimaryIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L536) | [TrackerPulse](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L570) | [RecIonizationCluster](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L583) |
| [TimeSeries](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L594) | [RecDqdx](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L606) | |

**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#L462) | [MCRecoCaloAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L471) | [MCRecoTrackerAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L480) |
| [MCRecoTrackerHitPlaneAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L489) | [MCRecoCaloParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L498) | [MCRecoClusterParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L507) |
| [MCRecoTrackParticleAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L516) | [RecoParticleVertexAssociation](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L525) | |

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

Expand Down
30 changes: 27 additions & 3 deletions edm4hep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,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 +257,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 @@ -540,7 +548,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\")]]\n
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

0 comments on commit cb738b0

Please sign in to comment.