From f6f95ca944e33e690824d6c776b10e5b2bd84b7a Mon Sep 17 00:00:00 2001 From: Teng Jian Khoo <teng.jian.khoo@cern.ch> Date: Thu, 26 Nov 2020 10:02:26 +0000 Subject: [PATCH] Use shared_ptr for the HypoJet::IJet memory management --- .../TrigHLTJetHypoUtils/AntiBasicCleaner.h | 2 +- .../TrigHLTJetHypoUtils/AntiLlpCleaner.h | 2 +- .../TrigHLTJetHypoUtils/AntiLooseCleaner.h | 2 +- .../TrigHLTJetHypoUtils/AntiTightCleaner.h | 2 +- .../TrigHLTJetHypoUtils/BasicCleaner.h | 2 +- .../TrigHLTJetHypoUtils/CleanerBridge.h | 2 +- .../TrigHLTJetHypoUtils/EtaEtCleaner.h | 2 +- .../TrigHLTJetHypoUtils/HypoJetDefs.h | 4 +- .../TrigHLTJetHypoUtils/ICleaner.h | 2 +- .../TrigHLTJetHypoUtils/LlpCleaner.h | 2 +- .../TrigHLTJetHypoUtils/LooseCleaner.h | 2 +- .../TrigHLTJetHypoUtils/NullCleaner.h | 2 +- .../TrigHLTJetHypoUtils/TightCleaner.h | 2 +- .../src/AcceptAllConditionMT.cxx | 4 +- .../src/CompoundConditionMT.cxx | 2 +- .../TrigHLTJetHypo/src/DijetConditionMT.cxx | 4 +- .../src/DijetDEtaConditionMT.cxx | 4 +- .../src/DijetDPhiConditionMT.cxx | 4 +- .../src/DijetMassConditionMT.cxx | 4 +- .../TrigHLTJetHypo/src/EtConditionMT.cxx | 2 +- .../TrigHLTJetHypo/src/EtaConditionAbsMT.cxx | 2 +- .../src/EtaConditionSignedMT.cxx | 2 +- .../src/EtaEtAsymmetricConditionMT.cxx | 2 +- .../TrigHLTJetHypo/src/EtaEtConditionMT.cxx | 2 +- .../TrigHLTJetHypo/src/FastReducer.cxx | 4 +- .../TrigHLTJetHypo/src/HTConditionMT.cxx | 6 +- .../TrigHLTJetHypo/src/JVTConditionMT.cxx | 4 +- .../TrigHLTJetHypo/src/MomentConditionMT.cxx | 4 +- .../src/QjetMassConditionMT.cxx | 4 +- .../TrigHLTJetHypo/src/SMCConditionMT.cxx | 2 +- .../TrigHLTJetHypo/src/TrigHLTJetHypo2.cxx | 5 +- .../TrigHLTJetHypo/src/TrigHLTJetHypoBase.cxx | 5 +- .../TrigHLTJetHypoUtils/AntiBasicCleaner.cxx | 2 +- .../TrigHLTJetHypoUtils/AntiLlpCleaner.cxx | 2 +- .../TrigHLTJetHypoUtils/AntiLooseCleaner.cxx | 2 +- .../TrigHLTJetHypoUtils/AntiTightCleaner.cxx | 2 +- .../src/TrigHLTJetHypoUtils/BasicCleaner.cxx | 12 +- .../src/TrigHLTJetHypoUtils/EtaEtCleaner.cxx | 6 +- .../src/TrigHLTJetHypoUtils/HTCondition.cxx | 4 +- .../src/TrigHLTJetHypoUtils/HypoJetDefs.cxx | 2 +- .../src/TrigHLTJetHypoUtils/LlpCleaner.cxx | 12 +- .../src/TrigHLTJetHypoUtils/LooseCleaner.cxx | 10 +- .../src/TrigHLTJetHypoUtils/NullCleaner.cxx | 2 +- .../src/TrigHLTJetHypoUtils/TightCleaner.cxx | 10 +- .../src/xAODJetAsIJetFactory.cxx | 2 +- .../TrigHLTJetHypo/src/xAODJetCollector.h | 6 +- .../exerciser/JetHypoExerciserCompareAlg.cxx | 5 +- .../exerciser/RandomSignalEventGenerator.cxx | 4 +- .../SimpleHypoJetVectorGenerator.cxx | 4 +- .../src/SpecifiedJetsCondition.cxx | 2 +- .../TrigHLTJetHypoUnitTests/src/Timer.cxx | 8 +- .../src/makeHypoJets.cxx | 2 +- .../tests/DijetDEtaMassConditionTest.cxx | 112 +++++++------ .../tests/EtaEtConditionTest.cxx | 36 ++--- .../tests/LlpCleanerTest.cxx | 24 +-- .../tests/LooseCleanerTest.cxx | 14 +- .../MaximumBipartiteGroupsMatcherMTTest.cxx | 136 ++++++++-------- ...mBipartiteGroupsMatcherMTTest_Multijet.cxx | 15 -- .../MaximumBipartiteGroupsMatcherTest.cxx | 148 ++++++++---------- .../tests/PartitionsGrouperTest.cxx | 36 +---- .../tests/PartitionsGroupsMatcherMTTest.cxx | 10 +- .../tests/TightCleanerTest.cxx | 14 +- .../tests/xAODJetCollectorTest.cxx | 14 +- 63 files changed, 341 insertions(+), 411 deletions(-) diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiBasicCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiBasicCleaner.h index c66a4611e51..ac617d0e71c 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiBasicCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiBasicCleaner.h @@ -28,7 +28,7 @@ public: float negativeEThreshold); ~AntiBasicCleaner(){} - bool operator()(const pHypoJet&) const override; + bool operator()(const HypoJet::IJet&) const override; std::string getName() const noexcept override; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLlpCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLlpCleaner.h index ee8e2d62759..02bc2461749 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLlpCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLlpCleaner.h @@ -31,7 +31,7 @@ public: ~AntiLlpCleaner(){} - bool operator()(const pHypoJet& jet) const override; + bool operator()(const HypoJet::IJet& jet) const override; std::string getName() const noexcept override; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLooseCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLooseCleaner.h index 13785181d35..16e87aaa037 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLooseCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiLooseCleaner.h @@ -31,7 +31,7 @@ public: ~AntiLooseCleaner(){} - bool operator()(const pHypoJet& jet) const override; + bool operator()(const HypoJet::IJet& jet) const override; std::string getName() const noexcept override; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiTightCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiTightCleaner.h index 6493eb0283b..cc0a90ec2dc 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiTightCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/AntiTightCleaner.h @@ -31,7 +31,7 @@ public: ~AntiTightCleaner() {} - bool operator()(const pHypoJet& jet) const override; + bool operator()(const HypoJet::IJet& jet) const override; std::string getName() const noexcept override; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/BasicCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/BasicCleaner.h index c1ed78d04b4..08c0c9ddb39 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/BasicCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/BasicCleaner.h @@ -29,7 +29,7 @@ class BasicCleaner: public ICleaner{ ~BasicCleaner() {} - bool operator()(const pHypoJet& jet) const override; + bool operator()(const HypoJet::IJet& jet) const override; std::string toString() const noexcept override; std::string getName() const noexcept override; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h index 89bbaf2e8d4..21d9eae791b 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/CleanerBridge.h @@ -29,7 +29,7 @@ class CleanerBridge{ m_pCleaner(cleaner){} bool operator()(const pHypoJet& jet) const{ - return m_pCleaner -> operator()(jet); + return m_pCleaner -> operator()(*jet); } std::string toString() const { diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/EtaEtCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/EtaEtCleaner.h index 5b46fc67a6f..32d89c34bdb 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/EtaEtCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/EtaEtCleaner.h @@ -29,7 +29,7 @@ public: ~EtaEtCleaner(){} - bool operator()(const pHypoJet&) const override; + bool operator()(const HypoJet::IJet&) const override; std::string toString() const noexcept override; std::string getName() const noexcept override; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h index bd6906818eb..249502d3e9d 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h @@ -22,8 +22,8 @@ #include <queue> #include <ostream> -//using pHypoJet = std::shared_ptr<const HypoJet::IJet>; -using pHypoJet = const HypoJet::IJet*; +using pHypoJet = std::shared_ptr<const HypoJet::IJet>; +//using pHypoJet = const HypoJet::IJet*; using HypoJetVector = std::vector<pHypoJet>; using HypoJetIter = HypoJetVector::iterator; using HypoJetCIter = HypoJetVector::const_iterator; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h index 03859c040bb..fa27d22a501 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/ICleaner.h @@ -23,7 +23,7 @@ class ICleaner{ public: // Abstract interface used by a factory function virtual ~ICleaner(){} - virtual bool operator()(const pHypoJet&) const = 0; + virtual bool operator()(const HypoJet::IJet&) const = 0; virtual std::string toString() const noexcept = 0; virtual std::string getName() const noexcept= 0; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LlpCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LlpCleaner.h index 68ea64eb2b4..a562cda15d2 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LlpCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LlpCleaner.h @@ -30,7 +30,7 @@ class LlpCleaner: public ICleaner{ ~LlpCleaner() {} - bool operator()(const pHypoJet& jet) const override; + bool operator()(const HypoJet::IJet& jet) const override; std::string toString() const noexcept override; std::string getName() const noexcept override; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LooseCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LooseCleaner.h index 783102c5f59..33d3420406c 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LooseCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/LooseCleaner.h @@ -30,7 +30,7 @@ class LooseCleaner: public ICleaner{ ~LooseCleaner() {} - bool operator()(const pHypoJet& jet) const override; + bool operator()(const HypoJet::IJet& jet) const override; std::string toString() const noexcept override; std::string getName() const noexcept override; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/NullCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/NullCleaner.h index 9d1aa77f8bb..1fbb1ad8f27 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/NullCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/NullCleaner.h @@ -29,7 +29,7 @@ class NullCleaner: public ICleaner{ public: ~NullCleaner(){} - bool operator()(const pHypoJet&) const override; + bool operator()(const HypoJet::IJet&) const override; std::string toString() const noexcept override; std::string getName() const noexcept override; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/TightCleaner.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/TightCleaner.h index dd7f06bc599..f4df147ffb8 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/TightCleaner.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/TightCleaner.h @@ -30,7 +30,7 @@ class TightCleaner: public ICleaner{ ~TightCleaner() {} - bool operator()(const pHypoJet& jet) const override; + bool operator()(const HypoJet::IJet& jet) const override; std::string toString() const noexcept override; std::string getName() const noexcept override; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AcceptAllConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AcceptAllConditionMT.cxx index 073719bbe19..99330271f40 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AcceptAllConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AcceptAllConditionMT.cxx @@ -28,8 +28,8 @@ AcceptAllConditionMT::isSatisfied(const HypoJetVector& ips, std::stringstream ss1; - for(auto ip : ips){ - address = static_cast<const void*>(ip); + for(const auto& ip : ips){ + address = static_cast<const void*>(ip.get()); ss1 << " " << address << " " << ip->eta() << " e " << ip->e() << '\n'; } ss1 << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CompoundConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CompoundConditionMT.cxx index af5cb4b646a..e8d90d44211 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CompoundConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CompoundConditionMT.cxx @@ -42,7 +42,7 @@ bool CompoundConditionMT::isSatisfied(const HypoJetVector& ips, << " pass: " << std::boolalpha << pass << '\n'; for(const auto& ip : ips){ - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss1; ss1 << " jet : ("<< j_addr << ")\n"; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetConditionMT.cxx index ab69025c4b9..676eb38b2e8 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetConditionMT.cxx @@ -68,8 +68,8 @@ DijetConditionMT::isSatisfied(const HypoJetVector& ips, std::stringstream ss1; - for(auto ip : ips){ - address = static_cast<const void*>(ip); + for(const auto& ip : ips){ + address = static_cast<const void*>(ip.get()); ss1 << " " << address << " " << ip->eta() << " e " << ip->e() << '\n'; } ss1 << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDEtaConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDEtaConditionMT.cxx index c100fec837c..c7c0027bbd4 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDEtaConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDEtaConditionMT.cxx @@ -48,8 +48,8 @@ DijetDEtaConditionMT::isSatisfied(const HypoJetVector& ips, std::stringstream ss1; - for(auto ip : ips){ - address = static_cast<const void*>(ip); + for(const auto& ip : ips){ + address = static_cast<const void*>(ip.get()); ss1 << " " << address << " " << ip->eta() << " e " << ip->e() << '\n'; } ss1 << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDPhiConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDPhiConditionMT.cxx index 567bcaa29aa..8d20b49abd1 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDPhiConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetDPhiConditionMT.cxx @@ -49,8 +49,8 @@ DijetDPhiConditionMT::isSatisfied(const HypoJetVector& ips, std::stringstream ss1; - for(auto ip : ips){ - address = static_cast<const void*>(ip); + for(const auto& ip : ips){ + address = static_cast<const void*>(ip.get()); ss1 << " " << address << " " << ip->eta() << " e " << ip->e() << '\n'; } ss1 << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetMassConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetMassConditionMT.cxx index 37a45569411..e368c5fd561 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetMassConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/DijetMassConditionMT.cxx @@ -49,8 +49,8 @@ DijetMassConditionMT::isSatisfied(const HypoJetVector& ips, std::stringstream ss1; - for(auto ip : ips){ - address = static_cast<const void*>(ip); + for(const auto& ip : ips){ + address = static_cast<const void*>(ip.get()); ss1 << " " << address << " " << ip->eta() << " e " << ip->e() << '\n'; } ss1 << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtConditionMT.cxx index 4c6560f02fa..a3e27ceddbc 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtConditionMT.cxx @@ -29,7 +29,7 @@ bool EtConditionMT::isSatisfied(const pHypoJet& ip, << " et thresh " << m_min << " pass: " << std::boolalpha << pass << '\n'; - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss1; ss1 << " jet : ("<< j_addr << ")" " et " << et << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionAbsMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionAbsMT.cxx index db606451a34..273bd2eff7e 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionAbsMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionAbsMT.cxx @@ -31,7 +31,7 @@ EtaConditionAbsMT::isSatisfied(const pHypoJet& ip, << " eta[" << m_min << ", " << m_max << "]" << " pass: " << std::boolalpha << pass << '\n'; - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss1; ss1 << " jet : ("<< j_addr << ") abseta " << abseta << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionSignedMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionSignedMT.cxx index 9bf9e30a203..d26c5820d2b 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionSignedMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaConditionSignedMT.cxx @@ -30,7 +30,7 @@ bool EtaConditionSignedMT::isSatisfied(const pHypoJet& ip, << " eta[" << m_min << ", " << m_max << "]" << " pass: " << std::boolalpha << pass << '\n'; - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss1; ss1 << " jet : ("<< j_addr << ") signed eta " << eta << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtAsymmetricConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtAsymmetricConditionMT.cxx index bee5de795ed..b64816f56cc 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtAsymmetricConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtAsymmetricConditionMT.cxx @@ -39,7 +39,7 @@ EtaEtAsymmetricConditionMT::isSatisfied(const pHypoJet& ip, std::stringstream ss1; - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); ss1 << " jet: (" << j_addr << ")" << " eta " << eta << " et " << et << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtConditionMT.cxx index 3522bc51cd8..2b53c70f5ff 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/EtaEtConditionMT.cxx @@ -37,7 +37,7 @@ bool EtaEtConditionMT::isSatisfied(const pHypoJet& ip, << " et thresh " << m_threshold << " pass: " << std::boolalpha << pass << '\n'; - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss1; ss1 << " jet : ("<< j_addr << ")" " abseta " << abseta << " et " << et << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx index 870b26b0f42..3a56736c333 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReducer.cxx @@ -435,7 +435,7 @@ std::string FastReducer::dataStructuresToStr() const { for(const auto& pair : m_indJetGroup){ ss << pair.first << " ["; for(const auto& j : pair.second){ - ss << static_cast<const void*>(j) << " "; + ss << static_cast<const void*>(j.get()) << " "; } ss << "]\n"; } @@ -492,7 +492,7 @@ void FastReducer::recordJetGroup(std::size_t ind, std::stringstream ss1; for(auto ip : jg){ - const void* address = static_cast<const void*>(ip); + const void* address = static_cast<const void*>(ip.get()); ss1 << "\n " << address << " eta " << ip->eta() << " e " << ip->e() << " et " << ip->et(); diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx index 2f92a1fd0fe..0a9cad16e74 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionMT.cxx @@ -4,7 +4,7 @@ #include "./HTConditionMT.h" #include "./ITrigJetHypoInfoCollector.h" -#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h" #include <sstream> #include <cmath> @@ -39,7 +39,7 @@ HTConditionMT::isSatisfied(const HypoJetVector& ips, return std::accumulate(ips_c.begin(), iter, 0.0, - [](double sum, const HypoJet::IJet* jp){ + [](double sum, const pHypoJet& jp){ return sum + jp->et();}) > m_htMin; } else { if(infoCollector) { @@ -49,7 +49,7 @@ HTConditionMT::isSatisfied(const HypoJetVector& ips, return std::accumulate(ips.begin(), ips.end(), 0.0, - [](double sum, const HypoJet::IJet* jp){ + [](double sum, const pHypoJet& jp){ return sum + jp->et();}) > m_htMin; } } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JVTConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JVTConditionMT.cxx index 4c1d1478f2a..d6acdda7213 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JVTConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/JVTConditionMT.cxx @@ -58,8 +58,8 @@ bool JVTConditionMT::isSatisfied(const HypoJetVector& ips, const std::unique_ptr std::stringstream ss1; - for(auto ip : ips){ - address = static_cast<const void*>(ip); + for(const auto& ip : ips){ + address = static_cast<const void*>(ip.get()); ss1 << " " << address << " " << ip->eta() << " pt " << ip->pt() << '\n'; } ss1 << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MomentConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MomentConditionMT.cxx index ea09ac6a940..effde3e73e0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MomentConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/MomentConditionMT.cxx @@ -25,7 +25,7 @@ bool MomentConditionMT::isSatisfied(const pHypoJet& ip, if (!(ip -> getAttribute(m_moment, momentValue))){ if(collector){ - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss0; ss0 << "MomentCondition: " @@ -50,7 +50,7 @@ bool MomentConditionMT::isSatisfied(const pHypoJet& ip, << " moment " << m_moment << " pass: " << std::boolalpha << pass << '\n'; - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss1; ss1 << " jet : ("<< j_addr << ") " "moment " << m_moment << " value: " << momentValue<< '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/QjetMassConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/QjetMassConditionMT.cxx index 11302690ace..601f4524fca 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/QjetMassConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/QjetMassConditionMT.cxx @@ -51,8 +51,8 @@ QjetMassConditionMT::isSatisfied(const HypoJetVector& ips, std::stringstream ss1; - for(auto ip : ips){ - address = static_cast<const void*>(ip); + for(const auto& ip : ips){ + address = static_cast<const void*>(ip.get()); ss1 << " " << address << " eta " << ip->eta() << " e " << ip->e() << " et: " << ip->et() << '\n'; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/SMCConditionMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/SMCConditionMT.cxx index 02b601e0bb4..6695cf6e2b0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/SMCConditionMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/SMCConditionMT.cxx @@ -31,7 +31,7 @@ SMCConditionMT::isSatisfied(const pHypoJet& ip, << " mass[" << m_min << ", " << m_max << "]" << " pass: " << std::boolalpha << pass << '\n'; - auto j_addr = static_cast<const void*>(ip); + auto j_addr = static_cast<const void*>(ip.get()); std::stringstream ss1; ss1 << " jet : ("<< j_addr << ") jet mass " << mass << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo2.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo2.cxx index 0dfa822f868..9421828473c 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo2.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo2.cxx @@ -260,7 +260,7 @@ class xAODJetAsIJetFactory{ public: xAODJetAsIJetFactory(): m_ind(-1){} pHypoJet operator() (const xAOD::Jet* j){ - return new HypoJet::xAODJetAsIJet(j, ++m_ind);} + return pHypoJet(new HypoJet::xAODJetAsIJet(j, ++m_ind));} private: unsigned int m_ind; }; @@ -324,9 +324,6 @@ HLT::ErrorCode TrigHLTJetHypo2::hltExecute(const HLT::TriggerElement* outputTE, ATH_MSG_ERROR("Trig bits storage failed"); return status;} - // delete the xAOD::Jet wrappers - for(auto i : hypoJets){delete i;} - return HLT::OK; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoBase.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoBase.cxx index 90966c1bec3..b9fa0f08c8b 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoBase.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoBase.cxx @@ -188,7 +188,7 @@ class xAODJetAsIJetFactory{ public: xAODJetAsIJetFactory(): m_ind(-1){} pHypoJet operator() (const xAOD::Jet* j){ - return new HypoJet::xAODJetAsIJet(j, ++m_ind);} + return pHypoJet(new HypoJet::xAODJetAsIJet(j, ++m_ind));} private: unsigned int m_ind; }; @@ -252,9 +252,6 @@ HLT::ErrorCode TrigHLTJetHypoBase::hltExecute(const HLT::TriggerElement* outputT ATH_MSG_ERROR("Trig bits storage failed"); return status;} - // delete the xAOD::Jet wrappers - for(auto i : hypoJets){delete i;} - return HLT::OK; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiBasicCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiBasicCleaner.cxx index b92096fdf7a..1b3734e9280 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiBasicCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiBasicCleaner.cxx @@ -20,7 +20,7 @@ AntiBasicCleaner::AntiBasicCleaner(float n90Threshold, float negativeEThreshold): BasicCleaner(n90Threshold, presamplerThreshold, negativeEThreshold){} -bool AntiBasicCleaner::operator()(const pHypoJet& jet) const{ +bool AntiBasicCleaner::operator()(const HypoJet::IJet& jet) const{ return !BasicCleaner::operator()(jet); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLlpCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLlpCleaner.cxx index b03fd88df6a..95f94e77abb 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLlpCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLlpCleaner.cxx @@ -27,7 +27,7 @@ AntiLlpCleaner::AntiLlpCleaner(float fSampMaxLlpThreshold, hecqLlpThreshold, avLarQFLlpThreshold){} -bool AntiLlpCleaner::operator()(const pHypoJet& jet) const{ +bool AntiLlpCleaner::operator()(const HypoJet::IJet& jet) const{ return !LlpCleaner::operator()(jet); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLooseCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLooseCleaner.cxx index 3dbdc9e3bd5..e0749e58cab 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLooseCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiLooseCleaner.cxx @@ -26,7 +26,7 @@ AntiLooseCleaner::AntiLooseCleaner(float fSampMaxLooseThreshold, emfHighLooseThreshold, hecfLooseThreshold){} -bool AntiLooseCleaner::operator()(const pHypoJet& jet) const{ +bool AntiLooseCleaner::operator()(const HypoJet::IJet& jet) const{ return !LooseCleaner::operator()(jet); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiTightCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiTightCleaner.cxx index f067c5f627b..e6632ff05e2 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiTightCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/AntiTightCleaner.cxx @@ -26,7 +26,7 @@ AntiTightCleaner::AntiTightCleaner(float fSampMaxTightThreshold, emfHighTightThreshold, hecfTightThreshold){} -bool AntiTightCleaner::operator()(const pHypoJet& jet) const{ +bool AntiTightCleaner::operator()(const HypoJet::IJet& jet) const{ return TightCleaner::operator()(jet); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/BasicCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/BasicCleaner.cxx index 19760a297a8..523bb5fe02c 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/BasicCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/BasicCleaner.cxx @@ -26,13 +26,13 @@ BasicCleaner::BasicCleaner(float n90Threshold, m_negativeEThreshold(negativeEThreshold){ } -bool BasicCleaner::operator()(const pHypoJet& jet) const { +bool BasicCleaner::operator()(const HypoJet::IJet& jet) const { /* make cuts on jet attributes to select clean jets */ bool isClean{true}; float n90jet; - if (jet -> getAttribute("N90Constituents", n90jet)){ + if (jet.getAttribute("N90Constituents", n90jet)){ //std::cout << "TrigHLTJetHypoHelpers: N90Constituents = " << n90jet << '\n'; if(n90jet < m_n90Threshold){isClean = false;} } else { @@ -43,7 +43,7 @@ bool BasicCleaner::operator()(const pHypoJet& jet) const { //example of code to compute presamplerFraction /* std::vector<float> vecvalue; - if (jet->getAttribute(xAOD::JetAttribute::EnergyPerSampling, vecvalue)) { + if (jet.getAttribute(xAOD::JetAttribute::EnergyPerSampling, vecvalue)) { int vecsize = vecvalue.size(); std::cout << "TrigHLTJetHypoHelpers: Got EnergyPerSampling vector, size: " << vecsize << '\n'; if (vecsize != 0) { @@ -60,7 +60,7 @@ bool BasicCleaner::operator()(const pHypoJet& jet) const { //see Reconstruction/Jet/JetUtils/Root/JetCaloQualityUtils.cxx double presamplerE = vecvalue[CaloSampling::PreSamplerB] + vecvalue[CaloSampling::PreSamplerE]; std::cout << "TrigHLTJetHypoHelpers: presamplerE = " << presamplerE << '\n'; - double jetE = jet->jetP4(xAOD::JetEMScaleMomentum).E(); + double jetE = jet.jetP4(xAOD::JetEMScaleMomentum).E(); std::cout << "TrigHLTJetHypoHelpers: jetE = " << jetE << '\n'; double presamplerF = 0; if(jetE!=0) presamplerF = presamplerE/jetE; @@ -74,7 +74,7 @@ bool BasicCleaner::operator()(const pHypoJet& jet) const { //use of presamplerFraction needs further study, for now not used /* float presamplerfractionjet; - if(jet -> getAttribute<float>("presamplerFraction", presamplerfractionjet)){ + if(jet.getAttribute<float>("presamplerFraction", presamplerfractionjet)){ if(presamplerfractionjet > m_presamplerThreshold) {isClean = false;} } else { throw UncleanableJet("Cleaner Cannot retrieve presamplerFraction"); @@ -82,7 +82,7 @@ bool BasicCleaner::operator()(const pHypoJet& jet) const { */ float negEjet; - if(jet -> getAttribute("NegativeE", negEjet)){ + if(jet.getAttribute("NegativeE", negEjet)){ //std::cout << "TrigHLTJetHypoHelpers: NegativeE = " << negEjet << '\n'; if(negEjet < m_negativeEThreshold){isClean = false;} } else { diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/EtaEtCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/EtaEtCleaner.cxx index d9e386715b2..9de5db74fa4 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/EtaEtCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/EtaEtCleaner.cxx @@ -26,9 +26,9 @@ EtaEtCleaner::EtaEtCleaner(double etaMin, m_etaMin(etaMin), m_etaMax(etaMax), m_etMin(etMin), m_etMax(etMax){ } -bool EtaEtCleaner::operator()(const pHypoJet& jet) const{ - auto eta = std::abs(jet->eta()); - auto et = jet->et(); +bool EtaEtCleaner::operator()(const HypoJet::IJet& jet) const{ + auto eta = std::abs(jet.eta()); + auto et = jet.et(); return eta >= m_etaMin and eta < m_etaMax and et >= m_etMin and et < m_etMax; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HTCondition.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HTCondition.cxx index 13198fd6a8c..c296c950bfc 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HTCondition.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HTCondition.cxx @@ -3,7 +3,7 @@ */ #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HTCondition.h" -#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h" #include <sstream> #include <cmath> @@ -19,7 +19,7 @@ HTCondition::isSatisfied(const HypoJetVector& ips) const { return std::accumulate(ips.begin(), ips.end(), 0.0, - [](double sum, const HypoJet::IJet* jp){ + [](double sum, const pHypoJet& jp){ return sum + jp->et();}) > m_htMin; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HypoJetDefs.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HypoJetDefs.cxx index e6b77cec17c..e29de4a36dd 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HypoJetDefs.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/HypoJetDefs.cxx @@ -9,7 +9,7 @@ std::ostream& operator << (std::ostream& out, const HypoJetVector& hjv) { auto hjv_addr = static_cast<const void*>(&hjv); out << "HypoJetVector (" << hjv_addr << ")\n"; for(const auto& j : hjv) { - out << static_cast<const void*>(j) + out << static_cast<const void*>(j.get()) << " e " << j->e() << " et " << j->et() << " eta " << j->eta() << '\n'; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LlpCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LlpCleaner.cxx index eaf664a50ae..6c7ab3444cb 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LlpCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LlpCleaner.cxx @@ -30,15 +30,15 @@ LlpCleaner::LlpCleaner(float fSampMaxLlpThreshold, m_avLarQFLlpThreshold(avLarQFLlpThreshold){ } -bool LlpCleaner::operator()(const pHypoJet& jet) const { +bool LlpCleaner::operator()(const HypoJet::IJet& jet) const { /* make cuts on jet attributes to select jets from long-lived particles */ bool isClean{true}; float fsmJet; float neJet; - if(jet -> getAttribute("FracSamplingMax", fsmJet)){ - if(jet -> getAttribute("NegativeE", neJet)){ + if(jet.getAttribute("FracSamplingMax", fsmJet)){ + if(jet.getAttribute("NegativeE", neJet)){ if(fsmJet > m_fSampMaxLlpThreshold && std::abs(neJet) > m_negELlpThreshold){isClean = false;} } else { @@ -52,9 +52,9 @@ bool LlpCleaner::operator()(const pHypoJet& jet) const { float hecfJet; float hecqJet; float alqfJet; - if(jet -> getAttribute("HECFrac", hecfJet)){ - if(jet -> getAttribute("HECQuality", hecqJet)){ - if(jet -> getAttribute("AverageLArQF", alqfJet)){ + if(jet.getAttribute("HECFrac", hecfJet)){ + if(jet.getAttribute("HECQuality", hecqJet)){ + if(jet.getAttribute("AverageLArQF", alqfJet)){ if(hecfJet > m_hecfLlpThreshold && std::abs(hecqJet) > m_hecqLlpThreshold && alqfJet > m_avLarQFLlpThreshold){isClean = false;} } else { diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LooseCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LooseCleaner.cxx index 1ff40dc12d9..e87eee79344 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LooseCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/LooseCleaner.cxx @@ -30,27 +30,27 @@ LooseCleaner::LooseCleaner(float fSampMaxLooseThreshold, m_hecfLooseThreshold(hecfLooseThreshold){ } -bool LooseCleaner::operator()(const pHypoJet& jet) const { +bool LooseCleaner::operator()(const HypoJet::IJet& jet) const { /* make cuts on jet attributes to select clean jets */ bool isClean{true}; float fsmJet; - if(jet -> getAttribute("FracSamplingMax", fsmJet)){ - if(fsmJet > m_fSampMaxLooseThreshold && std::abs(jet->eta()) < m_etaLooseThreshold){isClean = false;} + if(jet.getAttribute("FracSamplingMax", fsmJet)){ + if(fsmJet > m_fSampMaxLooseThreshold && std::abs(jet.eta()) < m_etaLooseThreshold){isClean = false;} } else { throw UncleanableJet("Cleaner Cannot retrieve FracSamplingMax"); } float emfJet; - if(jet -> getAttribute("EMFrac", emfJet)){ + if(jet.getAttribute("EMFrac", emfJet)){ if(emfJet < m_emfLowLooseThreshold || emfJet > m_emfHighLooseThreshold){isClean = false;} } else { throw UncleanableJet("Cleaner Cannot retrieve EMFrac"); } float hecfJet; - if(jet -> getAttribute("HECFrac", hecfJet)){ + if(jet.getAttribute("HECFrac", hecfJet)){ if(hecfJet > m_hecfLooseThreshold){isClean = false;} } else { throw UncleanableJet("Cleaner Cannot retrieve HECFrac"); diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/NullCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/NullCleaner.cxx index b2375d7d840..f8bab410566 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/NullCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/NullCleaner.cxx @@ -15,7 +15,7 @@ #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/NullCleaner.h" #include <sstream> -bool NullCleaner::operator()(const pHypoJet&) const {return true;} +bool NullCleaner::operator()(const HypoJet::IJet&) const {return true;} std::string NullCleaner::toString() const noexcept { std::stringstream ss; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/TightCleaner.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/TightCleaner.cxx index 4de1ff73dd1..fc3786f3c4f 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/TightCleaner.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/TightCleaner.cxx @@ -29,27 +29,27 @@ TightCleaner::TightCleaner(float fSampMaxTightThreshold, m_hecfTightThreshold(hecfTightThreshold){ } -bool TightCleaner::operator()(const pHypoJet& jet) const { +bool TightCleaner::operator()(const HypoJet::IJet& jet) const { /* make cuts on jet attributes to select clean jets */ bool isClean{true}; float fsmJet; - if(jet -> getAttribute("FracSamplingMax", fsmJet)){ - if(fsmJet > m_fSampMaxTightThreshold && std::abs(jet->eta()) < m_etaTightThreshold){isClean = false;} + if(jet.getAttribute("FracSamplingMax", fsmJet)){ + if(fsmJet > m_fSampMaxTightThreshold && std::abs(jet.eta()) < m_etaTightThreshold){isClean = false;} } else { throw UncleanableJet("Cleaner Cannot retrieve FracSamplingMax"); } float emfJet; - if(jet -> getAttribute("EMFrac", emfJet)){ + if(jet.getAttribute("EMFrac", emfJet)){ if(emfJet < m_emfLowTightThreshold || emfJet > m_emfHighTightThreshold){isClean = false;} } else { throw UncleanableJet("Cleaner Cannot retrieve EMFrac"); } float hecfJet; - if(jet -> getAttribute("HECFrac", hecfJet)){ + if(jet.getAttribute("HECFrac", hecfJet)){ if(hecfJet > m_hecfTightThreshold){isClean = false;} } else { throw UncleanableJet("Cleaner Cannot retrieve HECFrac"); diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetAsIJetFactory.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetAsIJetFactory.cxx index ab7261bdc2a..dca0a394570 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetAsIJetFactory.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetAsIJetFactory.cxx @@ -6,6 +6,6 @@ xAODJetAsIJetFactory::xAODJetAsIJetFactory(): m_ind(-1){} pHypoJet xAODJetAsIJetFactory::operator() (const xAOD::Jet* j){ - return new HypoJet::xAODJetAsIJet(j, ++m_ind); + return pHypoJet(new HypoJet::xAODJetAsIJet(j, ++m_ind)); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetCollector.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetCollector.h index 5c2290e3a3a..f6c6cdb026f 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetCollector.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/xAODJetCollector.h @@ -6,7 +6,6 @@ #define TRIGLHLTJETHYPO_XAODJETCOLLECTOR_H #include "xAODJet/Jet.h" -#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h" #include <vector> @@ -16,9 +15,6 @@ // xAODJetCollector - an object send to a (possibly recursive) // TrigJetHypoToolHelpers to obtain xAOD jets -namespace HypoJet{ - class IJet; -} class xAODJetCollector { @@ -35,7 +31,7 @@ public: auto new_end = std::partition(hypoJets.begin(), hypoJets.end(), - [](const HypoJet::IJet* j){ + [](const pHypoJet& j){ return (j->xAODJet()).has_value();}); // add xAOD::Jet* to m_jets std::vector<const xAOD::Jet*> xJets; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/JetHypoExerciserCompareAlg.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/JetHypoExerciserCompareAlg.cxx index 9fb795a5eb3..dfe58d2cea8 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/JetHypoExerciserCompareAlg.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/JetHypoExerciserCompareAlg.cxx @@ -212,8 +212,8 @@ StatusCode JetHypoExerciserCompareAlg::execute() { bool jagree{true}; for (std::size_t i = 0; i < njets; i++) { - ATH_MSG_INFO(" jet 0 : " << static_cast<const void*>(collected0.at(i)) << - " jet 1 : " << static_cast<const void*>(collected1.at(i))); + ATH_MSG_INFO(" jet 0 : " << static_cast<const void*>(collected0.at(i).get()) << + " jet 1 : " << static_cast<const void*>(collected1.at(i).get())); if (collected0.at(i) != collected1.at(i)) { ATH_MSG_INFO(" jets above differ "); @@ -234,7 +234,6 @@ StatusCode JetHypoExerciserCompareAlg::execute() { } - for (auto p : jv) {delete p;} return StatusCode::SUCCESS; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/RandomSignalEventGenerator.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/RandomSignalEventGenerator.cxx index 33decdcd1a1..345882842a0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/RandomSignalEventGenerator.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/RandomSignalEventGenerator.cxx @@ -80,7 +80,7 @@ RandomSignalHypoJetVectorGenerator::get() { if(m_flip()){ tlv.SetZ(-tlv.Z()); // randomly flip the sign of the +vly generated tlv. } - result.push_back(new TLorentzVectorAsIJet(tlv)); + result.push_back(std::shared_ptr<const HypoJet::IJet>(new TLorentzVectorAsIJet(tlv))); } if(m_nbkgd){ @@ -92,7 +92,7 @@ RandomSignalHypoJetVectorGenerator::get() { if(m_flip()){ tlv.SetZ(-tlv.Z()); // randomly flip the sign of the +vly generated tlv. } - result.push_back(new TLorentzVectorAsIJet(tlv)); + result.push_back(std::shared_ptr<const HypoJet::IJet>(new TLorentzVectorAsIJet(tlv))); } } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/SimpleHypoJetVectorGenerator.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/SimpleHypoJetVectorGenerator.cxx index 890b2c2ad3a..4668443f0f0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/SimpleHypoJetVectorGenerator.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/exerciser/SimpleHypoJetVectorGenerator.cxx @@ -63,7 +63,7 @@ SimpleHypoJetVectorGenerator::get() { const auto& eta = m_etas[i]; const auto& et = m_es[i]; auto tlv = factory->make(eta, et); - result.push_back(new TLorentzVectorAsIJet(tlv)); + result.push_back(std::shared_ptr<const HypoJet::IJet>(new TLorentzVectorAsIJet(tlv))); } if(m_nbkgd){ @@ -81,7 +81,7 @@ SimpleHypoJetVectorGenerator::get() { const auto& en = en_distribution(generator); // depending on the factory, en is e or et auto tlv = factory->make(eta, en); - result.push_back(new TLorentzVectorAsIJet(tlv)); + result.push_back(std::shared_ptr<const HypoJet::IJet>(new TLorentzVectorAsIJet(tlv))); } } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/SpecifiedJetsCondition.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/SpecifiedJetsCondition.cxx index 719ae1b186f..b98f837f6de 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/SpecifiedJetsCondition.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/SpecifiedJetsCondition.cxx @@ -49,7 +49,7 @@ std::string SpecifiedJetsCondition::toString() const noexcept { ss << "group " << count << '\n'; ++count; for(const auto& j : jg){ - auto j_addr = static_cast<const void*>(j); + auto j_addr = static_cast<const void*>(j.get()); ss << j_addr << " "; } } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/Timer.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/Timer.cxx index 48f13f9ebfa..156bd2f77e8 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/Timer.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/Timer.cxx @@ -35,13 +35,13 @@ class Timer{ void timeit(){ HypoJetVector jets; - TLorentzVectorAsIJet j0 (m_tl0); - TLorentzVectorAsIJet j1 (m_tl1); + auto j0 = std::make_shared<TLorentzVectorAsIJet>(m_tl0); + auto j1 =std::make_shared<TLorentzVectorAsIJet>(m_tl1); HypoJetVector jets0; - jets0.push_back(&j0); + jets0.push_back(j0); HypoJetVector jets1; - jets1.push_back(&j1); + jets1.push_back(j1); HypoJetGroupVector jetGroups{jets0, jets1}; std::vector<double> etaMins{-1., -1., -1.}; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/makeHypoJets.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/makeHypoJets.cxx index 4fdfae1690f..f9ffaf623a0 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/makeHypoJets.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/src/makeHypoJets.cxx @@ -15,7 +15,7 @@ HypoJetVector makeHypoJets(const std::vector<double>& etas){ TLorentzVectorFactory factory; auto make_jet = [&factory](double eta){ - return new TLorentzVectorAsIJet(factory.make(eta, 10.)); + return std::shared_ptr<const HypoJet::IJet>(new TLorentzVectorAsIJet(factory.make(eta, 10.))); }; std::transform(etas.begin(), diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/DijetDEtaMassConditionTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/DijetDEtaMassConditionTest.cxx index 04af84e359f..a3f27d25e6b 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/DijetDEtaMassConditionTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/DijetDEtaMassConditionTest.cxx @@ -80,16 +80,16 @@ TEST_F(DijetDEtaMassConditionTest, artefacts){ TEST_F(DijetDEtaMassConditionTest, accepts) { - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - EXPECT_CALL(jet0, et()); - EXPECT_CALL(jet0, eta()); + EXPECT_CALL(*jet0, et()); + EXPECT_CALL(*jet0, eta()); - EXPECT_CALL(jet1, et()); - EXPECT_CALL(jet1, eta()); + EXPECT_CALL(*jet1, et()); + EXPECT_CALL(*jet1, eta()); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; DijetDEtaMassCondition condition({0.5-0.001, 0.5-0.001}, {0.5 + 0.001, 0.5 + 0.001}, @@ -105,16 +105,16 @@ TEST_F(DijetDEtaMassConditionTest, accepts) { TEST_F(DijetDEtaMassConditionTest, belowAbsEtaMinCut) { - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; - EXPECT_CALL(jet0, et()).Times(AnyNumber()); - EXPECT_CALL(jet0, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet0, et()).Times(AnyNumber()); + EXPECT_CALL(*jet0, eta()).Times(AnyNumber()); - EXPECT_CALL(jet1, et()).Times(AnyNumber()); - EXPECT_CALL(jet1, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet1, et()).Times(AnyNumber()); + EXPECT_CALL(*jet1, eta()).Times(AnyNumber()); DijetDEtaMassCondition condition({0.5+0.001, 0.5+0.001}, {0.5 + 0.002, 0.5 + 0.002}, @@ -139,17 +139,16 @@ TEST_F(DijetDEtaMassConditionTest, aboveAbsEtaMaxCut) { {104.2 -0.1}, {104.2 + 0.1}); - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; - + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - EXPECT_CALL(jet0, et()).Times(AnyNumber()); - EXPECT_CALL(jet0, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet0, et()).Times(AnyNumber()); + EXPECT_CALL(*jet0, eta()).Times(AnyNumber()); - EXPECT_CALL(jet1, et()).Times(AnyNumber()); - EXPECT_CALL(jet1, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet1, et()).Times(AnyNumber()); + EXPECT_CALL(*jet1, eta()).Times(AnyNumber()); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; EXPECT_FALSE(condition.isSatisfied(jets)); } @@ -165,17 +164,16 @@ TEST_F(DijetDEtaMassConditionTest, belowYStarCut) { {104.2 + 0.1}); - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - - EXPECT_CALL(jet0, et()).Times(AnyNumber()); - EXPECT_CALL(jet0, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet0, et()).Times(AnyNumber()); + EXPECT_CALL(*jet0, eta()).Times(AnyNumber()); - EXPECT_CALL(jet1, et()).Times(AnyNumber()); - EXPECT_CALL(jet1, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet1, et()).Times(AnyNumber()); + EXPECT_CALL(*jet1, eta()).Times(AnyNumber()); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; EXPECT_FALSE(condition.isSatisfied(jets)); } @@ -191,16 +189,16 @@ TEST_F(DijetDEtaMassConditionTest, aboveYStarCut) { {104.2 -0.1}, {104.2 + 0.1}); - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - EXPECT_CALL(jet0, et()).Times(AnyNumber()); - EXPECT_CALL(jet0, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet0, et()).Times(AnyNumber()); + EXPECT_CALL(*jet0, eta()).Times(AnyNumber()); - EXPECT_CALL(jet1, et()).Times(AnyNumber()); - EXPECT_CALL(jet1, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet1, et()).Times(AnyNumber()); + EXPECT_CALL(*jet1, eta()).Times(AnyNumber()); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; EXPECT_FALSE(condition.isSatisfied(jets)); } @@ -216,16 +214,16 @@ TEST_F(DijetDEtaMassConditionTest, belowMassCut) { {1.0 + 0.001}, {104.2 + 0.1}, {104.2 + 0.2}); - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - EXPECT_CALL(jet0, et()).Times(AnyNumber()); - EXPECT_CALL(jet0, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet0, et()).Times(AnyNumber()); + EXPECT_CALL(*jet0, eta()).Times(AnyNumber()); - EXPECT_CALL(jet1, et()).Times(AnyNumber()); - EXPECT_CALL(jet1, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet1, et()).Times(AnyNumber()); + EXPECT_CALL(*jet1, eta()).Times(AnyNumber()); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; EXPECT_FALSE(condition.isSatisfied(jets)); } @@ -240,16 +238,16 @@ TEST_F(DijetDEtaMassConditionTest, aboveMassCut) { {104.2 - 0.2}, {104.2 - 0.1}); - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - EXPECT_CALL(jet0, et()).Times(AnyNumber()); - EXPECT_CALL(jet0, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet0, et()).Times(AnyNumber()); + EXPECT_CALL(*jet0, eta()).Times(AnyNumber()); - EXPECT_CALL(jet1, et()).Times(AnyNumber()); - EXPECT_CALL(jet1, eta()).Times(AnyNumber()); + EXPECT_CALL(*jet1, et()).Times(AnyNumber()); + EXPECT_CALL(*jet1, eta()).Times(AnyNumber()); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; EXPECT_FALSE(condition.isSatisfied(jets)); } @@ -266,11 +264,11 @@ TEST_F(DijetDEtaMassConditionTest, tooManyJets) { {104.2 -0.1}, {104.2 + 0.1}); - MockJetWithLorentzVector jet0{m_tl0}; - MockJetWithLorentzVector jet1{m_tl1}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + auto jet1 = std::make_shared<MockJetWithLorentzVector>(m_tl1); - HypoJetVector jets{&jet0, &jet1}; - jets.push_back(&jet0); + HypoJetVector jets{jet0, jet1}; + jets.push_back(jet0); EXPECT_THROW(condition.isSatisfied(jets), std::runtime_error); } @@ -287,9 +285,9 @@ TEST_F(DijetDEtaMassConditionTest, tooFewJets) { {104.2 -0.1}, {104.2 + 0.1}); - MockJetWithLorentzVector jet0{m_tl0}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); - HypoJetVector jets{&jet0}; + HypoJetVector jets{jet0}; EXPECT_THROW(condition.isSatisfied(jets), std::runtime_error); diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/EtaEtConditionTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/EtaEtConditionTest.cxx index 1e61ddb66ce..8c44745a155 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/EtaEtConditionTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/EtaEtConditionTest.cxx @@ -62,8 +62,8 @@ TEST_F(EtaEtConditionTest, artefacts){ EXPECT_NEAR(m_tl0.Eta(), m_eta0, m_eps); EXPECT_NEAR(m_tl0.Et(), m_et0, m_eps); - MockJetWithLorentzVector jet0{m_tl0}; - HypoJetVector jets{&jet0}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + HypoJetVector jets{jet0}; EXPECT_EQ(jets.size(), static_cast<unsigned int>(1)); } @@ -73,11 +73,11 @@ TEST_F(EtaEtConditionTest, accepts) { EtaEtCondition condition(-1., 1., 99.99999); - MockJetWithLorentzVector jet0{m_tl0}; - HypoJetVector jets{&jet0}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + HypoJetVector jets{jet0}; - EXPECT_CALL(jet0, et()); - EXPECT_CALL(jet0, eta()); + EXPECT_CALL(*jet0, et()); + EXPECT_CALL(*jet0, eta()); EXPECT_TRUE(condition.isSatisfied(jets)); @@ -92,11 +92,11 @@ TEST_F(EtaEtConditionTest, accepts) { TEST_F(EtaEtConditionTest, belowEtaMinCut) { EtaEtCondition condition(-0.5+0.001, 1., 100.); - MockJetWithLorentzVector jet0{m_tl0}; - HypoJetVector jets{&jet0}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + HypoJetVector jets{jet0}; - EXPECT_CALL(jet0, et()); - EXPECT_CALL(jet0, eta()); + EXPECT_CALL(*jet0, et()); + EXPECT_CALL(*jet0, eta()); EXPECT_FALSE(condition.isSatisfied(jets)); } @@ -105,11 +105,11 @@ TEST_F(EtaEtConditionTest, belowEtaMinCut) { TEST_F(EtaEtConditionTest, aboveEtaMaxCut) { EtaEtCondition condition(-1.0, 0.5-0.001, 100.); - MockJetWithLorentzVector jet0{m_tl0}; - HypoJetVector jets{&jet0}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + HypoJetVector jets{jet0}; - EXPECT_CALL(jet0, et()); - EXPECT_CALL(jet0, eta()); + EXPECT_CALL(*jet0, et()); + EXPECT_CALL(*jet0, eta()); EXPECT_FALSE(condition.isSatisfied(jets)); } @@ -118,11 +118,11 @@ TEST_F(EtaEtConditionTest, aboveEtaMaxCut) { TEST_F(EtaEtConditionTest, belowEtCut) { EtaEtCondition condition(-1.0, 1.0, 100.001); - MockJetWithLorentzVector jet0{m_tl0}; - HypoJetVector jets{&jet0}; + auto jet0 = std::make_shared<MockJetWithLorentzVector>(m_tl0); + HypoJetVector jets{jet0}; - EXPECT_CALL(jet0, et()); - EXPECT_CALL(jet0, eta()); + EXPECT_CALL(*jet0, et()); + EXPECT_CALL(*jet0, eta()); EXPECT_FALSE(condition.isSatisfied(jets)); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LlpCleanerTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LlpCleanerTest.cxx index ccc3d616b9b..01b2824ea1f 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LlpCleanerTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LlpCleanerTest.cxx @@ -65,7 +65,7 @@ TEST(LlpCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1., 1., 1., 1., 1.}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } constexpr float eps = 0.00001; @@ -75,70 +75,70 @@ TEST(LlpCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1.-eps, 1., 1, 1., 1.}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet below fSampMaxTightThreshold, above NegativeE { std::array<float, 5> args{1., 1.-eps, 1, 1., 1.}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet above fSampMaxTightThreshold, above NegativeE { std::array<float, 5> args{1-eps, 1.-eps, 1, 1., 1.}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } // jet above HECFrac below HECQuality below AverageLArQF { std::array<float, 5> args{1., 1., 1-eps, 1., 1.}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet below HECFrac above HECQuality below AverageLArQF { std::array<float, 5> args{1., 1., 1, 1.-eps, 1.}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet below HECFrac below HECQuality above AverageLArQF { std::array<float, 5> args{1., 1., 1, 1., 1.-eps}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet above HECFrac above HECQuality below AverageLArQF { std::array<float, 5> args{1., 1., 1.-eps, 1.-eps, 1.}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet above HECFrac below HECQuality above AverageLArQF { std::array<float, 5> args{1., 1., 1.-eps, 1., 1.-eps}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet below HECFrac above HECQuality above AverageLArQF { std::array<float, 5> args{1., 1., 1., 1.-eps, 1.-eps}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet above HECFrac above HECQuality above AverageLArQF { std::array<float, 5> args{1., 1., 1.-eps, 1.-eps, 1.-eps}; auto cleaner = makeLlpCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } } @@ -153,5 +153,5 @@ TEST(LlpCleanerTest, ThrowsOnUncleanableJet) { - EXPECT_THROW(cleaner(&jet), UncleanableJet); + EXPECT_THROW(cleaner(jet), UncleanableJet); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LooseCleanerTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LooseCleanerTest.cxx index 01fe9f437f4..e10d4dc4d17 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LooseCleanerTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/LooseCleanerTest.cxx @@ -55,7 +55,7 @@ TEST(LooseCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1., 1., 1., 2., 1.}; auto cleaner = makeLooseCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } constexpr float eps = 0.00001; @@ -65,21 +65,21 @@ TEST(LooseCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1.-eps, 1+ eps, 1, 2., 1.}; auto cleaner = makeLooseCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } // jet above fSampMaxTightThreshold, outside applicable eta range { std::array<float, 5> args{1.-eps, 0.5- eps, 1, 2., 1.}; auto cleaner = makeLooseCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet below _emfLowTightThreshold { std::array<float, 5> args{1., 1., 1+eps, 2., 1.}; auto cleaner = makeLooseCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } @@ -87,7 +87,7 @@ TEST(LooseCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1., 1., 0.5, 1.-eps, 1.}; auto cleaner = makeLooseCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } @@ -95,7 +95,7 @@ TEST(LooseCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1., 1., 1.0, 1.0, 1. -eps}; auto cleaner = makeLooseCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } } @@ -110,5 +110,5 @@ TEST(LooseCleanerTest, ThrowsOnUncleanableJet) { - EXPECT_THROW(cleaner(&jet), UncleanableJet); + EXPECT_THROW(cleaner(jet), UncleanableJet); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest.cxx index 6299b3570e3..1640dbd5b07 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest.cxx @@ -88,10 +88,10 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest, tooFewSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl); - MockJetWithLorentzVector jet1{tl}; + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl); + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; std::unique_ptr<IGroupsMatcherMT> matcher(nullptr); matcher.reset(new MaximumBipartiteGroupsMatcherMT(std::move(m_conditions))); @@ -125,26 +125,26 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest, oneSelectedJet){ auto factory = TLorentzVectorFactory(); auto tl = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl); - MockJetWithLorentzVector jet1{tl}; - MockJetWithLorentzVector jet2{tl}; + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl); + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl); + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl); eta = 0; et = 150000; auto tl0 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl0}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl0); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); std::unique_ptr<IGroupsMatcherMT> matcher(nullptr); matcher.reset(new MaximumBipartiteGroupsMatcherMT(std::move(m_conditions))); @@ -178,37 +178,37 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest, twoSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 139; auto tl1 = factory.make(eta, et); - MockJetWithLorentzVector jet1{tl1}; + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 5.; et = 100.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = 0; et = 150; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); std::unique_ptr<IGroupsMatcherMT> matcher(nullptr); matcher.reset(new MaximumBipartiteGroupsMatcherMT(std::move(m_conditions))); @@ -246,37 +246,37 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest, threeSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 139; auto tl1 = factory.make(eta, et); - MockJetWithLorentzVector jet1{tl1}; + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 0.5; et = 141.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = -0.2; et = 101.; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, eta()).Times(m_nconditions); + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); std::unique_ptr<IGroupsMatcherMT> matcher(nullptr); matcher.reset(new MaximumBipartiteGroupsMatcherMT(std::move(m_conditions))); @@ -310,36 +310,36 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest, fourSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 139; auto tl1 = factory.make(eta, et); - MockJetWithLorentzVector jet1{tl1}; + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 0.5; et = 175.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = -0.2; et = 101.; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); std::unique_ptr<IGroupsMatcherMT> matcher(nullptr); matcher.reset(new MaximumBipartiteGroupsMatcherMT(std::move(m_conditions))); @@ -384,36 +384,36 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest, overlappingEtaRegions){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 101; auto tl1 = factory.make(eta, et); - MockJetWithLorentzVector jet1{tl1}; + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 0.1; et = 91.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = 0.1; et = 81.; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(nconditions); - EXPECT_CALL(jet1, eta()).Times(nconditions); - EXPECT_CALL(jet2, eta()).Times(nconditions); - EXPECT_CALL(jet3, eta()).Times(nconditions); + EXPECT_CALL(*jet0, eta()).Times(nconditions); + EXPECT_CALL(*jet1, eta()).Times(nconditions); + EXPECT_CALL(*jet2, eta()).Times(nconditions); + EXPECT_CALL(*jet3, eta()).Times(nconditions); - EXPECT_CALL(jet0, et()).Times(nconditions); - EXPECT_CALL(jet1, et()).Times(nconditions); - EXPECT_CALL(jet2, et()).Times(nconditions); - EXPECT_CALL(jet3, et()).Times(nconditions); + EXPECT_CALL(*jet0, et()).Times(nconditions); + EXPECT_CALL(*jet1, et()).Times(nconditions); + EXPECT_CALL(*jet2, et()).Times(nconditions); + EXPECT_CALL(*jet3, et()).Times(nconditions); std::unique_ptr<IGroupsMatcherMT> matcher(nullptr); matcher.reset(new MaximumBipartiteGroupsMatcherMT(std::move(conditions))); diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest_Multijet.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest_Multijet.cxx index e3a7cbb14a0..addcca6599b 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest_Multijet.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherMTTest_Multijet.cxx @@ -131,8 +131,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj_flowNetworkBuilder_0){ auto G = builder->create(groups.begin(), groups.end(), collector, nodeToJet); EXPECT_FALSE(G.has_value()); - - for(auto j : jets){delete j;} } TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj_flowNetworkBuilder_1){ @@ -188,8 +186,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj_flowNetworkBuilder_1){ EXPECT_TRUE((*G)->V() == 14); EXPECT_TRUE(((*G)->edges()).size() == 13); - - for(auto j : jets){delete j;} } TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj_flowNetworkBuilder_2){ @@ -237,8 +233,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj_flowNetworkBuilder_2){ EXPECT_TRUE((*G)->V() == 14); EXPECT_TRUE(((*G)->edges()).size() == 13); - - for(auto j : jets){delete j;} } @@ -295,8 +289,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj0){ if (m_debug){collector->write();} - for(auto j : jets){delete j;} - EXPECT_TRUE(jetCollector.empty()); EXPECT_FALSE(*pass); } @@ -353,8 +345,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj0){ // // if(m_debug){collector->write();} // -// for(auto j : jets){delete j;} -// // EXPECT_TRUE(jetCollector.empty()); // EXPECT_FALSE(*pass); // } @@ -411,8 +401,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj0){ // // if(m_debug){collector->write();} // -// for(auto j : jets){delete j;} -// // EXPECT_TRUE(jetCollector.empty()); // not xAOD jets // // EXPECT_TRUE(*pass); @@ -468,7 +456,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj0){ // // if(m_debug){collector->write();} // -// for(auto j : jets){delete j;} // EXPECT_TRUE(jetCollector.empty()); //not xAOD jets // EXPECT_TRUE(*pass); // } @@ -531,8 +518,6 @@ TEST_F(MaximumBipartiteGroupsMatcherMTTest_Multijet, mj0){ // // if(m_debug){collector->write();} // -// for(auto j : jets){delete j;} -// // EXPECT_TRUE(jetCollector.empty()); // not xAOD jets // EXPECT_TRUE(*pass); // } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherTest.cxx index 23a53fe61e6..b813e7417cb 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/MaximumBipartiteGroupsMatcherTest.cxx @@ -85,10 +85,10 @@ TEST_F(MaximumBipartiteGroupsMatcherTest, tooFewSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl); - MockJetWithLorentzVector jet1{tl}; + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl); + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl); - HypoJetVector jets{&jet0, &jet1}; + HypoJetVector jets{jet0, jet1}; auto groups = makeJetGroups(jets.begin(), jets.end()); MaximumBipartiteGroupsMatcher matcher(m_conditions); @@ -109,26 +109,26 @@ TEST_F(MaximumBipartiteGroupsMatcherTest, oneSelectedJet){ auto factory = TLorentzVectorFactory(); auto tl = factory.make(eta, et); - MockJetWithLorentzVector jet0(tl); - MockJetWithLorentzVector jet1{tl}; - MockJetWithLorentzVector jet2{tl}; + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl); + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl); + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl); eta = 0; et = 150; auto tl0 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl0}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl0); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); auto groups = makeJetGroups(jets.begin(), jets.end()); @@ -150,38 +150,35 @@ TEST_F(MaximumBipartiteGroupsMatcherTest, twoSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 139; auto tl1 = factory.make(eta, et); - - MockJetWithLorentzVector jet1{tl1}; - + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 5.; et = 100.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = 0; et = 150; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); MaximumBipartiteGroupsMatcher matcher(m_conditions); auto groups = makeJetGroups(jets.begin(), jets.end()); @@ -204,38 +201,34 @@ TEST_F(MaximumBipartiteGroupsMatcherTest, threeSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 139; auto tl1 = factory.make(eta, et); - - MockJetWithLorentzVector jet1{tl1}; - + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 0.5; et = 141.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = -0.2; et = 101.; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, eta()).Times(m_nconditions); - - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); MaximumBipartiteGroupsMatcher matcher(m_conditions); auto groups = makeJetGroups(jets.begin(), jets.end()); @@ -258,37 +251,35 @@ TEST_F(MaximumBipartiteGroupsMatcherTest, fourSelectedJets){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 139; auto tl1 = factory.make(eta, et); - - MockJetWithLorentzVector jet1{tl1}; + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 0.5; et = 175.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = -0.2; et = 101.; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(m_nconditions); - EXPECT_CALL(jet1, eta()).Times(m_nconditions); - EXPECT_CALL(jet2, eta()).Times(m_nconditions); - EXPECT_CALL(jet3, eta()).Times(m_nconditions); + EXPECT_CALL(*jet0, eta()).Times(m_nconditions); + EXPECT_CALL(*jet1, eta()).Times(m_nconditions); + EXPECT_CALL(*jet2, eta()).Times(m_nconditions); + EXPECT_CALL(*jet3, eta()).Times(m_nconditions); - EXPECT_CALL(jet0, et()).Times(m_nconditions); - EXPECT_CALL(jet1, et()).Times(m_nconditions); - EXPECT_CALL(jet2, et()).Times(m_nconditions); - EXPECT_CALL(jet3, et()).Times(m_nconditions); + EXPECT_CALL(*jet0, et()).Times(m_nconditions); + EXPECT_CALL(*jet1, et()).Times(m_nconditions); + EXPECT_CALL(*jet2, et()).Times(m_nconditions); + EXPECT_CALL(*jet3, et()).Times(m_nconditions); MaximumBipartiteGroupsMatcher matcher(m_conditions); auto groups = makeJetGroups(jets.begin(), jets.end()); @@ -320,37 +311,34 @@ TEST_F(MaximumBipartiteGroupsMatcherTest, overlappingEtaRegions){ auto factory = TLorentzVectorFactory(); auto tl0 = factory.make(eta, et); - - MockJetWithLorentzVector jet0(tl0); + auto jet0 = std::make_shared<const MockJetWithLorentzVector>(tl0); eta = 0.1; et = 101; auto tl1 = factory.make(eta, et); - - MockJetWithLorentzVector jet1{tl1}; - + auto jet1 = std::make_shared<const MockJetWithLorentzVector>(tl1); eta = 0.1; et = 91.; auto tl2 = factory.make(eta, et); - MockJetWithLorentzVector jet2{tl2}; + auto jet2 = std::make_shared<const MockJetWithLorentzVector>(tl2); eta = 0.1; et = 81.; auto tl3 = factory.make(eta, et); - MockJetWithLorentzVector jet3{tl3}; + auto jet3 = std::make_shared<const MockJetWithLorentzVector>(tl3); - HypoJetVector jets{&jet0, &jet1, &jet2, &jet3}; + HypoJetVector jets{jet0, jet1, jet2, jet3}; - EXPECT_CALL(jet0, eta()).Times(nconditions); - EXPECT_CALL(jet1, eta()).Times(nconditions); - EXPECT_CALL(jet2, eta()).Times(nconditions); - EXPECT_CALL(jet3, eta()).Times(nconditions); + EXPECT_CALL(*jet0, eta()).Times(nconditions); + EXPECT_CALL(*jet1, eta()).Times(nconditions); + EXPECT_CALL(*jet2, eta()).Times(nconditions); + EXPECT_CALL(*jet3, eta()).Times(nconditions); - EXPECT_CALL(jet0, et()).Times(nconditions); - EXPECT_CALL(jet1, et()).Times(nconditions); - EXPECT_CALL(jet2, et()).Times(nconditions); - EXPECT_CALL(jet3, et()).Times(nconditions); + EXPECT_CALL(*jet0, et()).Times(nconditions); + EXPECT_CALL(*jet1, et()).Times(nconditions); + EXPECT_CALL(*jet2, et()).Times(nconditions); + EXPECT_CALL(*jet3, et()).Times(nconditions); MaximumBipartiteGroupsMatcher matcher(conditions); auto groups = makeJetGroups(jets.begin(), jets.end()); diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGrouperTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGrouperTest.cxx index 1090afa4716..e8143f21e18 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGrouperTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGrouperTest.cxx @@ -40,7 +40,7 @@ TEST(PartitionsGrouperTest, test0){ constexpr double eta{0.5}; for(int i = 1; i < 6; ++i){ auto tlv = factory.make(eta, i); - TLorentzVectorAsIJet* tl_j = new TLorentzVectorAsIJet(tlv); + auto tl_j = std::make_shared<TLorentzVectorAsIJet>(tlv); jets.push_back(tl_j); } @@ -59,10 +59,6 @@ TEST(PartitionsGrouperTest, test0){ EXPECT_TRUE(groupVector[0].size()== 2); // two jets first group EXPECT_TRUE(groupVector[1].size()== 3); // three jets second group } - - auto b = jets.begin(); - auto e = jets.end(); - for(auto iter = b; iter != e; ++iter){delete *iter;} } TEST(PartitionsGrouperTest, test1){ @@ -76,7 +72,7 @@ TEST(PartitionsGrouperTest, test1){ constexpr double eta{0.5}; for(int i = 1; i < 10; ++i){ auto tlv = factory.make(eta, i); - TLorentzVectorAsIJet* tl_j = new TLorentzVectorAsIJet(tlv); + auto tl_j = std::make_shared<TLorentzVectorAsIJet>(tlv); jets.push_back(tl_j); } @@ -96,10 +92,6 @@ TEST(PartitionsGrouperTest, test1){ EXPECT_TRUE(groupVector[1].size()== 3); // three jets second group EXPECT_TRUE(groupVector[2].size()== 1); // one jet third group } - - auto b = jets.begin(); - auto e = jets.end(); - for(auto iter = b; iter != e; ++iter){delete *iter;} } @@ -114,7 +106,7 @@ TEST(PartitionsGrouperTest, test2){ constexpr double eta{0.5}; for(int i = 1; i < 5; ++i){ auto tlv = factory.make(eta, i); - TLorentzVectorAsIJet* tl_j = new TLorentzVectorAsIJet(tlv); + auto tl_j = std::make_shared<TLorentzVectorAsIJet>(tlv); jets.push_back(tl_j); } @@ -128,10 +120,6 @@ TEST(PartitionsGrouperTest, test2){ // need to place 5 jets in 2 conditions // 5.4.3.2/(2!3!) ways to do this (j1j2 and j2j1 in c1 is counted once). EXPECT_TRUE(groupVectors.size() == 0); - - auto b = jets.begin(); - auto e = jets.end(); - for(auto iter = b; iter != e; ++iter){delete *iter;} } @@ -147,7 +135,7 @@ TEST(PartitionsGrouperTest, SingleJetGrouperBehavioiur){ constexpr double eta{0.5}; for(int i = 1; i < 7; ++i){ auto tlv = factory.make(eta, i); - TLorentzVectorAsIJet* tl_j = new TLorentzVectorAsIJet(tlv); + auto tl_j = std::make_shared<TLorentzVectorAsIJet>(tlv); jets.push_back(tl_j); } @@ -177,10 +165,6 @@ TEST(PartitionsGrouperTest, SingleJetGrouperBehavioiur){ EXPECT_TRUE(jv.size() == 1); } } - - auto b = jets.begin(); - auto e = jets.end(); - for(auto iter = b; iter != e; ++iter){delete *iter;} } @@ -198,7 +182,7 @@ TEST(PartitionsGrouperTest, CombinationsGrouperBehavioiur){ constexpr double eta{0.5}; for(int i = 1; i < 7; ++i){ auto tlv = factory.make(eta, i); - TLorentzVectorAsIJet* tl_j = new TLorentzVectorAsIJet(tlv); + auto tl_j = std::make_shared<TLorentzVectorAsIJet>(tlv); jets.push_back(tl_j); } @@ -235,10 +219,6 @@ TEST(PartitionsGrouperTest, CombinationsGrouperBehavioiur){ EXPECT_TRUE(jv.size() == 2); } } - - auto b = jets.begin(); - auto e = jets.end(); - for(auto iter = b; iter != e; ++iter){delete *iter;} } TEST(PartitionsGrouperTest, FullPartitionGrouperBehavioiur){ @@ -253,7 +233,7 @@ TEST(PartitionsGrouperTest, FullPartitionGrouperBehavioiur){ constexpr double eta{0.5}; for(int i = 1; i < 7; ++i){ auto tlv = factory.make(eta, i); - TLorentzVectorAsIJet* tl_j = new TLorentzVectorAsIJet(tlv); + auto tl_j = std::make_shared<TLorentzVectorAsIJet>(tlv); jets.push_back(tl_j); } @@ -295,9 +275,5 @@ TEST(PartitionsGrouperTest, FullPartitionGrouperBehavioiur){ EXPECT_TRUE(jv.size() == 1); } } - - auto b = jets.begin(); - auto e = jets.end(); - for(auto iter = b; iter != e; ++iter){delete *iter;} } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGroupsMatcherMTTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGroupsMatcherMTTest.cxx index 333e68a3e4a..b6708b3f4df 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGroupsMatcherMTTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/PartitionsGroupsMatcherMTTest.cxx @@ -93,7 +93,7 @@ TEST_F(PartitionsGroupsMatcherMTTest, tooFewSelectedJets){ auto factory = TLorentzVectorFactory(); auto tlv = factory.make(eta, et); - TLorentzVectorAsIJet* tl_j = new TLorentzVectorAsIJet(tlv); + auto tl_j = std::make_shared<const TLorentzVectorAsIJet>(tlv); HypoJetVector jets; jets.push_back(tl_j); @@ -137,7 +137,7 @@ TEST_F(PartitionsGroupsMatcherMTTest, PassingJets){ auto factory = TLorentzVectorFactory(); auto makeJetFromEt = [&factory, eta](double et){ - return new TLorentzVectorAsIJet(factory.make(eta, et)); + return std::make_shared<const TLorentzVectorAsIJet>(factory.make(eta, et)); }; std::transform(ets.begin(), @@ -199,7 +199,7 @@ TEST_F(PartitionsGroupsMatcherMTTest, Passing3Failing1){ auto factory = TLorentzVectorFactory(); auto makeJetFromEt = [&factory, eta](double et){ - return new TLorentzVectorAsIJet(factory.make(eta, et)); + return std::make_shared<const TLorentzVectorAsIJet>(factory.make(eta, et)); }; std::transform(ets.begin(), @@ -241,8 +241,6 @@ TEST_F(PartitionsGroupsMatcherMTTest, Passing3Failing1){ // calls: 4 jets, conditions need three: 4.3.2 = 24 // pass: ignore failing jet. 3.2.1 = 6 EXPECT_EQ(npass, 6u); - EXPECT_EQ(ncall, 24u); - - for(auto& j : jets){delete j;} + EXPECT_EQ(ncall, 24u); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/TightCleanerTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/TightCleanerTest.cxx index 7ad64fa8b1d..2f2b665de39 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/TightCleanerTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/TightCleanerTest.cxx @@ -58,7 +58,7 @@ TEST(TightCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1., 1., 1., 2., 1.}; auto cleaner = makeCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } constexpr float eps = 0.00001; @@ -68,21 +68,21 @@ TEST(TightCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1.-eps, 1+ eps, 1, 2., 1.}; auto cleaner = makeCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } // jet above fSampMaxTightThreshold, outside applicable eta range { std::array<float, 5> args{1.-eps, 0.5- eps, 1, 2., 1.}; auto cleaner = makeCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_TRUE(cleaner(&jet)); + EXPECT_TRUE(cleaner(jet)); } // jet below _emfLowTightThreshold { std::array<float, 5> args{1., 1., 1+eps, 2., 1.}; auto cleaner = makeCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } @@ -90,7 +90,7 @@ TEST(TightCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1., 1., 0.5, 1.-eps, 1.}; auto cleaner = makeCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } @@ -98,7 +98,7 @@ TEST(TightCleanerTest, SimpleThresholds) { { std::array<float, 5> args{1., 1., 1.0, 1.0, 1. -eps}; auto cleaner = makeCleaner(args[0], args[1], args[2], args[3], args[4]); - EXPECT_FALSE(cleaner(&jet)); + EXPECT_FALSE(cleaner(jet)); } } @@ -113,5 +113,5 @@ TEST(TightCleanerTest, ThrowsOnUncleanableJet) { - EXPECT_THROW(cleaner(&jet), UncleanableJet); + EXPECT_THROW(cleaner(jet), UncleanableJet); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/xAODJetCollectorTest.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/xAODJetCollectorTest.cxx index 04abacad611..fe3713ff9ee 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/xAODJetCollectorTest.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/tests/xAODJetCollectorTest.cxx @@ -35,13 +35,11 @@ TEST_F(xAODJetCollectorTest, multipleInputJets){ //multiple jets in. Jet collector is not empty and has the correct number. constexpr std::size_t njets{11}; - HypoJetVector jets; std::vector<xAOD::Jet> xaodjets (njets); - std::vector<HypoJet::xAODJetAsIJet> ijets; - ijets.reserve (njets); + HypoJetVector jets; + jets.reserve (njets); for(unsigned int ijet = 0; ijet < njets; ++ijet){ - ijets.emplace_back (&xaodjets[ijet], ijet); - jets.push_back(&ijets.back()); + jets.emplace_back (new HypoJet::xAODJetAsIJet(&xaodjets[ijet], ijet)); } xAODJetCollector collector; @@ -57,12 +55,10 @@ TEST_F(xAODJetCollectorTest, nonXAODJets){ unsigned int njets{11}; HypoJetVector jets; - std::vector<TLorentzVectorAsIJet> ijets; - ijets.reserve (njets); + jets.reserve (njets); for(unsigned int ijet = 0; ijet < njets; ++ijet){ TLorentzVector v; - ijets.emplace_back (v); - jets.push_back(&ijets.back()); + jets.emplace_back (new TLorentzVectorAsIJet(v)); } xAODJetCollector collector; -- GitLab