From 515fd97e5d0c52a6432948f99f063040b67fe891 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Tue, 13 Dec 2022 09:51:44 +0100 Subject: [PATCH 1/6] TrigJetMonitoring: pass string by reference --- Trigger/TrigMonitoring/TrigJetMonitoring/src/DataStructs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/src/DataStructs.h b/Trigger/TrigMonitoring/TrigJetMonitoring/src/DataStructs.h index b1e255e3728f..110ecd65b1e1 100644 --- a/Trigger/TrigMonitoring/TrigJetMonitoring/src/DataStructs.h +++ b/Trigger/TrigMonitoring/TrigJetMonitoring/src/DataStructs.h @@ -9,7 +9,7 @@ class JetData { public: -JetData(float et, float eta, float phi, std::string et_label) : +JetData(float et, float eta, float phi, const std::string& et_label) : m_et{et}, m_eta{eta}, m_phi{phi}, m_et_label{et_label}{} float m_et; -- GitLab From 21e15aef35c1ff615f34764e86b01e1a793da5f1 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Tue, 13 Dec 2022 09:55:43 +0100 Subject: [PATCH 2/6] TrigMETMonitoring: cppcheck fix (nullptr) --- .../src/TrigMETMonitorAlgorithm.cxx | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx index 0c0b1a02d51c..1c6f48559ad0 100644 --- a/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigMETMonitoring/src/TrigMETMonitorAlgorithm.cxx @@ -452,23 +452,25 @@ StatusCode TrigMETMonitorAlgorithm::fillHistograms( const EventContext& ctx ) co if ( offline_met_cont.isValid() && offline_met_cont->size() > 0 ) { finalTrkMET = ((*offline_met_cont)["FinalTrk"]); muonsMET = ((*offline_met_cont)["Muons"]); - - offline_Ex = - finalTrkMET->mpx()/Gaudi::Units::GeV; - offline_Ey = - finalTrkMET->mpy()/Gaudi::Units::GeV; - offline_sumEt = finalTrkMET->sumet()/Gaudi::Units::GeV; - offline_Et = std::sqrt(offline_Ex*offline_Ex + offline_Ey*offline_Ey); - offline_Et_eff = std::sqrt(offline_Ex*offline_Ex + offline_Ey*offline_Ey); - fill(tool,offline_Ex,offline_Ey,offline_Et,offline_sumEt); - - if(finalTrkMET && muonsMET){ - xAOD::MissingET finalTrkNoMuMET = *finalTrkMET - *muonsMET; - offline_NoMu_Ex = - finalTrkNoMuMET.mpx()/Gaudi::Units::GeV; - offline_NoMu_Ey = - finalTrkNoMuMET.mpy()/Gaudi::Units::GeV; - offline_NoMu_sumEt = finalTrkNoMuMET.sumet()/Gaudi::Units::GeV; - offline_NoMu_Et = std::sqrt(offline_NoMu_Ex*offline_NoMu_Ex + offline_NoMu_Ey*offline_NoMu_Ey); - offline_NoMu_Et_eff = std::sqrt(offline_NoMu_Ex*offline_NoMu_Ex + offline_NoMu_Ey*offline_NoMu_Ey); - fill(tool,offline_NoMu_Ex,offline_NoMu_Ey,offline_NoMu_Et,offline_NoMu_sumEt); - } + + if(finalTrkMET) { + offline_Ex = - finalTrkMET->mpx()/Gaudi::Units::GeV; + offline_Ey = - finalTrkMET->mpy()/Gaudi::Units::GeV; + offline_sumEt = finalTrkMET->sumet()/Gaudi::Units::GeV; + offline_Et = std::sqrt(offline_Ex*offline_Ex + offline_Ey*offline_Ey); + offline_Et_eff = std::sqrt(offline_Ex*offline_Ex + offline_Ey*offline_Ey); + fill(tool,offline_Ex,offline_Ey,offline_Et,offline_sumEt); + + if(muonsMET){ + xAOD::MissingET finalTrkNoMuMET = *finalTrkMET - *muonsMET; + offline_NoMu_Ex = - finalTrkNoMuMET.mpx()/Gaudi::Units::GeV; + offline_NoMu_Ey = - finalTrkNoMuMET.mpy()/Gaudi::Units::GeV; + offline_NoMu_sumEt = finalTrkNoMuMET.sumet()/Gaudi::Units::GeV; + offline_NoMu_Et = std::sqrt(offline_NoMu_Ex*offline_NoMu_Ex + offline_NoMu_Ey*offline_NoMu_Ey); + offline_NoMu_Et_eff = std::sqrt(offline_NoMu_Ex*offline_NoMu_Ex + offline_NoMu_Ey*offline_NoMu_Ey); + fill(tool,offline_NoMu_Ex,offline_NoMu_Ey,offline_NoMu_Et,offline_NoMu_sumEt); + } + } } // access L1 MET values -- GitLab From 48c101ae8d2a9cb53c8f901182c6d7345d8b11de Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Tue, 13 Dec 2022 09:57:26 +0100 Subject: [PATCH 3/6] TrigMinBiasMonitoring: fixed signed bit shift overflow --- .../TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx index e283a00a2c45..b57e4f841a7d 100644 --- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx +++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx @@ -190,7 +190,7 @@ StatusCode HLTMinBiasTrkMonAlg::monitorTrkCounts(const EventContext& context) co int nhits = 0; uint32_t pattern = trk->hitPattern(); for (int bit = 0; bit < 32; bit++) - nhits += (pattern & (1 << bit) ? 1 : 0); + nhits += (pattern & (1u << bit) ? 1 : 0); return nhits; }; auto trkHits = Collection("trkHits", *offlineTrkHandle, getNhits); -- GitLab From 10a6dc244c5de86933258c0cc6de677fcede6c01 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Tue, 13 Dec 2022 09:59:39 +0100 Subject: [PATCH 4/6] TrigMuonMonitoring: pass string by reference --- .../TrigMuonMonitoring/src/MuonMatchingTool.h | 6 +++--- .../TrigMuonMonitoring/src/MuonMatchingTool.icc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.h b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.h index 2279d9a908ac..70384a0f1c31 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.h +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.h @@ -278,7 +278,7 @@ class MuonMatchingTool : public AthAlgTool { private: enum L1Items{ L1B_MU3V=1, L1B_MU5VF=2, L1B_MU8F=3, L1B_MU14FCH=6, L1B_MU14FCHR=6 , L1E_MU3V=1, L1E_MU5VF=3, L1E_MU8F=6, L1E_MU14FCH=12, L1E_MU14FCHR=12, ERROR}; - int L1ItemStringToInt(std::string l1item, int roiSource) const { + int L1ItemStringToInt(const std::string& l1item, int roiSource) const { if( "L1_MU3V"==l1item) return roiSource==0 ? L1Items::L1B_MU3V : L1Items::L1E_MU3V; if( "L1_MU5VF"==l1item) return roiSource==0 ? L1Items::L1B_MU5VF : L1Items::L1E_MU5VF; if( "L1_MU8F"==l1item) return roiSource==0 ? L1Items::L1B_MU8F : L1Items::L1E_MU8F; @@ -321,7 +321,7 @@ class MuonMatchingTool : public AthAlgTool { */ template<class T, class OFFL> const TrigCompositeUtils::LinkInfo<DataVector<T> > matchLinkInfo(const OFFL *offl, std::string trigger, float reqdR, bool &pass, - const std::string containerSGKey = "", + const std::string& containerSGKey = "", std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*) = &MuonMatchingTool::trigPosForMatch<T>) const; /** @@ -337,7 +337,7 @@ class MuonMatchingTool : public AthAlgTool { * @todo Consider improving the argument list. */ template<class T, class OFFL> const T* match(const OFFL *offl, std::string trigger, float reqdR, bool &pass, - const std::string containerSGKey = "", + const std::string& containerSGKey = "", std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*) = &MuonMatchingTool::trigPosForMatch<T>) const; /** diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.icc b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.icc index 581deda15fde..3cf355fe3787 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.icc +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/MuonMatchingTool.icc @@ -49,7 +49,7 @@ const T* MuonMatchingTool :: matchReadHandle(const OFFL* offl, float reqdR, template<class T, class OFFL> const T* MuonMatchingTool :: match(const OFFL* offl, std::string trig, float reqdR, bool &pass, - const std::string containerSGKey, + const std::string& containerSGKey, std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*)) const { ATH_MSG_DEBUG("MuonMonitoring::match<T>"); @@ -70,7 +70,7 @@ const T* MuonMatchingTool :: match(const OFFL* offl, std::string trig, float req template<class T, class OFFL> const TrigCompositeUtils::LinkInfo<DataVector<T> > MuonMatchingTool :: matchLinkInfo(const OFFL* offl, std::string trig, float reqdR, bool &pass, - const std::string containerSGKey, + const std::string& containerSGKey, std::tuple<bool,double,double> (*trigPosForMatchFunc)(const T*)) const { ATH_MSG_DEBUG("MuonMonitoring::matchLinkInfo<T>"); -- GitLab From ee8fa6694c471aada25d14b4fd53c1d4215b5bfe Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Tue, 13 Dec 2022 10:02:17 +0100 Subject: [PATCH 5/6] TrigSteerMonitor: cppcheck fixes --- .../TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx | 4 ++-- .../TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx index 286569d7c539..8154d879471e 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx @@ -96,7 +96,7 @@ StatusCode TrigSignatureMoni::start() { if ( x > 0 ){ std::string outputRateName ("Rate" + std::to_string(m_duration) + "s"); m_rateHistogram.init(outputRateName, "Rate of positive decisions;chain;step", - x, yr, m_bookingPath + "/" + name() + '/' + outputRateName.c_str(), m_histSvc).ignore(); + x, yr, m_bookingPath + "/" + name() + '/' + outputRateName, m_histSvc).ignore(); ATH_CHECK(initHist(m_rateHistogram.getHistogram(), hltMenuHandle, false)); ATH_CHECK(initHist(m_rateHistogram.getBuffer(), hltMenuHandle, false)); } @@ -112,7 +112,7 @@ StatusCode TrigSignatureMoni::start() { if (xc > 0){ std::string outputSequenceName ("SequencesExecutionRate" + std::to_string(m_duration) + "s"); m_sequenceHistogram.init(outputSequenceName, "Rate of sequences execution;sequence;rate", - xc, yc, m_bookingPath + "/" + name() + '/' + outputSequenceName.c_str(), m_histSvc).ignore(); + xc, yc, m_bookingPath + "/" + name() + '/' + outputSequenceName, m_histSvc).ignore(); ATH_CHECK(initSeqHist(m_sequenceHistogram.getHistogram(), sequencesSet)); ATH_CHECK(initSeqHist(m_sequenceHistogram.getBuffer(), sequencesSet)); } diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h index 5bda1771bc28..18b8b5208db5 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.h @@ -49,6 +49,7 @@ class TrigSignatureMoni : public extends<AthReentrantAlgorithm, IIncidentListene // Class representing asynchronously published histograms class RateHistogram { public: + RateHistogram() = default; ~RateHistogram(); // Initialize rate histogram and create buffer -- GitLab From 4cf5bcac23a36609cc0395f398f1ca6d460be611 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier <frank.winklmeier@cern.ch> Date: Tue, 13 Dec 2022 10:04:23 +0100 Subject: [PATCH 6/6] TrigTauMonitoring: pass vector by reference --- .../TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h index a2d6a685814f..30f91efc86b6 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h @@ -81,7 +81,7 @@ class TrigTauMonitorAlgorithm : public AthMonitorAlgorithm { return sqrt(deta*deta + dphi*dphi); }; - inline bool HLTMatching(const xAOD::TauJet* offline_tau, std::vector<const xAOD::TauJet*> online_tau_vec, float threshold) const + inline bool HLTMatching(const xAOD::TauJet* offline_tau, const std::vector<const xAOD::TauJet*>& online_tau_vec, float threshold) const { for(auto online_tau: online_tau_vec){ float deltaR = dR(offline_tau->eta(),offline_tau->phi(), online_tau->eta(),online_tau->phi()); @@ -103,7 +103,7 @@ class TrigTauMonitorAlgorithm : public AthMonitorAlgorithm { return false; }; - inline bool HLTTruthMatching(const xAOD::TruthParticle* true_taus, const std::vector<const xAOD::TauJet*> online_tau_vec, float threshold) const + inline bool HLTTruthMatching(const xAOD::TruthParticle* true_taus, const std::vector<const xAOD::TauJet*>& online_tau_vec, float threshold) const { for(auto online_tau: online_tau_vec){ float deltaR = dR(true_taus->eta(),true_taus->phi(), online_tau->eta(),online_tau->phi()); -- GitLab