Skip to content

Commit

Permalink
Bug fix for RecoGeometry in FireWorks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Sep 19, 2018
1 parent 6f98e48 commit a1cd255
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
7 changes: 6 additions & 1 deletion Fireworks/Geometry/src/FWRecoGeometryESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,12 @@ FWRecoGeometryESProducer::addCaloGeometry( void )
const CaloCellGeometry::CornersVec& cor = m_caloGeom->getGeometry( *it )->getCorners();
fillPoints( id, cor.begin(), cor.end());
} else {
const HGCalGeometry* geom = dynamic_cast<const HGCalGeometry*>(m_caloGeom->getSubdetectorGeometry( *it ) );
DetId::Detector det = it->det();
int subdet = (((DetId::HGCalEE == det) ||
(DetId::HGCalHSi == det) ||
(DetId::HGCalHSc == det)) ? ForwardEmpty :
it->subdetId());
const HGCalGeometry* geom = dynamic_cast<const HGCalGeometry*>(m_caloGeom->getSubdetectorGeometry(det,subdet));
const auto cor = geom->get8Corners( *it );
fillPoints( id, cor.begin(), cor.end() );
}
Expand Down
48 changes: 24 additions & 24 deletions Geometry/HGCalGeometry/src/HGCalGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void HGCalGeometry::newCell( const GlobalPoint& f1 ,
<< " GEOM " << HGCSiliconDetId(geomId);
#endif
}
const uint32_t cellIndex (m_topology.detId2denseGeomId(detId));
const uint32_t cellIndex (m_topology.detId2denseGeomId(geomId));

if (m_det == DetId::HGCalHSc) {
m_cellVec2.at( cellIndex ) = FlatTrd( cornersMgr(), f1, f2, f3, parm ) ;
Expand Down Expand Up @@ -212,37 +212,37 @@ void HGCalGeometry::newCell( const GlobalPoint& f1 ,

std::shared_ptr<const CaloCellGeometry> HGCalGeometry::getGeometry(const DetId& id) const {
if (id == DetId()) return nullptr; // nothing to get
DetId geoId;
DetId geomId;
if ((mode_ == HGCalGeometryMode::Hexagon) ||
(mode_ == HGCalGeometryMode::HexagonFull)) {
geoId = (DetId)(HGCalDetId(id).geometryCell());
geomId = (DetId)(HGCalDetId(id).geometryCell());
} else if (mode_ == HGCalGeometryMode::Trapezoid) {
geoId = (DetId)(HGCScintillatorDetId(id).geometryCell());
geomId = (DetId)(HGCScintillatorDetId(id).geometryCell());
} else if (m_topology.isHFNose()) {
geoId = (DetId)(HFNoseDetId(id).geometryCell());
geomId = (DetId)(HFNoseDetId(id).geometryCell());
} else {
geoId = (DetId)(HGCSiliconDetId(id).geometryCell());
geomId = (DetId)(HGCSiliconDetId(id).geometryCell());
}
const uint32_t cellIndex (m_topology.detId2denseGeomId(geoId));
const GlobalPoint pos = (id != geoId) ? getPosition(id) : GlobalPoint();
const uint32_t cellIndex (m_topology.detId2denseGeomId(geomId));
const GlobalPoint pos = (id != geomId) ? getPosition(id) : GlobalPoint();
return cellGeomPtr (cellIndex, pos);

}

bool HGCalGeometry::present(const DetId& id) const {
if (id == DetId()) return false;
DetId geoId;
DetId geomId;
if ((mode_ == HGCalGeometryMode::Hexagon) ||
(mode_ == HGCalGeometryMode::HexagonFull)) {
geoId = (DetId)(HGCalDetId(id).geometryCell());
geomId = (DetId)(HGCalDetId(id).geometryCell());
} else if (mode_ == HGCalGeometryMode::Trapezoid) {
geoId = (DetId)(HGCScintillatorDetId(id).geometryCell());
geomId = (DetId)(HGCScintillatorDetId(id).geometryCell());
} else if (m_topology.isHFNose()) {
geoId = (DetId)(HFNoseDetId(id).geometryCell());
geomId = (DetId)(HFNoseDetId(id).geometryCell());
} else {
geoId = (DetId)(HGCSiliconDetId(id).geometryCell());
geomId = (DetId)(HGCSiliconDetId(id).geometryCell());
}
const uint32_t index (m_topology.detId2denseGeomId(geoId));
const uint32_t index (m_topology.detId2denseGeomId(geomId));
return (nullptr != getGeometryRawPtr(index)) ;
}

Expand Down Expand Up @@ -443,25 +443,25 @@ std::string HGCalGeometry::cellElement() const {
else return "Unknown";
}

unsigned int HGCalGeometry::indexFor(const DetId& id) const {
unsigned int HGCalGeometry::indexFor(const DetId& detId) const {
unsigned int cellIndex = ((m_det == DetId::HGCalHSc) ? m_cellVec2.size() :
m_cellVec.size());
if (id != DetId()) {
DetId geoId;
if (detId != DetId()) {
DetId geomId;
if ((mode_ == HGCalGeometryMode::Hexagon) ||
(mode_ == HGCalGeometryMode::HexagonFull)) {
geoId = (DetId)(HGCalDetId(id).geometryCell());
geomId = (DetId)(HGCalDetId(detId).geometryCell());
} else if (mode_ == HGCalGeometryMode::Trapezoid) {
geoId = (DetId)(HGCScintillatorDetId(id).geometryCell());
geomId = (DetId)(HGCScintillatorDetId(detId).geometryCell());
} else if (m_topology.isHFNose()) {
geoId = (DetId)(HFNoseDetId(id).geometryCell());
geomId = (DetId)(HFNoseDetId(detId).geometryCell());
} else {
geoId = (DetId)(HGCSiliconDetId(id).geometryCell());
geomId = (DetId)(HGCSiliconDetId(detId).geometryCell());
}
cellIndex = m_topology.detId2denseGeomId(geoId);
cellIndex = m_topology.detId2denseGeomId(geomId);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << id.rawId()
<< ":" << geoId.rawId() << std::dec
edm::LogVerbatim("HGCalGeom") << "indexFor " << std::hex << detId.rawId()
<< ":" << geomId.rawId() << std::dec
<< " index " << cellIndex;
#endif
}
Expand Down

0 comments on commit a1cd255

Please sign in to comment.