From 8484bd286807807e04dacb9484359ec92c4c3533 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Tue, 13 Sep 2022 11:02:06 -0400 Subject: [PATCH] MuonAlignErrorBase: Fix cppcheck warnings. Base class initialization. --- .../MuonAlignErrorBase/AlignmentDeviation.h | 16 +++++++++++++++- .../src/AlignmentRotationDeviation.cxx | 9 ++++----- .../src/AlignmentTranslationDeviation.cxx | 9 ++++----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/MuonAlignErrorBase/AlignmentDeviation.h b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/MuonAlignErrorBase/AlignmentDeviation.h index ae5a12eaf023..9fe6a19d16cb 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/MuonAlignErrorBase/AlignmentDeviation.h +++ b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/MuonAlignErrorBase/AlignmentDeviation.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONALIGNERRORBASE_ALIGNMENTDEVIATION_H @@ -19,6 +19,10 @@ namespace Trk { */ class AlignmentDeviation { public: + AlignmentDeviation (const std::vector<const Trk::RIO_OnTrack*>& hits, // not owned + std::size_t hitshash, + bool hitshashdone); + virtual ~AlignmentDeviation() {} /** @@ -69,6 +73,16 @@ namespace Trk { bool m_hitshashdone; }; + inline + AlignmentDeviation::AlignmentDeviation (const std::vector<const Trk::RIO_OnTrack*>& hits, // not owned + std::size_t hitshash, + bool hitshashdone) + : m_hits (hits), + m_hitshash (hitshash), + m_hitshashdone (hitshashdone) + { + } + inline void AlignmentDeviation::getListOfHits(std::vector<const Trk::RIO_OnTrack*>& hits) const { hits = m_hits; } inline std::size_t AlignmentDeviation::getHashOfHits() const { return m_hitshash; } diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentRotationDeviation.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentRotationDeviation.cxx index c7d348272c36..01edd6ce4330 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentRotationDeviation.cxx +++ b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentRotationDeviation.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "MuonAlignErrorBase/AlignmentRotationDeviation.h" @@ -11,10 +11,9 @@ using namespace MuonAlign; AlignmentRotationDeviation::AlignmentRotationDeviation(Amg::Vector3D center, Amg::Vector3D axis, double sigma, const std::vector<const Trk::RIO_OnTrack*>& hits) : - m_center(std::move(center)), m_axis(std::move(axis)), m_sigma(sigma) { - m_hits = hits; - m_hitshash = 0; - m_hitshashdone = false; + AlignmentDeviation (hits, 0, false), + m_center(std::move(center)), m_axis(std::move(axis)), m_sigma(sigma) +{ } int AlignmentRotationDeviation::nPar() const { return 1; } diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentTranslationDeviation.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentTranslationDeviation.cxx index e13e5b13239a..6a6af4b8207f 100644 --- a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentTranslationDeviation.cxx +++ b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorBase/src/AlignmentTranslationDeviation.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "MuonAlignErrorBase/AlignmentTranslationDeviation.h" @@ -10,10 +10,9 @@ using namespace MuonAlign; AlignmentTranslationDeviation::AlignmentTranslationDeviation(const Amg::Vector3D& u, double sigma, const std::vector<const Trk::RIO_OnTrack*>& hits) : - m_u(u.unit()), m_sigma(sigma) { - m_hits = hits; - m_hitshash = 0; - m_hitshashdone = false; + AlignmentDeviation (hits, 0, false), + m_u(u.unit()), m_sigma(sigma) +{ } int AlignmentTranslationDeviation::nPar() const { return 1; } -- GitLab