Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang tidy] Apply checks for geometry #30798

Merged
merged 2 commits into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DetectorDescription/Core/src/DDLogicalPart.cc
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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