Skip to content

Commit

Permalink
Merge pull request #30798 from cms-sw/apply-new-ct-checks-for-geometry
Browse files Browse the repository at this point in the history
[Clang tidy] Apply checks for geometry
  • Loading branch information
cmsbuild committed Jul 21, 2020
2 parents e277692 + 0cb7a97 commit 339e5db
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion DetectorDescription/Core/src/DDLogicalPart.cc
Expand Up @@ -204,7 +204,7 @@ bool DDLogicalPart::hasDDValue(const DDValue& v) const { return rep().hasDDValue
namespace {
struct Regex {
explicit Regex(const std::string& s) : m_ok(false), me(s) {
size_t p = me.find(".");
size_t p = me.find('.');
m_ok = p != std::string::npos;
if (m_ok) {
if (p > 0) {
Expand Down
Expand Up @@ -176,7 +176,7 @@ void OutputDDToDDL::beginRun(const edm::Run&, edm::EventSetup const& es) {
(*m_xos) << std::scientific << std::setprecision(18);

(*m_xos) << "<MaterialSection label=\"" << ns_ << "\">" << std::endl;
for (auto it : matStore) {
for (const auto& it : matStore) {
if (!it.isDefined().second)
continue;
out.material(it, *m_xos);
Expand Down
2 changes: 1 addition & 1 deletion DetectorDescription/Parser/src/DDLSAX2ConfigHandler.cc
Expand Up @@ -43,7 +43,7 @@ void DDLSAX2ConfigHandler::startElement(const XMLCh* const uri,
std::string fileName = toString(attrs.getValue(uStr("fileName").ptr()));
std::string logicalPartName = toString(attrs.getValue(uStr("logicalPartName").ptr()));

fileName = fileName.substr(0, fileName.find("."));
fileName = fileName.substr(0, fileName.find('.'));
DDLogicalPart root(DDName(logicalPartName, fileName));
DDRootDef::instance().set(root);
cpv_.setRoot(root);
Expand Down
2 changes: 1 addition & 1 deletion DetectorDescription/RegressionTest/src/DDCheckMaterials.cc
Expand Up @@ -106,7 +106,7 @@ bool DDCheckMaterials(std::ostream& os, std::vector<std::pair<std::string, std::
os << "[DDCore:Report] Materials " << std::endl;
os << s << mr.size() << " Materials declared" << std::endl;
os << s << "detected errors:" << errors.size() << std::endl;
for (auto j : errors) {
for (const auto& j : errors) {
os << std::endl << s << j.second << " " << j.first << std::endl;
result = true;
}
Expand Down
5 changes: 3 additions & 2 deletions Geometry/CaloGeometry/src/IdealZPrism.cc
@@ -1,5 +1,6 @@
#include "Geometry/CaloGeometry/interface/IdealZPrism.h"
#include <cmath>
#include <memory>

typedef IdealZPrism::CCGFloat CCGFloat;
typedef IdealZPrism::Pt3D Pt3D;
Expand All @@ -25,14 +26,14 @@ namespace {

IdealZPrism::IdealZPrism(const IdealZPrism& idzp) : CaloCellGeometry(idzp) {
if (idzp.forPF())
m_geoForPF.reset(new IdealZPrism(*idzp.forPF()));
m_geoForPF = std::make_unique<IdealZPrism>(*idzp.forPF());
}

IdealZPrism& IdealZPrism::operator=(const IdealZPrism& idzp) {
if (&idzp != this) {
CaloCellGeometry::operator=(idzp);
if (idzp.forPF())
m_geoForPF.reset(new IdealZPrism(*idzp.forPF()));
m_geoForPF = std::make_unique<IdealZPrism>(*idzp.forPF());
}
return *this;
}
Expand Down
1 change: 1 addition & 0 deletions Geometry/EcalMapping/src/ESElectronicsMapper.cc
Expand Up @@ -59,6 +59,7 @@ ESElectronicsMapper::ESElectronicsMapper(const edm::ParameterSet& ps) {

for (int i = 0; i < 18; ++i) { // loop over EE feds
std::vector<int> esFeds;
esFeds.reserve(nesfed[i]);
for (int esFed = 0; esFed < nesfed[i]; esFed++)
esFeds.emplace_back(esfed[i][esFed]);
ee_es_map_.insert(make_pair(eefed[i], esFeds));
Expand Down
2 changes: 1 addition & 1 deletion Geometry/TrackerCommonData/plugins/DDTECModuleAlgo.cc
Expand Up @@ -343,7 +343,7 @@ void DDTECModuleAlgo::doPos(DDLogicalPart toPos, double x, double y, double z, s
if (rotName == "NULL")
rotName = standardRot;

doPos(move(toPos), parent(), copyNr, x, y, z, rotName, cpv);
doPos(toPos, parent(), copyNr, x, y, z, rotName, cpv);
}

void DDTECModuleAlgo::execute(DDCompactView& cpv) {
Expand Down
26 changes: 13 additions & 13 deletions Geometry/TrackerGeometryBuilder/src/TrackerGeometry.cc
Expand Up @@ -226,7 +226,7 @@ bool TrackerGeometry::isThere(GeomDetEnumerators::SubDetector subdet) const {

void TrackerGeometry::fillTestMap(const GeometricDet* gd) {
const std::string& temp = gd->name();
std::string name = temp.substr(temp.find(":") + 1);
std::string name = temp.substr(temp.find(':') + 1);
DetId detid = gd->geographicalId();
float thickness = gd->bounds()->thickness();
std::string nameTag;
Expand Down Expand Up @@ -292,45 +292,45 @@ TrackerGeometry::ModuleType TrackerGeometry::moduleType(const std::string& name)

// TIB
else if (name.find("TIB") != std::string::npos) {
if (name.find("0") != std::string::npos)
if (name.find('0') != std::string::npos)
return ModuleType::IB1;
else
return ModuleType::IB2;
}

// TOB
else if (name.find("TOB") != std::string::npos) {
if (name.find("0") != std::string::npos)
if (name.find('0') != std::string::npos)
return ModuleType::OB1;
else
return ModuleType::OB2;
}

// TID
else if (name.find("TID") != std::string::npos) {
if (name.find("0") != std::string::npos)
if (name.find('0') != std::string::npos)
return ModuleType::W1A;
else if (name.find("1") != std::string::npos)
else if (name.find('1') != std::string::npos)
return ModuleType::W2A;
else if (name.find("2") != std::string::npos)
else if (name.find('2') != std::string::npos)
return ModuleType::W3A;
}

// TEC
else if (name.find("TEC") != std::string::npos) {
if (name.find("0") != std::string::npos)
if (name.find('0') != std::string::npos)
return ModuleType::W1B;
else if (name.find("1") != std::string::npos)
else if (name.find('1') != std::string::npos)
return ModuleType::W2B;
else if (name.find("2") != std::string::npos)
else if (name.find('2') != std::string::npos)
return ModuleType::W3B;
else if (name.find("3") != std::string::npos)
else if (name.find('3') != std::string::npos)
return ModuleType::W4;
else if (name.find("4") != std::string::npos)
else if (name.find('4') != std::string::npos)
return ModuleType::W5;
else if (name.find("5") != std::string::npos)
else if (name.find('5') != std::string::npos)
return ModuleType::W6;
else if (name.find("6") != std::string::npos)
else if (name.find('6') != std::string::npos)
return ModuleType::W7;
}

Expand Down

0 comments on commit 339e5db

Please sign in to comment.