From 97d05749d096091fe07f6a25d1088ff58d066d6f Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Fri, 16 Oct 2020 09:50:03 -0400 Subject: [PATCH] LArG4Code: Fix cppcheck warnings. - Pass class instances by const reference, not by value. --- LArCalorimeter/LArG4/LArG4Code/LArG4Code/CalibrationHit.h | 2 +- LArCalorimeter/LArG4/LArG4Code/LArG4Code/LArG4SimpleSD.h | 8 ++++---- LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h | 4 ++-- LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc | 4 ++-- LArCalorimeter/LArG4/LArG4Code/src/SDWrapper.cc | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/LArCalorimeter/LArG4/LArG4Code/LArG4Code/CalibrationHit.h b/LArCalorimeter/LArG4/LArG4Code/LArG4Code/CalibrationHit.h index 340425b93c3..e03ea922a74 100644 --- a/LArCalorimeter/LArG4/LArG4Code/LArG4Code/CalibrationHit.h +++ b/LArCalorimeter/LArG4/LArG4Code/LArG4Code/CalibrationHit.h @@ -40,7 +40,7 @@ namespace LArG4 { m_energy3(0.) {} - CalibrationHit(LArG4Identifier ident, + CalibrationHit(const LArG4Identifier& ident, G4double energy0 = 0., G4double energy1 = 0., G4double energy2 = 0., diff --git a/LArCalorimeter/LArG4/LArG4Code/LArG4Code/LArG4SimpleSD.h b/LArCalorimeter/LArG4/LArG4Code/LArG4Code/LArG4SimpleSD.h index 683d3f29d8f..1b7d3978de0 100644 --- a/LArCalorimeter/LArG4/LArG4Code/LArG4Code/LArG4SimpleSD.h +++ b/LArCalorimeter/LArG4/LArG4Code/LArG4Code/LArG4SimpleSD.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#ifndef LARG4SIMPLESD_H -#define LARG4SIMPLESD_H +#ifndef LARG4CODE_LARG4SIMPLESD_H +#define LARG4CODE_LARG4SIMPLESD_H #include "G4VSensitiveDetector.hh" @@ -69,7 +69,7 @@ public: G4bool ProcessHits(G4Step* a_step, G4TouchableHistory*) override; /// First method translates to this - also for fast sims - G4bool SimpleHit( LArG4Identifier lar_id , G4double time , G4double energy ); + G4bool SimpleHit( const LArG4Identifier& lar_id , G4double time , G4double energy ); /// End of athena event processing void EndOfAthenaEvent( LArHitContainer* hitContnainer ); diff --git a/LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h b/LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h index b3411d40b2e..5e2bc3e0539 100644 --- a/LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h +++ b/LArCalorimeter/LArG4/LArG4Code/LArG4Code/SDWrapper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef LARG4CODE_SDWRAPPER_H @@ -58,7 +58,7 @@ namespace LArG4 using SDList_t = std::vector< std::unique_ptr<SDType> >; /// Construct the wrapper from the output collection name - SDWrapper(const std::string& name, const std::string& hitCollectionName, std::string deadHitCollectionName=""); + SDWrapper(const std::string& name, const std::string& hitCollectionName, const std::string& deadHitCollectionName=""); /// Add an SD to this wrapper void addSD(std::unique_ptr<SDType> sd); diff --git a/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc b/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc index c4ad33d8c76..bf8889111a4 100644 --- a/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc +++ b/LArCalorimeter/LArG4/LArG4Code/src/LArG4SimpleSD.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "LArG4Code/LArG4SimpleSD.h" @@ -136,7 +136,7 @@ G4bool LArG4SimpleSD::ProcessHits(G4Step* a_step,G4TouchableHistory*) return result; } -G4bool LArG4SimpleSD::SimpleHit( LArG4Identifier lar_id , G4double time , G4double energy ) +G4bool LArG4SimpleSD::SimpleHit( const LArG4Identifier& lar_id , G4double time , G4double energy ) { // Build the hit from the calculator results. Identifier id = ConvertID( lar_id ); diff --git a/LArCalorimeter/LArG4/LArG4Code/src/SDWrapper.cc b/LArCalorimeter/LArG4/LArG4Code/src/SDWrapper.cc index 45c50c3b297..924ab1668bf 100644 --- a/LArCalorimeter/LArG4/LArG4Code/src/SDWrapper.cc +++ b/LArCalorimeter/LArG4/LArG4Code/src/SDWrapper.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "LArG4Code/SDWrapper.h" @@ -26,7 +26,7 @@ namespace LArG4 //------------------------------------------------------------------------- template<class SDType, class HitContainerType> SDWrapper<SDType, HitContainerType>:: - SDWrapper(const std::string& name, const std::string& hitCollectionName, std::string deadHitCollectionName) + SDWrapper(const std::string& name, const std::string& hitCollectionName, const std::string& deadHitCollectionName) : G4VSensitiveDetector(name), m_hitCollName(hitCollectionName), m_hitColl(hitCollectionName), -- GitLab