diff --git a/CMakeLists.txt b/CMakeLists.txt index a4e111dac1ce637d95d2e6cf015104e580d26aab..5cb6f1ff95aae0b2b17251a49100eacd55403ced 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.8) project(EICD VERSION 0.5.1 LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 20) #--- Declare options ----------------------------------------------------------- option(BUILD_DATA_MODEL "Run podio class generator yaml file" ON) diff --git a/eic_data.yaml b/eic_data.yaml index fecf3e1733c056dd56d1ce8016ed634bb362818a..472bc426de583a25fc7a18668463da844e92024b 100644 --- a/eic_data.yaml +++ b/eic_data.yaml @@ -46,14 +46,14 @@ components: - int32_t first - int32_t second ExtraCode: - includes: "#include <span>\n#include <pair>" + includes: "#include <tuple>" declaration: " IndexPair() : first{-1}, second{-1} {}\n IndexPair(int32_t a) : first{a}, second{-1} {}\n IndexPair operator=(int32_t a) {first = a; second = -1; return *this;} IndexPair(int32_t a, int32_t b) : first{a}, second{b} {}\n - IndexPair(std::span<int32_t> v) : first{v[0]}, second{v[1]} {}\n - IndexPair& operator=(std::span<int32_t> v) {first=v[0]; second=v[1]; return *this;}\n + //IndexPair(std::span<int32_t> v) : first{v[0]}, second{v[1]} {}\n + //IndexPair& operator=(std::span<int32_t> v) {first=v[0]; second=v[1]; return *this;}\n IndexPair(const std::pair<int32_t, int32_t>& p) : first{p.first}, second{p.second} {}\n IndexPair& operator=(const std::pair<int32_t, int32_t>& p) {first = p.first; second = p.second; return *this;}\n int32_t operator[](unsigned i) const { return *(&first + i); }\n @@ -71,12 +71,12 @@ components: - float first - float second ExtraCode: - includes: "#include <span>\n#include <pair>" + includes: "#include <tuple>" declaration: " FloatPair() : first{0}, second{0} {}\n FloatPair(float a, float b) : first{a}, second{b} {}\n - FloatPair(std::span<float> v) : first{v[0]}, second{v[1]} {}\n - FloatPair& operator=(std::span<float> v) {first=v[0]; second=v[1]; return *this;}\n + //FloatPair(std::span<float> v) : first{v[0]}, second{v[1]} {}\n + //FloatPair& operator=(std::span<float> v) {first=v[0]; second=v[1]; return *this;}\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 FloatPair(const std::pair<float,float>& fp)\n @@ -89,16 +89,16 @@ components: - float x // [mm] or [GeV] - float y // ExtraCode: - includes: "#include <span>\n#include <cmath>\n" + includes: "#include <cmath>\n" declaration: " VectorXY() : x{0}, y{0} {}\n VectorXY(float xx, float yy) : x{xx}, y{yy} {}\n - VectorXY(std::span<float > v) : x{v[0]}, y{v[1]} {}\n - VectorXY& operator=(std::span<float > v) {x = v[0]; y = v[1]; return *this;}\n + //VectorXY(std::span<float > v) : x{v[0]}, y{v[1]} {}\n + //VectorXY& operator=(std::span<float > v) {x = v[0]; y = v[1]; return *this;}\n float operator[](unsigned i) const { return *(&x + i); }\n float mag() const {return std::hypot(x, y);}\n - float px() const {return x();}\n - float py() const {return y();}\n + float px() const {return x;}\n + float py() const {return y;}\n float px(float xx) {x = xx; return x;}\n float py(float yy) {y = yy; return y;}\n operator std::pair<float, float>() const {return {first, second};} @@ -108,7 +108,7 @@ components: - float theta // [rad] - float phi // ExtraCode: - includes: "#include <cmath>\n#include <pair>" + includes: "#include <cmath>\n#include <tuple>" declaration: " Direction() : theta{0}, phi{0} {}\n Direction(float th, float ph) : theta{th}, phi{ph} {}\n @@ -122,20 +122,20 @@ components: - float y // - float z // ExtraCode: - includes: "#include <span>\n#include <cmath>\n#include<tuple>" + includes: "#include <cmath>\n#include<tuple>" declaration: " VectorXYZ() : x{0}, y{0}, z{0} {}\n VectorXYZ(float xx, float yy, float zz) : x{xx}, y{yy}, z{zz} {}\n - VectorXYZ(std::span<float> v) : x{v[0]}, y{v[1]}, z{v[2]} {}\n - VectorXYZ& operator=(std::span<float> v) {x = v[0]; y = v[1]; z = v[2]; return *this;}\n + //VectorXYZ(std::span<float> v) : x{v[0]}, y{v[1]}, z{v[2]} {}\n + //VectorXYZ& operator=(std::span<float> v) {x = v[0]; y = v[1]; z = v[2]; return *this;}\n float operator[](unsigned i) const { return *(&x + i); }\n float mag() const {return std::hypot(x, y, z);}\n float r() const {return mag();}\n float theta() const {return acos(z/mag());}\n float phi() const {return atan2(y,x);}\n - float px() const {return x();}\n - float py() const {return y();}\n - float pz() const {return z();}\n + float px() const {return x;}\n + float py() const {return y;}\n + float pz() const {return z;}\n operator std::tuple<float, float, float>() {return {x, y, z};} " eic::VectorPolar: @@ -144,7 +144,7 @@ components: - float theta // [rad] - float phi // ExtraCode: - includes: "#include <span>\n#include <cmath>\n#include<tuple>" + includes: "#include <cmath>\n#include<tuple>" declaration: " VectorPolar() : x{0}, theta{0}, phi{0} {}\n VectorPolar(float rr, float th, float ph) : r{rr}, theta{th}, phi{ph} {}\n @@ -165,12 +165,12 @@ components: - double z // - double t // [ns] or [GeV] ExtraCode: - includes: "#include <span>\n#include <cmath>\n#include <tuple>" + includes: "#include <cmath>\n#include <tuple>" declaration: " VectorXYZT() : x{0}, y{0}, z{0}, t{0] {}\n VectorXYZT(double xx, double yy, double zz, double tt) : x{xx}, y{yy}, z{zz}, t{tt} {}\n - VectorXYZT(std::span<double> v) : x{v[0]}, y{v[1]}, z{v[2]}, t{v[3]} {}\n - VextorXYZT& operator=(std::span<double> v) { x = v[0]; y = v[1]; z = v[2]; t = v[3]; return *this;} \n + //VectorXYZT(std::span<double> v) : x{v[0]}, y{v[1]}, z{v[2]}, t{v[3]} {}\n + //VextorXYZT& operator=(std::span<double> v) { x = v[0]; y = v[1]; z = v[2]; t = v[3]; return *this;} \n double operator[](unsigned i) const { return *(&x + i); }\n double mag() const {return std::hypot(x, y, z);}\n double r() const {return mag();}\n @@ -194,12 +194,12 @@ components: - double z // - double m // ExtraCode: - includes: "#include <span>\n#include <cmath>\n#include <tuple>" + includes: "#include <cmath>\n#include <tuple>" declaration: " VectorPxPyPzM() : x{0}, y{0}, z{0}, m{0] {}\n VectorPxPyPzM(double xx, double yy, double zz, double mm) : x{xx}, y{yy}, z{zz}, m{mm} {}\n - VectorPxPyPzM(std::span<double> v) : x{v[0]}, y{v[1]}, z{v[2]}, m{v[3]} {}\n - VectorPxPyPzM& operator=(std::span<double> v) { x = v[0]; y = v[1]; z = v[2]; m = v[3]; return *this;}\n + //VectorPxPyPzM(std::span<double> v) : x{v[0]}, y{v[1]}, z{v[2]}, m{v[3]} {}\n + //VectorPxPyPzM& operator=(std::span<double> v) { x = v[0]; y = v[1]; z = v[2]; m = v[3]; return *this;}\n double operator[](unsigned i) const { return *(&x + i); }\n double mag() const {return std::hypot(x, y, z);}\n double r() const {return mag();}\n @@ -225,8 +225,8 @@ components: declaration: " CovDiagXYZ() : xx{0}, yy{0}, zz{0} {}\n CovDiagXYZ(float x, float y, float z) : xx{x}, yy{y}, zz{z} {}\n - CovDiagXYZ(std::span<float> v) : xx{v[0]}, yy{v[1]}, zz{v[2]} {}\n - CovDiagXYZ& operator=(std::span<float> v) { xx = v[0]; yy = v[1]; zz = v[2]; return *this;}\n + //CovDiagXYZ(std::span<float> v) : xx{v[0]}, yy{v[1]}, zz{v[2]} {}\n + //CovDiagXYZ& operator=(std::span<float> v) { xx = v[0]; yy = v[1]; zz = v[2]; return *this;}\n float operator[](unsigned i, unsigned j) const {return (i == j) ? *(&xx + i) : 0.;}\n " @@ -242,8 +242,8 @@ components: declaration: " CovXYZ() : xx{0}, yy{0}, zz{0}, xy{0}, xz{0}, yz{0} {}\n CovXYZ(float vx, float vy, float vz, vxy, vxz, vyz) : xx{vx}, yy{vy}, zz{vz}, xy{vxy}, xz{vxz}, yz{vyz} {}\n - CovXYZ(std::span<float> v) : xx{v[0]}, yy{v[1]}, zz{v[2]}, xy{v[3]}, xz{v[4]}, yx{v[5]} {}\n - CovDiagXYZ& operator=(std::span<float> v) { xx = v[0]; yy = v[1]; zz = v[2]; xy = v[3]; xz = v[4]; yz = v[5]; return *this;}\n + //CovXYZ(std::span<float> v) : xx{v[0]}, yy{v[1]}, zz{v[2]}, xy{v[3]}, xz{v[4]}, yx{v[5]} {}\n + //CovDiagXYZ& operator=(std::span<float> v) { xx = v[0]; yy = v[1]; zz = v[2]; xy = v[3]; xz = v[4]; yz = v[5]; return *this;}\n float operator[](unsigned i, unsigned j) const {\n // diagonal\n if (i == j) {\n @@ -389,14 +389,17 @@ datatypes: - eic::VectorXYZ dimension // The dimension information of the cell [mm]. ExtraCode: declaration: " - explicit CalorimeterHit(const ConstCalorimeterHit& cv) - : cellID{cv.cellID()}, ID{cv.ID()}, layerID{cv.layerID()}, sectorID{cv.sectorID()}, clusterID{cv.clusterID()} - , type{cv.type()}, energy{cv.energy()}, time{cv.time()}, position{cv.position()}, local{cv.local()} - , dimension{cv.dimension()} {}\n - CalorimeterHit& operator=(const ConstCalorimeterHit& cv) { - cellID = cv.cellID(); ID = cv.ID(); layerID = cv.layerID(); sectorID = cv.sectorID(); clusterID = cv.clusterID(); - type = cv.type(); energy = cv.energy(); time = cv.time(); position = cv.position(); local = cv.local(); - dimension = cv.dimension();}\n + explicit CalorimeterHit(const ConstCalorimeterHit& cv)\n + : CalorimeterHit(cv.cellID(), cv.ID(), cv.layerID(), cv.sectorID(), cv.clusterID(),\n + cv.type(), cv.energy(), cv.time(), cv.position(), cv.local(),\n + cv.dimension()) {}\n + CalorimeterHit& operator=(const ConstCalorimeterHit& cv) {\n + auto tmp = CalorimeterHit(cv.cellID(), cv.ID(), cv.layerID(), cv.sectorID(), cv.clusterID(),\n + cv.type(), cv.energy(), cv.time(), cv.position(), cv.local(),\n + cv.dimension());\n + *this = std::move(tmp);\n + return *this;\n + } " eic::RawTrackerHit: