From e7dc92632fbeb013546afc7ff39564cbd8aecd68 Mon Sep 17 00:00:00 2001 From: Cms Build Date: Wed, 15 Jul 2020 18:17:15 +0200 Subject: [PATCH] [Clang tidy] Apply clang tidy checks for geometry-upgrade --- .../src/GEMGeometryBuilder.cc | 16 ++--- .../test/DD4hep_TestMTDIdealGeometry.cc | 2 +- .../test/TestMTDIdealGeometry.cc | 2 +- .../interface/RectangularMTDTopology.h | 4 +- .../src/RectangularMTDTopology.cc | 61 +++++++++---------- .../test/DD4hep_MTDTopologyAnalyzer.cc | 2 +- .../test/MTDTopologyAnalyzer.cc | 2 +- .../Geometry/test/ModuleInfo_Phase2.cc | 4 +- .../Geometry/test/Phase2PixelNtuple.cc | 12 ++-- .../Geometry/test/StdHitNtuplizer.cc | 10 +-- .../test/phase2_digi_reco_pixelntuple_cfg.py | 8 +-- .../test/phase2_reco_pixelntuple_cfg.py | 8 +-- 12 files changed, 63 insertions(+), 68 deletions(-) diff --git a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc index 66e5a56db8d90..9a9bd3062ec7a 100644 --- a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc +++ b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilder.cc @@ -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"; @@ -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)); @@ -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()); @@ -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]); diff --git a/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc b/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc index 3941687b2b1ab..589f8d5cb0e1b 100644 --- a/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc +++ b/Geometry/MTDCommonData/test/DD4hep_TestMTDIdealGeometry.cc @@ -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; diff --git a/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc b/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc index 0d33cd7efbbb3..4e1e37e777cab 100644 --- a/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc +++ b/Geometry/MTDCommonData/test/TestMTDIdealGeometry.cc @@ -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") { diff --git a/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h b/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h index 58b8cf7d32c94..465105ed09be9 100644 --- a/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h +++ b/Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h @@ -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)); diff --git a/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc b/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc index b062af276b8bd..88a2f97813e01 100644 --- a/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc +++ b/Geometry/MTDGeometryBuilder/src/RectangularMTDTopology.cc @@ -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 @@ -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) @@ -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)); } diff --git a/Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc b/Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc index b58e319af26ff..7fb281276da66 100644 --- a/Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc +++ b/Geometry/MTDNumberingBuilder/test/DD4hep_MTDTopologyAnalyzer.cc @@ -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; diff --git a/Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc b/Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc index d2e5a46474568..44eade04b0fe3 100644 --- a/Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc +++ b/Geometry/MTDNumberingBuilder/test/MTDTopologyAnalyzer.cc @@ -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") { diff --git a/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc b/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc index fc9ac3b4ceddf..341e5e30a52e0 100644 --- a/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc +++ b/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc @@ -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 --------------------------- diff --git a/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc b/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc index 61cb4018b7218..de55c3f46425e 100644 --- a/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc +++ b/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc @@ -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&); @@ -175,8 +175,8 @@ Phase2PixelNtuple::Phase2PixelNtuple(edm::ParameterSet const& conf) token_recoTracks(consumes>(conf.getParameter("trackProducer"))), verbose_(conf.getUntrackedParameter("verbose", false)), picky_(conf.getUntrackedParameter("picky", false)), - pixeltree_(0), - pixeltreeOnTrack_(0) {} + pixeltree_(nullptr), + pixeltreeOnTrack_(nullptr) {} Phase2PixelNtuple::~Phase2PixelNtuple() {} diff --git a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc index e3c1b84cd4002..bbc09807c691b 100644 --- a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc +++ b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc @@ -70,10 +70,10 @@ StdHitNtuplizer::StdHitNtuplizer(edm::ParameterSet const& conf) rphiRecHits_(conf.getParameter("rphiRecHits")), stereoRecHits_(conf.getParameter("stereoRecHits")), matchedRecHits_(conf.getParameter("matchedRecHits")), - tfile_(0), - pixeltree_(0), - striptree_(0), - pixeltree2_(0) {} + tfile_(nullptr), + pixeltree_(nullptr), + striptree_(nullptr), + pixeltree2_(nullptr) {} StdHitNtuplizer::~StdHitNtuplizer() {} @@ -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(); diff --git a/SLHCUpgradeSimulations/Geometry/test/phase2_digi_reco_pixelntuple_cfg.py b/SLHCUpgradeSimulations/Geometry/test/phase2_digi_reco_pixelntuple_cfg.py index 69650e060803a..800b790a14d9a 100644 --- a/SLHCUpgradeSimulations/Geometry/test/phase2_digi_reco_pixelntuple_cfg.py +++ b/SLHCUpgradeSimulations/Geometry/test/phase2_digi_reco_pixelntuple_cfg.py @@ -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 +process = cms.Process('Phase2PixelNtuple',Phase2C8) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -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') @@ -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' ) ) diff --git a/SLHCUpgradeSimulations/Geometry/test/phase2_reco_pixelntuple_cfg.py b/SLHCUpgradeSimulations/Geometry/test/phase2_reco_pixelntuple_cfg.py index 7dddcf3c470c5..065454756764a 100644 --- a/SLHCUpgradeSimulations/Geometry/test/phase2_reco_pixelntuple_cfg.py +++ b/SLHCUpgradeSimulations/Geometry/test/phase2_reco_pixelntuple_cfg.py @@ -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_Phase2_cff import Phase2 +process = cms.Process('Phase2PixelNtuple',Phase2) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -15,7 +15,7 @@ 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') @@ -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' ) )