Skip to content

Commit

Permalink
Merge pull request #20242 from ianna/dd-geom-performance-unnecessary-…
Browse files Browse the repository at this point in the history
…value-param

DetectorDescription and Geometry Clang Check performance-unnecessary-value-param
  • Loading branch information
cmsbuild committed Aug 23, 2017
2 parents 04416c4 + 34fa334 commit 97fcf11
Show file tree
Hide file tree
Showing 76 changed files with 173 additions and 157 deletions.
2 changes: 1 addition & 1 deletion DetectorDescription/Core/interface/DDCompactView.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class DDCompactView

void position (const DDLogicalPart & self,
const DDLogicalPart & parent,
std::string copyno,
const std::string& copyno,
const DDTranslation & trans,
const DDRotation & rot,
const DDDivision * div = nullptr);
Expand Down
2 changes: 1 addition & 1 deletion DetectorDescription/Core/src/DDCompactView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ double DDCompactView::weight(const DDLogicalPart & p) const

void DDCompactView::position (const DDLogicalPart & self,
const DDLogicalPart & parent,
std::string copyno,
const std::string& copyno,
const DDTranslation & trans,
const DDRotation & rot,
const DDDivision * div)
Expand Down
8 changes: 4 additions & 4 deletions DetectorDescription/Parser/src/DDLRotationAndReflection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ DDLRotationAndReflection::processElement( const std::string& name, const std::st
//

int
DDLRotationAndReflection::isLeftHanded (DD3Vector x, DD3Vector y, DD3Vector z, const std::string & nmspace)
DDLRotationAndReflection::isLeftHanded (const DD3Vector& x, const DD3Vector& y, const DD3Vector& z, const std::string & nmspace)
{
int ret = 0;

Expand Down Expand Up @@ -173,7 +173,7 @@ DDLRotationAndReflection::isLeftHanded (DD3Vector x, DD3Vector y, DD3Vector z, c
}

DD3Vector
DDLRotationAndReflection::makeX(std::string nmspace)
DDLRotationAndReflection::makeX(const std::string& nmspace)
{
DD3Vector x;
DDXMLAttribute atts = getAttributeSet();
Expand All @@ -191,7 +191,7 @@ DDLRotationAndReflection::makeX(std::string nmspace)
}

DD3Vector
DDLRotationAndReflection::makeY(std::string nmspace)
DDLRotationAndReflection::makeY(const std::string& nmspace)
{
DD3Vector y;
DDXMLAttribute atts = getAttributeSet();
Expand All @@ -209,7 +209,7 @@ DDLRotationAndReflection::makeY(std::string nmspace)
return y;
}

DD3Vector DDLRotationAndReflection::makeZ(std::string nmspace)
DD3Vector DDLRotationAndReflection::makeZ(const std::string& nmspace)
{
DD3Vector z;
DDXMLAttribute atts = getAttributeSet();
Expand Down
8 changes: 4 additions & 4 deletions DetectorDescription/Parser/src/DDLRotationAndReflection.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class DDLRotationAndReflection final : public DDXMLElement
DDLRotationAndReflection( DDLElementRegistry* myreg );

/// returns 1 = left handed rotation matrix, 0 = right-handed, -1 = not orthonormal.
int isLeftHanded( DD3Vector x, DD3Vector y, DD3Vector z, const std::string & nmspace );
int isLeftHanded( const DD3Vector& x, const DD3Vector& y, const DD3Vector& z, const std::string & nmspace );

void processElement( const std::string& name, const std::string& nmspace, DDCompactView& cpv ) override;

private:

DD3Vector makeX( std::string nmspace );
DD3Vector makeY( std::string nmspace );
DD3Vector makeZ( std::string nmspace );
DD3Vector makeX( const std::string& nmspace );
DD3Vector makeY( const std::string& nmspace );
DD3Vector makeZ( const std::string& nmspace );
};

#endif
6 changes: 3 additions & 3 deletions DetectorDescription/Parser/test/testDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DDLTestDoc : public DDLDocumentProvider
/// ReadConfig
int readConfig( const std::string& filename ) override;

void emplace_back( std::string fileName, std::string url = std::string( "./" ));
void emplace_back( const std::string& fileName, const std::string& url = std::string( "./" ));

void setSchemaLocation( std::string path = std::string( "../../DDSchema" ));

Expand Down Expand Up @@ -94,7 +94,7 @@ DDLTestDoc::getURLList( void ) const
}

void
DDLTestDoc::emplace_back( std::string fileName, std::string url )
DDLTestDoc::emplace_back( const std::string& fileName, const std::string& url )
{
fnames_.emplace_back(fileName);
urls_.emplace_back(url);
Expand All @@ -110,7 +110,7 @@ DDLTestDoc::doValidation( void ) const

void
DDLTestDoc::setSchemaLocation( std::string path )
{ schemaLoc_ = path; }
{ schemaLoc_ = std::move(path); }

std::string
DDLTestDoc::getSchemaLocation( void ) const
Expand Down
2 changes: 1 addition & 1 deletion DetectorDescription/RegressionTest/test/tutorial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void debugHistory(const DDGeoHistory & h)
}
}

void goPersistent(const DDCompactView & cv, std::string file) {
void goPersistent(const DDCompactView & cv, const std::string& file) {
std::ofstream f(file.c_str());
typedef DDCompactView::graph_type graph_t;
const graph_t & g = cv.graph();
Expand Down
4 changes: 2 additions & 2 deletions Geometry/CSCGeometry/interface/CSCChamber.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class CSCChamber : public GeomDet {

public:

CSCChamber( const BoundPlane::BoundPlanePointer bp, CSCDetId id, const CSCChamberSpecs* specs ) :
CSCChamber( const BoundPlane::BoundPlanePointer& bp, CSCDetId id, const CSCChamberSpecs* specs ) :
GeomDet( bp ), theChamberSpecs( specs ),
theComponents(6,(const CSCLayer*)0) {
theComponents(6,(const CSCLayer*)nullptr) {
setDetId(id);
}

Expand Down
2 changes: 1 addition & 1 deletion Geometry/CSCGeometry/interface/CSCLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CSCLayer : public GeomDetUnit {

public:

CSCLayer( const BoundPlane::BoundPlanePointer sp, CSCDetId id, const CSCChamber* ch, const CSCLayerGeometry* geo ) :
CSCLayer( const BoundPlane::BoundPlanePointer& sp, CSCDetId id, const CSCChamber* ch, const CSCLayerGeometry* geo ) :
GeomDetUnit( sp ), theId( id ), theChamber( ch ), theGeometry( geo ) {
setDetId(id);
}
Expand Down
10 changes: 5 additions & 5 deletions Geometry/CSCGeometryBuilder/src/CSCGeometryBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CSCGeometryBuilder::CSCGeometryBuilder() : myName("CSCGeometryBuilder"){}
CSCGeometryBuilder::~CSCGeometryBuilder(){}


void CSCGeometryBuilder::build( std::shared_ptr<CSCGeometry> theGeometry
void CSCGeometryBuilder::build( const std::shared_ptr<CSCGeometry>& theGeometry
, const RecoIdealGeometry& rig
, const CSCRecoDigiParameters& cscpars ) {

Expand Down Expand Up @@ -117,7 +117,7 @@ void CSCGeometryBuilder::build( std::shared_ptr<CSCGeometry> theGeometry
}

void CSCGeometryBuilder::buildChamber (
std::shared_ptr<CSCGeometry> theGeometry // the geometry container
const std::shared_ptr<CSCGeometry>& theGeometry // the geometry container
, CSCDetId chamberId // the DetId for this chamber
, const std::vector<float>& fpar // volume parameters hB, hT. hD, hH
, const std::vector<float>& fupar // user parameters
Expand Down Expand Up @@ -161,10 +161,10 @@ void CSCGeometryBuilder::buildChamber (
LogTrace(myName) << myName <<": CSCChamberSpecs::build requested for ME" << jstat << jring ;
int chamberType = CSCChamberSpecs::whatChamberType( jstat, jring );
const CSCChamberSpecs* aSpecs = theGeometry->findSpecs( chamberType );
if ( !fupar.empty() && aSpecs == 0 ) {
if ( !fupar.empty() && aSpecs == nullptr ) {
// make new one:
aSpecs = theGeometry->buildSpecs (chamberType, fpar, fupar, wg);
} else if ( fupar.empty() && aSpecs == 0 ) {
} else if ( fupar.empty() && aSpecs == nullptr ) {
edm::LogError(myName) << "SHOULD BE THROW? Error, wg and/or fupar size are 0 BUT this Chamber Spec has not been built!";
}

Expand Down Expand Up @@ -269,7 +269,7 @@ void CSCGeometryBuilder::buildChamber (
// extra-careful check that we haven't already built this layer
const CSCLayer* cLayer = dynamic_cast<const CSCLayer*> (theGeometry->idToDet( layerId ) );

if ( cLayer == 0 ) {
if ( cLayer == nullptr ) {

// build the layer - need the chamber's specs and an appropriate layer-geometry
const CSCChamberSpecs* aSpecs = chamber->specs();
Expand Down
4 changes: 2 additions & 2 deletions Geometry/CSCGeometryBuilder/src/CSCGeometryBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CSCGeometryBuilder {
virtual ~CSCGeometryBuilder();

/// Build the geometry
void build( std::shared_ptr<CSCGeometry> theGeometry
void build( const std::shared_ptr<CSCGeometry>& theGeometry
, const RecoIdealGeometry& rig
, const CSCRecoDigiParameters& cscpars ) ;

Expand All @@ -37,7 +37,7 @@ class CSCGeometryBuilder {
private:
/// Build one CSC chamber, and its component layers, and add them to the geometry
void buildChamber (
std::shared_ptr<CSCGeometry> theGeometry // the geometry container
const std::shared_ptr<CSCGeometry>& theGeometry // the geometry container
, CSCDetId chamberId // the DetId of this chamber
, const std::vector<float>& fpar // volume parameters
, const std::vector<float>& fupar // user parameters
Expand Down
4 changes: 3 additions & 1 deletion Geometry/CSCGeometryBuilder/src/CSCGeometryBuilderFromDDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <FWCore/Utilities/interface/Exception.h>

#include <utility>


CSCGeometryBuilderFromDDD::CSCGeometryBuilderFromDDD() : myName("CSCGeometryBuilderFromDDD"){}

Expand All @@ -26,7 +28,7 @@ void CSCGeometryBuilderFromDDD::build(std::shared_ptr<CSCGeometry> geom, const D
throw cms::Exception("CSCGeometryBuilderFromDDD", "Failed to build the necessary objects from the DDD");
}
CSCGeometryBuilder realbuilder;
realbuilder.build(geom, rig, rdp);
realbuilder.build(std::move(geom), rig, rdp);
// return realbuilder.build(rig, rdp);

}
4 changes: 2 additions & 2 deletions Geometry/CaloEventSetup/interface/CaloGeometryDBReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class CaloGeometryDBReader
static void write( TrVec& /*tvec*/,
DimVec& /*dvec*/,
IVec& /*ivec*/,
std::string /*str*/ ) {}
const std::string& /*str*/ ) {}

static void writeIndexed( const TrVec& /*tvec*/,
const DimVec& /*dvec*/,
const IVec& /*ivec*/,
const std::vector<uint32_t>& /*dins*/,
std::string /*tag*/ ) {}
const std::string& /*tag*/ ) {}

static bool writeFlag() { return false ; }

Expand Down
4 changes: 2 additions & 2 deletions Geometry/CaloEventSetup/interface/CaloGeometryDBWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CaloGeometryDBWriter
static void write( const TrVec& tvec,
const DimVec& dvec,
const IVec& ivec,
std::string tag )
const std::string& tag )
{
const IVec dins;
PCaloGeometry* peg = new PCaloGeometry( tvec, dvec, ivec, dins );
Expand Down Expand Up @@ -54,7 +54,7 @@ class CaloGeometryDBWriter
const DimVec& dvec,
const IVec& ivec,
const IVec& dins,
std::string tag )
const std::string& tag )
{
PCaloGeometry* peg = new PCaloGeometry( tvec, dvec, ivec, dins );

Expand Down
3 changes: 2 additions & 1 deletion Geometry/CaloTopology/interface/EcalBarrelTopology.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef GEOMETRY_CALOTOPOLOGY_ECALBARRELTOPOLOGY_H
#define GEOMETRY_CALOTOPOLOGY_ECALBARRELTOPOLOGY_H 1

#include <utility>
#include <vector>
#include <iostream>
#include "DataFormats/EcalDetId/interface/EBDetId.h"
Expand All @@ -19,7 +20,7 @@ class EcalBarrelTopology final : public CaloSubdetectorTopology
~EcalBarrelTopology() override { }

/// create a new Topology from geometry
EcalBarrelTopology(edm::ESHandle<CaloGeometry> theGeom) : theGeom_(theGeom)
EcalBarrelTopology(edm::ESHandle<CaloGeometry> theGeom) : theGeom_(std::move(theGeom))
{
}

Expand Down
3 changes: 2 additions & 1 deletion Geometry/CaloTopology/interface/EcalEndcapTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include <utility>
#include <vector>
#include <iostream>

Expand All @@ -18,7 +19,7 @@ class EcalEndcapTopology final : public CaloSubdetectorTopology {
~EcalEndcapTopology() override { }

/// create a new Topology from geometry
EcalEndcapTopology(edm::ESHandle<CaloGeometry> theGeom) : theGeom_(theGeom)
EcalEndcapTopology(edm::ESHandle<CaloGeometry> theGeom) : theGeom_(std::move(theGeom))
{
}

Expand Down
3 changes: 2 additions & 1 deletion Geometry/CaloTopology/interface/EcalPreshowerTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include <utility>
#include <vector>
#include <iostream>

Expand All @@ -18,7 +19,7 @@ class EcalPreshowerTopology final : public CaloSubdetectorTopology {
~EcalPreshowerTopology() override { }

/// create a new Topology from geometry
EcalPreshowerTopology(edm::ESHandle<CaloGeometry> theGeom) : theGeom_(theGeom)
EcalPreshowerTopology(edm::ESHandle<CaloGeometry> theGeom) : theGeom_(std::move(theGeom))
{
}

Expand Down
6 changes: 3 additions & 3 deletions Geometry/DTGeometry/interface/DTChamber.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DTChamber : public GeomDet {

public:
/// Constructor
DTChamber(DTChamberId id, const ReferenceCountingPointer<BoundPlane>& plane);
DTChamber(const DTChamberId& id, const ReferenceCountingPointer<BoundPlane>& plane);

/// Destructor
~DTChamber() override;
Expand All @@ -52,14 +52,14 @@ class DTChamber : public GeomDet {
const std::vector< const DTSuperLayer*>& superLayers() const;

/// Return the superlayer corresponding to the given id
const DTSuperLayer* superLayer(DTSuperLayerId id) const;
const DTSuperLayer* superLayer(const DTSuperLayerId& id) const;

/// Return the given superlayer.
/// Superlayers are numbered 1 (phi), 2 (Z), 3 (phi)
const DTSuperLayer* superLayer(int isl) const;

/// Return the layer corresponding to the given id
const DTLayer* layer(DTLayerId id) const;
const DTLayer* layer(const DTLayerId& id) const;

private:

Expand Down
6 changes: 3 additions & 3 deletions Geometry/DTGeometry/interface/DTGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ class DTGeometry : public TrackingGeometry {


/// Return a DTChamber given its id
const DTChamber* chamber(DTChamberId id) const;
const DTChamber* chamber(const DTChamberId& id) const;

/// Return a DTSuperLayer given its id
const DTSuperLayer* superLayer(DTSuperLayerId id) const;
const DTSuperLayer* superLayer(const DTSuperLayerId& id) const;

/// Return a layer given its id
const DTLayer* layer(DTLayerId id) const;
const DTLayer* layer(const DTLayerId& id) const;


private:
Expand Down
4 changes: 2 additions & 2 deletions Geometry/DTGeometry/interface/DTLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class DTLayer : public GeomDetUnit {
public:

/* Constructor */
DTLayer(DTLayerId id,
DTLayer(const DTLayerId& id,
ReferenceCountingPointer<BoundPlane>& plane,
const DTTopology& topo,
const DTLayerType& type,
const DTSuperLayer* sl=0) ;
const DTSuperLayer* sl=nullptr) ;

/* Destructor */
~DTLayer() override ;
Expand Down
6 changes: 3 additions & 3 deletions Geometry/DTGeometry/interface/DTSuperLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class DTSuperLayer : public GeomDet {
public:

/* Constructor */
DTSuperLayer(DTSuperLayerId id,
DTSuperLayer(const DTSuperLayerId& id,
ReferenceCountingPointer<BoundPlane>& plane,
const DTChamber* ch=0);
const DTChamber* ch=nullptr);

/* Destructor */
~DTSuperLayer() override ;
Expand Down Expand Up @@ -61,7 +61,7 @@ class DTSuperLayer : public GeomDet {
const DTChamber* chamber() const;

/// Return the layer corresponding to the given id
const DTLayer* layer(DTLayerId id) const;
const DTLayer* layer(const DTLayerId& id) const;

/// Return the given layer.
/// Layers are numbered 1-4.
Expand Down
Loading

0 comments on commit 97fcf11

Please sign in to comment.