From 1dc74d2a104cd1700281823dc4e66a026a4404db Mon Sep 17 00:00:00 2001
From: christos <christos@cern.ch>
Date: Tue, 10 May 2022 00:46:33 +0200
Subject: [PATCH] ALFA_BeamTransport, Prophecy4fControl , TrigServices,
 TrigT2CaloCommon, TrigmuComb: uninit member,reference, move fixes

---
 .../ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx    |  3 ++-
 .../ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.h  |  8 ++++----
 .../ALFA_LocRec/src/ALFA_LocRec.cxx                   |  2 +-
 .../ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.h |  2 +-
 Generators/Prophecy4fControl/src/Prophecy4fMerger.cxx |  4 ++--
 Generators/Prophecy4fControl/src/Prophecy4fMerger.h   |  4 ++--
 .../TrigServices/src/HltROBDataProviderSvc.cxx        |  4 ++--
 .../TrigControl/TrigServices/src/TrigMessageSvc.h     |  2 +-
 LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.h |  2 +-
 .../TrigT2CaloCommon/TrigT2CaloCommon/LArCellCont.h   |  2 +-
 .../TrigT2CaloCommon/src/TestCaloDataAccess.cxx       |  6 +++---
 .../TrigT2CaloCommon/src/TrigCaloDataAccessSvc.h      |  2 +-
 Trigger/TrigAlgorithms/TrigmuComb/src/muCombUtil.cxx  | 11 ++++++-----
 13 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx
index 1d794cb86c7e..1a1c43757008 100644
--- a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx
+++ b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTrack.cxx
@@ -28,6 +28,7 @@
 
 
 #include <iostream>
+#include <utility>
 
 //constructor
 ALFA_BeamTrack::ALFA_BeamTrack()
@@ -143,7 +144,7 @@ int ALFA_BeamTrack::initialize(const FPConfig &ConfigValues){
 //calculates Position and Momentum at RP
 int ALFA_BeamTrack::CalculatePosRP(FPTracker::Particle particle){
   
-	FPTracker::Particle Particle=particle;
+	FPTracker::Particle Particle=std::move(particle);
 	FPTracker::Point lost_markerMom(-99,-99,-99); 
 	
 
diff --git a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.h b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.h
index 99a4628893a1..0caf025e4522 100644
--- a/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.h
+++ b/ForwardDetectors/ALFA/ALFA_BeamTransport/src/ALFA_BeamTransport.h
@@ -104,8 +104,8 @@ class ALFA_BeamTransport : public ::AthAlgorithm
 	  FPTracker::Point m_MomRP1;
 	  FPTracker::Point m_MomRP3;
 	  
-	  double m_EnergyRP1;
-	  double m_EnergyRP3;
+	  double m_EnergyRP1 = 0.0;
+	  double m_EnergyRP3 = 0.0;
 	  
 	  std::string m_FPOutputBeam1;
 	  std::string m_FPOutputBeam2;
@@ -114,9 +114,9 @@ class ALFA_BeamTransport : public ::AthAlgorithm
 	  //The two counters have to be set zero at the beginning at each execute run since 
 	  //for every new call of the execute() funktion they have to be zero
 	  //counter for particles marked as outgoing in event record
-	  int m_pcount;
+	  int m_pcount = 0;
 	  //counter for particles marked as incomming in event record
-	  int m_pint;
+	  int m_pint = 0;
 
 	  double m_EtaCut;
 	  double m_XiCut;
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.cxx b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.cxx
index f32658b122f6..5e9ccc97ba12 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.cxx
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.cxx
@@ -671,7 +671,7 @@ void ALFA_LocRec::SaveGeometry()
 	ATH_MSG_DEBUG("end ALFA_LocRec::SaveGeometry()");
 }
 
-StatusCode ALFA_LocRec::ExecuteRecoMethod(const std::string strAlgo, const eRPotName eRPName, const std::list<MDHIT> &ListMDHits, const std::list<ODHIT> &ListODHits)
+StatusCode ALFA_LocRec::ExecuteRecoMethod(const std::string& strAlgo, const eRPotName eRPName, const std::list<MDHIT> &ListMDHits, const std::list<ODHIT> &ListODHits)
 {
 	//MsgStream LogStream(Athena::getMessageSvc(), "ALFA_LocRec::ExecuteRecoMethod()");
 	ATH_MSG_DEBUG("begin ALFA_LocRec::ExecuteRecoMethod()");
diff --git a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.h b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.h
index 9ae65a373bde..d18c913d11bb 100644
--- a/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.h
+++ b/ForwardDetectors/ALFA/ALFA_Reconstruction/ALFA_LocRec/src/ALFA_LocRec.h
@@ -149,7 +149,7 @@ class ALFA_LocRec : public AthAlgorithm
 
 		StatusCode RecordCollection();
 		StatusCode RecordODCollection();
-		StatusCode ExecuteRecoMethod(const std::string strAlgo, const eRPotName eRPName, const std::list<MDHIT> &ListMDHits, const std::list<ODHIT> &ListODHits);
+		StatusCode ExecuteRecoMethod(const std::string& strAlgo, const eRPotName eRPName, const std::list<MDHIT> &ListMDHits, const std::list<ODHIT> &ListODHits);
 };
 
 #endif	//ALFA_LOCREC_h
diff --git a/Generators/Prophecy4fControl/src/Prophecy4fMerger.cxx b/Generators/Prophecy4fControl/src/Prophecy4fMerger.cxx
index aadf2c1bc23e..a5d90e943fd5 100644
--- a/Generators/Prophecy4fControl/src/Prophecy4fMerger.cxx
+++ b/Generators/Prophecy4fControl/src/Prophecy4fMerger.cxx
@@ -486,8 +486,8 @@ void Prophecy4fMerger::merge(){
     }
 }
 
-bool Prophecy4fMerger::isPHevent(TLorentzVector higgs,
-                                 TLorentzVector sum_daugh_rest_init){
+bool Prophecy4fMerger::isPHevent(const TLorentzVector& higgs,
+                                 const TLorentzVector& sum_daugh_rest_init){
 
     if( std::abs(higgs.M()-sum_daugh_rest_init.M())>m_deltaM ){
         ANA_MSG_INFO("POWHEG event with Higgs off-mass shell: " << higgs.M() << " GeV");
diff --git a/Generators/Prophecy4fControl/src/Prophecy4fMerger.h b/Generators/Prophecy4fControl/src/Prophecy4fMerger.h
index f38fe617382f..343e77921da2 100644
--- a/Generators/Prophecy4fControl/src/Prophecy4fMerger.h
+++ b/Generators/Prophecy4fControl/src/Prophecy4fMerger.h
@@ -84,8 +84,8 @@ public:
     void merge();
 
     /*Verify if POWHEG event has Higgs off-mass shell */
-    bool isPHevent(TLorentzVector higgs,
-                   TLorentzVector sum_daugh_rest_init);
+    bool isPHevent(const TLorentzVector& higgs,
+                   const TLorentzVector& sum_daugh_rest_init);
 
     /* Set Particles Mass */
     double setParticleMass(int id) const;
diff --git a/HLT/Trigger/TrigControl/TrigServices/src/HltROBDataProviderSvc.cxx b/HLT/Trigger/TrigControl/TrigServices/src/HltROBDataProviderSvc.cxx
index 1b536c1a302c..e59cc077ada3 100644
--- a/HLT/Trigger/TrigControl/TrigServices/src/HltROBDataProviderSvc.cxx
+++ b/HLT/Trigger/TrigControl/TrigServices/src/HltROBDataProviderSvc.cxx
@@ -75,7 +75,7 @@ StatusCode HltROBDataProviderSvc::initialize()
 
   // print list of ROBs to filter out by status code
   ATH_MSG_INFO(" ---> Filter out specific ROBs by Status Code: # ROBs              = " << m_filterRobMap.size());
-  for (auto it : m_filterRobMap) {
+  for (const auto& it : m_filterRobMap) {
     eformat::helper::SourceIdentifier tmpsrc(it.first);
     ATH_MSG_INFO("      RobId=0x" << MSG::hex << it.first << " -> in Sub Det = " << tmpsrc.human_detector());
 
@@ -90,7 +90,7 @@ StatusCode HltROBDataProviderSvc::initialize()
 
   // print list of subdetectors to filter out by status code
   ATH_MSG_INFO(" ---> Filter out Sub Detector ROBs by Status Code: # Sub Detectors = " << m_filterSubDetMap.size());
-  for (auto it : m_filterSubDetMap) {
+  for (const auto& it : m_filterSubDetMap) {
     eformat::helper::SourceIdentifier tmpsrc(it.first, 0);
     ATH_MSG_INFO("      SubDetId=0x" << MSG::hex << it.first << " -> " << tmpsrc.human_detector());
     for (auto it_status : it.second) {
diff --git a/HLT/Trigger/TrigControl/TrigServices/src/TrigMessageSvc.h b/HLT/Trigger/TrigControl/TrigServices/src/TrigMessageSvc.h
index 9f90ccf75584..71cdde90c028 100644
--- a/HLT/Trigger/TrigControl/TrigServices/src/TrigMessageSvc.h
+++ b/HLT/Trigger/TrigControl/TrigServices/src/TrigMessageSvc.h
@@ -180,7 +180,7 @@ private:
   };
 
   std::map<std::string, MsgAry> m_sourceMap;     ///< counts per source
-  std::array<int, MSG::NUM_LEVELS> m_msgCount;   ///< counts per level
+  std::array<int, MSG::NUM_LEVELS> m_msgCount{};   ///< counts per level
   std::map<size_t, unsigned int> m_msgHashCount; ///< counts per message hash
   std::unordered_map<EventContext::ContextID_t,
                      std::pair<EventContext::ContextEvt_t, MsgAry>> m_slotMsgCount; ///< counts per slot and level
diff --git a/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.h b/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.h
index ff0d6073812a..bb832e1748d8 100644
--- a/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.h
+++ b/LArCalorimeter/LArROD/src/LArCalibDigitsAccumulator.h
@@ -121,7 +121,7 @@ private:
    * @brief Event counter
    * */
   unsigned int m_event_counter;
-  unsigned int m_eventNb;
+  unsigned int m_eventNb = 0U;
 
   // Information to remove certain readings if needed
   std::map<std::string, std::map<int,std::vector<int>*>*>           m_readingsMap;
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/TrigT2CaloCommon/LArCellCont.h b/Trigger/TrigAlgorithms/TrigT2CaloCommon/TrigT2CaloCommon/LArCellCont.h
index 3efc61217a0d..5b8d373b22e1 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/TrigT2CaloCommon/LArCellCont.h
+++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/TrigT2CaloCommon/LArCellCont.h
@@ -114,7 +114,7 @@ private:
 	/** A tool to help mask cells */
 	//const ILArBadChannelMasker  *m_masker;
 	/** A tool to help mask febs */
-	const ILArBadFebMasker *m_badFebMasker;
+	const ILArBadFebMasker *m_badFebMasker = nullptr;
 	/** List of Missing ROBs to be disabled at the RS */
 	std::vector<uint32_t> m_MissingROBs;
 	/** hash references to BCID */
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TestCaloDataAccess.cxx b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TestCaloDataAccess.cxx
index 018abae3281d..66d2b5b77c0d 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TestCaloDataAccess.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TestCaloDataAccess.cxx
@@ -69,7 +69,7 @@ public:
   void firstCall() override { 
     Gaudi::Hive::setCurrentContext (m_context);
     if ( m_roi.isFullscan() ) {
-      struct timeval t1,t2;
+      struct timeval t1{},t2{};
       gettimeofday(&t1,NULL);
       m_statusRef = request( *m_colRef );
       m_statusRef.ignore(); 
@@ -88,7 +88,7 @@ public:
       
     } else {
       
-      struct timeval t1,t2;
+      struct timeval t1{},t2{};
       gettimeofday(&t1,NULL);
       m_statusRef = request( m_selRef );
       m_statusRef.ignore();
@@ -314,7 +314,7 @@ StatusCode TestCaloDataAccess::execute( const EventContext& context ) const {
   if ( m_emulateFixedRoIs ) emulateFixedRoIs ( context, allRoIs );
 
     
-  timeval ti1,ti2;
+  timeval ti1{},ti2{};
   gettimeofday(&ti1,NULL);
   bool result = ParallelCallTest::launchTests( 2, allRoIs);
   gettimeofday(&ti2,NULL);
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigCaloDataAccessSvc.h b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigCaloDataAccessSvc.h
index 1072343f5def..558c08385299 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigCaloDataAccessSvc.h
+++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/src/TrigCaloDataAccessSvc.h
@@ -184,7 +184,7 @@ class TrigCaloDataAccessSvc : public extends<AthService, ITrigCaloDataAccessSvc>
   std::vector<uint32_t> m_vrodid32fullDet;
   std::vector<uint32_t> m_vrodid32tile;
   std::vector<unsigned int> m_mbts_add_rods;
-  const std::vector<unsigned int>* m_mbts_rods;
+  const std::vector<unsigned int>* m_mbts_rods = nullptr;
   std::vector<IdentifierHash> m_rIdstile;
   std::vector<std::vector<uint32_t> > m_vrodid32fullDetHG;
   size_t m_nSlots;
diff --git a/Trigger/TrigAlgorithms/TrigmuComb/src/muCombUtil.cxx b/Trigger/TrigAlgorithms/TrigmuComb/src/muCombUtil.cxx
index 4ceab564c217..8d7ce3a5b7d8 100644
--- a/Trigger/TrigAlgorithms/TrigmuComb/src/muCombUtil.cxx
+++ b/Trigger/TrigAlgorithms/TrigmuComb/src/muCombUtil.cxx
@@ -13,6 +13,7 @@
 // *********************************************************************
 #include <iostream>
 #include <math.h>
+#include <utility>
 
 #include "muCombUtil.h"
 #include "TrigMuonEvent/MuonFeature.h"
@@ -197,11 +198,11 @@ int whichECRegion( const float eta, const float phi ) {
     double AbsEta   = fabs(eta_id);
 
     std::vector<double> vec;
-    if (AbsEta < 1.05) vec = barrelvec;
-    else if (AbsEta>=1.05 && AbsEta<1.35) vec = ec1vec;
-    else if (AbsEta>=1.35 && AbsEta<1.65) vec = ec2vec;
-    else if (AbsEta>=1.65 && AbsEta<2.0)  vec = ec3vec;
-    else vec = ec4vec;
+    if (AbsEta < 1.05) vec = std::move(barrelvec);
+    else if (AbsEta>=1.05 && AbsEta<1.35) vec = std::move(ec1vec);
+    else if (AbsEta>=1.35 && AbsEta<1.65) vec = std::move(ec2vec);
+    else if (AbsEta>=1.65 && AbsEta<2.0)  vec = std::move(ec3vec);
+    else vec = std::move(ec4vec);
 
     return vec[0]*AbsPtInv+vec[1]/1000.;
   }
-- 
GitLab