Skip to content

Commit

Permalink
Merge pull request #20251 from ianna/geom-readability-avoid-const-par…
Browse files Browse the repository at this point in the history
…ams-in-decls-v1

Geometry Clang Check readability-avoid-const-params-in-decls
  • Loading branch information
cmsbuild authored Aug 28, 2017
2 parents 5ca2c40 + fbe693b commit dfbe6f7
Show file tree
Hide file tree
Showing 27 changed files with 182 additions and 191 deletions.
39 changes: 15 additions & 24 deletions DetectorDescription/Core/interface/DDDivision.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DDDivision_h
#define DDDivision_h
#ifndef DETECTOR_DESCRIPTION_CORE_DD_DIVISION_H
#define DETECTOR_DESCRIPTION_CORE_DD_DIVISION_H

// The following is based on G4PVDivision of Gean4 as of 4/2004
//
Expand Down Expand Up @@ -68,9 +68,10 @@ class DDDivision;
class DDMaterial;
class DDPartSelection;
class DDSolid;

namespace DDI {
class Division;
} // namespace DDI
class Division;
}

std::ostream & operator<<( std::ostream &, const DDDivision &);

Expand All @@ -91,45 +92,35 @@ class DDDivision : public DDBase<DDName, DDI::Division*>
*/
DDDivision(const DDName & name,
const DDLogicalPart & parent,
const DDAxes axis,
const int nReplicas,
const double width,
const double offset );

DDAxes axis,
int nReplicas,
double width,
double offset );

//! Registers (creates) a reference object representing a Division
/** ... Constructor with number of divisions
*/
DDDivision(const DDName & name,
const DDLogicalPart & parent,
const DDAxes axis,
const int nReplicas,
const double offset );
DDAxes axis,
int nReplicas,
double offset );

//! Registers (creates) a reference object representing a Division
/** ... Constructor with width
*/
DDDivision(const DDName & name,
const DDLogicalPart & parent,
const DDAxes axis,
const double width,
const double offset );
DDAxes axis,
double width,
double offset );

// virtual ~G4PVDivision();

DDAxes axis() const;
int nReplicas() const;
double width() const;
double offset() const;
const DDLogicalPart & parent() const;


};

// mike copied from DDLogicalPart
// some helpers .... (not very clean, redesign!! according to martin :-))
// left this analogy out for now (mec) : pair<bool,std::string> DDIsValid(const std::string & ns, const std::string & name, std::vector<DDDivision> & result,bool doRegex=true);
// std::maps name to std::vector of namespaces
typedef DDI::Singleton<std::map<std::string,std::vector<DDName> > > DIVNAMES;
//void DD_NDC(const DDName &);
#endif
8 changes: 4 additions & 4 deletions Geometry/CaloEventSetup/test/CaloGeometryAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CaloGeometryAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResourc

void cmpset( const CaloSubdetectorGeometry* geom ,
const GlobalPoint& gp ,
const double dR ) ;
double dR ) ;

void ovrTst( const CaloGeometry& cg ,
const CaloSubdetectorGeometry* geom ,
Expand Down Expand Up @@ -342,7 +342,7 @@ CaloGeometryAnalyzer::ovrTst( const CaloGeometry& cg ,
const CaloCellGeometry* cell ( geom->getGeometry(id) ) ;
const CaloSubdetectorGeometry* bar ( cg.getSubdetectorGeometry( DetId::Ecal, EcalBarrel ) );
const EcalEndcapGeometry::OrderedListOfEBDetId* ol ( eeG->getClosestBarrelCells( id ) ) ;
assert ( 0 != ol ) ;
assert ( nullptr != ol ) ;
for( unsigned int i ( 0 ) ; i != ol->size() ; ++i )
{
fOvr << " " << i << " " << (*ol)[i] ;
Expand Down Expand Up @@ -371,7 +371,7 @@ CaloGeometryAnalyzer::ovrTst( const CaloGeometry& cg ,
const CaloSubdetectorGeometry* ecap ( cg.getSubdetectorGeometry( DetId::Ecal, EcalEndcap ) );
fOvr << "Endcap Neighbors of Barrel id = " << id << std::endl ;
const EcalBarrelGeometry::OrderedListOfEEDetId* ol ( ebG->getClosestEndcapCells( id ) ) ;
assert ( 0 != ol ) ;
assert ( nullptr != ol ) ;
for( unsigned int i ( 0 ) ; i != ol->size() ; ++i )
{
fOvr << " " << i << " " << (*ol)[i] ;
Expand Down Expand Up @@ -1023,7 +1023,7 @@ CaloGeometryAnalyzer::build( const CaloGeometry& cg ,

f << " // " << HcalDetId(i) << std::endl;

const GlobalPoint gp ( cell->getPosition() ) ;
const GlobalPoint& gp ( cell->getPosition() ) ;

f << " // Checking getClosestCell for position "
<< gp
Expand Down
2 changes: 1 addition & 1 deletion Geometry/CaloGeometry/interface/CaloNumberingScheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CaloNumberingScheme {
CaloNumberingScheme(int iv=0);
virtual ~CaloNumberingScheme(){};
/// Verbosity setting
void setVerbosity(const int);
void setVerbosity(int);
protected:
/// Verbosity field: Zero = quiet, increasing integers mean more output
int verbosity;
Expand Down
4 changes: 2 additions & 2 deletions Geometry/CaloTopology/interface/FastTimeTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class FastTimeTopology : public CaloSubdetectorTopology {

const FastTimeDDDConstants& dddConstants () const {return hdcons_;}

DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY ) const;
DetId switchZSide(const DetId startId) const;
DetId offsetBy(DetId startId, int nrStepsX, int nrStepsY ) const;
DetId switchZSide(DetId startId) const;

struct DecodedDetId {
DecodedDetId() : iPhi(0), iEtaZ(0), zside(0), iType(0), subdet(0) {}
Expand Down
4 changes: 2 additions & 2 deletions Geometry/CaloTopology/interface/HGCalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class HGCalTopology : public CaloSubdetectorTopology {

/** returns a new DetId offset by nrStepsX and nrStepsY (can be negative),
* returns DetId(0) if invalid */
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const;
DetId switchZSide(const DetId startId) const;
DetId offsetBy(DetId startId, int nrStepsX, int nrStepsY) const;
DetId switchZSide(DetId startId) const;

/// Use subSector in square mode as wafer type in hexagon mode
static const int subSectors_ = 2;
Expand Down
20 changes: 10 additions & 10 deletions Geometry/CaloTopology/interface/HcalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class HcalTopology : public CaloSubdetectorTopology {
public:

HcalTopology(const HcalDDDRecConstants* hcons, const bool mergePosition=false);
HcalTopology(const HcalDDDRecConstants* hcons, bool mergePosition=false);
HcalTopology(HcalTopologyMode::Mode mode, int maxDepthHB, int maxDepthHE, HcalTopologyMode::TriggerMode tmode=HcalTopologyMode::TriggerMode_2009);

HcalTopologyMode::Mode mode() const {return mode_;}
Expand Down Expand Up @@ -55,7 +55,7 @@ class HcalTopology : public CaloSubdetectorTopology {
bool validDetId(HcalSubdetector subdet, int ieta, int iphi, int depth) const;
bool validHT(const HcalTrigTowerDetId& id) const;
/** Is this a valid cell in context of Plan1 */
bool validHcal(const HcalDetId& id, const unsigned int flag) const;
bool validHcal(const HcalDetId& id, unsigned int flag) const;
/** Flag=0 for unmerged Id's; =1 for for merged Id's; =2 for either */

/** Get the neighbors of the given cell in east direction*/
Expand Down Expand Up @@ -115,18 +115,18 @@ class HcalTopology : public CaloSubdetectorTopology {

/// for each of the ~17 depth segments, specify which readout bin they belong to
/// if the ring is not found, the first one with a lower ring will be returned.
void getDepthSegmentation(const unsigned ring,
void getDepthSegmentation(unsigned ring,
std::vector<int> & readoutDepths,
const bool flag=false) const;
void setDepthSegmentation(const unsigned ring,
bool flag=false) const;
void setDepthSegmentation(unsigned ring,
const std::vector<int> & readoutDepths,
const bool flag);
bool flag);
/// returns the boundaries of the depth segmentation, so that the first
/// result is the first segment, and the second result is the first one
/// of the next segment. Used for calculating physical bounds.
std::pair<int, int> segmentBoundaries(const unsigned ring,
const unsigned depth,
const bool flag=false) const;
std::pair<int, int> segmentBoundaries(unsigned ring,
unsigned depth,
bool flag=false) const;
int getPhiZOne(std::vector<std::pair<int,int> >& phiz) const {return hcons_->getPhiZOne(phiz);}

unsigned int getHBSize() const {return HBSize_;}
Expand Down Expand Up @@ -156,7 +156,7 @@ class HcalTopology : public CaloSubdetectorTopology {
unsigned int detId2denseIdCALIB(const DetId& id) const;

unsigned int getNumberOfShapes() const { return numberOfShapes_; }
bool isBH() const { return ((hcons_ == 0) ? false : hcons_->isBH()); }
bool isBH() const { return ((hcons_ == nullptr) ? false : hcons_->isBH()); }

const HcalDDDRecConstants* dddConstants () const {return hcons_;}
bool withSpecialRBXHBHE() const {return hcons_->withSpecialRBXHBHE();}
Expand Down
20 changes: 10 additions & 10 deletions Geometry/CommonDetUnit/interface/GeomDetEnumerators.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ namespace GeomDetEnumerators {
bool isBarrel(GeomDetEnumerators::SubDetector m);
bool isEndcap(GeomDetEnumerators::SubDetector m);

bool isTrackerPixel(const GeomDetEnumerators::SubDetector m);
bool isTrackerStrip(const GeomDetEnumerators::SubDetector m);
bool isTracker(const GeomDetEnumerators::SubDetector m);
bool isDT(const GeomDetEnumerators::SubDetector m);
bool isCSC(const GeomDetEnumerators::SubDetector m);
bool isRPC(const GeomDetEnumerators::SubDetector m);
bool isGEM(const GeomDetEnumerators::SubDetector m);
bool isME0(const GeomDetEnumerators::SubDetector m);
bool isMuon(const GeomDetEnumerators::SubDetector m);
bool isTiming(const GeomDetEnumerators::SubDetector m);
bool isTrackerPixel(GeomDetEnumerators::SubDetector m);
bool isTrackerStrip(GeomDetEnumerators::SubDetector m);
bool isTracker(GeomDetEnumerators::SubDetector m);
bool isDT(GeomDetEnumerators::SubDetector m);
bool isCSC(GeomDetEnumerators::SubDetector m);
bool isRPC(GeomDetEnumerators::SubDetector m);
bool isGEM(GeomDetEnumerators::SubDetector m);
bool isME0(GeomDetEnumerators::SubDetector m);
bool isMuon(GeomDetEnumerators::SubDetector m);
bool isTiming(GeomDetEnumerators::SubDetector m);

}

Expand Down
2 changes: 1 addition & 1 deletion Geometry/CommonDetUnit/interface/GluedGeomDet.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class GluedGeomDet final : public TrackerGeomDet {
public:

GluedGeomDet( BoundPlane* sp, const GeomDetUnit* monoDet, const GeomDetUnit* stereoDet, const DetId gluedDetId);
GluedGeomDet( BoundPlane* sp, const GeomDetUnit* monoDet, const GeomDetUnit* stereoDet, DetId gluedDetId);

~GluedGeomDet() override;

Expand Down
8 changes: 4 additions & 4 deletions Geometry/CommonTopologies/interface/PixelTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class PixelTopology : public Topology {
virtual int rowsperroc() const = 0;
virtual int colsperroc() const = 0;

virtual float localX(const float mpX) const = 0;
virtual float localY(const float mpY) const = 0;
virtual float localX(float mpX) const = 0;
virtual float localY(float mpY) const = 0;
virtual float localX(const float mpX, const Topology::LocalTrackPred &/*trk*/) const { return localX(mpX); }
virtual float localY(const float mpY, const Topology::LocalTrackPred &/*trk*/) const { return localY(mpY); }

virtual bool isItBigPixelInX(const int ixbin) const = 0;
virtual bool isItBigPixelInY(const int iybin) const = 0;
virtual bool isItBigPixelInX(int ixbin) const = 0;
virtual bool isItBigPixelInY(int iybin) const = 0;
virtual bool containsBigPixelInX(int ixmin, int ixmax) const = 0;
virtual bool containsBigPixelInY(int iymin, int iymax) const = 0;

Expand Down
4 changes: 2 additions & 2 deletions Geometry/CommonTopologies/test/ValidateRadial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ValidateRadial : public edm::one::EDAnalyzer<>
private:
std::vector<const TkRadialStripTopology*> get_list_of_radial_topologies(const edm::Event&, const edm::EventSetup&);
void test_topology(const TkRadialStripTopology* , unsigned);
bool pass_frame_change_test(const TkRadialStripTopology* t, const float strip, const float stripErr2, const bool);
bool pass_frame_change_test(const TkRadialStripTopology* t, float strip, float stripErr2, bool);
bool EQUAL(const double a, const double b) {return fabs(a-b)<epsilon_;}
const double epsilon_;
TFile* file_;
Expand Down Expand Up @@ -71,7 +71,7 @@ get_list_of_radial_topologies(const edm::Event&e, const edm::EventSetup& es) {
auto g = dynamic_cast<const StripGeomDetUnit*>(theTrackerGeometry->idToDet( radial_detid ));
if (!g) std::cout << "no geom for " << radial_detid << std::endl;
auto const topol = &g->specificTopology();
const TkRadialStripTopology* rt =0;
const TkRadialStripTopology* rt =nullptr;
auto const proxyT = dynamic_cast<const ProxyStripTopology*>(topol);
if (proxyT) rt = dynamic_cast<const TkRadialStripTopology*>(&(proxyT->specificTopology()));
else rt = dynamic_cast<const TkRadialStripTopology*>(topol);
Expand Down
4 changes: 2 additions & 2 deletions Geometry/DTGeometryBuilder/src/DTGeometryBuilderFromCondDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class DTGeometryBuilderFromCondDB{

typedef ReferenceCountingPointer<Plane> RCPPlane;

RCPPlane plane(const std::vector<double>::const_iterator tranStart,
const std::vector<double>::const_iterator rotStart,
RCPPlane plane(std::vector<double>::const_iterator tranStart,
std::vector<double>::const_iterator rotStart,
Bounds * bounds) const ;

protected:
Expand Down
20 changes: 10 additions & 10 deletions Geometry/EcalCommonData/interface/DDEcalEndcapAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ class DDEcalEndcapAlgo : public DDAlgorithm {
// New methods for SC geometry
void EEPositionCRs( const DDName& pName,
const DDTranslation& offset,
const int iSCType,
int iSCType,
DDCompactView& cpv );

void EECreateSC( const unsigned int iSCType, DDCompactView& cpv );
void EECreateSC( unsigned int iSCType, DDCompactView& cpv );

void EECreateCR();

void EEPosSC( const int iCol ,
const int iRow ,
void EEPosSC( int iCol ,
int iRow ,
DDName EEDeeName );

unsigned int EEGetSCType( const unsigned int iCol ,
const unsigned int iRow ) ;
unsigned int EEGetSCType( unsigned int iCol ,
unsigned int iRow ) ;

DDName EEGetSCName( const int iCol ,
const int iRow ) ;
DDName EEGetSCName( int iCol ,
int iRow ) ;

std::vector<double> EEGetSCCtrs( const int iCol ,
const int iRow );
std::vector<double> EEGetSCCtrs( int iCol ,
int iRow );

DDMaterial ddmat( const std::string& s ) const ;
DDName ddname( const std::string& s ) const ;
Expand Down
16 changes: 8 additions & 8 deletions Geometry/EcalCommonData/interface/DDEcalEndcapTrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
class DDEcalEndcapTrap {

public:
DDEcalEndcapTrap( const int hand,
const double front ,
const double rear ,
const double length ) ;
DDEcalEndcapTrap( int hand,
double front ,
double rear ,
double length ) ;

// virtual ~DDEcalEndcapTrap();

Expand All @@ -39,17 +39,17 @@ class DDEcalEndcapTrap {

// void rotate();

void rotateX( const double angle ) ;
void rotateY( const double angle ) ;
void rotateX( double angle ) ;
void rotateY( double angle ) ;
void translate();
void moveto( const DDTranslation& frontCentre,
const DDTranslation& rearCentre );
double elevationAngle( const DDTranslation& trans );
double polarAngle( const DDTranslation& trans);
double elevationAngle();
double polarAngle();
DDTranslation cornerPos( const int icorner );
void cornerPos( const int icorner ,
DDTranslation cornerPos( int icorner );
void cornerPos( int icorner ,
const DDTranslation& cc) ;
DDTranslation centrePos();
DDTranslation fcentrePos();
Expand Down
2 changes: 1 addition & 1 deletion Geometry/EcalTestBeam/interface/EcalTBCrystalMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class EcalTBCrystalMap {
~EcalTBCrystalMap();

int CrystalIndex(double thisEta, double thisPhi);
void findCrystalAngles(const int thisCrysIndex, double & thisEta, double & thisPhi);
void findCrystalAngles(int thisCrysIndex, double & thisEta, double & thisPhi);

static const int NCRYSTAL = 1700;

Expand Down
2 changes: 1 addition & 1 deletion Geometry/EcalTestBeam/test/ee/CaloGeometryLoaderTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CaloGeometryLoaderTest
void myFillGeom( T* geom ,
const ParmVec& pv ,
const HepGeom::Transform3D& tr ,
const unsigned int id ) ;
unsigned int id ) ;

unsigned int getDetIdForDDDNode( const DDFilteredView& fv ) ;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FastTimeParametersFromDD {
virtual ~FastTimeParametersFromDD() {}

bool build(const DDCompactView*, FastTimeParameters&, const std::string&,
const int);
int);
private:
std::vector<double> getDDDArray(const std::string &, const DDsvalues_type &);
};
Expand Down
4 changes: 2 additions & 2 deletions Geometry/HGCalCommonData/interface/HGCalDDDConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class HGCalDDDConstants {
std::vector<int> numberCellsSquare(float h, float bl, float tl,
float alpha, float cellSize) const;
int numberCellsHexagon(int wafer) const;
std::pair<int,int> rowColumnWafer(const int wafer) const;
std::pair<int,int> rowColumnWafer(int wafer) const;
int sectors() const {return hgpar_->nSectors_;}
std::pair<int,int> simToReco(int cell, int layer, int mod, bool half) const;
unsigned int volumes() const {return hgpar_->moduleLayR_.size();}
int waferFromCopy(int copy) const;
void waferFromPosition(const double x, const double y,
void waferFromPosition(double x, double y,
int& wafer, int& icell,
int& celltyp) const;
bool waferInLayer(int wafer, int lay, bool reco) const;
Expand Down
Loading

0 comments on commit dfbe6f7

Please sign in to comment.