diff --git a/.ci/build_tarballs.jl b/.ci/build_tarballs.jl index eb2d166..a45b342 100644 --- a/.ci/build_tarballs.jl +++ b/.ci/build_tarballs.jl @@ -13,7 +13,7 @@ julia_version = v"1.5.3" name = "LCIO_Julia_Wrapper" version = get(ENV, "TRAVIS_TAG", "") if version == "" - version = v"0.13.0-alpha4" + version = v"0.13.1-alpha1" else version = VersionNumber(version) end diff --git a/src/CalorimeterHitTypes.icc b/src/CalorimeterHitTypes.icc index 86e0500..8ee5dd1 100644 --- a/src/CalorimeterHitTypes.icc +++ b/src/CalorimeterHitTypes.icc @@ -19,7 +19,12 @@ lciowrap.add_type("SimCalorimeterHit") // returns a bool to indicate whether this was a nullptr lciowrap.method("getPosition3", [](const EVENT::SimCalorimeterHit* hit, ArrayRef x)->bool { const float* p = hit->getPosition(); - if (not p) return false; + if (not p) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p[0]; x[1] = p[1]; x[2] = p[2]; @@ -42,7 +47,12 @@ lciowrap.add_type("CalorimeterHit", jlcxx::julia_base_typ .method("getType", &EVENT::CalorimeterHit::getType); lciowrap.method("getPosition3", [](const EVENT::CalorimeterHit* hit, ArrayRef x)->bool { const float* p = hit->getPosition(); - if (not p) return false; + if (not p) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p[0]; x[1] = p[1]; x[2] = p[2]; @@ -53,7 +63,6 @@ lciowrap.method("_getPosition", [](const EVENT::CalorimeterHit* hit) { if (not p) { return make_tuple(nanf(""), nanf(""), nanf("")); } - return make_tuple(p[0], p[1], p[2]); }); diff --git a/src/Cluster.icc b/src/Cluster.icc index 049f946..0ca0780 100644 --- a/src/Cluster.icc +++ b/src/Cluster.icc @@ -24,7 +24,12 @@ lciowrap.method("getClusters", [](const EVENT::Cluster* c)->const std::vector x)->bool { const float* p3 = c->getPosition(); - if (not p3) return false; + if (not p3) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p3[0]; x[1] = p3[1]; x[2] = p3[2]; diff --git a/src/MCParticle.icc b/src/MCParticle.icc index bb17762..c0ded7f 100644 --- a/src/MCParticle.icc +++ b/src/MCParticle.icc @@ -32,7 +32,12 @@ lciowrap.method("getDaughters", [](const EVENT::MCParticle* p)->const std::vecto // returns a bool to indicate whether this was a nullptr lciowrap.method("getVertex3", [](const EVENT::MCParticle* p, ArrayRef v)->bool { const double* vtx = p->getVertex(); - if (not vtx) return false; + if (not vtx) { + v[0] = nan(""); + v[1] = nan(""); + v[2] = nan(""); + return false; + } v[0] = vtx[0]; v[1] = vtx[1]; v[2] = vtx[2]; @@ -49,7 +54,12 @@ lciowrap.method("_getVertex", [](const EVENT::MCParticle* p) { // returns a bool to indicate whether this was a nullptr lciowrap.method("getEndpoint3", [](const EVENT::MCParticle* p, ArrayRef pos)->bool { const double* endp = p->getEndpoint(); - if (not endp) return false; + if (not endp) { + pos[0] = nan(""); + pos[1] = nan(""); + pos[2] = nan(""); + return false; + } pos[0] = endp[0]; pos[1] = endp[1]; pos[2] = endp[2]; @@ -66,7 +76,12 @@ lciowrap.method("_getEndpoint", [](const EVENT::MCParticle* p) { // returns a bool to indicate whether this was a nullptr lciowrap.method("getMomentum3", [](const EVENT::MCParticle* p, ArrayRef p3)->bool { const double* mom = p->getMomentum(); - if (not mom) return false; + if (not mom) { + p3[0] = nan(""); + p3[1] = nan(""); + p3[2] = nan(""); + return false; + } p3[0] = mom[0]; p3[1] = mom[1]; p3[2] = mom[2]; @@ -83,7 +98,12 @@ lciowrap.method("_getMomentum", [](const EVENT::MCParticle* p) { // returns a bool to indicate whether this was a nullptr lciowrap.method("getMomentumAtEndpoint3", [](const EVENT::MCParticle* p, ArrayRef p3)->bool { const double* mom = p->getMomentumAtEndpoint(); - if (not mom) return false; + if (not mom) { + p3[0] = nan(""); + p3[1] = nan(""); + p3[2] = nan(""); + return false; + } p3[0] = mom[0]; p3[1] = mom[1]; p3[2] = mom[2]; diff --git a/src/ReconstructedParticle.icc b/src/ReconstructedParticle.icc index 7bc296d..b1143f6 100644 --- a/src/ReconstructedParticle.icc +++ b/src/ReconstructedParticle.icc @@ -16,7 +16,12 @@ lciowrap.add_type("ReconstructedParticle", jlcxx:: lciowrap.method("getMomentum3", [](const EVENT::ReconstructedParticle* p, ArrayRef mom)->bool { const double* p3 = p->getMomentum(); - if (not p3) return false; + if (not p3) { + mom[0] = nan(""); + mom[1] = nan(""); + mom[2] = nan(""); + return false; + } mom[0] = p3[0]; mom[1] = p3[1]; mom[2] = p3[2]; @@ -32,7 +37,12 @@ lciowrap.method("_getMomentum", [](const EVENT::ReconstructedParticle* p) { lciowrap.method("getReferencePoint3", [](const EVENT::ReconstructedParticle* p, ArrayRef point)->bool { const float* x = p->getReferencePoint(); - if (not x) return false; + if (not x) { + point[0] = nan(""); + point[1] = nan(""); + point[2] = nan(""); + return false; + } point[0] = x[0]; point[1] = x[1]; point[2] = x[2]; diff --git a/src/Track.icc b/src/Track.icc index 3daf313..af4c889 100644 --- a/src/Track.icc +++ b/src/Track.icc @@ -42,7 +42,12 @@ jlcxx::stl::apply_stl(lciowrap); lciowrap.method("getReferencePoint3", [](const EVENT::TrackState* t, ArrayRef x)->bool { const float* p3 = t->getReferencePoint(); - if (not p3) return false; + if (not p3) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p3[0]; x[1] = p3[1]; x[2] = p3[2]; @@ -78,7 +83,12 @@ jlcxx::stl::apply_stl(lciowrap); lciowrap.method("getReferencePoint3", [](const EVENT::Track* t, ArrayRef x)->bool { const float* p3 = t->getReferencePoint(); - if (not p3) return false; + if (not p3) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p3[0]; x[1] = p3[1]; x[2] = p3[2]; diff --git a/src/TrackerHitTypes.icc b/src/TrackerHitTypes.icc index 6a9b263..d65a373 100644 --- a/src/TrackerHitTypes.icc +++ b/src/TrackerHitTypes.icc @@ -17,7 +17,12 @@ jlcxx::stl::apply_stl(lciowrap); // returns a bool to indicate whether this was a nullptr lciowrap.method("getPosition3", [](const EVENT::SimTrackerHit* hit, ArrayRef x)->bool { const double* p = hit->getPosition(); - if (not p) return false; + if (not p) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p[0]; x[1] = p[1]; x[2] = p[2]; @@ -34,7 +39,12 @@ lciowrap.method("_getPosition", [](const EVENT::SimTrackerHit* hit) { // returns a bool to indicate whether this was a nusllptr lciowrap.method("getMomentum3", [](const EVENT::SimTrackerHit* hit, ArrayRef x)->bool { const float* p = hit->getMomentum(); - if (not p) return false; + if (not p) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p[0]; x[1] = p[1]; x[2] = p[2]; @@ -62,7 +72,12 @@ lciowrap.add_type("TrackerHit", jlcxx::julia_base_type x)->bool { const double* p = hit->getPosition(); - if (not p) return false; + if (not p) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p[0]; x[1] = p[1]; x[2] = p[2]; diff --git a/src/lciowrap.cc b/src/lciowrap.cc index 2134101..c25c322 100644 --- a/src/lciowrap.cc +++ b/src/lciowrap.cc @@ -192,7 +192,12 @@ JLCXX_MODULE define_julia_module(jlcxx::Module& lciowrap) .method("getParameters", &Vertex::getParameters); lciowrap.method("getPosition3", [](const Vertex* v, ArrayRef x)->bool { const float* p3 = v->getPosition(); - if (not p3) return false; + if (not p3) { + x[0] = nan(""); + x[1] = nan(""); + x[2] = nan(""); + return false; + } x[0] = p3[0]; x[1] = p3[1]; x[2] = p3[2];