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

Update to more closely mirror the DD4hep internal data structure

parent d17efb7d
Branches 82-set-charge-by-pdg-id-in-hepmc-reader
No related tags found
4 merge requests!273Draft: Resolve "Support FastSim and GFlash",!210Draft: Resolve "Set charge by pdg ID in hepmc reader",!209Update to more closely mirror the DD4hep internal data structure,!197Allow for multithreading in npsim
......@@ -20,13 +20,13 @@ components:
VectorXYZ(double xx, double yy, double zz) : x{xx}, y{yy}, z{zz} {}\n
double& operator[](unsigned i) {return *(&x + i);}\n
const double& operator[](unsigned i) const {return *(&x + i);}\n
doublemag() const {return std::hypot(x, y, z);}\n
doubler() const {return mag();}\n
doubletheta() const {return acos(z/mag());}\n
doublephi() const {return atan2(y,x);}\n
doubleeta() const {return -log(tan(0.5*theta()));}\n
double mag() const {return std::hypot(x, y, z);}\n
double r() const {return mag();}\n
double theta() const {return acos(z/mag());}\n
double phi() const {return atan2(y,x);}\n
double eta() const {return -log(tan(0.5*theta()));}\n
operator std::tuple<double, double, double>() {return {x, y, z};}\n
doubledot(const VectorXYZ& rhs) const {return x*rhs.x + y*rhs.y + z*rhs.z;}\n
double dot(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 scale(double f) const {return {f*x, f*y, f*z};}\n
......@@ -41,17 +41,17 @@ components:
- double deposit // energy deposit [GeV]
- double time // time [ns]
- double length // length [mm]
- double x // x position [mm]
- double y // y position [mm]
- double z // z position [mm]
- float x // x position [mm]
- float y // y position [mm]
- float z // z position [mm]
ExtraCode:
includes: "#include <cmath>"
declaration: "
MonteCarloContrib() : trackID{-1}, pdgID{0}, deposit{0}, time{0}, x{0}, y{0}, z{0} {}\n
MonteCarloContrib(int32_t id, int32_t pdg, double e, double t,\n
double l, double xx, double yy, double zz)\n
: trackID{id}, pdgID{pdg}, deposit{e)}, time{t)}, length{l)}\n
, x{xx)}, y{yy)}, z{zz)} {}\n
: trackID{id}, pdgID{pdg}, deposit{e}, time{t}, length{l}\n
, x{static_cast<float>(xx)}, y{static_cast<float>(yy)}, z{static_cast<float>(zz)} {}\n
double mag() const {return std::hypot(x, y, z);}\n
double r() const {return mag();}\n
double theta() const {return acos(z/mag());}\n
......@@ -78,8 +78,8 @@ datatypes :
- std::array<int,2> colorFlow // TODO document
- int32_t genStatus // Generator status code
- int32_t charge // Particle charge
- int32_t spare // TODO document, note, used to be array<int,1>
- std::array<double,3> spin // Particle spin state
- int32_t _spare // extra int to have doubles properly aligned at 8 bytes
- std::array<float,3> spin // Particle spin state
- dd4pod::VectorXYZ vs // Start vertex [mm]
- dd4pod::VectorXYZ ve // End vertex [mm]
- dd4pod::VectorXYZ ps // 3-momentum at start vertex [GeV]
......@@ -92,10 +92,10 @@ datatypes :
- int32_t daughters // daughter IDs
ConstExtraCode :
declaration: "
doublepx() const {return ps().x;}\n
doublepy() const {return ps().y;}\n
doublepz() const {return ps().z;}\n
doubleenergy() const {return std::hypot(ps().mag(), mass());}
double px() const {return ps().x;}\n
double py() const {return ps().y;}\n
double pz() const {return ps().z;}\n
double energy() const {return std::hypot(ps().mag(), mass());}
"
dd4pod::PhotoMultiplierHit:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment