Skip to content
Snippets Groups Projects
Commit 105ad0ad authored by Adam Edward Barton's avatar Adam Edward Barton :speech_balloon:
Browse files

Merge branch 'cppcheck.InDetServMatGeoModel-20200928' into 'master'

InDetServMatGeoModel: Fix cppcheck warnings.

See merge request !36779
parents f02d471e c60fbf39
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!36779InDetServMatGeoModel: Fix cppcheck warnings.
Showing
with 28 additions and 28 deletions
......@@ -143,11 +143,11 @@ public:
double sctInnerSupport() const;
// Pixel support tubes dimensions: specify name from simple services table
double SupportTubeRMin(std::string name) const;
double SupportTubeRMax(std::string name) const;
double SupportTubeZMin(std::string name) const;
double SupportTubeZMax(std::string name) const;
int SupportTubeExists(std::string name) const;
double SupportTubeRMin(const std::string& name) const;
double SupportTubeRMax(const std::string& name) const;
double SupportTubeZMin(const std::string& name) const;
double SupportTubeZMax(const std::string& name) const;
int SupportTubeExists(const std::string& name) const;
private:
// Record sets
......@@ -188,7 +188,7 @@ private:
InDetMaterialManager * m_matMgr;
// index of named support tube in m_InDetSimpleServices table, -1 if not found. Could be cached for speed.
int SupportTubeIndex(std::string name) const;
int SupportTubeIndex(const std::string& name) const;
};
......
/*
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 ServiceMaterial_H
......@@ -19,8 +19,8 @@ public:
If the weight is zero it will be taken from the material DB
*/
struct Entry {
Entry( std::string nam, int num, bool lin) : name(nam), number(num), linear(lin), weight(1) {}
Entry( std::string nam, int num, bool lin, double w) : name(nam), number(num), linear(lin), weight(w) {}
Entry( const std::string& nam, int num, bool lin) : name(nam), number(num), linear(lin), weight(1) {}
Entry( const std::string& nam, int num, bool lin, double w) : name(nam), number(num), linear(lin), weight(w) {}
std::string name;
int number;
......@@ -55,7 +55,7 @@ public:
//ServiceMaterial operator*( double len) const {return ServiceMaterial( name(), len*linearWeight(), m_components);}
void multiply( int factor) {
for ( std::vector< Entry>::iterator i=m_components.begin(); i!=m_components.end(); i++) {
for ( std::vector< Entry>::iterator i=m_components.begin(); i!=m_components.end(); ++i) {
i->number *= factor;
}
}
......
/*
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 ServicesTracker_H
......@@ -46,7 +46,7 @@ public:
const std::vector<ServiceVolume*>& serviceVolumes() const {return m_volumes;}
// Called by Routing
void setServiceVolumes( const std::vector<ServiceVolume*> vc) {m_volumes=vc;}
void setServiceVolumes( const std::vector<ServiceVolume*>& vc) {m_volumes=vc;}
// methods called by Builder
void constructBarrelLayer( double radius, double zHalfLength,
......
/*
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 StaveServices_H
......@@ -17,7 +17,7 @@ class StaveServices {
public:
StaveServices( DetType::Type type, DetType::Part part, int layer,
int nhv, int ndcs, int ndata, std::vector<int> lvGauge) :
int nhv, int ndcs, int ndata, const std::vector<int>& lvGauge) :
m_type( type), m_part(part), m_layer(layer),
m_numHV(nhv), m_numDCS( ndcs), m_numData( ndata), m_lvGauge( lvGauge) {}
......
......@@ -161,7 +161,7 @@ void InDetServMatBuilderToolSLHC::build()
fixMissingMaterials();
typedef std::vector<ServiceVolume*>::const_iterator iter;
for (iter i=tracker->serviceVolumes().begin(); i!=tracker->serviceVolumes().end(); i++) {
for (iter i=tracker->serviceVolumes().begin(); i!=tracker->serviceVolumes().end(); ++i) {
/*
msg(MSG::INFO) << "Calling ServiceVolume->dump() for the " << n++ << "th time" << endmsg;
(**i).dump(); // for DEBUG only
......@@ -219,7 +219,7 @@ void InDetServMatBuilderToolSLHC::addServiceVolume( const ServiceVolume& vol)
param->setZmax(vol.zMax());
param->setZsymm(true);
for (std::vector<ServiceMaterial>::const_iterator ism=vol.materials().begin(); ism!=vol.materials().end(); ++ism) {
for ( ServiceMaterial::EntryIter ient= ism->components().begin(); ient!=ism->components().end(); ient++) {
for ( ServiceMaterial::EntryIter ient= ism->components().begin(); ient!=ism->components().end(); ++ient) {
/*
msg(MSG::INFO) << "Inside components loop, comp = " << ient->name
<< " number " << ient->number
......
......@@ -105,7 +105,7 @@ bool InDetServMatGeometryManager::buildServices() const
return false;
}
int InDetServMatGeometryManager::SupportTubeIndex(std::string name) const
int InDetServMatGeometryManager::SupportTubeIndex(const std::string& name) const
{
for (unsigned int i = 0; i < db()->getTableSize(m_InDetSimpleServices); i++)
{
......@@ -114,35 +114,35 @@ int InDetServMatGeometryManager::SupportTubeIndex(std::string name) const
return -1;
}
double InDetServMatGeometryManager::SupportTubeRMin(std::string name) const
double InDetServMatGeometryManager::SupportTubeRMin(const std::string& name) const
{
int ind = SupportTubeIndex(name);
if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "RMIN", ind);
return 0;
}
double InDetServMatGeometryManager::SupportTubeRMax(std::string name) const
double InDetServMatGeometryManager::SupportTubeRMax(const std::string& name) const
{
int ind = SupportTubeIndex(name);
if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "RMAX", ind);
return 0;
}
double InDetServMatGeometryManager::SupportTubeZMin(std::string name) const
double InDetServMatGeometryManager::SupportTubeZMin(const std::string& name) const
{
int ind = SupportTubeIndex(name);
if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "ZMIN", ind);
return 0;
}
double InDetServMatGeometryManager::SupportTubeZMax(std::string name) const
double InDetServMatGeometryManager::SupportTubeZMax(const std::string& name) const
{
int ind = SupportTubeIndex(name);
if (ind >= 0) return db()->getDouble(m_InDetSimpleServices, "ZMAX", ind);
return 0;
}
int InDetServMatGeometryManager::SupportTubeExists(std::string name) const
int InDetServMatGeometryManager::SupportTubeExists(const std::string& name) const
{
if (SupportTubeIndex(name) != -1) return 1;
return 0;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetServMatGeoModel/Route.h"
......@@ -21,7 +21,7 @@ ServiceVolume* Route::entryVolume( double pos, bool ascending, Athena::MsgStream
// else {
//should iterate to find exit volume
if ( ascending) {
for (VolumeContainer::const_iterator i=volumes().begin(); i!=volumes().end(); i++) {
for (VolumeContainer::const_iterator i=volumes().begin(); i!=volumes().end(); ++i) {
msg << MSG::DEBUG << "Comparing " << pos << " and " << (**i).position() << endmsg;
......@@ -57,7 +57,7 @@ ServiceVolume* Route::exitVolume( bool ascending, Athena::MsgStreamMember& msg)
// returns the volume closest to the exit point, coming from the given direction
if (volumes().empty()) return 0;
if ( ascending) {
for (VolumeContainer::const_iterator i=volumes().begin(); i!=volumes().end(); i++) {
for (VolumeContainer::const_iterator i=volumes().begin(); i!=volumes().end(); ++i) {
if ((**i).contains(exit())) return *i;
else {
msg << MSG::DEBUG << "volume at pos " << (**i).radius()
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "InDetServMatGeoModel/ServiceVolume.h"
......@@ -23,7 +23,7 @@ void ServiceVolume::dump( bool dumpMaterial) const
if ( dumpMaterial && !materials().empty()) {
for (std::vector<ServiceMaterial>::const_iterator i=materials().begin(); i!=materials().end(); ++i) {
cout << " service material " << i->name() << " has the following components" << endl;
for ( ServiceMaterial::EntryIter ient= i->components().begin(); ient!=i->components().end(); ient++) {
for ( ServiceMaterial::EntryIter ient= i->components().begin(); ient!=i->components().end(); ++ient) {
cout << ient->name << " linear? " << ient->linear
<< " number " << ient->number
<< " l/w " << ient->weight
......
......@@ -85,7 +85,7 @@ void ServicesTracker::finaliseServices()
std::map<const ServicesLayer*, ServiceMaterial> layerMaterial; // cache the layer services
typedef std::vector<ServiceVolume*>::iterator VolumeIter;
for (VolumeIter iv=m_volumes.begin(); iv!=m_volumes.end(); iv++) {
for (VolumeIter iv=m_volumes.begin(); iv!=m_volumes.end(); ++iv) {
std::vector<ServiceMaterial> result; // = (**iv).materials(); // preserve already present mat. (EOS)
if ((**iv).isEOS()) addEosMaterial(**iv, result);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment