Skip to content

Commit

Permalink
Merge pull request #26504 from bsunanda/Run2-hgx192
Browse files Browse the repository at this point in the history
Run2-hgx192 Complete first level of debugging geometry
  • Loading branch information
cmsbuild committed Apr 26, 2019
2 parents 1737810 + ec5634d commit 64aea4c
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 75 deletions.
2 changes: 1 addition & 1 deletion Geometry/CaloTopology/src/HGCalTopology.cc
Expand Up @@ -34,7 +34,7 @@ HGCalTopology::HGCalTopology(const HGCalDDDConstants& hdcons,
} else if (mode_ == HGCalGeometryMode::Trapezoid) {
det_ = (DetId::Detector)(det);
subdet_ = ForwardEmpty;
kHGeomHalf_ = sectors_*layers_*cells_;
kHGeomHalf_ = sectors_*layers_*cellMax_;
types_ = 2;
} else {
det_ = (DetId::Detector)(det);
Expand Down
28 changes: 14 additions & 14 deletions Geometry/HGCalCommonData/data/hgcal/v10/hgcal.xml
Expand Up @@ -27,20 +27,20 @@
<Constant name="ChoiceType" value="0"/>
<Constant name="NCornerCut" value="2"/>
<Constant name="FracAreaMin" value="0.2"/>
<Constant name="radMixL0" value="1450.0*mm"/>
<Constant name="radMixL1" value="1450.0*mm"/>
<Constant name="radMixL2" value="1450.0*mm"/>
<Constant name="radMixL3" value="1450.0*mm"/>
<Constant name="radMixL4" value="1305.0*mm"/>
<Constant name="radMixL5" value="1305.0*mm"/>
<Constant name="radMixL6" value="1160.0*mm"/>
<Constant name="radMixL7" value="1160.0*mm"/>
<Constant name="radMixL8" value="1160.0*mm"/>
<Constant name="radMixL9" value="1160.0*mm"/>
<Constant name="radMixL10" value="1005.0*mm"/>
<Constant name="radMixL11" value="1005.0*mm"/>
<Constant name="radMixL12" value="1005.0*mm"/>
<Constant name="radMixL13" value="1005.0*mm"/>
<Constant name="radMixL0" value="1537.0*mm"/>
<Constant name="radMixL1" value="1537.0*mm"/>
<Constant name="radMixL2" value="1537.0*mm"/>
<Constant name="radMixL3" value="1537.0*mm"/>
<Constant name="radMixL4" value="1378.2*mm"/>
<Constant name="radMixL5" value="1378.2*mm"/>
<Constant name="radMixL6" value="1183.0*mm"/>
<Constant name="radMixL7" value="1183.0*mm"/>
<Constant name="radMixL8" value="1183.0*mm"/>
<Constant name="radMixL9" value="1183.0*mm"/>
<Constant name="radMixL10" value="1037.8*mm"/>
<Constant name="radMixL11" value="1037.8*mm"/>
<Constant name="radMixL12" value="1037.8*mm"/>
<Constant name="radMixL13" value="1037.8*mm"/>
<Constant name="slope1" value="[etaMax:slope]"/>
<Constant name="slope2" value="[caloBase:slope20]"/>
<Constant name="slope3" value="[caloBase:slope30]"/>
Expand Down
4 changes: 2 additions & 2 deletions Geometry/HGCalCommonData/data/hgcalCons/v10/hgcalCons.xml
Expand Up @@ -129,10 +129,10 @@
<Parameter name="DetectorType" value="3"/>
<Parameter name="WaferThickness" value="[hgcal:ScintillatorThickness]"/>
<Parameter name="MinimumTileSize" value="[MinimumTileSize]"/>
<Parameter name="NPhiBinBH" value="360"/>
<Parameter name="NPhiBinBH" value="288"/>
<Parameter name="NPhiBinBH" value="288"/>
<Parameter name="LayerFrontBH" value="[hgcal:FirstMixedLayer]"/>
<Parameter name="LayerFrontBH" value="([hgcal:FirstMixedLayer]+4)"/>
<Parameter name="LayerFrontBH" value="[hgcal:FirstMixedLayer]"/>
<Parameter name="RMinLayerBH" value="[hgcal:radMixL3]"/>
<Parameter name="RMinLayerBH" value="[hgcal:radMixL13]"/>
<Parameter name="SlopeBottom" value="0"/>
Expand Down
8 changes: 4 additions & 4 deletions Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc
Expand Up @@ -545,10 +545,10 @@ void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin,
cpv.position(name, glog.ddname(), copy, tran, rotation);
#ifdef EDM_ML_DEBUG
++ntype[type];
edm::LogVerbatim("HGCalGeom")
<< "DDHGCalHEAlgo: " << name << " number " << copy
<< " positioned in " << glog.ddname() << " at " << tran
<< " with " << rotation;
edm::LogVerbatim("HGCalGeom")
<< "DDHGCalHEAlgo: " << name << " number " << copy
<< " positioned in " << glog.ddname() << " at " << tran
<< " with " << rotation;
#endif
}
}
Expand Down
31 changes: 17 additions & 14 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Expand Up @@ -387,14 +387,14 @@ int HGCalDDDConstants::getLayer(double z, bool reco) const {
double zz =
(reco ? std::abs(z) : HGCalParameters::k_ScaleFromDDD * std::abs(z));
const auto& zLayerHex = hgpar_->zLayerHex_;
std::find_if(zLayerHex.begin() + 1, zLayerHex.end(),
[&k, &zz, &zLayerHex](double zLayer) {
++k;
return zz < 0.5 * (zLayerHex[k - 1] + zLayerHex[k]);
});
int lay = k;
auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(),
[&k, &zz, &zLayerHex](double zLayer) {
++k;
return zz < 0.5 * (zLayerHex[k-1] + zLayerHex[k]);
});
int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) : k;
if (((mode_ == HGCalGeometryMode::Hexagon) ||
(mode_ == HGCalGeometryMode::HexagonFull)) &
(mode_ == HGCalGeometryMode::HexagonFull)) &&
reco) {
int indx = layerIndex(lay, false);
if (indx >= 0) lay = hgpar_->layerGroup_[indx];
Expand Down Expand Up @@ -1039,17 +1039,20 @@ std::pair<double, double> HGCalDDDConstants::rangeR(double z, bool reco) const {
rmin = HGCalGeomTools::radius(zz, hgpar_->zFrontMin_, hgpar_->rMinFront_,
hgpar_->slopeMin_);
} else {
rmin = HGCalGeomTools::radius(
zz, hgpar_->firstLayer_, hgpar_->firstMixedLayer_, hgpar_->zLayerHex_,
hgpar_->radiusMixBoundary_);
rmin = HGCalGeomTools::radius(zz, hgpar_->firstLayer_,
hgpar_->firstMixedLayer_,
hgpar_->zLayerHex_,
hgpar_->radiusMixBoundary_);
}
if ((hgpar_->detectorType_ == 2) &&
(zz >= hgpar_->zLayerHex_[hgpar_->firstMixedLayer_ - 1])) {
rmax = HGCalGeomTools::radius(
zz, hgpar_->firstLayer_, hgpar_->firstMixedLayer_, hgpar_->zLayerHex_,
hgpar_->radiusMixBoundary_);
rmax = HGCalGeomTools::radius(zz, hgpar_->firstLayer_,
hgpar_->firstMixedLayer_,
hgpar_->zLayerHex_,
hgpar_->radiusMixBoundary_);
} else {
rmax = HGCalGeomTools::radius(zz, hgpar_->zFrontTop_, hgpar_->rMaxFront_,
rmax = HGCalGeomTools::radius(zz, hgpar_->zFrontTop_,
hgpar_->rMaxFront_,
hgpar_->slopeTop_);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Geometry/HGCalCommonData/src/HGCalGeomTools.cc
Expand Up @@ -37,11 +37,11 @@ double HGCalGeomTools::radius(double z, int layer0, int layerf,
for (unsigned int k = 0; k < rFront.size(); ++k) {
int k1 = layerf - layer0 + (int)(k);
if (k1 < (int)(zFront.size())) {
if (z < zFront[k1] + tol) break;
r = rFront[k];
#ifdef EDM_ML_DEBUG
ik = k;
#endif
if (z < zFront[k1] + tol) break;
}
}
#ifdef EDM_ML_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion Geometry/HGCalCommonData/test/testHGCalNumbering_cfg.py
Expand Up @@ -5,7 +5,7 @@
#process.load("Geometry.CMSCommonData.cmsExtendedGeometry2023D17XML_cfi")
#process.load("Geometry.HGCalCommonData.hgcalV6ParametersInitialization_cfi")
#process.load("Geometry.HGCalCommonData.hgcalV6NumberingInitialization_cfi")
process.load("Geometry.HGCalCommonData.testHGCXML_cfi")
process.load("Geometry.HGCalCommonData.testHGCV10XML_cfi")
process.load("Geometry.HGCalCommonData.hgcalParametersInitialization_cfi")
process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi")
process.load('FWCore.MessageService.MessageLogger_cfi')
Expand Down
33 changes: 25 additions & 8 deletions Geometry/HGCalGeometry/test/HGCalGeometryTester.cc
Expand Up @@ -106,14 +106,16 @@ void HGCalGeometryTester::doTest(const HGCalGeometry* geom,
auto icell1 = geom->getGeometry(id1);
GlobalPoint global1 = geom->getPosition(id1);
DetId idc1 = geom->getClosestCell(global1);
GlobalPoint global2 = geom->getPosition(idc1);
std::cout << "DetId (" << subdet << ":" << zside << ":" << layer
<< ":" << sector << ":0:" << cell << ") Geom " << icell1
<< " position (" << global1.x() << ", " << global1.y()
<< ", " << global1.z() << ") ids " << std::hex
<< id1.rawId() << ":" << idc1.rawId() << std::dec
<< ":" << HGCalDetId(id1) << ":" << HGCalDetId(idc1)
<< " parameter[3] = " << icell1->param()[2] << ":"
<< icell1->param()[2];
<< " new position (" << global2.x() << ", " << global2.y()
<< ", " << global2.z() << ") parameter[3] = "
<< icell1->param()[2] << ":" << icell1->param()[2];
if (id1.rawId() != idc1.rawId())
std::cout << "***** ERROR *****" << std::endl;
else
Expand Down Expand Up @@ -156,6 +158,7 @@ void HGCalGeometryTester::doTestWafer(const HGCalGeometry* geom,
auto icell1 = geom->getGeometry(id1);
GlobalPoint global1 = geom->getPosition(id1);
DetId idc1 = geom->getClosestCell(global1);
GlobalPoint global2 = geom->getPosition(idc1);
std::cout << "DetId (" << det << ":" << zside << ":"
<< type << ":" << layer << ":" << waferU << ":"
<< waferV << ":" << cellU << ":" << cellV
Expand All @@ -164,7 +167,9 @@ void HGCalGeometryTester::doTestWafer(const HGCalGeometry* geom,
<< ", " << global1.z() << ") ids " << std::hex
<< id1.rawId() << ":" << idc1.rawId() << std::dec
<< ":" << HGCSiliconDetId(id1) << ":"
<< HGCSiliconDetId(idc1) << " parameter[3] = "
<< HGCSiliconDetId(idc1) << " new position ("
<< global2.x() << ", " << global2.y()
<< ", " << global2.z() << ") parameter[3] = "
<< icell1->param()[2] << ":" << icell1->param()[2];
if (id1.rawId() != idc1.rawId())
std::cout << "***** ERROR *****" << std::endl;
Expand Down Expand Up @@ -205,15 +210,18 @@ void HGCalGeometryTester::doTestScint(const HGCalGeometry* geom,
auto icell1 = geom->getGeometry(id1);
GlobalPoint global1 = geom->getPosition(id1);
DetId idc1 = geom->getClosestCell(global1);
GlobalPoint global2 = geom->getPosition(idc1);
std::cout << "DetId (" << det << ":" << zside << ":" << type
<< ":" << layer << ":" << ieta << ":" << iphi
<< ") Geom " << icell1 << " position (" << global1.x()
<< ", " << global1.y() << ", " << global1.z()
<< ") ids " << std::hex << id1.rawId() << ":"
<< idc1.rawId() << std::dec << ":"
<< HGCScintillatorDetId(id1) << ":"
<< HGCScintillatorDetId(idc1)
<< " parameter[11] = " << icell1->param()[10] << ":"
<< ":" << global1.perp() << ") ids " << std::hex
<< id1.rawId() << ":" << idc1.rawId() << std::dec
<< ":" << HGCScintillatorDetId(id1) << ":"
<< HGCScintillatorDetId(idc1) << " new position ("
<< global2.x() << ", " << global2.y() << ", "
<< global2.z() << ":" << global2.perp()
<< ") parameter[11] = " << icell1->param()[10] << ":"
<< icell1->param()[10];
if (id1.rawId() != idc1.rawId())
std::cout << "***** ERROR *****" << std::endl;
Expand All @@ -230,6 +238,15 @@ void HGCalGeometryTester::doTestScint(const HGCalGeometry* geom,
}
}
}
for (int layer = geom->topology().dddConstants().firstLayer();
layer <= geom->topology().dddConstants().lastLayer(true); ++layer) {
HGCScintillatorDetId id(geom->topology().dddConstants().getTypeTrap(layer),
layer, 20, 1);
GlobalPoint global1 = geom->getPosition(id);
std::cout << "Layer " << layer << " DetId " << id << " position ("
<< global1.x() << ", " << global1.y() << ", " << global1.z()
<< ", " << global1.perp() << ")" << std::endl;
}
}

//define this as a plug-in
Expand Down
14 changes: 8 additions & 6 deletions Geometry/HGCalGeometry/test/python/testHGCalGeometry_cfg.py
Expand Up @@ -3,15 +3,16 @@
process = cms.Process("PROD")
process.load("SimGeneral.HepPDTESSource.pdt_cfi")

#process.load("Geometry.CMSCommonData.cmsExtendedGeometry2023D17XML_cfi")
process.load("Configuration.Geometry.GeometryExtended2023D41Reco_cff")
#process.load("Geometry.CMSCommonData.cmsExtendedGeometry2023D41XML_cfi")
#process.load("Geometry.HGCalCommonData.hgcalV6NumberingInitialization_cfi")
#process.load("Geometry.HGCalCommonData.hgcalV6ParametersInitialization_cfi")
#process.load("Geometry.CaloEventSetup.HGCalV6Topology_cfi")
process.load("Geometry.HGCalCommonData.testHGCXML_cfi")
process.load("Geometry.HGCalCommonData.hgcalParametersInitialization_cfi")
process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi")
process.load("Geometry.CaloEventSetup.HGCalV9Topology_cfi")
process.load("Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi")
#process.load("Geometry.HGCalCommonData.testHGCV10XML_cfi")
#process.load("Geometry.HGCalCommonData.hgcalParametersInitialization_cfi")
#process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi")
#process.load("Geometry.CaloEventSetup.HGCalV9Topology_cfi")
#process.load("Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi")
process.load('FWCore.MessageService.MessageLogger_cfi')

if hasattr(process,'MessageLogger'):
Expand Down Expand Up @@ -55,3 +56,4 @@

#process.p1 = cms.Path(process.generator*process.prodEE*process.prodHEF)
process.p1 = cms.Path(process.generator*process.prodEE*process.prodHEF*process.prodHEB)
#process.p1 = cms.Path(process.generator*process.prodHEB)
57 changes: 36 additions & 21 deletions SimG4CMS/Calo/src/HGCalNumberingScheme.cc
Expand Up @@ -27,6 +27,13 @@ uint32_t HGCalNumberingScheme::getUnitID(int layer, int module, int cell, int iz
// module is the copy number of the wafer as placed in the layer
uint32_t index(0);
wt = 1.0;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCSim")
<< "HGCalNumberingScheme:: input Layer " << layer << " Module " << module
<< " Cell " << cell << " iz " << iz << " Position " << pos << " Mode "
<< mode_ << ":" << HGCalGeometryMode::Hexagon8Full << ":"
<< HGCalGeometryMode::Hexagon8 << ":" << HGCalGeometryMode::Trapezoid;
#endif
if ((mode_ == HGCalGeometryMode::Hexagon8Full) || (mode_ == HGCalGeometryMode::Hexagon8)) {
int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0);
if (cell >= 0) {
Expand All @@ -46,8 +53,9 @@ uint32_t HGCalNumberingScheme::getUnitID(int layer, int module, int cell, int iz
if (waferType >= 0) {
index = HGCSiliconDetId(det_, iz, waferType, layer, waferU, waferV, cellU, cellV).rawId();
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCSim") << "OK WaferType " << waferType << " Wafer " << waferU << ":" << waferV << " Cell "
<< cellU << ":" << cellV;
edm::LogVerbatim("HGCSim")
<< "OK WaferType " << waferType << " Wafer " << waferU << ":" << waferV
<< " Cell " << cellU << ":" << cellV;
} else {
edm::LogVerbatim("HGCSim") << "Bad WaferType " << waferType;
#endif
Expand All @@ -57,19 +65,24 @@ uint32_t HGCalNumberingScheme::getUnitID(int layer, int module, int cell, int iz
if (id[2] >= 0) {
index = HGCScintillatorDetId(id[2], layer, iz * id[0], id[1]).rawId();
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCSim") << "Radius/Phi " << id[0] << ":" << id[1] << " Type " << id[2] << " Layer|iz " << layer
<< ":" << iz << " " << HGCScintillatorDetId(index);
edm::LogVerbatim("HGCSim")
<< "Radius/Phi " << id[0] << ":" << id[1] << " Type " << id[2]
<< " Layer|iz " << layer << ":" << iz << " "
<< HGCScintillatorDetId(index);
} else {
edm::LogVerbatim("HGCSim") << "Radius/Phi " << id[0] << ":" << id[1] << " Type " << id[2] << " Layer|iz " << layer
<< ":" << iz;
edm::LogVerbatim("HGCSim")
<< "Radius/Phi " << id[0] << ":" << id[1] << " Type " << id[2]
<< " Layer|iz " << layer << ":" << iz << " ERROR";
#endif
}
}
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme::i/p " << det_ << ":" << layer << ":" << module << ":" << cell
<< ":" << iz << ":" << pos.x() << ":" << pos.y() << ":" << pos.z() << " ID " << std::hex
<< index << std::dec << " wt " << wt;
edm::LogVerbatim("HGCSim")
<< "HGCalNumberingScheme::i/p " << det_ << ":" << layer << ":" << module
<< ":" << cell << ":" << iz << ":" << pos.x() << ":" << pos.y() << ":"
<< pos.z() << " ID " << std::hex << index << std::dec << " wt " << wt;
checkPosition(index, pos);
}
#endif
return index;
}
Expand Down Expand Up @@ -106,24 +119,26 @@ void HGCalNumberingScheme::checkPosition(uint32_t index, const G4ThreeVector& po
bool match = (std::abs(r1 - r2) < drMax) && (std::abs(z1 - z2) < dzMax);
bool inok = ((r2 >= rrange.first) && (r2 <= rrange.second) && (z2 >= zrange.first) && (z2 <= zrange.second));
bool outok = ((r1 >= rrange.first) && (r1 <= rrange.second) && (z1 >= zrange.first) && (z1 <= zrange.second));
std::string ck = (((r1 < rrange.first - 10.0) || (r1 > rrange.second + 10.0) || (z1 < zrange.first - 5.0) ||
(z1 > zrange.second + 5.0))
? "***** ERROR *****"
: "");
std::string ck = (((r1 < rrange.first - 10.0) || (r1 > rrange.second +10.0) ||
(z1 < zrange.first - 5.0) || (z1 > zrange.second + 5.0)) ?
"***** ERROR *****" : "");
if (!(match && inok && outok)) {
edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme::Detector " << det_ << " Layer " << lay << " R " << r2 << ":"
<< r1 << ":" << rrange.first << ":" << rrange.second << " Z " << z2 << ":" << z1 << ":"
<< zrange.first << ":" << zrange.second << " Match " << match << ":" << inok << ":"
<< outok << " " << ck;
edm::LogVerbatim("HGCSim") << "Original " << pos.x() << ":" << pos.y() << " return " << xy.first << ":"
<< xy.second;
edm::LogVerbatim("HGCSim")
<< "HGCalNumberingScheme::Detector " << det_ << " Layer " << lay << " R "
<< r2 << ":" << r1 << ":" << rrange.first << ":" << rrange.second << " Z "
<< z2 << ":" << z1 << ":" << zrange.first << ":" << zrange.second
<< " Match " << match << ":" << inok << ":" << outok << " " << ck;
edm::LogVerbatim("HGCSim")
<< "Original " << pos.x() << ":" << pos.y() << " return " << xy.first
<< ":" << xy.second;
if (DetId(index).det() == DetId::HGCalHSi) {
double wt = 0, xx = ((pos.z() > 0) ? pos.x() : -pos.x());
int waferU, waferV, cellU, cellV, waferType;
hgcons_.waferFromPosition(xx, pos.y(), lay, waferU, waferV, cellU, cellV, waferType, wt, true);
xy = hgcons_.locateCell(lay, waferU, waferV, cellU, cellV, false, true, true);
edm::LogVerbatim("HGCSim") << "HGCalNumberingScheme " << HGCSiliconDetId(index) << " position " << xy.first
<< ":" << xy.second;
edm::LogVerbatim("HGCSim")
<< "HGCalNumberingScheme " << HGCSiliconDetId(index) << " position "
<< xy.first << ":" << xy.second;
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions SimG4CMS/Calo/test/python/runHGC4_cfg.py
Expand Up @@ -19,7 +19,7 @@
if hasattr(process,'MessageLogger'):
process.MessageLogger.categories.append('HGCalGeom')
process.MessageLogger.categories.append('HGCSim')
process.MessageLogger.categories.append('SimG4CoreGeometry')
# process.MessageLogger.categories.append('SimG4CoreGeometry')

process.load("IOMC.RandomEngine.IOMC_cff")
process.RandomNumberGeneratorService.generator.initialSeed = 456789
Expand All @@ -40,8 +40,10 @@
process.generator = cms.EDProducer("FlatRandomEGunProducer",
PGunParameters = cms.PSet(
PartID = cms.vint32(13),
MinEta = cms.double(2.95),
MaxEta = cms.double(3.01),
# MinEta = cms.double(2.95),
# MaxEta = cms.double(3.01),
MinEta = cms.double(1.69),
MaxEta = cms.double(2.32),
MinPhi = cms.double(-3.1415926),
MaxPhi = cms.double(-1.5707963),
MinE = cms.double(100.00),
Expand Down

0 comments on commit 64aea4c

Please sign in to comment.