From 8979f5b932a6a3bf38431ba4adb57b63c7a42632 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Tue, 22 Mar 2022 08:26:25 +0100 Subject: [PATCH] Code check --- .../test/FastTimeNumberingTester.cc | 6 +- .../test/HGCalNumberingTester.cc | 60 +++++++++++++++---- .../test/HGCalParameterTester.cc | 30 +++++++--- .../test/python/testHGCalParametersDDD_cfg.py | 2 +- 4 files changed, 73 insertions(+), 25 deletions(-) diff --git a/Geometry/HGCalCommonData/test/FastTimeNumberingTester.cc b/Geometry/HGCalCommonData/test/FastTimeNumberingTester.cc index f1209fe8a386c..154a25217fd9e 100644 --- a/Geometry/HGCalCommonData/test/FastTimeNumberingTester.cc +++ b/Geometry/HGCalCommonData/test/FastTimeNumberingTester.cc @@ -61,7 +61,8 @@ FastTimeNumberingTester::FastTimeNumberingTester(const edm::ParameterSet&) // ------------ method called to produce the data ------------ void FastTimeNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { const FastTimeDDDConstants& fTnDC = iSetup.getData(token_); - edm::LogVerbatim("HGCalGeom") << "Fast timing device with " << fTnDC.getCells(1) << ":" << fTnDC.getCells(2) << " cells for barrel and endcap"; + edm::LogVerbatim("HGCalGeom") << "Fast timing device with " << fTnDC.getCells(1) << ":" << fTnDC.getCells(2) + << " cells for barrel and endcap"; for (int type = 1; type <= 2; ++type) { for (int ix = 0; ix < 400; ++ix) { for (int iy = 0; iy < 400; ++iy) { @@ -70,7 +71,8 @@ void FastTimeNumberingTester::analyze(const edm::Event& iEvent, const edm::Event edm::LogVerbatim("HGCalGeom") << "Valid ID " << id1 << " and " << id2; } else { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "ix = " << ix << ", iy = " << iy << " is not valid for " << "FastTime type " << type; + edm::LogVerbatim("HGCalGeom") << "ix = " << ix << ", iy = " << iy << " is not valid for " + << "FastTime type " << type; #endif } iy += 9; diff --git a/Geometry/HGCalCommonData/test/HGCalNumberingTester.cc b/Geometry/HGCalCommonData/test/HGCalNumberingTester.cc index 618e93043b8a7..20dd6bc2a5869 100644 --- a/Geometry/HGCalCommonData/test/HGCalNumberingTester.cc +++ b/Geometry/HGCalCommonData/test/HGCalNumberingTester.cc @@ -81,9 +81,13 @@ HGCalNumberingTester::HGCalNumberingTester(const edm::ParameterSet& iC) { positionY_[k] /= CLHEP::mm; } } - edm::LogVerbatim("HGCalGeom") << "Test numbering for " << nameDetector_ << " using constants of " << nameSense_ << " at " << positionX_.size() << " local positions " << "for every " << increment_ << " layers for DetType " << detType_ << " and RecoFlag " << reco_; + edm::LogVerbatim("HGCalGeom") << "Test numbering for " << nameDetector_ << " using constants of " << nameSense_ + << " at " << positionX_.size() << " local positions " + << "for every " << increment_ << " layers for DetType " << detType_ << " and RecoFlag " + << reco_; for (unsigned int k = 0; k < positionX_.size(); ++k) - edm::LogVerbatim("HGCalGeom") << "Position[" << k << "] " << positionX_[k] << " " << unit << ", " << positionY_[k] << " " << unit; + edm::LogVerbatim("HGCalGeom") << "Position[" << k << "] " << positionX_[k] << " " << unit << ", " << positionY_[k] + << " " << unit; } void HGCalNumberingTester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -102,13 +106,17 @@ void HGCalNumberingTester::fillDescriptions(edm::ConfigurationDescriptions& desc // ------------ method called to produce the data ------------ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { const HGCalDDDConstants& hgdc = iSetup.getData(dddToken_); - edm::LogVerbatim("HGCalGeom") << nameDetector_ << " Layers = " << hgdc.layers(reco_) << " Sectors = " << hgdc.sectors() << " Minimum Slope = " << hgdc.minSlope(); + edm::LogVerbatim("HGCalGeom") << nameDetector_ << " Layers = " << hgdc.layers(reco_) + << " Sectors = " << hgdc.sectors() << " Minimum Slope = " << hgdc.minSlope(); if (detType_ != 0) { - edm::LogVerbatim("HGCalGeom") << "Minimum Wafer # " << hgdc.waferMin() << " Mamximum Wafer # " << hgdc.waferMax() << " Wafer counts " << hgdc.waferCount(0) << ":" << hgdc.waferCount(1); + edm::LogVerbatim("HGCalGeom") << "Minimum Wafer # " << hgdc.waferMin() << " Mamximum Wafer # " << hgdc.waferMax() + << " Wafer counts " << hgdc.waferCount(0) << ":" << hgdc.waferCount(1); for (unsigned int i = 0; i < hgdc.layers(true); ++i) { int lay = i + 1; double z = hgdc.waferZ(lay, reco_); - edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " Wafers " << hgdc.wafers(lay, 0) << ":" << hgdc.wafers(lay, 1) << ":" << hgdc.wafers(lay, 2) << " Z " << z << " R " << hgdc.rangeR(z, reco_).first << ":" << hgdc.rangeR(z, reco_).second; + edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " Wafers " << hgdc.wafers(lay, 0) << ":" + << hgdc.wafers(lay, 1) << ":" << hgdc.wafers(lay, 2) << " Z " << z << " R " + << hgdc.rangeR(z, reco_).first << ":" << hgdc.rangeR(z, reco_).second; } } edm::LogVerbatim("HGCalGeom") << std::endl; @@ -126,12 +134,18 @@ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSet xy = hgdc.locateCell(kxy.second, i + loff, kxy.first, reco_); lxy = hgdc.assignCell(xy.first, xy.second, i + loff, 0, reco_); flg = (kxy == lxy) ? " " : " ***** Error *****"; - edm::LogVerbatim("HGCalGeom") << "Input: (" << localx << "," << localy << "," << i + loff << ", " << subsec << "), assignCell o/p (" << kxy.first << ", " << kxy.second << ") locateCell o/p (" << xy.first << ", " << xy.second << ")," << " final (" << lxy.first << ", " << lxy.second << ")" << flg; + edm::LogVerbatim("HGCalGeom") << "Input: (" << localx << "," << localy << "," << i + loff << ", " << subsec + << "), assignCell o/p (" << kxy.first << ", " << kxy.second + << ") locateCell o/p (" << xy.first << ", " << xy.second << ")," + << " final (" << lxy.first << ", " << lxy.second << ")" << flg; kxy = hgdc.assignCell(-localx, -localy, i + loff, subsec, reco_); xy = hgdc.locateCell(kxy.second, i + loff, kxy.first, reco_); lxy = hgdc.assignCell(xy.first, xy.second, i + loff, 0, reco_); flg = (kxy == lxy) ? " " : " ***** Error *****"; - edm::LogVerbatim("HGCalGeom") << "Input: (" << -localx << "," << -localy << "," << i + loff << ", " << subsec << "), assignCell o/p (" << kxy.first << ", " << kxy.second << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" << lxy.first << ", " << lxy.second << ")" << flg; + edm::LogVerbatim("HGCalGeom") << "Input: (" << -localx << "," << -localy << "," << i + loff << ", " << subsec + << "), assignCell o/p (" << kxy.first << ", " << kxy.second + << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" + << lxy.first << ", " << lxy.second << ")" << flg; } else if (detType_ == 0) { std::array kxy, lxy; double zpos = hgdc.waferZ(i + loff, reco_); @@ -139,12 +153,20 @@ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSet xy = hgdc.locateCellTrap(i + loff, kxy[0], kxy[1], reco_); lxy = hgdc.assignCellTrap(xy.first, xy.second, zpos, i + loff, reco_); flg = (kxy == lxy) ? " " : " ***** Error *****"; - edm::LogVerbatim("HGCalGeom") << "Input: (" << localx << "," << localy << "," << zpos << ", " << i + loff << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" << lxy[0] << ":" << lxy[1] << ":" << lxy[2] << ") Dist " << hgdc.distFromEdgeTrap(scl * localx, scl * localy, scl * zpos) << " " << flg; + edm::LogVerbatim("HGCalGeom") << "Input: (" << localx << "," << localy << "," << zpos << ", " << i + loff + << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] + << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" << lxy[0] + << ":" << lxy[1] << ":" << lxy[2] << ") Dist " + << hgdc.distFromEdgeTrap(scl * localx, scl * localy, scl * zpos) << " " << flg; kxy = hgdc.assignCellTrap(-localx, -localy, zpos, i + loff, reco_); xy = hgdc.locateCellTrap(i + loff, kxy[0], kxy[1], reco_); lxy = hgdc.assignCellTrap(xy.first, xy.second, zpos, i + loff, reco_); flg = (kxy == lxy) ? " " : " ***** Error *****"; - edm::LogVerbatim("HGCalGeom") << "Input: (" << -localx << "," << -localy << "," << zpos << ", " << i + loff << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" << lxy[0] << ":" << lxy[1] << ":" << lxy[2] << ") Dist " << hgdc.distFromEdgeTrap(scl * localx, scl * localy, scl * zpos) << " " << flg; + edm::LogVerbatim("HGCalGeom") << "Input: (" << -localx << "," << -localy << "," << zpos << ", " << i + loff + << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] + << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" << lxy[0] + << ":" << lxy[1] << ":" << lxy[2] << ") Dist " + << hgdc.distFromEdgeTrap(scl * localx, scl * localy, scl * zpos) << " " << flg; } else { std::array kxy, lxy; kxy = hgdc.assignCellHex(localx, localy, i + loff, reco_); @@ -152,12 +174,22 @@ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSet lxy = hgdc.assignCellHex(xy.first, xy.second, i + loff, reco_); flg = (kxy == lxy) ? " " : " ***** Error *****"; double zpos = hgdc.waferZ(i + loff, reco_); - edm::LogVerbatim("HGCalGeom") << "Input: (" << localx << "," << localy << ", " << i + loff << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] << ":" << kxy[3] << ":" << kxy[4] << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" << lxy[0] << ":" << lxy[1] << ":" << lxy[2] << ":" << lxy[3] << ":" << lxy[4] << ") Dist " << hgdc.distFromEdgeHex(scl * localx, scl * localy, scl * zpos) << " " << flg; + edm::LogVerbatim("HGCalGeom") << "Input: (" << localx << "," << localy << ", " << i + loff + << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] << ":" + << kxy[3] << ":" << kxy[4] << ") locateCell o/p (" << xy.first << ", " + << xy.second << "), final (" << lxy[0] << ":" << lxy[1] << ":" << lxy[2] << ":" + << lxy[3] << ":" << lxy[4] << ") Dist " + << hgdc.distFromEdgeHex(scl * localx, scl * localy, scl * zpos) << " " << flg; kxy = hgdc.assignCellHex(-localx, -localy, i + loff, reco_); xy = hgdc.locateCell(i + loff, kxy[0], kxy[1], kxy[3], kxy[4], reco_, true); lxy = hgdc.assignCellHex(xy.first, xy.second, i + loff, reco_); flg = (kxy == lxy) ? " " : " ***** Error *****"; - edm::LogVerbatim("HGCalGeom") << "Input: (" << -localx << "," << -localy << ", " << i + loff << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] << ":" << kxy[3] << ":" << kxy[4] << ") locateCell o/p (" << xy.first << ", " << xy.second << "), final (" << lxy[0] << ":" << lxy[1] << ":" << lxy[2] << ":" << lxy[3] << ":" << lxy[4] << ") Dist " << hgdc.distFromEdgeHex(scl * localx, scl * localy, scl * zpos) << " " << flg; + edm::LogVerbatim("HGCalGeom") << "Input: (" << -localx << "," << -localy << ", " << i + loff + << "), assignCell o/p (" << kxy[0] << ":" << kxy[1] << ":" << kxy[2] << ":" + << kxy[3] << ":" << kxy[4] << ") locateCell o/p (" << xy.first << ", " + << xy.second << "), final (" << lxy[0] << ":" << lxy[1] << ":" << lxy[2] << ":" + << lxy[3] << ":" << lxy[4] << ") Dist " + << hgdc.distFromEdgeHex(scl * localx, scl * localy, scl * zpos) << " " << flg; } if (k == 0 && i == 0 && detType_ == 1) { std::vector ncells = hgdc.numberCells(i + 1, reco_); @@ -178,7 +210,8 @@ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSet unsigned int kk(0); for (auto const& zz : hgdc.getParameter()->zLayerHex_) { std::pair rr = hgdc.rangeR(zz, true); - edm::LogVerbatim("HGCalGeom") << "[" << kk << "]\t z = " << zz << "\t rMin = " << rr.first << "\t rMax = " << rr.second; + edm::LogVerbatim("HGCalGeom") << "[" << kk << "]\t z = " << zz << "\t rMin = " << rr.first + << "\t rMax = " << rr.second; ++kk; } } @@ -188,7 +221,8 @@ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSet unsigned int kk(0); for (auto const& lay : hgdc.getParameter()->layer_) { auto rRange = hgdc.getREtaRange(lay); - edm::LogVerbatim("HGCalGeom") << "[" << kk << "] Layer " << lay << " R/Eta " << rRange.first << ":" << rRange.second << " nPhi " << hgdc.getPhiBins(lay); + edm::LogVerbatim("HGCalGeom") << "[" << kk << "] Layer " << lay << " R/Eta " << rRange.first << ":" + << rRange.second << " nPhi " << hgdc.getPhiBins(lay); ++kk; } } diff --git a/Geometry/HGCalCommonData/test/HGCalParameterTester.cc b/Geometry/HGCalCommonData/test/HGCalParameterTester.cc index 0318c1e237d82..a6c03a2abca0b 100644 --- a/Geometry/HGCalCommonData/test/HGCalParameterTester.cc +++ b/Geometry/HGCalCommonData/test/HGCalParameterTester.cc @@ -130,8 +130,8 @@ void HGCalParameterTester::analyze(const edm::Event& iEvent, const edm::EventSet } else if (mode_ == 1) { // Wafers of 8-inch format edm::LogVerbatim("HGCalGeom") << "DetectorType: " << phgp->detectorType_; - edm::LogVerbatim("HGCalGeom") << "Wafer Parameters: " << phgp->waferSize_ << ":" << phgp->waferR_ << ":" << phgp->waferThick_ << ":" - << phgp->sensorSeparation_ << ":" << phgp->mouseBite_; + edm::LogVerbatim("HGCalGeom") << "Wafer Parameters: " << phgp->waferSize_ << ":" << phgp->waferR_ << ":" + << phgp->waferThick_ << ":" << phgp->sensorSeparation_ << ":" << phgp->mouseBite_; myPrint("waferThickness", phgp->waferThickness_, 10); edm::LogVerbatim("HGCalGeom") << "nCells_: " << phgp->nCellsFine_ << ":" << phgp->nCellsCoarse_; edm::LogVerbatim("HGCalGeom") << "nSectors_: " << phgp->nSectors_; @@ -144,15 +144,17 @@ void HGCalParameterTester::analyze(const edm::Event& iEvent, const edm::EventSet myPrint("CellThickness", phgp->cellThickness_, 10); myPrint("radius100to200", phgp->radius100to200_, 10); myPrint("radius200to300", phgp->radius200to300_, 10); - edm::LogVerbatim("HGCalGeom") << "choiceType " << phgp->choiceType_ << " nCornerCut " << phgp->nCornerCut_ << " fracAreaMin " - << phgp->fracAreaMin_ << " zMinForRad " << phgp->zMinForRad_; + edm::LogVerbatim("HGCalGeom") << "choiceType " << phgp->choiceType_ << " nCornerCut " << phgp->nCornerCut_ + << " fracAreaMin " << phgp->fracAreaMin_ << " zMinForRad " << phgp->zMinForRad_; myPrint("CellSize", phgp->cellSize_, 10); myPrint("radiusMixBoundary", phgp->radiusMixBoundary_, 10); myPrint("LayerCenter", phgp->layerCenter_, 20); - edm::LogVerbatim("HGCalGeom") << "Layer Rotation " << phgp->layerRotation_ << " with " << phgp->layerRotV_.size() << " parameters"; + edm::LogVerbatim("HGCalGeom") << "Layer Rotation " << phgp->layerRotation_ << " with " << phgp->layerRotV_.size() + << " parameters"; for (unsigned int k = 0; k < phgp->layerRotV_.size(); ++k) - edm::LogVerbatim("HGCalGeom") << "Element[" << k << "] " << phgp->layerRotV_[k].first << ":" << phgp->layerRotV_[k].second; + edm::LogVerbatim("HGCalGeom") << "Element[" << k << "] " << phgp->layerRotV_[k].first << ":" + << phgp->layerRotV_[k].second; myPrint("slopeMin", phgp->slopeMin_, 10); myPrint("zFrontMin", phgp->zFrontMin_, 10); myPrint("rMinFront", phgp->rMinFront_, 10); @@ -211,7 +213,11 @@ void HGCalParameterTester::analyze(const edm::Event& iEvent, const edm::EventSet unsigned int kk(0); std::unordered_map::const_iterator itr = phgp->waferInfoMap_.begin(); for (; itr != phgp->waferInfoMap_.end(); ++itr, ++kk) - edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << itr->first << "[" << HGCalWaferIndex::waferLayer(itr->first) << ", " << HGCalWaferIndex::waferU(itr->first) << ", " << HGCalWaferIndex::waferV(itr->first) << "] (" << (itr->second).type << ", " << (itr->second).part << ", " << (itr->second).orient << ")"; + edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << itr->first << "[" + << HGCalWaferIndex::waferLayer(itr->first) << ", " + << HGCalWaferIndex::waferU(itr->first) << ", " + << HGCalWaferIndex::waferV(itr->first) << "] (" << (itr->second).type << ", " + << (itr->second).part << ", " << (itr->second).orient << ")"; } } else { // Tpaezoid (scintillator) type @@ -291,7 +297,12 @@ void HGCalParameterTester::analyze(const edm::Event& iEvent, const edm::EventSet unsigned int kk(0); std::unordered_map::const_iterator itr = phgp->tileInfoMap_.begin(); for (; itr != phgp->tileInfoMap_.end(); ++itr, ++kk) - edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << itr->first << "[" << HGCalTileIndex::tileLayer(itr->first) << ", " << HGCalTileIndex::tileRing(itr->first) << ", " << HGCalTileIndex::tilePhi(itr->first) << "] (" << (itr->second).type << ", " << (itr->second).sipm << std::hex << ", " << (itr->second).hex[0] << ", " << (itr->second).hex[1] << ", " << (itr->second).hex[2] << ", " << (itr->second).hex[3] << ")" << std::dec; + edm::LogVerbatim("HGCalGeom") << "[" << kk << "] " << itr->first << "[" << HGCalTileIndex::tileLayer(itr->first) + << ", " << HGCalTileIndex::tileRing(itr->first) << ", " + << HGCalTileIndex::tilePhi(itr->first) << "] (" << (itr->second).type << ", " + << (itr->second).sipm << std::hex << ", " << (itr->second).hex[0] << ", " + << (itr->second).hex[1] << ", " << (itr->second).hex[2] << ", " + << (itr->second).hex[3] << ")" << std::dec; } } @@ -415,7 +426,8 @@ void HGCalParameterTester::printWaferType(HGCalParameters const* phgp) const { if (!kounts.empty()) { edm::LogVerbatim("HGCalGeom") << "Summary of waferTypes =========================="; for (itr = kounts.begin(); itr != kounts.end(); ++itr) - edm::LogVerbatim("HGCalGeom") << "Type (" << (itr->first).first << ":" << (itr->first).second << ") Kount " << itr->second; + edm::LogVerbatim("HGCalGeom") << "Type (" << (itr->first).first << ":" << (itr->first).second << ") Kount " + << itr->second; } } diff --git a/Geometry/HGCalCommonData/test/python/testHGCalParametersDDD_cfg.py b/Geometry/HGCalCommonData/test/python/testHGCalParametersDDD_cfg.py index dfc20daf58ae0..ba560935bf745 100644 --- a/Geometry/HGCalCommonData/test/python/testHGCalParametersDDD_cfg.py +++ b/Geometry/HGCalCommonData/test/python/testHGCalParametersDDD_cfg.py @@ -5,7 +5,7 @@ process.load("SimGeneral.HepPDTESSource.pdt_cfi") #process.load("Geometry.CMSCommonData.cmsExtendedGeometry2026D83XML_cfi") process.load("Geometry.HGCalCommonData.testHGCalV15XML_cfi") -process.load("Geometry.HGCalCommonData.hgcalParametersInitialization_cfi") +process.load("Geometry.HGCalCommonData.hgcalV15ParametersInitialization_cfi") process.load('FWCore.MessageService.MessageLogger_cfi') if hasattr(process,'MessageLogger'):