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-upgrade #30722

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 8 additions & 8 deletions Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ GEMGeometryBuilder::~GEMGeometryBuilder() {}

// DDD
void GEMGeometryBuilder::build(GEMGeometry& theGeometry,
const DDCompactView* cview,
const MuonGeometryConstants& muonConstants) {
const DDCompactView* cview,
const MuonGeometryConstants& muonConstants) {
std::string attribute = "MuStructure";
std::string value = "MuonEndCapGEM";

Expand Down Expand Up @@ -316,8 +316,8 @@ GEMEtaPartition* GEMGeometryBuilder::buildEtaPartition(DDFilteredView& fv, GEMDe
}

GEMGeometryBuilder::RCPBoundPlane GEMGeometryBuilder::boundPlane(const DDFilteredView& fv,
Bounds* bounds,
bool isOddChamber) const {
Bounds* bounds,
bool isOddChamber) const {
// extract the position
const DDTranslation& trans(fv.translation());
const Surface::PositionType posResult(float(trans.x() / cm), float(trans.y() / cm), float(trans.z() / cm));
Expand Down Expand Up @@ -350,8 +350,8 @@ GEMGeometryBuilder::RCPBoundPlane GEMGeometryBuilder::boundPlane(const DDFiltere
// DD4HEP

void GEMGeometryBuilder::build(GEMGeometry& theGeometry,
const cms::DDCompactView* cview,
const MuonGeometryConstants& muonConstants) {
const cms::DDCompactView* cview,
const MuonGeometryConstants& muonConstants) {
std::string attribute = "MuStructure";
std::string value = "MuonEndCapGEM";
cms::DDFilteredView fv(cview->detector(), cview->detector()->worldVolume());
Expand Down Expand Up @@ -523,8 +523,8 @@ GEMEtaPartition* GEMGeometryBuilder::buildEtaPartition(cms::DDFilteredView& fv,
}

GEMGeometryBuilder::RCPBoundPlane GEMGeometryBuilder::boundPlane(const cms::DDFilteredView& fv,
Bounds* bounds,
bool isOddChamber) const {
Bounds* bounds,
bool isOddChamber) const {
// extract the position
const Double_t* tran = fv.trans();
Surface::PositionType posResult(tran[0], tran[1], tran[2]);
Expand Down
2 changes: 1 addition & 1 deletion Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using namespace cms;
class DD4hep_TestMTDIdealGeometry : public edm::one::EDAnalyzer<> {
public:
explicit DD4hep_TestMTDIdealGeometry(const edm::ParameterSet&);
~DD4hep_TestMTDIdealGeometry() = default;
~DD4hep_TestMTDIdealGeometry() override = default;

void beginJob() override {}
void analyze(edm::Event const&, edm::EventSetup const&) override;
Expand Down
2 changes: 1 addition & 1 deletion Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void TestMTDIdealGeometry::analyze(const edm::Event& iEvent, const edm::EventSet

bool isSens = false;

if (fv.geoHistory()[num - 1].logicalPart().specifics().size() > 0) {
if (!fv.geoHistory()[num - 1].logicalPart().specifics().empty()) {
for (auto vec : fv.geoHistory()[num - 1].logicalPart().specifics()) {
for (auto elem : *vec) {
if (elem.second.name() == "SensitiveDetector") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class RectangularMTDTopology final : public PixelTopology {
}

bool isItBigPixelInY(const int iybin) const override {
if
UNLIKELY(m_upgradeGeometry) return false;
if UNLIKELY (m_upgradeGeometry)
return false;
else {
int iybin0 = iybin % 52;
return ((iybin0 == 0) | (iybin0 == 51));
Expand Down
61 changes: 28 additions & 33 deletions Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,16 @@ float RectangularMTDTopology::localX(const float mpx) const {
float fractionX = mpx - float(binoffx); // find the fraction
float local_pitchx = m_pitchx; // defaultpitch

if
UNLIKELY(m_upgradeGeometry) {
if UNLIKELY (m_upgradeGeometry) {
#ifdef EDM_ML_DEBUG
if (binoffx > m_ROWS_PER_ROC * m_ROCS_X) // too large
{
LogDebug("RectangularMTDTopology")
<< " very bad, binx " << binoffx << "\n"
<< mpx << " " << binoffx << " " << fractionX << " " << local_pitchx << " " << m_xoffset << "\n";
}
#endif
if (binoffx > m_ROWS_PER_ROC * m_ROCS_X) // too large
{
LogDebug("RectangularMTDTopology") << " very bad, binx " << binoffx << "\n"
<< mpx << " " << binoffx << " " << fractionX << " " << local_pitchx << " "
<< m_xoffset << "\n";
}
else {
#endif
} else {
if (binoffx > 80) { // ROC 1 - handles x on edge cluster
binoffx = binoffx + 2;
} else if (binoffx == 80) { // ROC 1
Expand Down Expand Up @@ -269,18 +267,16 @@ float RectangularMTDTopology::localY(const float mpy) const {
float fractionY = mpy - float(binoffy); // find the fraction
float local_pitchy = m_pitchy; // defaultpitch

if
UNLIKELY(m_upgradeGeometry) {
if UNLIKELY (m_upgradeGeometry) {
#ifdef EDM_ML_DEBUG
if (binoffy > m_ROCS_Y * m_COLS_PER_ROC) // too large
{
LogDebug("RectangularMTDTopology")
<< " very bad, biny " << binoffy << "\n"
<< mpy << " " << binoffy << " " << fractionY << " " << local_pitchy << " " << m_yoffset;
}
#endif
if (binoffy > m_ROCS_Y * m_COLS_PER_ROC) // too large
{
LogDebug("RectangularMTDTopology") << " very bad, biny " << binoffy << "\n"
<< mpy << " " << binoffy << " " << fractionY << " " << local_pitchy << " "
<< m_yoffset;
}
else { // 415 is last big pixel, 416 and above do not exists!
#endif
} else { // 415 is last big pixel, 416 and above do not exists!
constexpr int bigYIndeces[]{0, 51, 52, 103, 104, 155, 156, 207, 208, 259, 260, 311, 312, 363, 364, 415, 416, 511};
auto const j = std::lower_bound(std::begin(bigYIndeces), std::end(bigYIndeces), binoffy);
if (*j == binoffy)
Expand Down Expand Up @@ -325,19 +321,18 @@ MeasurementError RectangularMTDTopology::measurementError(const LocalPoint& lp,
float pitchy = m_pitchy;
float pitchx = m_pitchx;

if
LIKELY(!m_upgradeGeometry) {
int iybin = int((lp.y() - m_yoffset) / m_pitchy); //get bin for equal picth
int iybin0 = iybin % 54; //This is just to avoid many ifs by using the periodicy
//quasi bins 0,1,52,53 fall into larger pixels
if ((iybin0 <= 1) | (iybin0 >= 52))
pitchy = 2.f * m_pitchy;

int ixbin = int((lp.x() - m_xoffset) / m_pitchx); //get bin for equal pitch
//quasi bins 79,80,81,82 fall into the 2 larger pixels
if ((ixbin >= 79) & (ixbin <= 82))
pitchx = 2.f * m_pitchx;
}
if LIKELY (!m_upgradeGeometry) {
int iybin = int((lp.y() - m_yoffset) / m_pitchy); //get bin for equal picth
int iybin0 = iybin % 54; //This is just to avoid many ifs by using the periodicy
//quasi bins 0,1,52,53 fall into larger pixels
if ((iybin0 <= 1) | (iybin0 >= 52))
pitchy = 2.f * m_pitchy;

int ixbin = int((lp.x() - m_xoffset) / m_pitchx); //get bin for equal pitch
//quasi bins 79,80,81,82 fall into the 2 larger pixels
if ((ixbin >= 79) & (ixbin <= 82))
pitchx = 2.f * m_pitchx;
}

return MeasurementError(le.xx() / float(pitchx * pitchx), 0, le.yy() / float(pitchy * pitchy));
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using namespace cms;
class DD4hep_MTDTopologyAnalyzer : public edm::one::EDAnalyzer<> {
public:
explicit DD4hep_MTDTopologyAnalyzer(const edm::ParameterSet&);
~DD4hep_MTDTopologyAnalyzer() = default;
~DD4hep_MTDTopologyAnalyzer() override = default;

void beginJob() override {}
void analyze(edm::Event const&, edm::EventSetup const&) override;
Expand Down
2 changes: 1 addition & 1 deletion Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void MTDTopologyAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetu

bool isSens = false;

if (fv.geoHistory()[num - 1].logicalPart().specifics().size() > 0) {
if (!fv.geoHistory()[num - 1].logicalPart().specifics().empty()) {
for (auto vec : fv.geoHistory()[num - 1].logicalPart().specifics()) {
for (auto elem : *vec) {
if (elem.second.name() == "SensitiveDetector") {
Expand Down
4 changes: 2 additions & 2 deletions SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
class ModuleInfo_Phase2 : public edm::EDAnalyzer {
public:
explicit ModuleInfo_Phase2(const edm::ParameterSet&);
~ModuleInfo_Phase2();
~ModuleInfo_Phase2() override;

virtual void analyze(const edm::Event&, const edm::EventSetup&);
void analyze(const edm::Event&, const edm::EventSetup&) override;

private:
// ----------member data ---------------------------
Expand Down
12 changes: 6 additions & 6 deletions SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ using namespace reco;
class Phase2PixelNtuple : public edm::one::EDAnalyzer<> {
public:
explicit Phase2PixelNtuple(const edm::ParameterSet& conf);
virtual ~Phase2PixelNtuple();
virtual void beginJob();
virtual void endJob();
virtual void analyze(const edm::Event& e, const edm::EventSetup& es);
~Phase2PixelNtuple() override;
void beginJob() override;
void endJob() override;
void analyze(const edm::Event& e, const edm::EventSetup& es) override;

protected:
void fillEvt(const edm::Event&);
Expand Down Expand Up @@ -175,8 +175,8 @@ Phase2PixelNtuple::Phase2PixelNtuple(edm::ParameterSet const& conf)
token_recoTracks(consumes<edm::View<reco::Track>>(conf.getParameter<edm::InputTag>("trackProducer"))),
verbose_(conf.getUntrackedParameter<bool>("verbose", false)),
picky_(conf.getUntrackedParameter<bool>("picky", false)),
pixeltree_(0),
pixeltreeOnTrack_(0) {}
pixeltree_(nullptr),
pixeltreeOnTrack_(nullptr) {}

Phase2PixelNtuple::~Phase2PixelNtuple() {}

Expand Down
10 changes: 5 additions & 5 deletions SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ StdHitNtuplizer::StdHitNtuplizer(edm::ParameterSet const& conf)
rphiRecHits_(conf.getParameter<edm::InputTag>("rphiRecHits")),
stereoRecHits_(conf.getParameter<edm::InputTag>("stereoRecHits")),
matchedRecHits_(conf.getParameter<edm::InputTag>("matchedRecHits")),
tfile_(0),
pixeltree_(0),
striptree_(0),
pixeltree2_(0) {}
tfile_(nullptr),
pixeltree_(nullptr),
striptree_(nullptr),
pixeltree2_(nullptr) {}

StdHitNtuplizer::~StdHitNtuplizer() {}

Expand Down Expand Up @@ -389,7 +389,7 @@ void StdHitNtuplizer::analyze(const edm::Event& e, const edm::EventSetup& es) {
//std::cout << " Step A: Standard Strip RPHI RecHits found " << rechitsrphi.product()->dataSize() << std::endl;
//std::cout << " Step A: Standard Strip Stereo RecHits found " << rechitsstereo.product()->dataSize() << std::endl;
//std::cout << " Step A: Standard Strip Matched RecHits found " << rechitsmatched.product()->dataSize() << std::endl;
if (rechitsrphi->size() > 0) {
if (!rechitsrphi->empty()) {
//Loop over all rechits in RPHI collection (can also loop only over DetId)
// SiStripRecHit2DCollectionOld::const_iterator theRecHitRangeIteratorBegin = rechitsrphi->begin();
// SiStripRecHit2DCollectionOld::const_iterator theRecHitRangeIteratorEnd = rechitsrphi->end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import FWCore.ParameterSet.Config as cms


from Configuration.Eras.Era_Phase2C9_cff import Phase2C9
process = cms.Process('Phase2PixelNtuple',Phase2C9)
from Configuration.Eras.Era_Phase2C8_cff import Phase2C8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change in this file and the file below constitute a regression
please remake this PR on the latest IB

process = cms.Process('Phase2PixelNtuple',Phase2C8)

# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
Expand All @@ -16,7 +16,7 @@
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
#process.load('SimGeneral.MixingModule.mix_POISSON_average_cfi')
process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.Digi_cff')
process.load('Configuration.StandardSequences.SimL1Emulator_cff')
Expand All @@ -35,7 +35,7 @@

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/relval/CMSSW_11_2_0_pre1/RelValSingleMuPt10/GEN-SIM/110X_mcRun4_realistic_v3_2026D49noPU-v1/10000/743B02CC-F5B9-5642-A7EF-EE222E18C54F.root'
'/store/relval/CMSSW_10_6_0_patch2/RelValSingleMuPt10/GEN-SIM/106X_upgrade2023_realistic_v3_2023D41noPU-v1/10000/7377ED92-245C-CC4D-9F05-25ABB5522A08.root'
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
import FWCore.ParameterSet.Config as cms


from Configuration.Eras.Era_Phase2C9_cff import Phase2C9
process = cms.Process('Phase2PixelNtuple',Phase2C9)
from Configuration.Eras.Era_Phase2_cff import Phase2
process = cms.Process('Phase2PixelNtuple',Phase2)

# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load('Configuration.StandardSequences.Digi_cff')
process.load('Configuration.StandardSequences.SimL1Emulator_cff')
Expand All @@ -34,7 +34,7 @@

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/relval/CMSSW_11_2_0_pre1/RelValSingleMuPt10/GEN-SIM-DIGI-RAW/110X_mcRun4_realistic_v3_2026D49noPU-v1/10000/8A7349B5-D01D-2249-BCBA-92754DBD1127.root',
'/store/relval/CMSSW_10_6_0_patch2/RelValSingleMuPt10/GEN-SIM-DIGI-RAW/106X_upgrade2023_realistic_v3_2023D41noPU-v1/10000/2C5C22E5-A92E-C64D-9BEC-7AE84777A41F.root'
)
)

Expand Down