diff --git a/JugFast/src/components/ClusterMerger.cpp b/JugFast/src/components/ClusterMerger.cpp index 30df222aac44a5fedc898b9fad1bdadb6a1d62d8..ddabc9f8efb02bc2b17adf54b09934ea871e3f0b 100644 --- a/JugFast/src/components/ClusterMerger.cpp +++ b/JugFast/src/components/ClusterMerger.cpp @@ -106,7 +106,7 @@ public: float energyError = 0; float time = 0; int nhits = 0; - eicd::Vector3f position; + auto position = new_clus.getPosition(); for (const auto& clus : clusters) { if (msgLevel(MSG::DEBUG)) { debug() << " --> Adding cluster with energy: " << clus.getEnergy() << endmsg; diff --git a/JugReco/src/components/CalorimeterIslandCluster.cpp b/JugReco/src/components/CalorimeterIslandCluster.cpp index 194f6476a6315412d90a907a8e7da2035a887d7f..c5eea65c78fa54f526f55325e51ede145b84dd63 100644 --- a/JugReco/src/components/CalorimeterIslandCluster.cpp +++ b/JugReco/src/components/CalorimeterIslandCluster.cpp @@ -36,9 +36,9 @@ #include "eicd/CalorimeterHitCollection.h" #include "eicd/ClusterCollection.h" #include "eicd/ProtoClusterCollection.h" -#include "eicd/Vector2f.h" -#include "eicd/Vector3f.h" #include "eicd/vector_utils.h" +#include "eicd/Vector2f.h" +#include "edm4hep/Vector2f.h" using namespace Gaudi::Units; @@ -47,26 +47,32 @@ namespace { using CaloHit = eicd::CalorimeterHit; using CaloHitCollection = eicd::CalorimeterHitCollection; +using Vector2f = std::conditional_t< + std::is_same_v, + eicd::Vector2f, + edm4hep::Vector2f +>; + // helper functions to get distance between hits -static eicd::Vector2f localDistXY(const CaloHit& h1, const CaloHit& h2) { +static Vector2f localDistXY(const CaloHit& h1, const CaloHit& h2) { const auto delta = h1.getLocal() - h2.getLocal(); return {delta.x, delta.y}; } -static eicd::Vector2f localDistXZ(const CaloHit& h1, const CaloHit& h2) { +static Vector2f localDistXZ(const CaloHit& h1, const CaloHit& h2) { const auto delta = h1.getLocal() - h2.getLocal(); return {delta.x, delta.z}; } -static eicd::Vector2f localDistYZ(const CaloHit& h1, const CaloHit& h2) { +static Vector2f localDistYZ(const CaloHit& h1, const CaloHit& h2) { const auto delta = h1.getLocal() - h2.getLocal(); return {delta.y, delta.z}; } -static eicd::Vector2f dimScaledLocalDistXY(const CaloHit& h1, const CaloHit& h2) { +static Vector2f dimScaledLocalDistXY(const CaloHit& h1, const CaloHit& h2) { const auto delta = h1.getLocal() - h2.getLocal(); const auto dimsum = h1.getDimension() + h2.getDimension(); return {2 * delta.x / dimsum.x, 2 * delta.y / dimsum.y}; } -static eicd::Vector2f globalDistRPhi(const CaloHit& h1, const CaloHit& h2) { - using vector_type = decltype(eicd::Vector2f::a); +static Vector2f globalDistRPhi(const CaloHit& h1, const CaloHit& h2) { + using vector_type = decltype(Vector2f::a); return { static_cast( eicd::magnitude(h1.getPosition()) - eicd::magnitude(h2.getPosition()) @@ -76,9 +82,9 @@ static eicd::Vector2f globalDistRPhi(const CaloHit& h1, const CaloHit& h2) { ) }; } -static eicd::Vector2f globalDistEtaPhi(const CaloHit& h1, +static Vector2f globalDistEtaPhi(const CaloHit& h1, const CaloHit& h2) { - using vector_type = decltype(eicd::Vector2f::a); + using vector_type = decltype(Vector2f::a); return { static_cast( eicd::eta(h1.getPosition()) - eicd::eta(h2.getPosition()) @@ -90,7 +96,7 @@ static eicd::Vector2f globalDistEtaPhi(const CaloHit& h1, } // name: {method, units} static std::map, std::vector>> + std::tuple, std::vector>> distMethods{ {"localDistXY", {localDistXY, {mm, mm}}}, {"localDistXZ", {localDistXZ, {mm, mm}}}, {"localDistYZ", {localDistYZ, {mm, mm}}}, {"dimScaledLocalDistXY", {dimScaledLocalDistXY, {1., 1.}}}, @@ -130,7 +136,7 @@ private: Gaudi::Property> u_globalDistEtaPhi{this, "globalDistEtaPhi", {}}; Gaudi::Property> u_dimScaledLocalDistXY{this, "dimScaledLocalDistXY", {1.8, 1.8}}; // neighbor checking function - std::function hitsDist; + std::function hitsDist; // unitless counterparts of the input parameters double minClusterHitEdep{0}, minClusterCenterEdep{0}, sectorDist{0}; diff --git a/JugReco/src/components/ImagingClusterReco.cpp b/JugReco/src/components/ImagingClusterReco.cpp index 5d78e7d040de25410fdb9676815b5b3b11ffe19a..84ee214d45450529f930d4cc9b528ab8c48a8f86 100644 --- a/JugReco/src/components/ImagingClusterReco.cpp +++ b/JugReco/src/components/ImagingClusterReco.cpp @@ -315,7 +315,7 @@ private: std::pair fit_track(const std::vector& layers) const { int nrows = 0; - eicd::Vector3f mean_pos{0, 0, 0}; + decltype(eicd::ClusterData::position) mean_pos{0, 0, 0}; for (const auto& layer : layers) { if ((layer.getNhits() > 0) && (layer.getHits(0).getLayer() <= m_trackStopLayer)) { mean_pos = mean_pos + layer.getPosition(); diff --git a/JugTrack/src/components/ParticlesFromTrackFit.cpp b/JugTrack/src/components/ParticlesFromTrackFit.cpp index 46af359d3c7107291fe8789e6a38026d59d19733..9a6418b16971f467af3ef4fc2b52bdbc6f99d55f 100644 --- a/JugTrack/src/components/ParticlesFromTrackFit.cpp +++ b/JugTrack/src/components/ParticlesFromTrackFit.cpp @@ -116,18 +116,18 @@ namespace Jug::Reco { debug() << " chi2 = " << trajState.chi2Sum << endmsg; } - const eicd::Vector2f loc { + const decltype(eicd::TrackParametersData::loc) loc { parameter[Acts::eBoundLoc0], parameter[Acts::eBoundLoc1] }; - const eicd::Cov3f covMomentum { + const decltype(eicd::TrackParametersData::momentumError) momentumError { static_cast(covariance(Acts::eBoundTheta, Acts::eBoundTheta)), static_cast(covariance(Acts::eBoundPhi, Acts::eBoundPhi)), static_cast(covariance(Acts::eBoundQOverP, Acts::eBoundQOverP)), static_cast(covariance(Acts::eBoundTheta, Acts::eBoundPhi)), static_cast(covariance(Acts::eBoundTheta, Acts::eBoundQOverP)), static_cast(covariance(Acts::eBoundPhi, Acts::eBoundQOverP))}; - const eicd::Cov2f covPos { + const decltype(eicd::TrackParametersData::locError) locError { static_cast(covariance(Acts::eBoundLoc0, Acts::eBoundLoc0)), static_cast(covariance(Acts::eBoundLoc1, Acts::eBoundLoc1)), static_cast(covariance(Acts::eBoundLoc0, Acts::eBoundLoc1))}; @@ -136,11 +136,11 @@ namespace Jug::Reco { eicd::TrackParameters pars{ 0, // type: track head --> 0 loc, - covPos, + locError, static_cast(parameter[Acts::eBoundTheta]), static_cast(parameter[Acts::eBoundPhi]), static_cast(parameter[Acts::eBoundQOverP]), - covMomentum, + momentumError, static_cast(parameter[Acts::eBoundTime]), timeError, static_cast(boundParam.charge())}; diff --git a/JugTrack/src/components/TrackParamACTSSeeding.cpp b/JugTrack/src/components/TrackParamACTSSeeding.cpp index 6a664e6b4fce7d82091cecf3b7ecc5eda8d285cf..c4cb3ecf25e1c654052d1c7b61ade1985294662d 100644 --- a/JugTrack/src/components/TrackParamACTSSeeding.cpp +++ b/JugTrack/src/components/TrackParamACTSSeeding.cpp @@ -332,9 +332,9 @@ namespace Jug::Reco { SpacePoint( eicd::TrackerHit( static_cast(spacePoint.size()), - eicd::Vector3f(v[0], v[1], v[2]), - eicd::CovDiag3f(25.0e-6 / 3.0, - 25.0e-6 / 3.0, 0.0), + {v[0], v[1], v[2]}, + {25.0e-6 / 3.0, + 25.0e-6 / 3.0, 0.0}, 0.0, 10.0, 0.05, 0.0), static_cast(spacePoint.size()))); spacePointPtrs.push_back(&spacePoint.back()); diff --git a/JugTrack/src/components/TrackProjector.cpp b/JugTrack/src/components/TrackProjector.cpp index 0a55fbff6f43c32c0c9a0df01c51a29dc8fac513..9e84d85502a326eaa1b9bf903cff2b8fd3060bed 100644 --- a/JugTrack/src/components/TrackProjector.cpp +++ b/JugTrack/src/components/TrackProjector.cpp @@ -118,8 +118,6 @@ namespace Jug::Reco { // visit the track points mj.visitBackwards(trackTip, [&](auto&& trackstate) { - auto pathLength = trackstate.pathLength(); - // get volume info auto geoID = trackstate.referenceSurface().geometryId(); auto volume = geoID.volume(); @@ -139,29 +137,29 @@ namespace Jug::Reco { {0, 0, 0} ); // global position - const eicd::Vector3f position { + const decltype(eicd::TrackPoint::position) position { global.x(), global.y(), global.z() }; // local position - const eicd::Vector2f loc { + const decltype(eicd::TrackParametersData::loc) loc { parameter[Acts::eBoundLoc0], parameter[Acts::eBoundLoc1] }; - const eicd::Cov2f covLoc { + const decltype(eicd::TrackParametersData::locError) locError { static_cast(covariance(Acts::eBoundLoc0, Acts::eBoundLoc0)), static_cast(covariance(Acts::eBoundLoc1, Acts::eBoundLoc1)), static_cast(covariance(Acts::eBoundLoc0, Acts::eBoundLoc1)) }; - const eicd::Cov3f positionError{0, 0, 0}; - const eicd::Vector3f momentum = eicd::sphericalToVector( + const decltype(eicd::TrackPoint::positionError) positionError{0, 0, 0}; + const decltype(eicd::TrackPoint::momentum) momentum = eicd::sphericalToVector( 1.0 / std::abs(parameter[Acts::eBoundQOverP]), parameter[Acts::eBoundTheta], parameter[Acts::eBoundPhi] ); - const eicd::Cov3f covMomentum { + const decltype(eicd::TrackPoint::momentumError) momentumError { static_cast(covariance(Acts::eBoundTheta, Acts::eBoundTheta)), static_cast(covariance(Acts::eBoundPhi, Acts::eBoundPhi)), static_cast(covariance(Acts::eBoundQOverP, Acts::eBoundQOverP)), @@ -173,11 +171,12 @@ namespace Jug::Reco { const float timeError{sqrt(static_cast(covariance(Acts::eBoundTime, Acts::eBoundTime)))}; const float theta(parameter[Acts::eBoundTheta]); const float phi(parameter[Acts::eBoundPhi]); - const eicd::Cov2f directionError { + const decltype(eicd::TrackPoint::directionError) directionError { static_cast(covariance(Acts::eBoundTheta, Acts::eBoundTheta)), static_cast(covariance(Acts::eBoundPhi, Acts::eBoundPhi)), static_cast(covariance(Acts::eBoundTheta, Acts::eBoundPhi)) }; + const float pathLength = static_cast(trackstate.pathLength()); const float pathLengthError = 0; // Store track point @@ -185,13 +184,13 @@ namespace Jug::Reco { position, positionError, momentum, - covMomentum, + momentumError, time, timeError, theta, phi, directionError, - static_cast(pathLength), + pathLength, pathLengthError });