Skip to content

Commit

Permalink
drop types for datatypes
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliorivas committed Jun 11, 2024
1 parent 1ff80b6 commit 9ba9506
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 42 deletions.
23 changes: 7 additions & 16 deletions model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ const datatypesDefinition = {};
class Component {}

class DataTypeMember {
constructor(type = null, name, unit = null) {
if (type) this.type = type;
constructor(name, unit = null) {
this.name = name;
if (unit) this.unit = unit;
}
}

class Relation {
constructor(type = null, name) {
if (type) this.type = type;
constructor(name) {
this.name = name;
}
}
Expand All @@ -55,26 +53,19 @@ const parseDatatypesMembers = (members) => {
const newMembers = [];

for (const member of members) {
let [type, name, unit] = parseString(member);
let [_, name, unit] = parseString(member);
if (unit) unit = unit.replace("[", "").replace("]", "");
if (type.includes("edm4hep::")) {
newMembers.push(new DataTypeMember(type, name, unit));
} else {
newMembers.push(new DataTypeMember(null, name, unit));
}
newMembers.push(new DataTypeMember(name, unit));
}

return newMembers;
};

const parseRelation = (relations) => {
return relations.map((relation) => {
const [type, name] = parseString(relation);
if (type.includes("edm4hep::")) {
return new Relation(type, name);
} else {
return new Relation(null, name);
}
const [_, name] = parseString(relation);

return new Relation(name);
});
};

Expand Down
26 changes: 0 additions & 26 deletions output/datatypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,33 @@ export const datatypes = {
"unit": "GeV"
},
{
"type": "edm4hep::Vector3d",
"name": "vertex",
"unit": "mm"
},
{
"type": "edm4hep::Vector3d",
"name": "endpoint",
"unit": "mm"
},
{
"type": "edm4hep::Vector3d",
"name": "momentum",
"unit": "GeV"
},
{
"type": "edm4hep::Vector3d",
"name": "momentumAtEndpoint",
"unit": "GeV"
},
{
"type": "edm4hep::Vector3f",
"name": "spin"
},
{
"type": "edm4hep::Vector2i",
"name": "colorFlow"
}
],
"oneToManyRelations": [
{
"type": "edm4hep::MCParticle",
"name": "parents"
},
{
"type": "edm4hep::MCParticle",
"name": "daughters"
}
]
Expand All @@ -78,7 +70,6 @@ export const datatypes = {
],
"oneToOneRelations": [
{
"type": "edm4hep::ReconstructedParticle",
"name": "particle"
}
]
Expand All @@ -97,12 +88,10 @@ export const datatypes = {
"unit": "GeV"
},
{
"type": "edm4hep::Vector3f",
"name": "position",
"unit": "mm"
},
{
"type": "edm4hep::CovMatrix3f",
"name": "positionError"
},
{
Expand All @@ -112,18 +101,15 @@ export const datatypes = {
"name": "phi"
},
{
"type": "edm4hep::Vector3f",
"name": "directionError",
"unit": "mm**2"
}
],
"oneToManyRelations": [
{
"type": "edm4hep::Cluster",
"name": "clusters"
},
{
"type": "edm4hep::CalorimeterHit",
"name": "hits"
}
]
Expand Down Expand Up @@ -151,11 +137,9 @@ export const datatypes = {
],
"oneToManyRelations": [
{
"type": "edm4hep::TrackerHit",
"name": "trackerHits"
},
{
"type": "edm4hep::Track",
"name": "tracks"
}
]
Expand All @@ -172,11 +156,9 @@ export const datatypes = {
"name": "probability"
},
{
"type": "edm4hep::Vector3f",
"name": "position"
},
{
"type": "edm4hep::CovMatrix3f",
"name": "covMatrix"
},
{
Expand All @@ -185,7 +167,6 @@ export const datatypes = {
],
"oneToOneRelations": [
{
"type": "edm4hep::ReconstructedParticle",
"name": "associatedParticle"
}
]
Expand All @@ -200,12 +181,10 @@ export const datatypes = {
"unit": "GeV"
},
{
"type": "edm4hep::Vector3f",
"name": "momentum",
"unit": "GeV"
},
{
"type": "edm4hep::Vector3f",
"name": "referencePoint",
"unit": "mm"
},
Expand All @@ -220,27 +199,22 @@ export const datatypes = {
"name": "goodnessOfPID"
},
{
"type": "edm4hep::CovMatrix4f",
"name": "covMatrix"
}
],
"oneToManyRelations": [
{
"type": "edm4hep::Cluster",
"name": "clusters"
},
{
"type": "edm4hep::Track",
"name": "tracks"
},
{
"type": "edm4hep::ReconstructedParticle",
"name": "particles"
}
],
"oneToOneRelations": [
{
"type": "edm4hep::Vertex",
"name": "startVertex"
}
]
Expand Down

0 comments on commit 9ba9506

Please sign in to comment.