Commit d2250ce7 authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'Surface_default_dtor_in_header' into 'master'

Surfaces: use default (for dtor/copy/assignment)

See merge request !35094
parents 2e384ef2 c02c79b7
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -66,7 +66,7 @@ public:
AnnulusBounds(const AnnulusBounds& annbo) = default;
/**Destructor*/
virtual ~AnnulusBounds();
virtual ~AnnulusBounds() = default;
/**Virtual constructor*/
virtual AnnulusBounds* clone() const override;
......
......@@ -66,13 +66,13 @@ public:
ConeBounds(double alpha, double zmin, double zmax, double halfphi = M_PI, double avphi = 0.);
/**Copy Constructor */
ConeBounds(const ConeBounds& cylbo);
/**Destructor */
virtual ~ConeBounds();
ConeBounds(const ConeBounds& cylbo) = default;
/**Assignment operator*/
ConeBounds& operator=(const ConeBounds& cylbo);
ConeBounds& operator=(const ConeBounds& cylbo) = default;
/**Destructor */
virtual ~ConeBounds() = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& sbo) const override;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -68,16 +68,19 @@ public:
CylinderBounds(double radius, double halfphi, double avphi, double halez);
/**Copy Constructor */
CylinderBounds(const CylinderBounds& cylbo);
CylinderBounds(const CylinderBounds& cylbo) = default;
/**Move Constructor */
CylinderBounds(CylinderBounds&& cylbo) = default;
/**Destructor */
virtual ~CylinderBounds();
virtual ~CylinderBounds() = default;
/**Assignment operator*/
CylinderBounds& operator=(const CylinderBounds& cylbo);
CylinderBounds& operator=(const CylinderBounds& cylbo) = default;
/**Move assignment operator*/
CylinderBounds& operator=(CylinderBounds&& cylbo);
CylinderBounds& operator=(CylinderBounds&& cylbo) = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& sbo) const override;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -55,16 +55,16 @@ public:
DiamondBounds(double minhalex, double medhalex, double maxhalex, double haley1, double haley2);
/**Copy constructor*/
DiamondBounds(const DiamondBounds& diabo);
DiamondBounds(const DiamondBounds& diabo) = default;
/**Destructor*/
virtual ~DiamondBounds();
virtual ~DiamondBounds() = default;
/**Virtual constructor*/
DiamondBounds* clone() const override;
/**Assignment operator*/
DiamondBounds& operator=(const DiamondBounds& sbo);
DiamondBounds& operator=(const DiamondBounds& sbo) = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& diabo) const override;
......
......@@ -94,7 +94,7 @@ public:
DiscSurface(const DiscSurface& psf, const Amg::Transform3D& transf);
/**Destructor*/
virtual ~DiscSurface();
virtual ~DiscSurface() = default;
/**Assignement operator*/
DiscSurface& operator=(const DiscSurface& dsf);
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -63,16 +63,16 @@ public:
EllipseBounds(double minrad1, double minrad2, double maxrad1, double maxrad2, double avephi, double hphisec);
/**Copy constructor*/
EllipseBounds(const EllipseBounds& discbo);
EllipseBounds(const EllipseBounds& discbo) = default;
/**Destructor*/
virtual ~EllipseBounds();
virtual ~EllipseBounds() = default;
/**Assignment operator*/
EllipseBounds& operator=(const EllipseBounds& discbo);
EllipseBounds& operator=(const EllipseBounds& discbo) = default;
/**Move assignment operator*/
EllipseBounds& operator=(EllipseBounds&& discbo);
EllipseBounds& operator=(EllipseBounds&& discbo) = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& sbo) const override;
......
......@@ -59,7 +59,7 @@ public:
PerigeeSurface(const PerigeeSurface& pesf, const Amg::Transform3D& transf);
/**Destructor*/
virtual ~PerigeeSurface();
virtual ~PerigeeSurface() = default;
/**Virtual constructor*/
virtual PerigeeSurface* clone() const override;
......
......@@ -63,7 +63,7 @@ public:
PlaneSurface();
/** Copy Constructor*/
PlaneSurface(const PlaneSurface& psf);
PlaneSurface(const PlaneSurface& psf) = default;
/** Copy Constructor with shift*/
PlaneSurface(const PlaneSurface& psf, const Amg::Transform3D& transf);
......@@ -129,10 +129,10 @@ public:
Trk::SharedObject<const Trk::SurfaceBounds>& sbounds);
/**Destructor*/
virtual ~PlaneSurface();
virtual ~PlaneSurface() = default;
/**Assignment operator*/
PlaneSurface& operator=(const PlaneSurface& psf);
PlaneSurface& operator=(const PlaneSurface& psf) = default;
/**Equality operator*/
virtual bool operator==(const Surface& sf) const override;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -60,16 +60,16 @@ public:
RotatedDiamondBounds(double minhalex, double medhalex, double maxhalex, double haley1, double haley2);
/**Copy constructor*/
RotatedDiamondBounds(const RotatedDiamondBounds& diabo);
RotatedDiamondBounds(const RotatedDiamondBounds& diabo) = default;
/**Destructor*/
virtual ~RotatedDiamondBounds();
virtual ~RotatedDiamondBounds() = default;
/**Virtual constructor*/
RotatedDiamondBounds* clone() const override;
/**Assignment operator*/
RotatedDiamondBounds& operator=(const RotatedDiamondBounds& sbo);
RotatedDiamondBounds& operator=(const RotatedDiamondBounds& sbo) = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& diabo) const override;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -61,10 +61,10 @@ public:
RotatedTrapezoidBounds(double halex, double minhalex, double maxhalex);
/**Copy constructor*/
RotatedTrapezoidBounds(const RotatedTrapezoidBounds& trabo);
RotatedTrapezoidBounds(const RotatedTrapezoidBounds& trabo) = default;
/**Destructor*/
virtual ~RotatedTrapezoidBounds();
virtual ~RotatedTrapezoidBounds() = default;
/**Virtual constructor*/
virtual RotatedTrapezoidBounds* clone() const override;
......@@ -73,7 +73,7 @@ public:
virtual BoundsType type() const override { return SurfaceBounds::RotatedTrapezoid; }
/**Assignment operator*/
RotatedTrapezoidBounds& operator=(const RotatedTrapezoidBounds& sbo);
RotatedTrapezoidBounds& operator=(const RotatedTrapezoidBounds& sbo) = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& trabo) const override;
......
......@@ -69,7 +69,7 @@ public:
const Amg::Transform3D& transf);
/**Destructor*/
virtual ~StraightLineSurface();
virtual ~StraightLineSurface() = default;
/**Assignment operator*/
StraightLineSurface& operator=(const StraightLineSurface& slsf);
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -62,10 +62,10 @@ public:
TrapezoidBounds(double minhalex, double haley, double alpha, double beta);
/**Copy constructor*/
TrapezoidBounds(const TrapezoidBounds& trabo);
TrapezoidBounds(const TrapezoidBounds& trabo) = default;
/**Destructor*/
virtual ~TrapezoidBounds();
virtual ~TrapezoidBounds() = default;
/**Virtual constructor*/
virtual TrapezoidBounds* clone() const override;
......@@ -74,7 +74,7 @@ public:
virtual BoundsType type() const override { return SurfaceBounds::Trapezoid; }
/**Assignment operator*/
TrapezoidBounds& operator=(const TrapezoidBounds& sbo);
TrapezoidBounds& operator=(const TrapezoidBounds& sbo) = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& trabo) const override;
......
......@@ -64,13 +64,13 @@ public:
TriangleBounds(const Amg::Vector2D& p1, const Amg::Vector2D& p2, const Amg::Vector2D& p3);
/**Copy constructor*/
TriangleBounds(const TriangleBounds& tribo);
TriangleBounds(const TriangleBounds& tribo) = default;
/**Destructor*/
virtual ~TriangleBounds();
virtual ~TriangleBounds() = default;
/**Assignment Operator*/
TriangleBounds& operator=(const TriangleBounds& recbo);
TriangleBounds& operator=(const TriangleBounds& recbo) = default;
/**Equality operator*/
virtual bool operator==(const SurfaceBounds& sbo) const override;
......
......@@ -106,18 +106,18 @@ public:
|| ((x * h + y * w - w * h) * (x * h + y * w - w * h) <= r * r * (w * w + h * h) && x * w - y * h >= -h * h &&
x * w - y * h <= w * w)) { // collision with (0, h)---(w, 0)
return true;
}
}
if ((x - w) * (x - w) + (y - h) * (y - h) <= r * r || (x <= w && y - r <= h) || (y <= h && x - r <= w)) {
return iterate(x, y, w, 0, 0, h, r * r); // collision within triangle (0, h) (w, h) (0, 0) is possible
}
return false;
}
}
double R = -r;
double localCos = x / R;
double deltaR = std::sqrt(h * h + (w * w - h * h) * localCos * localCos);
return deltaR >= R - std::sqrt(x * x + y * y);
}
EllipseCollisionTest(int maxIterations) { this->m_maxIterations = maxIterations; }
};
......@@ -196,9 +196,6 @@ Trk::AnnulusBounds::AnnulusBounds(double minR, double maxR, double R, double phi
m_minYin = minR;
}
// destructor
Trk::AnnulusBounds::~AnnulusBounds() = default;
bool
Trk::AnnulusBounds::operator==(const Trk::SurfaceBounds& sbo) const
{
......@@ -357,7 +354,7 @@ Trk::AnnulusBounds::isAbove(const Amg::Vector2D& locpo,
// the most tolerant approach for tol1 and tol2
double sign = k > 0. ? -1. : +1.;
return (locpo[Trk::locY] + tol2 > (k * (locpo[Trk::locX] + sign * tol1) + d));
}
}
return false;
}
......@@ -472,7 +469,7 @@ Trk::AnnulusBounds::circleLineIntersection(double R, double k, double d) const
x2 = (-2. * k * d + std::sqrt(delta)) / (2. * (1 + k * k));
y1 = k * x1 + d;
y2 = k * x2 + d;
if (y1 > y2) {
solution.push_back(x1);
solution.push_back(y1);
......
......@@ -50,27 +50,6 @@ Trk::ConeBounds::ConeBounds(double alpha, double zmin, double zmax, double halfp
initCache();
}
Trk::ConeBounds::ConeBounds(const Trk::ConeBounds& conebo)
: m_boundValues(conebo.m_boundValues)
, m_tanAlpha(conebo.m_tanAlpha)
, m_sinAlpha(conebo.m_sinAlpha)
, m_cosAlpha(conebo.m_cosAlpha)
{}
Trk::ConeBounds::~ConeBounds() = default;
Trk::ConeBounds&
Trk::ConeBounds::operator=(const Trk::ConeBounds& conebo)
{
if (this != &conebo) {
m_tanAlpha = conebo.m_tanAlpha;
m_sinAlpha = conebo.m_sinAlpha;
m_cosAlpha = conebo.m_cosAlpha;
m_boundValues = conebo.m_boundValues;
}
return *this;
}
bool
Trk::ConeBounds::operator==(const SurfaceBounds& sbo) const
{
......
......@@ -48,34 +48,6 @@ Trk::CylinderBounds::CylinderBounds(double radius, double haphi, double averagep
m_boundValues[CylinderBounds::bv_halfZ] = fabs(halez);
}
Trk::CylinderBounds::CylinderBounds(const Trk::CylinderBounds& cylbo)
: Trk::SurfaceBounds()
, m_boundValues(cylbo.m_boundValues)
, m_checkPhi(cylbo.m_checkPhi)
{}
Trk::CylinderBounds::~CylinderBounds() = default;
Trk::CylinderBounds&
Trk::CylinderBounds::operator=(const Trk::CylinderBounds& cylbo)
{
if (this != &cylbo) {
m_boundValues = cylbo.m_boundValues;
m_checkPhi = cylbo.m_checkPhi;
}
return *this;
}
Trk::CylinderBounds&
Trk::CylinderBounds::operator=(Trk::CylinderBounds&& cylbo)
{
if (this != &cylbo) {
m_boundValues = std::move(cylbo.m_boundValues);
m_checkPhi = cylbo.m_checkPhi;
}
return *this;
}
bool
Trk::CylinderBounds::operator==(const SurfaceBounds& sbo) const
{
......
......@@ -38,28 +38,6 @@ Trk::DiamondBounds::DiamondBounds(double minhalex, double medhalex, double maxha
initCache();
}
// copy constructor
Trk::DiamondBounds::DiamondBounds(const DiamondBounds& diabo)
: Trk::SurfaceBounds()
, m_boundValues(diabo.m_boundValues)
, m_alpha1(diabo.m_alpha1)
, m_alpha2(diabo.m_alpha2)
{}
// destructor
Trk::DiamondBounds::~DiamondBounds() = default;
Trk::DiamondBounds&
Trk::DiamondBounds::operator=(const DiamondBounds& diabo)
{
if (this != &diabo) {
m_boundValues = diabo.m_boundValues;
m_alpha1 = diabo.m_alpha1;
m_alpha2 = diabo.m_alpha2;
}
return *this;
}
bool
Trk::DiamondBounds::operator==(const Trk::SurfaceBounds& sbo) const
{
......@@ -105,13 +83,13 @@ Trk::DiamondBounds::insideFull(const Amg::Vector2D& locpo, double tol1, double t
m_boundValues[DiamondBounds::bv_halfY1]
: 0.;
return (fabs(locpo[Trk::locX]) <= m_boundValues[DiamondBounds::bv_medHalfX] - k * fabs(locpo[Trk::locY]));
}
}
double k = m_boundValues[DiamondBounds::bv_halfY2] > 0.
? (m_boundValues[DiamondBounds::bv_medHalfX] - m_boundValues[DiamondBounds::bv_maxHalfX]) / 2 /
m_boundValues[DiamondBounds::bv_halfY2]
: 0.;
return (fabs(locpo[Trk::locX]) <= m_boundValues[DiamondBounds::bv_medHalfX] - k * fabs(locpo[Trk::locY]));
}
// opening angle in point A
......
......@@ -97,8 +97,6 @@ Trk::DiscSurface::DiscSurface(const Trk::TrkDetElementBase& detelement)
, m_bounds()
, m_referencePoint(nullptr)
{}
// destructor (will call destructor from base class which deletes objects)
Trk::DiscSurface::~DiscSurface() = default;
Trk::DiscSurface&
Trk::DiscSurface::operator=(const DiscSurface& dsf)
......@@ -237,9 +235,9 @@ Trk::DiscSurface::straightLineDistanceEstimate(const Amg::Vector3D& pos, const A
if (A == 0.) { // direction parallel to surface
if (fabs(d) < tol) {
return Trk::DistanceSolution(1, 0., true, 0.);
}
}
return Trk::DistanceSolution(0, d, true, 0.);
}
double D = b * (S - (pos.dot(N))) / A;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -54,29 +54,6 @@ Trk::EllipseBounds::EllipseBounds(double minradX,
swap(m_boundValues[EllipseBounds::bv_rMinY], m_boundValues[EllipseBounds::bv_rMaxY]);
}
Trk::EllipseBounds::EllipseBounds(const EllipseBounds& discbo)
: Trk::SurfaceBounds()
, m_boundValues(discbo.m_boundValues)
{}
Trk::EllipseBounds::~EllipseBounds() = default;
Trk::EllipseBounds&
Trk::EllipseBounds::operator=(const EllipseBounds& discbo)
{
if (this != &discbo)
m_boundValues = discbo.m_boundValues;
return *this;
}
Trk::EllipseBounds&
Trk::EllipseBounds::operator=(EllipseBounds&& discbo)
{
if (this != &discbo)
m_boundValues = std::move(discbo.m_boundValues);
return *this;
}
bool
Trk::EllipseBounds::operator==(const Trk::SurfaceBounds& sbo) const
{
......
......@@ -64,7 +64,6 @@ Trk::PerigeeSurface::PerigeeSurface(const PerigeeSurface& pesf, const Amg::Trans
Surface::m_transform = std::make_unique<Amg::Transform3D>(shift * (*pesf.m_transform));
}
Trk::PerigeeSurface::~PerigeeSurface() = default;
// assignment operator
Trk::PerigeeSurface&
......@@ -97,7 +96,7 @@ Trk::PerigeeSurface::localToGlobal(const Trk::LocalParameters& locpars) const
Amg::Vector3D loc3Dframe(
-locpars[Trk::d0] * sin(locpars[Trk::phi0]), locpars[Trk::d0] * cos(locpars[Trk::phi0]), locpars[Trk::z0]);
return new Amg::Vector3D(transform() * loc3Dframe);
}
}
return new Amg::Vector3D(0., 0., locpars[Trk::z0] + (center().z()));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment