Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Oct 23, 2021
1 parent 943362d commit b0dc745
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
6 changes: 4 additions & 2 deletions Geometry/HGCalCommonData/interface/HGCalDDDConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ class HGCalDDDConstants {
double waferSepar(bool reco) const {
return (reco ? hgpar_->sensorSeparation_ : HGCalParameters::k_ScaleToDDD * hgpar_->sensorSeparation_);
}
GlobalPoint waferLocal2Global(HepGeom::Point3D<float>& loc, const DetId& id, bool useWafer, bool reco, bool debug) const {
GlobalPoint waferLocal2Global(
HepGeom::Point3D<float>& loc, const DetId& id, bool useWafer, bool reco, bool debug) const {
HGCSiliconDetId detid(id);
double x(0), y(0);
if (useWafer) {
Expand All @@ -198,7 +199,8 @@ class HGCalDDDConstants {
y = xyw.second;
}
auto xy = getXY(detid.layer(), (x + loc.x()), (y + loc.y()), false);
double zz = (detid.zside() < 0) ? -(loc.z() + waferZ(detid.layer(), reco)) : (loc.z() + waferZ(detid.layer(), reco));
double zz =
(detid.zside() < 0) ? -(loc.z() + waferZ(detid.layer(), reco)) : (loc.z() + waferZ(detid.layer(), reco));
double xx = (detid.zside() < 0) ? -xy.first : xy.first;
return GlobalPoint(xx, xy.second, zz);
}
Expand Down
54 changes: 30 additions & 24 deletions Geometry/HGCalGeometry/src/HGCalGeometryLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,39 @@ HGCalGeometry* HGCalGeometryLoader::build(const HGCalTopology& topology) {
id.setType(typm.first);
id.setSiPM(typm.second);
}
bool ok = test ? topology.dddConstants().tileExist(zside, layer, ring, iphi) : true;
bool ok = test ? topology.dddConstants().tileExist(zside, layer, ring, iphi) : true;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader::layer:rad:phi:type:sipm " << layer << ":" << ring * zside << ":" << iphi << ":" << type << ":" << typm.first << ":" << typm.second << " Test " << test << ":" << ok;
edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader::layer:rad:phi:type:sipm " << layer << ":"
<< ring * zside << ":" << iphi << ":" << type << ":" << typm.first << ":"
<< typm.second << " Test " << test << ":" << ok;
#endif
if (ok) {
DetId detId = static_cast<DetId>(id);
const auto& w = topology.dddConstants().locateCellTrap(layer, ring, iphi, true);
double xx = (zside > 0) ? w.first : -w.first;
CLHEP::Hep3Vector h3v(xx, w.second, mytr.h3v.z());
const HepGeom::Transform3D ht3d(mytr.hr, h3v);
if (ok) {
DetId detId = static_cast<DetId>(id);
const auto& w = topology.dddConstants().locateCellTrap(layer, ring, iphi, true);
double xx = (zside > 0) ? w.first : -w.first;
CLHEP::Hep3Vector h3v(xx, w.second, mytr.h3v.z());
const HepGeom::Transform3D ht3d(mytr.hr, h3v);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader::rad:phi:type " << ring * zside << ":" << iphi << ":" << type " DetId " << HGCScintillatorDetId(detId) << " " << std::hex << detId.rawId() << std::dec << " transf " << ht3d.getTranslation() << " R " << ht3d.getTranslation().perp() << " and " << ht3d.getRotation();
edm::LogVerbatim("HGCalGeom")
<< "HGCalGeometryLoader::rad:phi:type " << ring * zside << ":" << iphi << ":" << type " DetId "
<< HGCScintillatorDetId(detId) << " " << std::hex << detId.rawId() << std::dec << " transf "
<< ht3d.getTranslation() << " R " << ht3d.getTranslation().perp() << " and " << ht3d.getRotation();
#endif
HGCalParameters::hgtrap vol = topology.dddConstants().getModule(md, false, true);
params[FlatTrd::k_dZ] = vol.dz;
params[FlatTrd::k_Theta] = params[FlatTrd::k_Phi] = 0;
params[FlatTrd::k_dY1] = params[FlatTrd::k_dY2] = vol.h;
params[FlatTrd::k_dX1] = params[FlatTrd::k_dX3] = vol.bl;
params[FlatTrd::k_dX2] = params[FlatTrd::k_dX4] = vol.tl;
params[FlatTrd::k_Alp1] = params[FlatTrd::k_Alp2] = 0;
params[FlatTrd::k_Cell] = topology.dddConstants().cellSizeHex(type);

buildGeom(params, ht3d, detId, geom, 1);
counter++;
HGCalParameters::hgtrap vol = topology.dddConstants().getModule(md, false, true);
params[FlatTrd::k_dZ] = vol.dz;
params[FlatTrd::k_Theta] = params[FlatTrd::k_Phi] = 0;
params[FlatTrd::k_dY1] = params[FlatTrd::k_dY2] = vol.h;
params[FlatTrd::k_dX1] = params[FlatTrd::k_dX3] = vol.bl;
params[FlatTrd::k_dX2] = params[FlatTrd::k_dX4] = vol.tl;
params[FlatTrd::k_Alp1] = params[FlatTrd::k_Alp2] = 0;
params[FlatTrd::k_Cell] = topology.dddConstants().cellSizeHex(type);

buildGeom(params, ht3d, detId, geom, 1);
counter++;
#ifdef EDM_ML_DEBUG
++kount;
++kount;
#endif
}
}
}
++ring;
}
Expand Down Expand Up @@ -178,10 +183,11 @@ HGCalGeometry* HGCalGeometryLoader::build(const HGCalTopology& topology) {

if (counter != numberExpected) {
if (test) {
edm::LogVerbatim("HGCalGeom") << "Inconsistent # of cells: expected " << numberExpected << ":" << numberOfCells << " , inited " << counter;
edm::LogVerbatim("HGCalGeom") << "Inconsistent # of cells: expected " << numberExpected << ":" << numberOfCells
<< " , inited " << counter;
} else {
edm::LogError("HGCalGeom") << "Inconsistent # of cells: expected " << numberExpected << ":" << numberOfCells
<< " , inited " << counter;
<< " , inited " << counter;
assert(counter == numberExpected);
}
}
Expand Down

0 comments on commit b0dc745

Please sign in to comment.