From fdf75f9d5eb34850e5d9e42ed9fb9cea33f4ec70 Mon Sep 17 00:00:00 2001 From: "s.zharko@gsi.de" <s.zharko@gsi.de> Date: Wed, 12 Oct 2022 17:15:29 +0200 Subject: [PATCH] L1: explicit implementation of copy and move constructors and assignment operators were replaced with default for L1Parameters and L1CAIteration classes --- reco/L1/L1Algo/L1CAIteration.cxx | 93 +------------------------------- reco/L1/L1Algo/L1CAIteration.h | 17 +++--- reco/L1/L1Algo/L1InitManager.cxx | 3 +- reco/L1/L1Algo/L1Parameters.cxx | 79 --------------------------- reco/L1/L1Algo/L1Parameters.h | 13 ++--- 5 files changed, 15 insertions(+), 190 deletions(-) diff --git a/reco/L1/L1Algo/L1CAIteration.cxx b/reco/L1/L1Algo/L1CAIteration.cxx index 2196d1131a..766f1ff113 100644 --- a/reco/L1/L1Algo/L1CAIteration.cxx +++ b/reco/L1/L1Algo/L1CAIteration.cxx @@ -18,72 +18,9 @@ using namespace L1Constants::size; - -// --------------------------------------------------------------------------------------------------------------------- -// -L1CAIteration::L1CAIteration() noexcept { LOG(debug) << "L1CAIteration: Default constructor called for " << this; } - -// --------------------------------------------------------------------------------------------------------------------- -// -L1CAIteration::L1CAIteration(const L1CAIteration& other) noexcept - // Basic fields - : fName(other.fName) - // Cuts - , fTrackChi2Cut(other.fTrackChi2Cut) - , fTripletChi2Cut(other.fTripletChi2Cut) - , fDoubletChi2Cut(other.fDoubletChi2Cut) - , fPickGather(other.fPickGather) - , fPickNeighbour(other.fPickNeighbour) - , fMaxInvMom(other.fMaxInvMom) - , fMaxSlopePV(other.fMaxSlopePV) - , fMaxSlope(other.fMaxSlope) - , fMaxDZ(other.fMaxDZ) - , fTargetPosSigmaX(other.fTargetPosSigmaX) - , fTargetPosSigmaY(other.fTargetPosSigmaY) - , fMinLevelTripletStart(other.fMinLevelTripletStart) - , fFirstStationIndex(other.fFirstStationIndex) - , fIsPrimary(other.fIsPrimary) - , fIsElectron(other.fIsElectron) - , fIsTrackFromTriplets(other.fIsTrackFromTriplets) - , fIfExtendTracks(other.fIfExtendTracks) - , fIfJumped(other.fIfJumped) - , fIfSuppressGhost(other.fIfSuppressGhost) -{ -} - -// --------------------------------------------------------------------------------------------------------------------- -// -L1CAIteration::L1CAIteration(L1CAIteration&& other) noexcept -{ - this->Swap(other); -} - -// --------------------------------------------------------------------------------------------------------------------- -// -L1CAIteration::L1CAIteration(const std::string& name) noexcept : fName(name) {} - -// --------------------------------------------------------------------------------------------------------------------- -// -L1CAIteration::~L1CAIteration() noexcept {} - -// --------------------------------------------------------------------------------------------------------------------- -// -L1CAIteration& L1CAIteration::operator=(const L1CAIteration& other) noexcept -{ - if (this != &other) { L1CAIteration(other).Swap(*this); } - return *this; -} - // --------------------------------------------------------------------------------------------------------------------- // -L1CAIteration& L1CAIteration::operator=(L1CAIteration&& other) noexcept -{ - if (this != &other) { - L1CAIteration tmp(std::move(other)); - this->Swap(tmp); - } - return *this; -} +L1CAIteration::L1CAIteration(const std::string& name) : fName(name) {} // --------------------------------------------------------------------------------------------------------------------- // @@ -125,34 +62,6 @@ void L1CAIteration::SetTargetPosSigmaXY(float sigmaX, float sigmaY) fTargetPosSigmaY = sigmaY; } -// --------------------------------------------------------------------------------------------------------------------- -// -void L1CAIteration::Swap(L1CAIteration& other) noexcept -{ - // Basic fields - std::swap(fName, other.fName); - // Cuts - std::swap(fTrackChi2Cut, other.fTrackChi2Cut); - std::swap(fTripletChi2Cut, other.fTripletChi2Cut); - std::swap(fDoubletChi2Cut, other.fDoubletChi2Cut); - std::swap(fPickGather, other.fPickGather); - std::swap(fPickNeighbour, other.fPickNeighbour); - std::swap(fMaxInvMom, other.fMaxInvMom); - std::swap(fMaxSlopePV, other.fMaxSlopePV); - std::swap(fMaxSlope, other.fMaxSlope); - std::swap(fMaxDZ, other.fMaxDZ); - std::swap(fTargetPosSigmaX, other.fTargetPosSigmaX); - std::swap(fTargetPosSigmaY, other.fTargetPosSigmaY); - std::swap(fMinLevelTripletStart, other.fMinLevelTripletStart); - std::swap(fFirstStationIndex, other.fFirstStationIndex); - std::swap(fIsPrimary, other.fIsPrimary); - std::swap(fIsElectron, other.fIsElectron); - std::swap(fIsTrackFromTriplets, other.fIsTrackFromTriplets); - std::swap(fIfExtendTracks, other.fIfExtendTracks); - std::swap(fIfJumped, other.fIfJumped); - std::swap(fIfSuppressGhost, other.fIfSuppressGhost); -} - // --------------------------------------------------------------------------------------------------------------------- // std::string L1CAIteration::ToString(int indentLevel) const diff --git a/reco/L1/L1Algo/L1CAIteration.h b/reco/L1/L1Algo/L1CAIteration.h index 508544c0ff..1123e303b3 100644 --- a/reco/L1/L1Algo/L1CAIteration.h +++ b/reco/L1/L1Algo/L1CAIteration.h @@ -30,25 +30,25 @@ class L1CAIteration { public: /// Default constructor - L1CAIteration() noexcept; + L1CAIteration() = default; /// Copy constructor - L1CAIteration(const L1CAIteration& other) noexcept; + L1CAIteration(const L1CAIteration& other) = default; /// Move constructor - L1CAIteration(L1CAIteration&& other) noexcept; + L1CAIteration(L1CAIteration&& other) noexcept = default; /// Constructor from L1CAIteration type - L1CAIteration(const std::string& name) noexcept; + L1CAIteration(const std::string& name); /// Destructor - ~L1CAIteration() noexcept; + ~L1CAIteration() noexcept = default; /// Copy assignment operator - L1CAIteration& operator=(const L1CAIteration& other) noexcept; + L1CAIteration& operator=(const L1CAIteration& other) = default; /// Move assignment operator - L1CAIteration& operator=(L1CAIteration&& other) noexcept; + L1CAIteration& operator=(L1CAIteration&& other) = default; /// Checks parameters consistency bool Check() const; @@ -195,9 +195,6 @@ public: /// Sets triplet chi2 upper cut void SetTripletChi2Cut(float input) { fTripletChi2Cut = input; } - /// Swap method - void Swap(L1CAIteration& other) noexcept; - /// String representation of the class contents /// \param indentLevel Level of indentation for the text (in terms of \t symbols) std::string ToString(int indentLevel = 0) const; diff --git a/reco/L1/L1Algo/L1InitManager.cxx b/reco/L1/L1Algo/L1InitManager.cxx index 154b411072..eb27a04ba5 100644 --- a/reco/L1/L1Algo/L1InitManager.cxx +++ b/reco/L1/L1Algo/L1InitManager.cxx @@ -253,7 +253,6 @@ void L1InitManager::PushBackCAIteration(const L1CAIteration& iteration) { // TODO: probably some checks must be inserted here (S.Zharko) bool control = fInitController.GetFlag(EInitKey::kCAIterationsNumberCrosscheck); - //std::cout << "L1InitManager::PushBackCAIteration " << control << '\n'; L1MASSERT(0, control, //fInitController.GetFlag(EInitKey::kCAIterationsNumberCrosscheck), "Attempt to push back a CA track finder iteration before the number of iterations was defined"); @@ -283,7 +282,9 @@ void L1InitManager::ReadParametersObject(const std::string& fileName) bool L1InitManager::SendParameters(L1Algo* pAlgo) { assert(pAlgo); + std::cout << "\033[1;32m" << fParameters.ToString() << "\033[0m\n"; pAlgo->ReceiveParameters(std::move(fParameters)); + std::cout << "\033[1;31m" << fParameters.ToString() << "\033[0m\n"; return true; } diff --git a/reco/L1/L1Algo/L1Parameters.cxx b/reco/L1/L1Algo/L1Parameters.cxx index fba0587794..ebac7e671a 100644 --- a/reco/L1/L1Algo/L1Parameters.cxx +++ b/reco/L1/L1Algo/L1Parameters.cxx @@ -20,85 +20,6 @@ L1Parameters::L1Parameters() fActiveStationGlobalIDs.fill(-1); // by default, all stations are inactive, thus all the IDs must be -1 } -//---------------------------------------------------------------------------------------------------------------------- -// -L1Parameters::~L1Parameters() noexcept {} - -//---------------------------------------------------------------------------------------------------------------------- -// -L1Parameters::L1Parameters(const L1Parameters& other) noexcept - : fMaxDoubletsPerSinglet(other.fMaxDoubletsPerSinglet) - , fMaxTripletPerDoublets(other.fMaxTripletPerDoublets) - , fCAIterations(other.fCAIterations) - , fTargetPos(other.fTargetPos) - , fVertexFieldValue(other.fVertexFieldValue) - , fVertexFieldRegion(other.fVertexFieldRegion) - , fStations(other.fStations) - , fThickMap(other.fThickMap) - , fNstationsGeometryTotal(other.fNstationsGeometryTotal) - , fNstationsActiveTotal(other.fNstationsActiveTotal) - , fNstationsGeometry(other.fNstationsGeometry) - , fNstationsActive(other.fNstationsActive) - , fActiveStationGlobalIDs(other.fActiveStationGlobalIDs) - , fTrackingLevel(other.fTrackingLevel) - , fGhostSuppression(other.fGhostSuppression) - , fMomentumCutOff(other.fMomentumCutOff) - , fDevIsIgnoreHitSearchAreas(other.fDevIsIgnoreHitSearchAreas) - , fDevIsUseOfOriginalField(other.fDevIsUseOfOriginalField) - , fDevIsMatchDoubletsViaMc(other.fDevIsMatchDoubletsViaMc) - , fDevIsMatchTripletsViaMc(other.fDevIsMatchTripletsViaMc) -{ -} - -//---------------------------------------------------------------------------------------------------------------------- -// -L1Parameters& L1Parameters::operator=(const L1Parameters& other) noexcept -{ - if (this != &other) { L1Parameters(other).Swap(*this); } - return *this; -} - -//---------------------------------------------------------------------------------------------------------------------- -// -L1Parameters::L1Parameters(L1Parameters&& other) noexcept { this->Swap(other); } - -//---------------------------------------------------------------------------------------------------------------------- -// -L1Parameters& L1Parameters::operator=(L1Parameters&& other) noexcept -{ - if (this != &other) { - L1Parameters tmp(std::move(other)); - this->Swap(tmp); - } - return *this; -} - -//---------------------------------------------------------------------------------------------------------------------- -// -void L1Parameters::Swap(L1Parameters& other) noexcept -{ - std::swap(fMaxDoubletsPerSinglet, other.fMaxDoubletsPerSinglet); - std::swap(fMaxTripletPerDoublets, other.fMaxTripletPerDoublets); - std::swap(fCAIterations, other.fCAIterations); - std::swap(fTargetPos, other.fTargetPos); - std::swap(fVertexFieldValue, other.fVertexFieldValue); - std::swap(fVertexFieldRegion, other.fVertexFieldRegion); - std::swap(fStations, other.fStations); - std::swap(fThickMap, other.fThickMap); - std::swap(fNstationsGeometryTotal, other.fNstationsGeometryTotal); - std::swap(fNstationsActiveTotal, other.fNstationsActiveTotal); - std::swap(fNstationsGeometry, other.fNstationsGeometry); - std::swap(fNstationsActive, other.fNstationsActive); - std::swap(fActiveStationGlobalIDs, other.fActiveStationGlobalIDs); - std::swap(fTrackingLevel, other.fTrackingLevel); - std::swap(fGhostSuppression, other.fGhostSuppression); - std::swap(fMomentumCutOff, other.fMomentumCutOff); - std::swap(fDevIsIgnoreHitSearchAreas, other.fDevIsIgnoreHitSearchAreas); - std::swap(fDevIsUseOfOriginalField, other.fDevIsUseOfOriginalField); - std::swap(fDevIsMatchDoubletsViaMc, other.fDevIsMatchDoubletsViaMc); - std::swap(fDevIsMatchTripletsViaMc, other.fDevIsMatchTripletsViaMc); -} - //---------------------------------------------------------------------------------------------------------------------- // void L1Parameters::CheckConsistency() const diff --git a/reco/L1/L1Algo/L1Parameters.h b/reco/L1/L1Algo/L1Parameters.h index 3900a29305..cd78ec2104 100644 --- a/reco/L1/L1Algo/L1Parameters.h +++ b/reco/L1/L1Algo/L1Parameters.h @@ -50,22 +50,19 @@ public: L1Parameters(); /// Destructor - ~L1Parameters() noexcept; + ~L1Parameters() noexcept = default; /// Copy constructor - L1Parameters(const L1Parameters& other) noexcept; + L1Parameters(const L1Parameters& other) = default; /// Copy assignment operator - L1Parameters& operator=(const L1Parameters& other) noexcept; + L1Parameters& operator=(const L1Parameters& other) = default; /// Move constructor - L1Parameters(L1Parameters&& other) noexcept; + L1Parameters(L1Parameters&& other) noexcept = default; /// Move assignment operator - L1Parameters& operator=(L1Parameters&& other) noexcept; - - /// Swap method - void Swap(L1Parameters& other) noexcept; + L1Parameters& operator=(L1Parameters&& other) noexcept = default; /// Prints configuration void Print(int verbosityLevel = 0) const; -- GitLab