From ac13d540b4270d2b1afd03fcc4d2ccc90f478abb Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 15 Apr 2021 21:29:22 +0200 Subject: [PATCH 1/4] Define a separate scoped enumeration for the possible SurfaceTypes. And use it consistently. The motivation is that there is a cross dependency creeping in from ParameterBase to Surface and Surface impl to ParametersBase due to that enum. Also a single scoped enum allows to unify the usage syntax --- .../src/SingleTrackConversionTool.cxx | 4 +- .../src/InDetTrackHoleSearchTool.cxx | 14 ++-- .../src/PixelClusterOnTrackTool.cxx | 4 +- .../TrkGeometry/src/TrackingVolume.cxx | 2 +- .../TrkSurfaces/TrkSurfaces/ConeSurface.h | 2 +- .../TrkSurfaces/TrkSurfaces/ConeSurface.icc | 2 +- .../TrkSurfaces/TrkSurfaces/CylinderSurface.h | 2 +- .../TrkSurfaces/CylinderSurface.icc | 2 +- .../TrkSurfaces/TrkSurfaces/DiscSurface.h | 2 +- .../TrkSurfaces/TrkSurfaces/DiscSurface.icc | 2 +- .../TrkSurfaces/TrkSurfaces/PerigeeSurface.h | 2 +- .../TrkSurfaces/PerigeeSurface.icc | 16 +++-- .../TrkSurfaces/TrkSurfaces/PlaneSurface.h | 2 +- .../TrkSurfaces/TrkSurfaces/PlaneSurface.icc | 2 +- .../TrkSurfaces/StraightLineSurface.h | 2 +- .../TrkSurfaces/StraightLineSurface.icc | 2 +- .../TrkSurfaces/TrkSurfaces/Surface.h | 22 +----- .../TrkEventPrimitives/SurfaceUniquePtrT.h | 2 +- .../MeasurementBaseComparisonFunction.h | 24 +++---- .../PrepRawDataComparisonFunction.h | 16 ++--- .../test/testConstExpr.cxx | 2 +- .../TrkParameters/test/testConstExpr.cxx | 2 +- .../CurvilinearParametersT.h | 6 +- .../CurvilinearParametersT.icc | 2 +- .../TrkParametersBase/ParametersBase.h | 3 +- .../TrkParametersBase/ParametersT.h | 12 ++-- .../TrkParametersBase/ParametersT.icc | 6 +- .../PatternTrackParameters.h | 2 +- .../src/PatternTrackParameters.cxx | 2 +- .../TrkEventCnvTools/DetElementSurface.h | 2 +- .../TrkParameters/TrackParametersCnv_p2.h | 2 +- .../TrkParameters/TrackParametersCnv_p2.cxx | 50 +++++++------ .../src/RungeKuttaPropagator.cxx | 70 +++++++++---------- .../TrkExSTEP_Propagator/STEP_Propagator.h | 7 +- .../src/STEP_Propagator.cxx | 58 ++++++++------- .../TrkExTools/src/Extrapolator.cxx | 7 +- .../ExtrapolationEngineTest.icc | 6 +- .../TrkExUtils/src/RungeKuttaUtils.cxx | 41 ++++++----- .../src/GlobalChi2Fitter.cxx | 64 ++++++++--------- .../TrkiPatFitter/src/MaterialAllocator.cxx | 4 +- 40 files changed, 239 insertions(+), 235 deletions(-) diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx index 6374a5b25bd..6bfa2a60a3d 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx @@ -121,7 +121,7 @@ namespace InDet { // Should use eigen to do all of this // ME: use the surface to find out what we do, do not hardcode the geoemtry - if (Trk::Surface::Plane == trkPar.associatedSurface().type()) { + if (Trk::SurfaceType::Plane == trkPar.associatedSurface().type()) { /// The local position parameters covariance matrix C (2x2) double p11 = em(Trk::locX, Trk::locX); @@ -169,7 +169,7 @@ namespace InDet { nCovVtx(2, 1) = P32; nCovVtx(2, 2) = P33; - } else if (Trk::Surface::Line == trkPar.associatedSurface().type()) { + } else if (Trk::SurfaceType::Line == trkPar.associatedSurface().type()) { /// The local position parameters covariance matrix C (2x2) double p11 = em(Trk::locR, Trk::locR); diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx index 2d699262cd0..e8409dfcaf8 100644 --- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx @@ -268,7 +268,7 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx, //get BoundarySurface for cylinder between sct and trt const Trk::CylinderSurface* sctCylinder = nullptr; const Trk::Surface* sctSurface= &(sctVolume->boundarySurfaces()[Trk::tubeOuterCover].get()->surfaceRepresentation()); - if(sctSurface->type()==Trk::Surface::Cylinder){ + if(sctSurface->type()==Trk::SurfaceType::Cylinder){ sctCylinder= static_cast (sctSurface); } if (!sctCylinder) { @@ -297,13 +297,13 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx, if (firstsipar->parameters()[Trk::theta] < M_PI/2.) { const Trk::TrackingVolume* trtVolume = trackingGeometry->trackingVolume("InDet::Detectors::TRT::NegativeEndcap"); const Trk::Surface* trtSurface = &(trtVolume->boundarySurfaces()[Trk::negativeFaceXY].get()->surfaceRepresentation()); - if(trtSurface->type()==Trk::Surface::Disc){ + if(trtSurface->type()==Trk::SurfaceType::Disc){ trtDisc = static_cast (trtSurface); } } else { const Trk::TrackingVolume* trtVolume = trackingGeometry->trackingVolume("InDet::Detectors::TRT::PositiveEndcap"); const Trk::Surface* trtSurface = &(trtVolume->boundarySurfaces()[Trk::positiveFaceXY].get()->surfaceRepresentation()); - if(trtSurface->type()==Trk::Surface::Disc){ + if(trtSurface->type()==Trk::SurfaceType::Disc){ trtDisc = static_cast (trtSurface); } } @@ -359,7 +359,7 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx, if (m_cosmic) { while (iterTSOS!=track.trackStateOnSurfaces()->end() && (!(*iterTSOS)->type(Trk::TrackStateOnSurface::Measurement) - || (*iterTSOS)->measurementOnTrack()->associatedSurface().type()!=Trk::Surface::Plane)) { + || (*iterTSOS)->measurementOnTrack()->associatedSurface().type()!=Trk::SurfaceType::Plane)) { ++iterTSOS; } } @@ -380,7 +380,7 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx, per=nullptr; const Trk::TrackParameters* tmpParam= (*iterTSOS)->trackParameters(); if (m_cosmic && tmpParam) { - if(tmpParam->associatedSurface().type()==Trk::Surface::Perigee){ + if(tmpParam->associatedSurface().type()==Trk::SurfaceType::Perigee){ per=static_cast(tmpParam) ; } } @@ -433,7 +433,7 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx, id2 = (thisParameters->associatedSurface()).associatedDetectorElement()->identify(); } else { ATH_MSG_VERBOSE("Surface has no detector element ID, skip it"); - if(thisParameters->associatedSurface().type()==Trk::Surface::Perigee){ + if(thisParameters->associatedSurface().type()==Trk::SurfaceType::Perigee){ startParameters = std::move(thisParameters); } continue; @@ -444,7 +444,7 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx, ATH_MSG_VERBOSE("Surface is not Pixel or SCT, stop loop over parameters in this step"); // for collisions, we want to stop at the first trt measurement; whereas for cosmics not // here we will have trt measurements on the track before the first si measurement! - if(thisParameters->associatedSurface().type()==Trk::Surface::Perigee){ + if(thisParameters->associatedSurface().type()==Trk::SurfaceType::Perigee){ startParameters = std::move(thisParameters); } if (m_cosmic) continue; diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx index 0ba5db94067..3a644d60f64 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx @@ -724,7 +724,7 @@ InDet::PixelClusterOnTrackTool::getErrorsDefaultAmbi(const InDet::PixelCluster * // now you have numberOfSubclusters and the vectorOfPositions (Amg::Vector2D) - if (trackPar.surfaceType() != Trk::Surface::Plane || + if (trackPar.surfaceType() != Trk::SurfaceType::Plane || trackPar.type() != Trk::AtaSurface) { ATH_MSG_WARNING( "Parameters are not at a plane ! Aborting cluster correction... "); @@ -855,7 +855,7 @@ InDet::PixelClusterOnTrackTool::getErrorsTIDE_Ambi(const InDet::PixelCluster *pi } // now you have numberOfSubclusters and the vectorOfPositions (Amg::Vector2D) - if (trackPar.surfaceType() != Trk::Surface::Plane || + if (trackPar.surfaceType() != Trk::SurfaceType::Plane || trackPar.type() != Trk::AtaSurface) { ATH_MSG_WARNING("Parameters are not at a plane surface ! Aborting cluster " "correction... "); diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx index 10c32ffc4b4..ce9d5860daa 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/TrackingVolume.cxx @@ -1347,7 +1347,7 @@ void Trk::TrackingVolume::synchronizeLayers ATLAS_NOT_THREAD_SAFE( for (const auto& clayIter : confLayers->arrayObjects()) if (clayIter) { if (clayIter->surfaceRepresentation().type() == - Trk::Surface::Cylinder && + Trk::SurfaceType::Cylinder && !(center().isApprox(clayIter->surfaceRepresentation().center()))) clayIter->resizeAndRepositionLayer(volumeBounds(), center(), envelope); diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h index 62902c54d7f..5fcde61f585 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.h @@ -47,7 +47,7 @@ class ConeSurface : public Surface public: /** The surface type static constexpr */ - static constexpr SurfaceType staticType = Surface::Cone; + static constexpr SurfaceType staticType = SurfaceType::Cone; /**Default Constructor*/ ConeSurface(); diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc index 439bbbc78aa..8c75e4acc7d 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/ConeSurface.icc @@ -5,7 +5,7 @@ namespace Trk { /** Return the surface type */ -inline Surface::SurfaceType +inline SurfaceType ConeSurface::type() const { return ConeSurface::staticType; diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h index 91fa753f475..9739577f9b3 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.h @@ -52,7 +52,7 @@ class CylinderSurface : public Surface public: /** The surface type static constexpr */ - static constexpr SurfaceType staticType = Surface::Cylinder; + static constexpr SurfaceType staticType = SurfaceType::Cylinder; /**Default Constructor*/ CylinderSurface(); diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc index d062006f3b2..8e90a6c519c 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/CylinderSurface.icc @@ -5,7 +5,7 @@ namespace Trk { /** Return the surface type */ -inline Surface::SurfaceType +inline SurfaceType CylinderSurface::type() const { return CylinderSurface::staticType; diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.h index 537f8fb3c22..437a9bf91b6 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.h @@ -48,7 +48,7 @@ class DiscSurface : public Surface { public: - static constexpr SurfaceType staticType = Surface::Disc; + static constexpr SurfaceType staticType = SurfaceType::Disc; /**Default Constructor*/ DiscSurface(); diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.icc index a74e59a52bd..fc7dce245cf 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/DiscSurface.icc @@ -4,7 +4,7 @@ namespace Trk { /** Return the surface type */ -inline Surface::SurfaceType +inline SurfaceType DiscSurface::type() const { return DiscSurface::staticType; diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h index f43a7664071..2651cdcb68f 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.h @@ -42,7 +42,7 @@ class PerigeeSurface final : public Surface public: /** The surface type static constexpr */ - static constexpr SurfaceType staticType = Surface::Perigee; + static constexpr SurfaceType staticType = SurfaceType::Perigee; /**Default Constructor - needed for persistency*/ PerigeeSurface(); diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc index 574f4152cd2..e43cf216554 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PerigeeSurface.icc @@ -3,6 +3,15 @@ */ namespace Trk { + +/** Return the surface type */ +inline SurfaceType +PerigeeSurface::type() const +{ + return PerigeeSurface::staticType; +} + + /** Use the Surface as a ParametersBase constructor, from local parameters - * charged */ inline Surface::ChargedTrackParametersUniquePtr @@ -111,13 +120,6 @@ PerigeeSurface::createParameters(const Amg::Vector3D& position, position, momentum, charge, *this, std::move(cov)); } -/** Return the surface type */ -inline Surface::SurfaceType -PerigeeSurface::type() const -{ - return PerigeeSurface::staticType; -} - inline PerigeeSurface* PerigeeSurface::clone() const { diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h index 48da22d827d..5a1cc38e84a 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.h @@ -60,7 +60,7 @@ class PlaneSurface : public Surface { public: /** The surface type static constexpr */ - static constexpr SurfaceType staticType = Surface::Plane; + static constexpr SurfaceType staticType = SurfaceType::Plane; /** Default Constructor - needed for persistency*/ PlaneSurface(); diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.icc index 02b4d59a24c..cf24c25753c 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/PlaneSurface.icc @@ -4,7 +4,7 @@ namespace Trk { -inline Surface::SurfaceType +inline SurfaceType PlaneSurface::type() const { return PlaneSurface::staticType; diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h index 99fb6e9741c..6c6635cab14 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h @@ -46,7 +46,7 @@ class StraightLineSurface : public Surface { public: - static constexpr SurfaceType staticType = Surface::Line; + static constexpr SurfaceType staticType = SurfaceType::Line; /**Default Constructor - needed for persistency*/ StraightLineSurface(); diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc index b481dbe7462..fbc8eb792e8 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.icc @@ -4,7 +4,7 @@ namespace Trk { /** Return the surface type */ -inline Surface::SurfaceType +inline SurfaceType StraightLineSurface::type() const { return StraightLineSurface::staticType; diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h index 22442a1d17a..0d7e71c8cbf 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h @@ -18,10 +18,13 @@ #include "TrkDetDescrUtils/GeometryStatics.h" #include "TrkDetDescrUtils/Intersection.h" #include "TrkDetElementBase/TrkDetElementBase.h" +// #include "TrkEventPrimitives/LocalParameters.h" +#include "TrkEventPrimitives/SurfaceTypes.h" #include "TrkEventPrimitives/ParamDefs.h" #include "TrkEventPrimitives/PropDirection.h" #include "TrkEventPrimitives/SurfaceUniquePtrT.h" +// #include "TrkParametersBase/Charged.h" #include "TrkParametersBase/Neutral.h" #include "TrkParametersBase/ParametersBase.h" @@ -78,25 +81,6 @@ class Surface friend class ITrackingVolumeHelper; public: - /** @enum SurfaceType - - This enumerator simplifies the persistency & calculations, - by saving a dynamic_cast to happen. - - Other is reserved for the GeometrySurfaces implementation. - - */ - enum SurfaceType - { - Cone = 0, - Cylinder = 1, - Disc = 2, - Perigee = 3, - Plane = 4, - Line = 5, - Curvilinear = 6, - Other = 7 - }; /* * struct holding the transform, center, normal, diff --git a/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceUniquePtrT.h b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceUniquePtrT.h index 3292b84d83b..af6fee6bc81 100644 --- a/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceUniquePtrT.h +++ b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceUniquePtrT.h @@ -6,7 +6,7 @@ // $Id$ /** - * @file TrkParametersBase/SurfaceUniquePtrT.h + * @file TrkEventPrimitives/SurfaceUniquePtrT.h * @author scott snyder * @date Sep, 2015 * @brief Handle conditional ownership of surfaces. diff --git a/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/MeasurementBaseComparisonFunction.h b/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/MeasurementBaseComparisonFunction.h index 75e24b86c41..d67200e10c2 100755 --- a/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/MeasurementBaseComparisonFunction.h +++ b/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/MeasurementBaseComparisonFunction.h @@ -69,29 +69,29 @@ public: // --- flexible sorting along a predicted direction double path1 = 0; const Trk::Surface& sf1 = one->associatedSurface(); - const Trk::Surface::SurfaceType surfType1 = sf1.type(); + const Trk::SurfaceType surfType1 = sf1.type(); switch (surfType1) { - case Trk::Surface::Plane: { + case Trk::SurfaceType::Plane: { const Trk::PlaneSurface& opsf = static_cast(sf1); path1 = this->pathIntersectWithPlane(opsf); } break; - case Trk::Surface::Line: { + case Trk::SurfaceType::Line: { const Trk::StraightLineSurface& ossf = static_cast(sf1); path1 = this->pathIntersectWithLine(ossf); } break; - case Trk::Surface::Disc: { + case Trk::SurfaceType::Disc: { const Trk::DiscSurface& odsf = static_cast(sf1); path1 = this->pathIntersectWithDisc(odsf); } break; - case Trk::Surface::Cylinder: { + case Trk::SurfaceType::Cylinder: { const Trk::CylinderSurface& ocsf = static_cast(sf1); path1 = this->pathIntersectWithCylinder(ocsf, one->globalPosition()); } break; - case Trk::Surface::Perigee: { + case Trk::SurfaceType::Perigee: { const Trk::PerigeeSurface& ogsf = static_cast(sf1); path1 = this->pathIntersectWithLine(ogsf); @@ -105,29 +105,29 @@ public: // --- identify the 2nd surface type and get intersection path for surface 1 double path2 = 0; const Trk::Surface& sf2 = two->associatedSurface(); - const Trk::Surface::SurfaceType surfType2 = sf2.type(); + const Trk::SurfaceType surfType2 = sf2.type(); switch (surfType2) { - case Trk::Surface::Plane: { + case Trk::SurfaceType::Plane: { const Trk::PlaneSurface& tpsf = static_cast(sf2); path2 = this->pathIntersectWithPlane(tpsf); } break; - case Trk::Surface::Line: { + case Trk::SurfaceType::Line: { const Trk::StraightLineSurface& tssf = static_cast(sf2); path2 = this->pathIntersectWithLine(tssf); } break; - case Trk::Surface::Disc: { + case Trk::SurfaceType::Disc: { const Trk::DiscSurface& tdsf = static_cast(sf2); path2 = this->pathIntersectWithDisc(tdsf); } break; - case Trk::Surface::Cylinder: { + case Trk::SurfaceType::Cylinder: { const Trk::CylinderSurface& tcsf = static_cast(sf2); path2 = this->pathIntersectWithCylinder(tcsf, two->globalPosition()); } break; - case Trk::Surface::Perigee: { + case Trk::SurfaceType::Perigee: { const Trk::PerigeeSurface& tgsf = static_cast(sf2); path2 = this->pathIntersectWithLine(tgsf); diff --git a/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/PrepRawDataComparisonFunction.h b/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/PrepRawDataComparisonFunction.h index 080aabdab6a..8f9303d827c 100755 --- a/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/PrepRawDataComparisonFunction.h +++ b/Tracking/TrkEvent/TrkEventUtils/TrkEventUtils/PrepRawDataComparisonFunction.h @@ -62,19 +62,19 @@ public: // double path1 = 0; const Trk::Surface& sf1 = one->detectorElement()->surface(one->identify()); - const Trk::Surface::SurfaceType surfType1 = sf1.type(); + const Trk::SurfaceType surfType1 = sf1.type(); switch (surfType1) { - case Trk::Surface::Plane: { + case Trk::SurfaceType::Plane: { const Trk::PlaneSurface& opsf = static_cast(sf1); path1 = this->pathIntersectWithPlane(opsf); } break; - case Trk::Surface::Line: { + case Trk::SurfaceType::Line: { const Trk::StraightLineSurface& ossf = static_cast(sf1); path1 = this->pathIntersectWithLine(ossf); } break; - case Trk::Surface::Disc: { + case Trk::SurfaceType::Disc: { const Trk::DiscSurface& odsf = static_cast(sf1); path1 = this->pathIntersectWithDisc(odsf); @@ -89,19 +89,19 @@ public: // double path2 = 0; const Trk::Surface& sf2 = two->detectorElement()->surface(two->identify()); - const Trk::Surface::SurfaceType surfType2 = sf2.type(); + const Trk::SurfaceType surfType2 = sf2.type(); switch (surfType2) { - case Trk::Surface::Plane: { + case Trk::SurfaceType::Plane: { const Trk::PlaneSurface& opsf = static_cast(sf2); path2 = this->pathIntersectWithPlane(opsf); } break; - case Trk::Surface::Line: { + case Trk::SurfaceType::Line: { const Trk::StraightLineSurface& ossf = static_cast(sf2); path2 = this->pathIntersectWithLine(ossf); } break; - case Trk::Surface::Disc: { + case Trk::SurfaceType::Disc: { const Trk::DiscSurface& odsf = static_cast(sf2); path2 = this->pathIntersectWithDisc(odsf); diff --git a/Tracking/TrkEvent/TrkNeutralParameters/test/testConstExpr.cxx b/Tracking/TrkEvent/TrkNeutralParameters/test/testConstExpr.cxx index 3f97528b331..f3029e5b926 100644 --- a/Tracking/TrkEvent/TrkNeutralParameters/test/testConstExpr.cxx +++ b/Tracking/TrkEvent/TrkNeutralParameters/test/testConstExpr.cxx @@ -21,6 +21,6 @@ main() for (const auto& i : params) { std::cout << "Dimensions: " << i->dim << " isCharged: " << i->isCharged() - << " SurfaceType: " << i->surfaceType() << '\n'; + << " SurfaceType: " << static_cast(i->surfaceType()) << '\n'; } } diff --git a/Tracking/TrkEvent/TrkParameters/test/testConstExpr.cxx b/Tracking/TrkEvent/TrkParameters/test/testConstExpr.cxx index e8bf0f20b53..55754fa74af 100644 --- a/Tracking/TrkEvent/TrkParameters/test/testConstExpr.cxx +++ b/Tracking/TrkEvent/TrkParameters/test/testConstExpr.cxx @@ -21,6 +21,6 @@ main() for (const auto& i : params) { std::cout << "Dimensions: " << i->dim << " isCharged: " << i->isCharged() - << " SurfaceType: " << i->surfaceType() << '\n'; + << " SurfaceType: " << static_cast(i->surfaceType()) << '\n'; } } diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h index 3f47f3f18db..0ae9e0f6249 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.h @@ -14,7 +14,7 @@ #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" #include "TrkEventPrimitives/CurvilinearUVT.h" -#include "TrkSurfaces/Surface.h" +#include "TrkEventPrimitives/SurfaceTypes.h" #include class MsgStream; @@ -47,7 +47,7 @@ template class CurvilinearParametersT final : public ParametersBase { public: - static_assert(S::staticType == Surface::Plane, + static_assert(S::staticType == SurfaceType::Plane, "The surface type must be Plane"); /** default constructor only for POOL */ @@ -130,7 +130,7 @@ public: virtual ParametersType type() const override final; /** Return the Surface Type enum*/ - virtual int surfaceType() const override final; + virtual SurfaceType surfaceType() const override final; /** Return the measurementFrame of the parameters */ virtual Amg::RotationMatrix3D measurementFrame() const override final; diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc index 4b52c9774eb..1b43db20eab 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/CurvilinearParametersT.icc @@ -263,7 +263,7 @@ CurvilinearParametersT::type() const /** Return the Surface Type (check SurfaceType enums)*/ template -int +SurfaceType CurvilinearParametersT::surfaceType() const { return S::staticType; diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h index c338791d924..3c4ee277248 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersBase.h @@ -14,6 +14,7 @@ // Amg #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" +#include "TrkEventPrimitives/SurfaceTypes.h" //system #include #include @@ -167,7 +168,7 @@ public: /** Returns the Surface Type enum for the surface used * to define the derived class*/ - virtual int surfaceType() const = 0; + virtual SurfaceType surfaceType() const = 0; /** Dumps relevant information about the track parameters into the ostream */ virtual MsgStream& dump(MsgStream& out) const; diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h index ca23a19b683..5cf9b4f781d 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.h @@ -12,8 +12,8 @@ #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" #include "TrkEventPrimitives/SurfaceUniquePtrT.h" +#include "TrkEventPrimitives/SurfaceTypes.h" #include "TrkParametersBase/ParametersBase.h" -#include "TrkSurfaces/Surface.h" namespace Trk { class MaterialEffectsEngine; @@ -46,9 +46,11 @@ class ParametersT final : public ParametersBase { public: static_assert( - (S::staticType == Surface::Cone || S::staticType == Surface::Cylinder || - S::staticType == Surface::Disc || S::staticType == Surface::Perigee || - S::staticType == Surface::Plane || S::staticType == Surface::Line), + (S::staticType == SurfaceType::Cone || + S::staticType == SurfaceType::Cylinder || + S::staticType == SurfaceType::Disc || + S::staticType == SurfaceType::Perigee || + S::staticType == SurfaceType::Plane || S::staticType == SurfaceType::Line), "The surface type must be one of Cone, Cylinder, Disc, Perigee, Plane, " "Line"); @@ -132,7 +134,7 @@ public: virtual ParametersType type() const override final; /** Return the Surface Type enum */ - virtual int surfaceType() const override final; + virtual SurfaceType surfaceType() const override final; /** Return the measurementFrame of the parameters */ virtual Amg::RotationMatrix3D measurementFrame() const override final; diff --git a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc index b2aa1ea40b3..a4416290511 100644 --- a/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc +++ b/Tracking/TrkEvent/TrkParametersBase/TrkParametersBase/ParametersT.icc @@ -278,7 +278,7 @@ ParametersT::type() const /** Return the Surface Type (check SurfaceType enums)*/ template -int +SurfaceType ParametersT::surfaceType() const { return S::staticType; @@ -309,8 +309,8 @@ ParametersT::updateParametersHelper(const AmgVector(DIM) & (updatedParameters[Trk::theta] != m_parameters[Trk::theta]) || (updatedParameters[qOverP] != m_parameters[qOverP]); - if constexpr (S::staticType == Trk::Surface::Line || - S::staticType == Trk::Surface::Perigee) { + if constexpr (S::staticType == Trk::SurfaceType::Line || + S::staticType == Trk::SurfaceType::Perigee) { updatePosition |= updateMomentum; } diff --git a/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h b/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h index fd08b51c6ea..2fde473fc14 100755 --- a/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h +++ b/Tracking/TrkEvent/TrkPatternParameters/TrkPatternParameters/PatternTrackParameters.h @@ -67,7 +67,7 @@ namespace Trk { virtual Amg::RotationMatrix3D measurementFrame() const override final; virtual PatternTrackParameters * clone() const override final; virtual ParametersType type() const override final; - virtual int surfaceType() const override final; + virtual SurfaceType surfaceType() const override final; virtual void updateParametersHelper(const AmgVector(5) &) override final; /////////////////////////////////////////////////////////////////// diff --git a/Tracking/TrkEvent/TrkPatternParameters/src/PatternTrackParameters.cxx b/Tracking/TrkEvent/TrkPatternParameters/src/PatternTrackParameters.cxx index 640e7e0ead9..496b649ce22 100755 --- a/Tracking/TrkEvent/TrkPatternParameters/src/PatternTrackParameters.cxx +++ b/Tracking/TrkEvent/TrkPatternParameters/src/PatternTrackParameters.cxx @@ -587,7 +587,7 @@ Trk::ParametersType Trk::PatternTrackParameters::type() const { return Trk::Pattern; } -int Trk::PatternTrackParameters::surfaceType() const { +Trk::SurfaceType Trk::PatternTrackParameters::surfaceType() const { return m_surface->type(); } diff --git a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/DetElementSurface.h b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/DetElementSurface.h index a5115fc9afe..7f61616065b 100644 --- a/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/DetElementSurface.h +++ b/Tracking/TrkEventCnv/TrkEventCnvTools/TrkEventCnvTools/DetElementSurface.h @@ -47,7 +47,7 @@ class DetElementSurface : public Surface std::ostream & dump (std::ostream &sl) const { return sl;}; const Identifier associatedDetectorElementIdentifier() const {return m_id;} bool isFree() {return true;}// To avoid memory leaks - Surface::SurfaceType type() const {return Surface::Other;} + SurfaceType type() const {return SurfaceType::Other;} void localToGlobal(const Amg::Vector2D&, const Amg::Vector3D&, Amg::Vector3D&) const {} bool globalToLocal(const Amg::Vector3D&, const Amg::Vector3D&, Amg::Vector2D&) const {return false;} std::string name() const { return "Trk::DetElementSurface";} diff --git a/Tracking/TrkEventCnv/TrkEventTPCnv/TrkEventTPCnv/TrkParameters/TrackParametersCnv_p2.h b/Tracking/TrkEventCnv/TrkEventTPCnv/TrkEventTPCnv/TrkParameters/TrackParametersCnv_p2.h index 6e089d1eea3..6138466d00c 100644 --- a/Tracking/TrkEventCnv/TrkEventTPCnv/TrkEventTPCnv/TrkParameters/TrackParametersCnv_p2.h +++ b/Tracking/TrkEventCnv/TrkEventTPCnv/TrkEventTPCnv/TrkParameters/TrackParametersCnv_p2.h @@ -56,7 +56,7 @@ public: private: AmgSymMatrix(5)* transErrorMatrix(const Trk :: TrackParameters_p2 *persObj, MsgStream& log); - const Trk::Surface* transSurface( const Trk :: TrackParameters_p2 *persObj, Trk::Surface::SurfaceType type, MsgStream& log); + const Trk::Surface* transSurface( const Trk :: TrackParameters_p2 *persObj, Trk::SurfaceType type, MsgStream& log); void fillPersSurface( const Trk :: TrackParameters *transObj, Trk :: TrackParameters_p2 *persObj, MsgStream& log); void convertTransCurvilinearToPers(const Trk :: TrackParameters *transObj, Trk :: TrackParameters_p2 *persObj) const; bool isPersistifiableType(const Trk :: TrackParameters *transObj) const; diff --git a/Tracking/TrkEventCnv/TrkEventTPCnv/src/TrkParameters/TrackParametersCnv_p2.cxx b/Tracking/TrkEventCnv/TrkEventTPCnv/src/TrkParameters/TrackParametersCnv_p2.cxx index 70c6a03c338..a553308c07a 100644 --- a/Tracking/TrkEventCnv/TrkEventTPCnv/src/TrkParameters/TrackParametersCnv_p2.cxx +++ b/Tracking/TrkEventCnv/TrkEventTPCnv/src/TrkParameters/TrackParametersCnv_p2.cxx @@ -60,7 +60,7 @@ Trk::TrackParameters* TrackParametersCnv_p2::createTransient( const Trk::TrackPa // Okay, not curvilinear & so we need to have a surface to handle local->global transformations etc // ---- Surfaces //get surface type - Trk::Surface::SurfaceType type = static_cast(persObj->m_surfaceType); + Trk::SurfaceType type = static_cast(persObj->m_surfaceType); // get surface & fill parameter vector const Trk::Surface* surface = transSurface(persObj, type, log); @@ -69,15 +69,15 @@ Trk::TrackParameters* TrackParametersCnv_p2::createTransient( const Trk::TrackPa if (surface){ // Now create concrete parameters ... - if (type == Trk::Surface::Perigee) { + if (type == Trk::SurfaceType::Perigee) { transObj = new Trk::Perigee( parameters, static_cast(surface), cov); return transObj; - } else if (type == Trk::Surface::Plane) { + } else if (type == Trk::SurfaceType::Plane) { transObj = new Trk::AtaPlane( parameters, static_cast(surface), cov); return transObj; - } else if (type == Trk::Surface::Line) { + } else if (type == Trk::SurfaceType::Line) { transObj = new Trk::AtaStraightLine( parameters, static_cast(surface), @@ -87,7 +87,7 @@ Trk::TrackParameters* TrackParametersCnv_p2::createTransient( const Trk::TrackPa } else if (!m_nosurf) { // FIXME: next line changed to DEBUG to avoid filling the derivation job // options with garbage. Underlying issue should be fixed. - log << MSG::DEBUG << "No surface of type=" << type + log << MSG::DEBUG << "No surface of type=" << static_cast(type) << " created - so these parameters cannot be made!" << endmsg; return nullptr; } @@ -108,8 +108,12 @@ AmgSymMatrix(5)* TrackParametersCnv_p2::transErrorMatrix(const Trk :: TrackParam return cov; } -const Trk::Surface* TrackParametersCnv_p2::transSurface(const Trk :: TrackParameters_p2 *persObj, Trk::Surface::SurfaceType type, MsgStream& log){ - const Trk::Surface* surface=0; +const Trk::Surface* +TrackParametersCnv_p2::transSurface(const Trk ::TrackParameters_p2* persObj, + Trk::SurfaceType type, + MsgStream& log) +{ + const Trk::Surface* surface = 0; // check if surface had transform. if (persObj->m_transform.size()){ //if (debug) std::cout<<"Reading in parameters with FREE surface type ="<m_transform, *transform.get()); // recreate free surface - if (type==Trk::Surface::Perigee) { + if (type==Trk::SurfaceType::Perigee) { surface = new Trk::PerigeeSurface(std::move(transform)); - } else if (type==Trk::Surface::Plane){ + } else if (type==Trk::SurfaceType::Plane){ surface = new Trk::PlaneSurface(std::move(transform)); - } else if (type==Trk::Surface::Line){ + } else if (type==Trk::SurfaceType::Line){ surface = new Trk::StraightLineSurface(std::move(transform)); } if (!surface){ - log<m_associatedDetElementId); if (!id.get_compact() && persObj->m_associatedDetElementId != 0) id = Identifier(persObj->m_associatedDetElementId); @@ -142,7 +147,8 @@ const Trk::Surface* TrackParametersCnv_p2::transSurface(const Trk :: TrackParame else { const Trk::Surface* detSurf = m_eventCnvTool->getSurface(id); if (!detSurf){ - log<(transObj)!=0); bool deleteAtEnd = false; @@ -211,8 +216,8 @@ void TrackParametersCnv_p2::convertTransCurvilinearToPers(const Trk :: TrackPara bool TrackParametersCnv_p2::isPersistifiableType(const Trk :: TrackParameters *transObj) const { const Trk::Surface* surf = transObj->associatedSurface ().baseSurface(); assert (surf); - Trk::Surface::SurfaceType type = surf->type(); - if (type==Trk::Surface::Perigee || type==Trk::Surface::Plane || type==Trk::Surface::Line){ + Trk::SurfaceType type = surf->type(); + if (type==Trk::SurfaceType::Perigee || type==Trk::SurfaceType::Plane || type==Trk::SurfaceType::Line){ return true; } return false; @@ -229,14 +234,13 @@ void TrackParametersCnv_p2::fillPersSurface(const Trk :: TrackParameters *tra // Need to write out transforms for TG owned surfaces, and 'free' (noOwn) surfaces - i.e. anything which isn't on det element if( surf->cachedTransform()!=0 ) { // FIXME - I think maybe we can just remove all of the code below and ALWAYS write out the transform if it exists - i.e. it won't exist if the surface is 'nominal' - if (surf->type()!=Trk::Surface::Perigee || (surf->type()==Trk::Surface::Perigee && *surf!=s_nominalPerigeeSurface)){ - //if (debug) std::cout<<"Writing out transform for parameters with FREE surface type ="<type()<<" with centre="<center()<cachedTransform()),persObj->m_transform ); - } else { - //if (debug && surf->type()==Trk::Surface::Perigee && (*surf)==s_nominalPerigeeSurface) std::cout<<"Writing out perigee parameters with nominal surface (so not writing transform)."<type() != Trk::SurfaceType::Perigee || + (surf->type() == Trk::SurfaceType::Perigee && + *surf != s_nominalPerigeeSurface)) { + EigenHelpers::eigenTransform3DToVector(*(surf->cachedTransform()), + persObj->m_transform); } - } + } // Debug info //if (surf->isFree() && debug) std::cout<<"Writing out parameters with det element (free) surface type ="<type()<(su); @@ -615,12 +615,12 @@ Trk::RungeKuttaPropagator::propagateStraightLine( s[8] = 0.; if(!propagateWithJacobian(cache,useJac,2,s,P,Step)) return nullptr; } } - else if (ty == Trk::Surface::Perigee ) { + else if (ty == Trk::SurfaceType::Perigee ) { double s[6] ={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,useJac,0,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Cone ) { + else if (ty == Trk::SurfaceType::Cone ) { double k = static_cast(su)->bounds().tanAlpha(); k = k*k+1.; double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),k,cache.m_direction,0.}; @@ -710,9 +710,9 @@ Trk::RungeKuttaPropagator::propagateRungeKutta double Step = 0.; if(!Trk::RungeKuttaUtils::transformLocalToGlobal(useJac,Tp,P)) return nullptr; const Amg::Transform3D& T = Su.transform(); - int ty = Su.type(); + Trk::SurfaceType ty = Su.type(); - if (ty == Trk::Surface::Plane ) { + if (ty == Trk::SurfaceType::Plane ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -722,12 +722,12 @@ Trk::RungeKuttaPropagator::propagateRungeKutta if(!propagateWithJacobian(cache,useJac,1,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Line ) { + else if (ty == Trk::SurfaceType::Line ) { double s[6] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,useJac,0,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Disc ) { + else if (ty == Trk::SurfaceType::Disc ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -735,7 +735,7 @@ Trk::RungeKuttaPropagator::propagateRungeKutta else {s[0]=-T(0,2); s[1]=-T(1,2); s[2]=-T(2,2); s[3]=-d;} if(!propagateWithJacobian(cache,useJac,1,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Cylinder ) { + else if (ty == Trk::SurfaceType::Cylinder ) { const Trk::CylinderSurface* cyl = static_cast(su); @@ -750,12 +750,12 @@ Trk::RungeKuttaPropagator::propagateRungeKutta if(!propagateWithJacobian(cache,useJac,2,s,P,Step)) return nullptr; } } - else if (ty == Trk::Surface::Perigee ) { + else if (ty == Trk::SurfaceType::Perigee ) { double s[6] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,useJac,0,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Cone ) { + else if (ty == Trk::SurfaceType::Cone ) { double k = static_cast(su)->bounds().tanAlpha(); k = k*k+1.; double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),k,cache.m_direction,0.}; @@ -865,9 +865,9 @@ const Trk::IntersectionSolution* Trk::RungeKuttaPropagator::intersect double Step = 0.; const Amg::Transform3D& T = Su.transform(); - int ty = Su.type(); + Trk::SurfaceType ty = Su.type(); - if (ty == Trk::Surface::Plane ) { + if (ty == Trk::SurfaceType::Plane ) { double s[4]; const double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -876,12 +876,12 @@ const Trk::IntersectionSolution* Trk::RungeKuttaPropagator::intersect else {s[0]=-T(0,2); s[1]=-T(1,2); s[2]=-T(2,2); s[3]=-d;} if(!propagateWithJacobian(cache,nJ,1,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Line ) { + else if (ty == Trk::SurfaceType::Line ) { double s[6] ={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,nJ,0,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Disc ) { + else if (ty == Trk::SurfaceType::Disc ) { double s[4]; const double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -890,7 +890,7 @@ const Trk::IntersectionSolution* Trk::RungeKuttaPropagator::intersect else {s[0]=-T(0,2); s[1]=-T(1,2); s[2]=-T(2,2); s[3]=-d;} if(!propagateWithJacobian(cache,nJ,1,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Cylinder ) { + else if (ty == Trk::SurfaceType::Cylinder ) { const Trk::CylinderSurface* cyl = static_cast(su); @@ -905,12 +905,12 @@ const Trk::IntersectionSolution* Trk::RungeKuttaPropagator::intersect s[8] = 0.; if(!propagateWithJacobian(cache,nJ,2,s,P,Step)) return nullptr; } } - else if (ty == Trk::Surface::Perigee ) { + else if (ty == Trk::SurfaceType::Perigee ) { double s[6] ={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,nJ,0,s,P,Step)) return nullptr; } - else if (ty == Trk::Surface::Cone ) { + else if (ty == Trk::SurfaceType::Cone ) { double k = static_cast(su)->bounds().tanAlpha(); k = k*k+1.; double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),k,cache.m_direction,0.}; @@ -1511,9 +1511,9 @@ void Trk::RungeKuttaPropagator::globalPositions for(; su!=sue; ++su) { const Amg::Transform3D& T = (*su)->transform(); - int ty = (*su)->type(); + Trk::SurfaceType ty = (*su)->type(); - if( ty == Trk::Surface::Plane ) { + if( ty == Trk::SurfaceType::Plane ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -1522,12 +1522,12 @@ void Trk::RungeKuttaPropagator::globalPositions else {s[0]=-T(0,2); s[1]=-T(1,2); s[2]=-T(2,2); s[3]=-d;} if(!propagateWithJacobian(cache,false,1,s,P,Step)) return; } - else if(ty == Trk::Surface::Line ) { + else if(ty == Trk::SurfaceType::Line ) { double s[6]={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,false,0,s,P,Step)) return; } - else if (ty == Trk::Surface::Disc ) { + else if (ty == Trk::SurfaceType::Disc ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -1535,7 +1535,7 @@ void Trk::RungeKuttaPropagator::globalPositions else {s[0]=-T(0,2); s[1]=-T(1,2); s[2]=-T(2,2); s[3]=-d;} if(!propagateWithJacobian(cache,false,1,s,P,Step)) return; } - else if (ty == Trk::Surface::Cylinder ) { + else if (ty == Trk::SurfaceType::Cylinder ) { const Trk::CylinderSurface* cyl = static_cast(*su); double r0[3] = {P[0],P[1],P[2]}; @@ -1549,12 +1549,12 @@ void Trk::RungeKuttaPropagator::globalPositions s[8] = 0.; if(!propagateWithJacobian(cache,false,2,s,P,Step)) return; } } - else if (ty == Trk::Surface::Perigee ) { + else if (ty == Trk::SurfaceType::Perigee ) { double s[6]={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,false,0,s,P,Step)) return ; } - else if (ty == Trk::Surface::Cone ) { + else if (ty == Trk::SurfaceType::Cone ) { double k = static_cast(*su)->bounds().tanAlpha(); k = k*k+1.; double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),k,cache.m_direction,0.}; @@ -1598,9 +1598,9 @@ bool Trk::RungeKuttaPropagator::propagateRungeKutta double P[45]; if(!Trk::RungeKuttaUtils::transformLocalToGlobal(useJac,Ta,P)) return false; Step = 0.; const Amg::Transform3D& T = Su.transform(); - int ty = Su.type(); + Trk::SurfaceType ty = Su.type(); - if (ty == Trk::Surface::Plane ) { + if (ty == Trk::SurfaceType::Plane ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -1609,12 +1609,12 @@ bool Trk::RungeKuttaPropagator::propagateRungeKutta else {s[0]=-T(0,2); s[1]=-T(1,2); s[2]=-T(2,2); s[3]=-d;} if(!propagateWithJacobian(cache,useJac,1,s,P,Step)) return false; } - else if (ty == Trk::Surface::Line ) { + else if (ty == Trk::SurfaceType::Line ) { double s[6] ={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,useJac,0,s,P,Step)) return false; } - else if (ty == Trk::Surface::Disc ) { + else if (ty == Trk::SurfaceType::Disc ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -1623,7 +1623,7 @@ bool Trk::RungeKuttaPropagator::propagateRungeKutta else {s[0]=-T(0,2); s[1]=-T(1,2); s[2]=-T(2,2); s[3]=-d;} if(!propagateWithJacobian(cache,useJac,1,s,P,Step)) return false; } - else if (ty == Trk::Surface::Cylinder ) { + else if (ty == Trk::SurfaceType::Cylinder ) { const Trk::CylinderSurface* cyl = static_cast(su); @@ -1638,12 +1638,12 @@ bool Trk::RungeKuttaPropagator::propagateRungeKutta s[8] = 0.; if(!propagateWithJacobian(cache,useJac,2,s,P,Step)) return false; } } - else if (ty == Trk::Surface::Perigee ) { + else if (ty == Trk::SurfaceType::Perigee ) { double s[6] ={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if(!propagateWithJacobian(cache,useJac,0,s,P,Step)) return false; } - else if (ty == Trk::Surface::Cone ) { + else if (ty == Trk::SurfaceType::Cone ) { double k = static_cast(su)->bounds().tanAlpha(); k = k*k+1.; double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),k,cache.m_direction,0.}; diff --git a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h index ff178835b30..76953984f9f 100755 --- a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h +++ b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/TrkExSTEP_Propagator/STEP_Propagator.h @@ -25,6 +25,8 @@ #include "TrkExInterfaces/IPropagator.h" #include "TrkEventPrimitives/PropDirection.h" #include "TrkEventPrimitives/ParticleHypothesis.h" +#include "TrkEventPrimitives/SurfaceTypes.h" +// #include "TrkParameters/TrackParameters.h" //TrackParameters typedef #include "TrkGeometry/BinnedMaterial.h" //Identified material typedef #include "TrkExUtils/MaterialInteraction.h" @@ -320,7 +322,6 @@ namespace Trk { ///////////////////////////////////////////////////////////////////////////////// private: - enum SurfaceType { LINE, PLANE, CYLINDER, CONE}; struct Cache { bool m_detailedElossFlag{true}; @@ -416,7 +417,7 @@ namespace Trk { bool propagateWithJacobian (Cache& cache, bool errorPropagation, - Surface::SurfaceType surfaceType, + Trk::SurfaceType surfaceType, double* targetSurface, double* P, double& path) const; @@ -464,7 +465,7 @@ namespace Trk { // Distance to surface ///////////////////////////////////////////////////////////////////////////////// double - distance (Surface::SurfaceType surfaceType, + distance (Trk::SurfaceType surfaceType, double* targetSurface, const double* P, bool& distanceSuccessful) const; diff --git a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx index c5c4cf97616..45466f9075f 100755 --- a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx +++ b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx @@ -661,9 +661,9 @@ Trk::STEP_Propagator::intersect (const EventContext& ctx, double path = 0.; const Amg::Transform3D& T = targetSurface.transform(); - Trk::Surface::SurfaceType ty = targetSurface.type(); + Trk::SurfaceType ty = targetSurface.type(); - if (ty == Trk::Surface::Plane || ty == Trk::Surface::Disc ) { + if (ty == Trk::SurfaceType::Plane || ty == Trk::SurfaceType::Disc ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -672,27 +672,27 @@ Trk::STEP_Propagator::intersect (const EventContext& ctx, if (!propagateWithJacobian(cache, false, ty, s, cache.m_P, path)) return nullptr; } - else if (ty == Trk::Surface::Line ) { + else if (ty == Trk::SurfaceType::Line ) { double s[6] ={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if (!propagateWithJacobian( cache,false, ty, s, cache.m_P, path)) return nullptr; } - else if (ty == Trk::Surface::Cylinder ) { + else if (ty == Trk::SurfaceType::Cylinder ) { const Trk::CylinderSurface* cyl = static_cast(&targetSurface); double s [9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),cyl->bounds().r(),Trk::alongMomentum,0.}; if (!propagateWithJacobian(cache, false, ty, s, cache.m_P, path)) return nullptr; } - else if (ty == Trk::Surface::Cone ) { + else if (ty == Trk::SurfaceType::Cone ) { double k = static_cast(&targetSurface)->bounds().tanAlpha(); k = k*k+1.; double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),k,Trk::alongMomentum,0.}; if (!propagateWithJacobian(cache, false, ty, s, cache.m_P, path)) return nullptr; } - else if (ty == Trk::Surface::Perigee ) { + else if (ty == Trk::SurfaceType::Perigee ) { double s[6] ={T(0,3),T(1,3),T(2,3),0.,0.,1.}; if (!propagateWithJacobian( cache,false, ty, s, cache.m_P, path)) return nullptr; @@ -938,9 +938,9 @@ Trk::STEP_Propagator::propagateRungeKutta (Cache& c double path = 0.; const Amg::Transform3D& T = targetSurface.transform(); - Trk::Surface::SurfaceType ty = targetSurface.type(); + Trk::SurfaceType ty = targetSurface.type(); - if (ty == Trk::Surface::Plane || ty == Trk::Surface::Disc ) { + if (ty == Trk::SurfaceType::Plane || ty == Trk::SurfaceType::Disc ) { double s[4]; double d = T(0,3)*T(0,2)+T(1,3)*T(1,2)+T(2,3)*T(2,2); @@ -951,7 +951,7 @@ Trk::STEP_Propagator::propagateRungeKutta (Cache& c } } - else if (ty == Trk::Surface::Line ) { + else if (ty == Trk::SurfaceType::Line ) { double s[6] ={T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2)}; if (!propagateWithJacobian( cache,errorPropagation, ty, s, cache.m_P, path)) { @@ -959,7 +959,7 @@ Trk::STEP_Propagator::propagateRungeKutta (Cache& c } } - else if (ty == Trk::Surface::Cylinder ) { + else if (ty == Trk::SurfaceType::Cylinder ) { const Trk::CylinderSurface* cyl = static_cast(&targetSurface); double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),cyl->bounds().r(),(double)propagationDirection,0.}; @@ -968,7 +968,7 @@ Trk::STEP_Propagator::propagateRungeKutta (Cache& c } } - else if (ty == Trk::Surface::Cone ) { + else if (ty == Trk::SurfaceType::Cone ) { double k = static_cast(&targetSurface)->bounds().tanAlpha(); k = k*k+1.; double s[9] = {T(0,3),T(1,3),T(2,3),T(0,2),T(1,2),T(2,2),k,(double)propagationDirection,0.}; @@ -977,7 +977,7 @@ Trk::STEP_Propagator::propagateRungeKutta (Cache& c } } - else if (ty == Trk::Surface::Perigee ) { + else if (ty == Trk::SurfaceType::Perigee ) { double s[6] ={T(0,3),T(1,3),T(2,3),0.,0.,1.}; if (!propagateWithJacobian(cache, errorPropagation, ty, s, cache.m_P, path)) { @@ -1003,7 +1003,7 @@ Trk::STEP_Propagator::propagateRungeKutta (Cache& c double localp[5]; // output in curvilinear parameters - if (returnCurv || ty==Trk::Surface::Cone) { + if (returnCurv || ty==Trk::SurfaceType::Cone) { Trk::RungeKuttaUtils::transformGlobalToLocal(cache.m_P,localp); Amg::Vector3D gp(cache.m_P[0],cache.m_P[1],cache.m_P[2]); @@ -1199,7 +1199,7 @@ Trk::STEP_Propagator::propagateRungeKutta ( Cache& if ( targetSurfaces[*iSol].first->isOnSurface(gp,targetSurfaces[*iSol].second ,0.001,0.001) ) { if (!solution) { Trk::RungeKuttaUtils::transformGlobalToLocal(cache.m_P, localp); - if (returnCurv || targetSurfaces[*iSol].first->type()==Trk::Surface::Cone) { + if (returnCurv || targetSurfaces[*iSol].first->type()==Trk::SurfaceType::Cone) { Trk::RungeKuttaUtils::transformGlobalToCurvilinear(errorPropagation,cache.m_P,localp,Jacobian); } else Trk::RungeKuttaUtils::transformGlobalToLocal(targetSurfaces[*iSol].first,errorPropagation,cache.m_P,localp,Jacobian); solution = true; @@ -1222,11 +1222,15 @@ Trk::STEP_Propagator::propagateRungeKutta ( Cache& smear(cache,localp[2],localp[3],trackParameters.get(),radDist); } - std::unique_ptr onTargetSurf = (returnCurv || targetSurfaces[solutions[0]].first->type()==Trk::Surface::Cone) ? - nullptr : targetSurfaces[solutions[0]].first->createUniqueTrackParameters(localp[0],localp[1],localp[2],localp[3],localp[4],std::nullopt); + std::unique_ptr onTargetSurf = + (returnCurv || + targetSurfaces[solutions[0]].first->type() == Trk::SurfaceType::Cone) + ? nullptr + : targetSurfaces[solutions[0]].first->createUniqueTrackParameters( + localp[0], localp[1], localp[2], localp[3], localp[4], std::nullopt); if (!errorPropagation) { - if (returnCurv || targetSurfaces[solutions[0]].first->type()==Trk::Surface::Cone) { + if (returnCurv || targetSurfaces[solutions[0]].first->type()==Trk::SurfaceType::Cone) { Amg::Vector3D gp(cache.m_P[0],cache.m_P[1],cache.m_P[2]); return std::make_unique< Trk::CurvilinearParameters>(gp, localp[2], localp[3], localp[4]); } @@ -1239,14 +1243,14 @@ Trk::STEP_Propagator::propagateRungeKutta ( Cache& //Calculate multiple scattering and straggling covariance contribution. if (cache.m_matPropOK && (m_multipleScattering || m_straggling) && std::abs(totalPath)>0.) { - if (returnCurv || targetSurfaces[solutions[0]].first->type()==Trk::Surface::Cone) { + if (returnCurv || targetSurfaces[solutions[0]].first->type()==Trk::SurfaceType::Cone) { covarianceContribution( cache,trackParameters.get(), totalPath, std::abs( 1./cache.m_P[6]), &measurementCovariance); } else { covarianceContribution( cache,trackParameters.get(), totalPath, onTargetSurf.get(), &measurementCovariance); } } - if (returnCurv || targetSurfaces[solutions[0]].first->type()==Trk::Surface::Cone) { + if (returnCurv || targetSurfaces[solutions[0]].first->type()==Trk::SurfaceType::Cone) { Amg::Vector3D gp(cache.m_P[0],cache.m_P[1],cache.m_P[2]); return std::make_unique( gp, localp[2], localp[3], localp[4], std::move(measurementCovariance)); @@ -1270,7 +1274,7 @@ Trk::STEP_Propagator::propagateRungeKutta ( Cache& bool Trk::STEP_Propagator::propagateWithJacobian (Cache& cache, bool errorPropagation, - Trk::Surface::SurfaceType surfaceType, + Trk::SurfaceType surfaceType, double* targetSurface, double* P, double& path) const @@ -2313,23 +2317,23 @@ Trk::STEP_Propagator::getMagneticField( Cache& cache, ///////////////////////////////////////////////////////////////////////////////// double -Trk::STEP_Propagator::distance (Surface::SurfaceType surfaceType, +Trk::STEP_Propagator::distance (Trk::SurfaceType surfaceType, double* targetSurface, const double* P, bool& distanceEstimationSuccessful) const { - if (surfaceType == Trk::Surface::Plane || surfaceType == Trk::Surface::Disc) + if (surfaceType == Trk::SurfaceType::Plane || surfaceType == Trk::SurfaceType::Disc) return Trk::RungeKuttaUtils::stepEstimatorToPlane(targetSurface, P, distanceEstimationSuccessful); - if (surfaceType == Trk::Surface::Cylinder) + if (surfaceType == Trk::SurfaceType::Cylinder) return Trk::RungeKuttaUtils::stepEstimatorToCylinder( targetSurface, P, distanceEstimationSuccessful); - if (surfaceType == Trk::Surface::Line || surfaceType == Trk::Surface::Perigee) + if (surfaceType == Trk::SurfaceType::Line || surfaceType == Trk::SurfaceType::Perigee) return Trk::RungeKuttaUtils::stepEstimatorToStraightLine( targetSurface, P, distanceEstimationSuccessful); - if (surfaceType == Trk::Surface::Cone) + if (surfaceType == Trk::SurfaceType::Cone) return Trk::RungeKuttaUtils::stepEstimatorToCone(targetSurface, P, distanceEstimationSuccessful); @@ -2763,7 +2767,9 @@ Trk::STEP_Propagator::propagateNeutral(const Trk::TrackParameters& parm, solutions.push_back((*oIter).first); const Trk::Surface* sf = targetSurfaces[(*oIter).first].first; - if( returnCurv || sf->type()==Trk::Surface::Cone) return std::make_unique< Trk::CurvilinearParameters>(xsct,parm.momentum(),parm.charge()); + if( returnCurv || sf->type()==Trk::SurfaceType::Cone) { + return std::make_unique< Trk::CurvilinearParameters>(xsct,parm.momentum(),parm.charge()); + } return sf->createUniqueTrackParameters(xsct,parm.momentum(),parm.charge(),std::nullopt); } } diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx index ff34e9096a1..9fbb97cc755 100755 --- a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx +++ b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx @@ -1447,7 +1447,7 @@ Trk::Extrapolator::extrapolateToNextMaterialLayer(const EventContext& ctx, // don't repeat if identical to last update && input parameters on the layer bool collect = true; if (nextLayer == cache.m_lastMaterialLayer && - nextLayer->surfaceRepresentation().type() != Trk::Surface::Cylinder) { + nextLayer->surfaceRepresentation().type() != Trk::SurfaceType::Cylinder) { ATH_MSG_DEBUG( " [!] This layer is identical to the one with last material update, return layer " "without repeating the update"); @@ -3197,7 +3197,8 @@ Trk::Extrapolator::extrapolateWithinDetachedVolumes(const EventContext& ctx, if (!bcheck || sf.isOnSurface(onNextLayer->position(), bcheck, m_tolerance, m_tolerance)) { if (sf.type() != onNextLayer->associatedSurface().type()) { ATH_MSG_DEBUG("mismatch in destination surface type:" - << sf.type() << "," << onNextLayer->associatedSurface().type() + << static_cast(sf.type()) + << "," << static_cast(onNextLayer->associatedSurface().type()) << ":distance to the destination surface:" << currentDistance); ManagedTrackParmPtr cParms(ManagedTrackParmPtr::recapture( onNextLayer, @@ -5501,7 +5502,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx, m_includeMaterialEffects && nextLayer->isOnLayer(nextPar->position()); // identical to last material layer ? if (matUp && nextLayer == cache.m_lastMaterialLayer && - nextLayer->surfaceRepresentation().type() != Trk::Surface::Cylinder) { + nextLayer->surfaceRepresentation().type() != Trk::SurfaceType::Cylinder) { matUp = false; } diff --git a/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc b/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc index 0421b4189ad..3cd578c8b1f 100644 --- a/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc +++ b/Tracking/TrkExtrapolation/TrkExUnitTests/TrkExUnitTests/ExtrapolationEngineTest.icc @@ -398,11 +398,11 @@ template < class T, class P > StatusCode Trk::ExtrapolationEngineTest::fillStepI m_materialThicknessInX0Boundary += tInX0; } // check what type of surface you have - if (es.surface && es.surface->type() == Trk::Surface::Cylinder) { + if (es.surface && es.surface->type() == Trk::SurfaceType::Cylinder) { m_materialThicknessInX0Cylinder += tInX0; - } else if (es.surface && es.surface->type() == Trk::Surface::Disc) { + } else if (es.surface && es.surface->type() == Trk::SurfaceType::Disc) { m_materialThicknessInX0Disc += tInX0; - } else if (es.surface && es.surface->type() == Trk::Surface::Plane) { + } else if (es.surface && es.surface->type() == Trk::SurfaceType::Plane) { m_materialThicknessInX0Plane += tInX0; } // delete the parameters if there are any there diff --git a/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx b/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx index ff5c9da405f..1b2ff59f9d1 100755 --- a/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx +++ b/Tracking/TrkExtrapolation/TrkExUtils/src/RungeKuttaUtils.cxx @@ -621,20 +621,20 @@ void Trk::RungeKuttaUtils::transformGlobalToLocal par[4] = P[6]; - const unsigned int ty = su->type(); + const Trk::SurfaceType ty = su->type(); const Amg::Transform3D& T = su->transform(); switch (ty) { - case Trk::Surface::Plane: { + case Trk::SurfaceType::Plane: { transformGlobalToPlane(T, useJac, P, par, Jac); break; } // Perigee call the same as line - case Trk::Surface::Line: - case Trk::Surface::Perigee: { + case Trk::SurfaceType::Line: + case Trk::SurfaceType::Perigee: { transformGlobalToLine(T, useJac, P, par, Jac); break; } - case Trk::Surface::Cylinder: { + case Trk::SurfaceType::Cylinder: { transformGlobalToCylinder( T, static_cast(su)->bounds().r(), @@ -644,11 +644,11 @@ void Trk::RungeKuttaUtils::transformGlobalToLocal Jac); break; } - case Trk::Surface::Disc: { + case Trk::SurfaceType::Disc: { transformGlobalToDisc(T, useJac, P, par, Jac); break; } - case Trk::Surface::Cone: { + case Trk::SurfaceType::Cone: { transformGlobalToCone( T, static_cast(su)->bounds().tanAlpha(), @@ -658,6 +658,9 @@ void Trk::RungeKuttaUtils::transformGlobalToLocal Jac); break; } + default: { + break; + } } if(!useJac) return; @@ -1069,19 +1072,19 @@ Trk::RungeKuttaUtils::transformLocalToGlobal(bool useJac, P[42] = 0.; P[43] = 0.; P[44] = 0.; // d(Ax,Ay,Az)/ds } - const unsigned int ty = Su->type(); + const Trk::SurfaceType ty = Su->type(); const Amg::Transform3D& T = Su->transform(); switch (ty) { - case Trk::Surface::Plane: { + case Trk::SurfaceType::Plane: { transformPlaneToGlobal(useJac, T, p, P); return true; } - case Trk::Surface::Line: - case Trk::Surface::Perigee: { + case Trk::SurfaceType::Line: + case Trk::SurfaceType::Perigee: { transformLineToGlobal(useJac, T, p, P); return true; } - case Trk::Surface::Cylinder: { + case Trk::SurfaceType::Cylinder: { transformCylinderToGlobal( useJac, T, @@ -1090,7 +1093,7 @@ Trk::RungeKuttaUtils::transformLocalToGlobal(bool useJac, P); return true; } - case Trk::Surface::Disc: { + case Trk::SurfaceType::Disc: { transformDiscToGlobal(useJac, T, p, P); return true; } @@ -1252,16 +1255,16 @@ void Trk::RungeKuttaUtils::jacobianTransformCurvilinearToLocal P[16] = T(0,1); P[17] = T(1,1); P[18] = T(2,1); // Ay P[19] = T(0,2); P[20] = T(1,2); P[21] = T(2,2); // Az - const unsigned int ty = su->type(); + const Trk::SurfaceType ty = su->type(); - if(ty == Trk::Surface::Plane ) {jacobianTransformCurvilinearToPlane (P,Jac); return;} - if(ty == Trk::Surface::Line ) {jacobianTransformCurvilinearToStraightLine(P,Jac); return;} - if(ty == Trk::Surface::Cylinder) { + if(ty == Trk::SurfaceType::Plane ) {jacobianTransformCurvilinearToPlane (P,Jac); return;} + if(ty == Trk::SurfaceType::Line ) {jacobianTransformCurvilinearToStraightLine(P,Jac); return;} + if(ty == Trk::SurfaceType::Cylinder) { P[22] = static_cast(su)->bounds().r(); jacobianTransformCurvilinearToCylinder (P,Jac); return; } - if(ty == Trk::Surface::Perigee ) {jacobianTransformCurvilinearToStraightLine(P,Jac); return;} - if(ty == Trk::Surface::Disc ) {jacobianTransformCurvilinearToDisc (P,Jac); return;} + if(ty == Trk::SurfaceType::Perigee ) {jacobianTransformCurvilinearToStraightLine(P,Jac); return;} + if(ty == Trk::SurfaceType::Disc ) {jacobianTransformCurvilinearToDisc (P,Jac); return;} Jac[0] = Jac[3] = 1.; Jac[1] = Jac[2] = 0.; } diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx index 5354664b9b2..918889c6799 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx @@ -94,7 +94,7 @@ namespace { while ((firstidpar == nullptr) && parit != track.trackParameters()->end()) { if ( ((**parit).covariance() != nullptr) && - (**parit).associatedSurface().type() == Trk::Surface::Perigee) + (**parit).associatedSurface().type() == Trk::SurfaceType::Perigee) { firstidpar = *parit; } @@ -107,7 +107,7 @@ namespace { parit--; if ( ((**parit).covariance() != nullptr) && - (**parit).associatedSurface().type() == Trk::Surface::Perigee) + (**parit).associatedSurface().type() == Trk::SurfaceType::Perigee) { lastidpar = *parit; } @@ -632,7 +632,7 @@ namespace Trk { const Surface & associatedSurface = tmppar->associatedSurface(); std::unique_ptr muonsurf = nullptr; - if (associatedSurface.type() == Trk::Surface::Cylinder) { + if (associatedSurface.type() == Trk::SurfaceType::Cylinder) { if (associatedSurface.bounds().type() == Trk::SurfaceBounds::Cylinder) { const CylinderBounds *cylbounds = static_cast (&associatedSurface.bounds()); std::unique_ptr trans = std::make_unique(associatedSurface.transform()); @@ -640,7 +640,7 @@ namespace Trk { double hlength = cylbounds->halflengthZ(); muonsurf = std::make_unique(trans.release(), radius + 1, hlength); } - } else if (associatedSurface.type() == Trk::Surface::Disc) { + } else if (associatedSurface.type() == Trk::SurfaceType::Disc) { if (associatedSurface.bounds().type() == Trk::SurfaceBounds::Disc) { double newz = ( associatedSurface.center().z() > 0 ? @@ -993,12 +993,12 @@ namespace Trk { double dloc2 = idscatpar->parameters()[Trk::loc2] - scat2->parameters()[Trk::loc2]; const Trk::CylinderSurface * cylsurf = nullptr; - if (scat2->associatedSurface().type() == Trk::Surface::Cylinder) + if (scat2->associatedSurface().type() == Trk::SurfaceType::Cylinder) cylsurf = static_cast(&scat2->associatedSurface()); const Trk::DiscSurface * discsurf = nullptr; - if (scat2->associatedSurface().type() == Trk::Surface::Cylinder) + if (scat2->associatedSurface().type() == Trk::SurfaceType::Cylinder) discsurf = static_cast(&scat2->associatedSurface()); if (cylsurf != nullptr) { @@ -1147,7 +1147,7 @@ namespace Trk { if ( (pull1 > 5 || pull2 > 5) && - (pull1 > 25 || pull2 > 25 || closestmuonmeas->associatedSurface().type() == Trk::Surface::Line) + (pull1 > 25 || pull2 > 25 || closestmuonmeas->associatedSurface().type() == Trk::SurfaceType::Line) ) { return nullptr; } @@ -1192,7 +1192,7 @@ namespace Trk { if ( itStates2 == endState2 - 1 && - tpar->associatedSurface().type() == Trk::Surface::Line && + tpar->associatedSurface().type() == Trk::SurfaceType::Line && tpar->position().perp() > 9000 && std::abs(tpar->position().z()) < 13000 ) { @@ -1625,7 +1625,7 @@ namespace Trk { bool isStraightLine = (*itStates2)->measurementOnTrack() != nullptr ? - (*itStates2)->measurementOnTrack()->associatedSurface().type() == Trk::Surface::Line : + (*itStates2)->measurementOnTrack()->associatedSurface().type() == Trk::SurfaceType::Line : false; if ( @@ -2246,12 +2246,12 @@ namespace Trk { const RIO_OnTrack *rot = nullptr; const PlaneSurface *plsurf = nullptr; - if (prdsurf.type() == Trk::Surface::Plane) + if (prdsurf.type() == Trk::SurfaceType::Plane) plsurf = static_cast < const PlaneSurface *>(&prdsurf); const StraightLineSurface *slsurf = nullptr; - if (prdsurf.type() == Trk::Surface::Line) + if (prdsurf.type() == Trk::SurfaceType::Line) slsurf = static_cast < const StraightLineSurface *>(&prdsurf); if ((slsurf == nullptr) && (plsurf == nullptr)) { @@ -2435,7 +2435,7 @@ namespace Trk { const RIO_OnTrack *rot = nullptr; - if (!m_broadROTcreator.empty() && prdsurf.type() == Trk::Surface::Line) { + if (!m_broadROTcreator.empty() && prdsurf.type() == Trk::SurfaceType::Line) { rot = m_broadROTcreator->correct(*prd, *hitparam); } else { rot = m_ROTcreator->correct(*prd, *trackparForCorrect); @@ -2939,12 +2939,12 @@ namespace Trk { } const CylinderLayer *cyllay = nullptr; - if ((*layerIter)->surfaceRepresentation().type() == Trk::Surface::Cylinder) + if ((*layerIter)->surfaceRepresentation().type() == Trk::SurfaceType::Cylinder) cyllay = static_cast((*layerIter)); const DiscLayer *disclay = nullptr; - if ((*layerIter)->surfaceRepresentation().type() == Trk::Surface::Disc) + if ((*layerIter)->surfaceRepresentation().type() == Trk::SurfaceType::Disc) disclay = static_cast((*layerIter)); if (disclay != nullptr) { @@ -2977,12 +2977,12 @@ namespace Trk { const CylinderSurface *cylsurf = nullptr; - if (layer->surfaceRepresentation().type() == Trk::Surface::Cylinder) + if (layer->surfaceRepresentation().type() == Trk::SurfaceType::Cylinder) cylsurf = static_cast(&layer->surfaceRepresentation()); const DiscSurface *discsurf = nullptr; - if (layer->surfaceRepresentation().type() == Trk::Surface::Disc) + if (layer->surfaceRepresentation().type() == Trk::SurfaceType::Disc) discsurf = static_cast(&layer->surfaceRepresentation()); if (discsurf != nullptr) { @@ -3116,19 +3116,19 @@ namespace Trk { const Layer * two ) const { const CylinderSurface *cyl1 = nullptr; - if (one->surfaceRepresentation().type() == Trk::Surface::Cylinder) + if (one->surfaceRepresentation().type() == Trk::SurfaceType::Cylinder) cyl1 = static_cast(&one->surfaceRepresentation()); const DiscSurface *disc1 = nullptr; - if (one->surfaceRepresentation().type() == Trk::Surface::Disc) + if (one->surfaceRepresentation().type() == Trk::SurfaceType::Disc) disc1 = static_cast(&one->surfaceRepresentation()); const CylinderSurface *cyl2 = nullptr; - if (two->surfaceRepresentation().type() == Trk::Surface::Cylinder) + if (two->surfaceRepresentation().type() == Trk::SurfaceType::Cylinder) cyl2 = static_cast(&two->surfaceRepresentation()); const DiscSurface *disc2 = nullptr; - if (two->surfaceRepresentation().type() == Trk::Surface::Disc) + if (two->surfaceRepresentation().type() == Trk::SurfaceType::Disc) disc2 = static_cast(&two->surfaceRepresentation()); if ((cyl1 != nullptr) && (cyl2 != nullptr)) { @@ -4136,12 +4136,12 @@ namespace Trk { if (tmppar != nullptr) { const CylinderSurface *cylcalosurf = nullptr; - if (tmppar->associatedSurface().type() == Trk::Surface::Cylinder) + if (tmppar->associatedSurface().type() == Trk::SurfaceType::Cylinder) cylcalosurf = static_cast(&tmppar->associatedSurface()); const DiscSurface *disccalosurf = nullptr; - if (tmppar->associatedSurface().type() == Trk::Surface::Disc) + if (tmppar->associatedSurface().type() == Trk::SurfaceType::Disc) disccalosurf = static_cast(&tmppar->associatedSurface()); if (cylcalosurf != nullptr) { @@ -4651,7 +4651,7 @@ namespace Trk { addlayer = true; } - if (layerpar->associatedSurface().type() == Trk::Surface::Cylinder) { + if (layerpar->associatedSurface().type() == Trk::SurfaceType::Cylinder) { double cylinderradius = layerpar->associatedSurface().bounds().r(); double trackimpact = std::abs(-refpar->position().x() * sinphi + refpar->position().y() * cosphi); @@ -4717,7 +4717,7 @@ namespace Trk { ) const { const PerigeeSurface *persurf = nullptr; - if (param.associatedSurface().type() == Trk::Surface::Perigee) + if (param.associatedSurface().type() == Trk::SurfaceType::Perigee) persurf = static_cast(¶m.associatedSurface()); if ((persurf != nullptr) && (!cache.m_acceleration || persurf->center().perp() > 5)) { @@ -5975,7 +5975,7 @@ namespace Trk { if (meff != nullptr) { const PlaneSurface *plsurf = nullptr; - if (thisstate->surface()->type() == Trk::Surface::Plane) + if (thisstate->surface()->type() == Trk::SurfaceType::Plane) plsurf = static_cast < const PlaneSurface *>(thisstate->surface()); if (meff->deltaE() == 0 || ((trajectory.prefit() == 0) && (plsurf != nullptr))) { weightchanged = true; @@ -6079,7 +6079,7 @@ namespace Trk { const PlaneSurface *plsurf = nullptr; - if (thisstate->surface()->type() == Trk::Surface::Plane) + if (thisstate->surface()->type() == Trk::SurfaceType::Plane) plsurf = static_cast(thisstate->surface()); if (thisstate->materialEffects()->deltaE() == 0 || (plsurf != nullptr)) { @@ -7027,7 +7027,7 @@ namespace Trk { double startfactor = startlayer->layerMaterialProperties()->alongPostFactor(); const Surface & discsurf = startlayer->surfaceRepresentation(); - if (discsurf.type() == Trk::Surface::Disc && discsurf.center().z() * discsurf.normal().z() < 0) { + if (discsurf.type() == Trk::SurfaceType::Disc && discsurf.center().z() * discsurf.normal().z() < 0) { startfactor = startlayer->layerMaterialProperties()->oppositePostFactor(); } if (startfactor > 0.5) { @@ -7051,7 +7051,7 @@ namespace Trk { double endfactor = endlayer->layerMaterialProperties()->alongPreFactor(); const Surface & discsurf = endlayer->surfaceRepresentation(); - if (discsurf.type() == Trk::Surface::Disc && discsurf.center().z() * discsurf.normal().z() < 0) { + if (discsurf.type() == Trk::SurfaceType::Disc && discsurf.center().z() * discsurf.normal().z() < 0) { endfactor = endlayer->layerMaterialProperties()->oppositePreFactor(); } @@ -8268,11 +8268,11 @@ __attribute__ ((flatten)) const AmgVector(5) & vec = tmpprevpar->parameters(); - bool cylsurf = surf->type() == Trk::Surface::Cylinder; - bool discsurf = surf->type() == Trk::Surface::Disc; + bool cylsurf = surf->type() == Trk::SurfaceType::Cylinder; + bool discsurf = surf->type() == Trk::SurfaceType::Disc; const Surface & previousSurface = tmpprevpar->associatedSurface(); - bool thiscylsurf = previousSurface.type() == Trk::Surface::Cylinder; - bool thisdiscsurf = previousSurface.type() == Trk::Surface::Disc; + bool thiscylsurf = previousSurface.type() == Trk::SurfaceType::Cylinder; + bool thisdiscsurf = previousSurface.type() == Trk::SurfaceType::Disc; for (int i = 0; i < 5; i++) { AmgVector(5) vecpluseps = vec, vecminuseps = vec; diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx index feeb8347cf4..94aab7e271a 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx @@ -1114,8 +1114,8 @@ namespace Trk if (!(**m).isPositionMeasurement()) continue; if (!endIndetMeasurement && (**m).hasIntersection(FittedTrajectory) - && ((**m).surface()->type() == Surface::SurfaceType::Plane - || (**m).surface()->type() == Surface::SurfaceType::Disc)) { + && ((**m).surface()->type() == Trk::SurfaceType::Plane + || (**m).surface()->type() == Trk::SurfaceType::Disc)) { const TrackSurfaceIntersection* intersection = &(**m).intersection(FittedTrajectory); Amg::Vector3D offset = intersection->direction() * tolerance; CurvilinearUVT uvt(intersection->direction()); -- GitLab From 3c5b954c56dae463db1e647a04658960400da803 Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 16 Apr 2021 01:23:47 +0200 Subject: [PATCH 2/4] Add the actual file with the scoped enum... --- .../TrkEventPrimitives/SurfaceTypes.h | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceTypes.h diff --git a/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceTypes.h b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceTypes.h new file mode 100644 index 00000000000..ecba5512e63 --- /dev/null +++ b/Tracking/TrkEvent/TrkEventPrimitives/TrkEventPrimitives/SurfaceTypes.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file TrkEventPrimitivs/SurfaceType.h + */ + +#ifndef TRKEVENTPRIMITIVES_SURFACETYPE_H +#define TRKEVENTPRIMITIVES_SURFACETYPE_H + +namespace Trk { +/** @enum SurfaceType + This enumerator simplifies the persistency & calculations, + */ +enum class SurfaceType +{ + Cone = 0, + Cylinder = 1, + Disc = 2, + Perigee = 3, + Plane = 4, + Line = 5, + Curvilinear = 6, + Other = 7 +}; + +} // namespace Trk + +#endif -- GitLab From 57cc207fad190fa8e082fc93bd4c4ddaa3dbde5e Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 16 Apr 2021 03:35:28 +0200 Subject: [PATCH 3/4] Migrate more clients --- .../src/TRT_DriftCircleOnTrack.cxx | 2 +- .../src/GeometryAsciiDumper.cxx | 2 +- .../src/LayerMaterialAnalyser.cxx | 4 ++-- .../src/LayerMaterialInspector.cxx | 4 ++-- .../TrkDetDescrTestTools/src/MaterialMapper.cxx | 2 +- .../src/TrackingVolumeDisplayer.cxx | 4 ++-- .../TrkDetDescrTestTools/src/VertexMapper.cxx | 7 ++++++- .../TrkDetDescrTools/src/TrackingVolumeHelper.cxx | 4 ++-- .../src/SurfaceIntersectionTest.cxx | 14 +++++++------- Tracking/TrkEvent/TrkTrack/src/Track.cxx | 4 ++-- 10 files changed, 26 insertions(+), 21 deletions(-) diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx index 02733453236..cf41c0a039b 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx @@ -45,7 +45,7 @@ InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( m_rio.setElement(RIO); const Trk::Surface& detElSurf= m_detEl->surface(RIO->identify()); - if (detElSurf.type() == Trk::Surface::Line) { + if (detElSurf.type() == Trk::SurfaceType::Line) { const Trk::StraightLineSurface& slsf = static_cast(detElSurf); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryAsciiDumper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryAsciiDumper.cxx index 723f5a871d7..3ec66319f5a 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryAsciiDumper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/GeometryAsciiDumper.cxx @@ -127,7 +127,7 @@ StatusCode Trk::GeometryAsciiDumper::processNode(const Trk::Surface& sf, size_t std::stringstream levelBuffer; for (size_t il = 0; il < level; ++il) levelBuffer << " "; - m_outputFile << levelBuffer.str() << " Trk::Surface object of type " << sf.type() << std::endl; + m_outputFile << levelBuffer.str() << " Trk::Surface object of type " << static_cast(sf.type()) << std::endl; std::string rotationOffset = levelBuffer.str() +" "; m_outputFile << levelBuffer.str() << " - transform : " << Amg::toString( sf.transform(), m_outputPrecision, rotationOffset ) << std::endl; diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx index 2e5ea721968..4fccf295713 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialAnalyser.cxx @@ -187,7 +187,7 @@ StatusCode Trk::LayerMaterialAnalyser::analyse(const Trk::Layer& layer, m_layerRotation[8] = rMatrix(2,2); // cylinder bounds - if ( lSurface.type() == Trk::Surface::Cylinder ){ + if ( lSurface.type() == Trk::SurfaceType::Cylinder ){ m_layerType = 1; // cylinder bounds const Trk::CylinderBounds* cb = dynamic_cast(&(lSurface.bounds())); @@ -195,7 +195,7 @@ StatusCode Trk::LayerMaterialAnalyser::analyse(const Trk::Layer& layer, m_layerDimension0 = cb->r(); m_layerDimension1 = cb->halflengthZ(); } - } else if ( lSurface.type() == Trk::Surface::Disc ) { + } else if ( lSurface.type() == Trk::SurfaceType::Disc ) { m_layerType = 2; // disc bounds const Trk::DiscBounds* db = dynamic_cast(&(lSurface.bounds())); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx index 95eea86082c..f299ad8db91 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/LayerMaterialInspector.cxx @@ -66,7 +66,7 @@ StatusCode Trk::LayerMaterialInspector::processNode(const Trk::Layer& lay, size_ float centerZ = lCenter.z(); // cylinder bounds - if ( lay.surfaceRepresentation().type() == Trk::Surface::Cylinder ){ + if ( lay.surfaceRepresentation().type() == Trk::SurfaceType::Cylinder ){ lType = 1; // cylinder bounds const Trk::CylinderBounds* cb = dynamic_cast(&(lay.surfaceRepresentation().bounds())); @@ -74,7 +74,7 @@ StatusCode Trk::LayerMaterialInspector::processNode(const Trk::Layer& lay, size_ dim0 = cb->r(); dim1 = cb->halflengthZ(); } - } else if ( lay.surfaceRepresentation().type() == Trk::Surface::Disc ) { + } else if ( lay.surfaceRepresentation().type() == Trk::SurfaceType::Disc ) { lType = 2; // disc bounds const Trk::DiscBounds* db = dynamic_cast(&(lay.surfaceRepresentation().bounds())); diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.cxx index d88ac68c509..0b013094065 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/MaterialMapper.cxx @@ -499,7 +499,7 @@ Trk::LayerTreeObject* Trk::MaterialMapper::layerTreeObject(const Trk::Layer& lay treeName += "_"; treeName += m_layerTreePrefix; - TString layerType = (lay.surfaceRepresentation().type() == Trk::Surface::Cylinder) ? + TString layerType = (lay.surfaceRepresentation().type() == Trk::SurfaceType::Cylinder) ? "CylinderLayer_" : "DiscLayer_"; if (full) treeName += "full_"; treeName += layerType; diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx index 7258fa2ccbc..5f97a30f8e1 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/TrackingVolumeDisplayer.cxx @@ -203,7 +203,7 @@ StatusCode Trk::TrackingVolumeDisplayer::processNode(const Trk::Layer& lay, size int layerColor = lay.enclosingTrackingVolume() ? lay.enclosingTrackingVolume()->colorCode() : 22; // CYLINDER SECTION - if (lSurface.type() == Trk::Surface::Cylinder && layerIndex > 0) { + if (lSurface.type() == Trk::SurfaceType::Cylinder && layerIndex > 0) { // get the Bounds const Trk::CylinderBounds* cylBo = dynamic_cast(&lSurface.bounds()); if (!cylBo) { @@ -227,7 +227,7 @@ StatusCode Trk::TrackingVolumeDisplayer::processNode(const Trk::Layer& lay, size return StatusCode::SUCCESS; } - } else if (lSurface.type() == Trk::Surface::Disc && layerIndex > 0) { + } else if (lSurface.type() == Trk::SurfaceType::Disc && layerIndex > 0) { // get the Bounds const Trk::DiscBounds* discBo = dynamic_cast(&lSurface.bounds()); if (!discBo) { diff --git a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.cxx index 026faaee7fb..31eb3674c3a 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTestTools/src/VertexMapper.cxx @@ -91,7 +91,12 @@ Trk::MappedVertex Trk::VertexMapper::mapToLocal(const Amg::Vector3D& vertex) con // find out the optimal association : // - for cylinders we want to radially hit the layer // - for disks we want to move along z - mDirection = Amg::Vector3D((sLayer->surfaceRepresentation().type() == Trk::Surface::Cylinder) ? Amg::Vector3D(vertex.x(),vertex.y(),0.) : Amg::Vector3D(0.,0.,1.)).unit(); + mDirection = Amg::Vector3D( + (sLayer->surfaceRepresentation().type() == + Trk::SurfaceType::Cylinder) + ? Amg::Vector3D(vertex.x(), vertex.y(), 0.) + : Amg::Vector3D(0., 0., 1.)) + .unit(); // now intersect the layer Intersection sIntersection = sLayer->surfaceRepresentation().straightLineIntersection(vertex,mDirection,false,false); // check if valid diff --git a/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.cxx b/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.cxx index 0b7bea4b218..7a42071d551 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrTools/src/TrackingVolumeHelper.cxx @@ -718,7 +718,7 @@ void Trk::TrackingVolumeHelper::glueTrackingVolumes(const std::vector(&boundarySurface.bounds()); if (!cb) throw std::logic_error("Not CylinderBounds"); // --------------- material estimation ---------------------------------------------------------------- @@ -735,7 +735,7 @@ const Trk::LayerMaterialProperties* Trk::TrackingVolumeHelper::layerMaterialProp } // --------------- material estimation ---------------------------------------------------------------- } - if (boundarySurface.type() == Trk::Surface::Disc){ + if (boundarySurface.type() == Trk::SurfaceType::Disc){ // --------------- material estimation ---------------------------------------------------------------- const Trk::DiscBounds* db = dynamic_cast(&boundarySurface.bounds()); if (!db) throw std::logic_error("Not DiscBounds"); diff --git a/Tracking/TrkDetDescr/TrkDetDescrUnitTests/src/SurfaceIntersectionTest.cxx b/Tracking/TrkDetDescr/TrkDetDescrUnitTests/src/SurfaceIntersectionTest.cxx index 5ca35e7ab43..a4161141153 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUnitTests/src/SurfaceIntersectionTest.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrUnitTests/src/SurfaceIntersectionTest.cxx @@ -79,13 +79,13 @@ StatusCode Trk::SurfaceIntersectionTest::runTest() if (!sf) continue; // get the type - Trk::Surface::SurfaceType sType = sf->type(); - ++m_surfaces[sType]; + Trk::SurfaceType sType = sf->type(); + ++m_surfaces[static_cast(sType)]; ATH_MSG_VERBOSE("Surface of type " << sf->name() << " at postion " << Amg::toString(sf->center())); - if (!m_surfaceNamesSet[sType]) { - m_surfaceNames[sType] = sf->name(); - m_surfaceNamesSet[sType] = true; + if (!m_surfaceNamesSet[static_cast(sType)]) { + m_surfaceNames[static_cast(sType)] = sf->name(); + m_surfaceNamesSet[static_cast(sType)] = true; } // create the Tree for this TrackingVolume TString treeName = "IntersectionTest_Event"; @@ -149,10 +149,10 @@ StatusCode Trk::SurfaceIntersectionTest::runTest() // now doing the distance estimation Trk::Intersection intersection = sf->straightLineIntersection(startPosition,direction,false); - ++m_surfaceAttempts[sType]; + ++m_surfaceAttempts[static_cast(sType)]; // now check if the intesection is valid or not if (intersection.valid){ - ++m_surfaceSuccessful[sType]; + ++m_surfaceSuccessful[static_cast(sType)]; Amg::Vector3D consistency = (intersection.position-intersection.pathLength*direction) - startPosition; if (m_writeTTree){ intersectionBranch.fill(intersection.position); diff --git a/Tracking/TrkEvent/TrkTrack/src/Track.cxx b/Tracking/TrkEvent/TrkTrack/src/Track.cxx index 399ff0c55eb..56b784ebeab 100755 --- a/Tracking/TrkEvent/TrkTrack/src/Track.cxx +++ b/Tracking/TrkEvent/TrkTrack/src/Track.cxx @@ -126,7 +126,7 @@ Trk::Track::copyHelper(const Trk::Track& rhs) const Trk::Perigee* perigee = nullptr; const Trk::TrackParameters* tp = tsos->trackParameters(); if (tp && tp->type() == Trk::AtaSurface && - tp->surfaceType() == Trk::Surface::Perigee) { + tp->surfaceType() == Trk::SurfaceType::Perigee) { perigee = static_cast(tp); } if (perigee != nullptr) { @@ -240,7 +240,7 @@ void Trk::Track::findPerigeeImpl() const if ((*it)->type(TrackStateOnSurface::Perigee)) { const Trk::TrackParameters* tp = (*it)->trackParameters(); if (tp && tp->type() == Trk::AtaSurface && - tp->surfaceType() == Trk::Surface::Perigee) { + tp->surfaceType() == Trk::SurfaceType::Perigee) { tmpPerigeeParameters = static_cast(tp); } -- GitLab From fde435c853fc2dfb31c6cf14e81fca6be5adc1c9 Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 16 Apr 2021 19:05:06 +0200 Subject: [PATCH 4/4] compilation fixes --- .../src/TgcRawDataMonitorAlgorithm.cxx | 4 +-- .../TrackToVertex/src/TrackToVertex.cxx | 10 ++++---- .../src/egammaTrkRefitterTool.cxx | 2 +- .../RDOAnalysis/src/TRT_FastRDOAnalysis.cxx | 4 +-- .../src/MaterialValidation.cxx | 25 +++++++++++++++---- .../src/TrackParticleCreatorTool.cxx | 4 +-- .../TrkVKalVrtFitter/src/CvtTrackParticle.cxx | 2 +- .../src/GaussianTrackDensity.cxx | 2 +- 8 files changed, 34 insertions(+), 19 deletions(-) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx index 8ad324ceaaf..b2be33d3999 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/src/TgcRawDataMonitorAlgorithm.cxx @@ -1198,7 +1198,7 @@ std::unique_ptr TgcRawDataMonitorAlgorithm::extrapol return nullptr; } // We want disc - if (param->surfaceType() != Trk::Surface::Disc) { + if (param->surfaceType() != Trk::SurfaceType::Disc) { return nullptr; } return param; @@ -1227,7 +1227,7 @@ std::unique_ptr TgcRawDataMonitorAlgorithm::extrapol return nullptr; } //It has to be cylinder - if (param->surfaceType() != Trk::Surface::Cylinder) { + if (param->surfaceType() != Trk::SurfaceType::Cylinder) { return nullptr; } return param; diff --git a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx index 788ad1626c6..3d37fc13e59 100755 --- a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx +++ b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx @@ -112,7 +112,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtVertex(const xAOD::TrackPartic } else { const Trk::TrackParameters* extrapResult = m_extrapolator->extrapolateDirectly(trackparPerigee, persf); - if (extrapResult && extrapResult->surfaceType() == Trk::Surface::Perigee) { + if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) { vertexPerigee = static_cast(extrapResult); } } @@ -138,7 +138,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtVertex(const Rec::TrackParticl const Trk::TrackParameters* extrapResult = m_extrapolator->extrapolateDirectly(*trackparPerigee, persf); if (extrapResult && - extrapResult->surfaceType() == Trk::Surface::Perigee) { + extrapResult->surfaceType() == Trk::SurfaceType::Perigee) { vertexPerigee = static_cast(extrapResult); } } @@ -161,7 +161,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtVertex(const Trk::Track& track const Trk::Perigee* vertexPerigee = nullptr; const Trk::TrackParameters* extrapResult = m_extrapolator->extrapolate(track, persf); - if (extrapResult && extrapResult->surfaceType() == Trk::Surface::Perigee) { + if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) { vertexPerigee = static_cast(extrapResult); } if (!vertexPerigee) { @@ -222,7 +222,7 @@ Reco::TrackToVertex::perigeeAtBeamline( const Trk::Perigee* vertexPerigee = nullptr; const Trk::TrackParameters* extrapResult = m_extrapolator->extrapolate(ctx,track, persf); - if (extrapResult && extrapResult->surfaceType() == Trk::Surface::Perigee) { + if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) { vertexPerigee = static_cast(extrapResult); } if (!vertexPerigee) { @@ -238,7 +238,7 @@ Reco::TrackToVertex::perigeeAtBeamline( } extrapResult = m_extrapolator->extrapolate(ctx,*trk_params, persf); if (extrapResult && - extrapResult->surfaceType() == Trk::Surface::Perigee) { + extrapResult->surfaceType() == Trk::SurfaceType::Perigee) { vertexPerigee = static_cast(extrapResult); } break; diff --git a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx index b065a59b508..2fef72711bb 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx @@ -353,7 +353,7 @@ const Trk::VertexOnTrack* egammaTrkRefitterTool::provideVotFromBeamspot(const Ev // calculate perigee parameters wrt. beam-spot const Trk::Perigee * perigee = nullptr; const Trk::TrackParameters* tmp =m_extrapolator->extrapolate(*track, *surface); - if(tmp->associatedSurface().type()==Trk::Surface::Perigee){ + if(tmp->associatedSurface().type()==Trk::SurfaceType::Perigee){ perigee= static_cast (tmp); } if (!perigee) {// if failure diff --git a/Simulation/Tools/RDOAnalysis/src/TRT_FastRDOAnalysis.cxx b/Simulation/Tools/RDOAnalysis/src/TRT_FastRDOAnalysis.cxx index 3dd4635807a..47b8b8098ed 100644 --- a/Simulation/Tools/RDOAnalysis/src/TRT_FastRDOAnalysis.cxx +++ b/Simulation/Tools/RDOAnalysis/src/TRT_FastRDOAnalysis.cxx @@ -513,7 +513,7 @@ StatusCode TRT_FastRDOAnalysis::execute() { // Surface & Tracking info // -- element surface (straw layer) const Trk::Surface& surf((*detElement).surface()); - const int surfType(surf.type()); + const int surfType(static_cast(surf.type())); const Trk::SurfaceBounds& bnds((*detElement).bounds()); const int bndsType(bnds.type()); @@ -534,7 +534,7 @@ StatusCode TRT_FastRDOAnalysis::execute() { // -- straw surface (first straw in layer?) const Trk::Surface& strSurf((*detElement).surface(trtID)); - const int strSurfType(strSurf.type()); + const int strSurfType(static_cast(strSurf.type())); const Trk::SurfaceBounds& strBnds((*detElement).bounds(trtID)); const int strBndsType(strBnds.type()); diff --git a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx index a4a83403772..93f10c158c4 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx +++ b/Tracking/TrkDetDescr/TrkDetDescrAlgs/src/MaterialValidation.cxx @@ -275,11 +275,26 @@ Trk::PositionAtBoundary Trk::MaterialValidation::collectMaterialAndExit(const Tr int layerIndex = cmIter->second.associatedLayer() ? cmIter->second.associatedLayer()->layerIndex().value() : 0; ATH_MSG_DEBUG("[>>>] Accumulate pathLength/X0 on layer with index " << layerIndex << " - t/X0 (total so far) = " << cmIter->second.steplengthInX0() << " (" << m_accTinX0 << ")"); if (layerIndex){ - std::string surfaceType = cmIter->second.associatedLayer()->surfaceRepresentation().type() == Trk::Surface::Cylinder ? "Cylinder at radius = " : "Disc at z-position = "; - std::string layerType = cmIter->second.associatedLayer()->surfaceArray() ? "Active " : "Passive "; - double rz = cmIter->second.associatedLayer()->surfaceRepresentation().type() == Trk::Surface::Cylinder ? cmIter->second.associatedLayer()->surfaceRepresentation().bounds().r() : - cmIter->second.associatedLayer()->surfaceRepresentation().center().z(); - ATH_MSG_DEBUG(" " << layerType << surfaceType << rz); + std::string surfaceType = + cmIter->second.associatedLayer()->surfaceRepresentation().type() == + Trk::SurfaceType::Cylinder + ? "Cylinder at radius = " + : "Disc at z-position = "; + std::string layerType = + cmIter->second.associatedLayer()->surfaceArray() ? "Active " + : "Passive "; + double rz = + cmIter->second.associatedLayer()->surfaceRepresentation().type() == + Trk::SurfaceType::Cylinder + ? cmIter->second.associatedLayer() + ->surfaceRepresentation() + .bounds() + .r() + : cmIter->second.associatedLayer() + ->surfaceRepresentation() + .center() + .z(); + ATH_MSG_DEBUG(" " << layerType << surfaceType << rz); } ATH_MSG_DEBUG(" Distance to origin is " << cmIter->second.materialPosition().mag() ); } diff --git a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx index 1d0a57bf43b..0f4027e71e2 100644 --- a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx +++ b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx @@ -447,7 +447,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t, } if (!tsos->type(TrackStateOnSurface::Perigee) || !(tsos->trackParameters()->surfaceType() == - Trk::Surface::Perigee) || + Trk::SurfaceType::Perigee) || !(tsos->trackParameters()->type() == Trk::AtaSurface)) { continue; } @@ -771,7 +771,7 @@ TrackParticleCreatorTool::TrackParticleCreatorTool(const std::string& t, } if (!tsos->type(TrackStateOnSurface::Perigee) || !(tsos->trackParameters()->surfaceType() == - Trk::Surface::Perigee) || + Trk::SurfaceType::Perigee) || !(tsos->trackParameters()->type() == Trk::AtaSurface)) { continue; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx index 06489a887a1..1e5b23e0325 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/CvtTrackParticle.cxx @@ -228,7 +228,7 @@ namespace Trk { const Perigee* TrkVKalVrtFitter::GetPerigee( const TrackParameters* i_ntrk) const { const Perigee* mPer = nullptr; - if(i_ntrk->surfaceType()==Surface::Perigee && i_ntrk->covariance()!= nullptr ) { + if(i_ntrk->surfaceType()==Trk::SurfaceType::Perigee && i_ntrk->covariance()!= nullptr ) { mPer = dynamic_cast (i_ntrk); } return mPer; diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx index a0c3f0a231e..6d9bc7c44df 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianTrackDensity.cxx @@ -117,7 +117,7 @@ namespace Trk const double z0SignificanceCut = m_z0MaxSignificance * m_z0MaxSignificance; for (const TrackParameters* iparam : perigeeList) { - if (iparam && iparam->surfaceType() == Trk::Surface::Perigee) { + if (iparam && iparam->surfaceType() == Trk::SurfaceType::Perigee) { density.addTrack(*(static_cast(iparam)), d0SignificanceCut, z0SignificanceCut); -- GitLab