Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Mar 22, 2022
1 parent 18e5507 commit 8979f5b
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 25 deletions.
6 changes: 4 additions & 2 deletions Geometry/HGCalCommonData/test/FastTimeNumberingTester.cc
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
60 changes: 47 additions & 13 deletions Geometry/HGCalCommonData/test/HGCalNumberingTester.cc
Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -126,38 +134,62 @@ 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<int, 3> kxy, lxy;
double zpos = hgdc.waferZ(i + loff, reco_);
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;
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<int, 5> kxy, lxy;
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 *****";
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<int> ncells = hgdc.numberCells(i + 1, reco_);
Expand All @@ -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<double, double> 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;
}
}
Expand All @@ -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;
}
}
Expand Down
30 changes: 21 additions & 9 deletions Geometry/HGCalCommonData/test/HGCalParameterTester.cc
Expand Up @@ -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_;
Expand All @@ -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);
Expand Down Expand Up @@ -211,7 +213,11 @@ void HGCalParameterTester::analyze(const edm::Event& iEvent, const edm::EventSet
unsigned int kk(0);
std::unordered_map<int32_t, HGCalParameters::waferInfo>::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
Expand Down Expand Up @@ -291,7 +297,12 @@ void HGCalParameterTester::analyze(const edm::Event& iEvent, const edm::EventSet
unsigned int kk(0);
std::unordered_map<int32_t, HGCalParameters::tileInfo>::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;
}
}

Expand Down Expand Up @@ -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;
}
}

Expand Down
Expand Up @@ -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'):
Expand Down

0 comments on commit 8979f5b

Please sign in to comment.