Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-gex32 Updates geometry building for EB/EE and solves the issue of failure #31998

Merged
merged 4 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
#include "DetectorDescription/Core/interface/DDScope.h"
#include "DetectorDescription/Core/interface/DDFilter.h"

#include "DD4hep/Filter.h"
#include "CLHEP/Units/GlobalSystemOfUnits.h"

#include <boost/algorithm/string/predicate.hpp>

#include <vector>
//#define EDM_ML_DEBUG

template <class T>
typename CaloGeometryLoader<T>::PtrType CaloGeometryLoader<T>::load(const DDCompactView* cpv,
Expand Down Expand Up @@ -131,7 +133,10 @@ void CaloGeometryLoader<T>::makeGeometry(const cms::DDCompactView* cpv,

unsigned int counter(0);
while (fv.firstChild()) {
if (boost::starts_with(fv.name(), "EA")) {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("EcalGeom") << "Do child " << fv.name();
#endif
if (boost::starts_with(dd4hep::dd::noNamespace(fv.name()), "EA")) {
continue;
}
++counter;
Expand Down Expand Up @@ -202,8 +207,10 @@ unsigned int CaloGeometryLoader<T>::getDetIdForDD4HepNode(const cms::DDFilteredV
EcalBaseNumber baseNumber;
baseNumber.setSize(psize);

size_t n = path.find("/") + 1;
edm::LogVerbatim("CaloGeometryBuilder") << path << " n " << n;
size_t n = path.find('/') + 1;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("EcalGeom") << path << " n " << n;
#endif
size_t start = n, startold = n;
std::string det(""), num("");
bool done(false);
Expand All @@ -222,7 +229,12 @@ unsigned int CaloGeometryLoader<T>::getDetIdForDD4HepNode(const cms::DDFilteredV
}
}
baseNumber.reverse();

#ifdef EDM_ML_DEBUG
edm::LogVerbatim("EcalGeom") << "Base number with " << baseNumber.getLevels() << " levels";
for (int k = 0; k < baseNumber.getLevels(); ++k)
edm::LogVerbatim("EcalGeom") << "[" << k << "] " << baseNumber.getLevelName(k) << ":"
<< baseNumber.getCopyNumber(k);
#endif
return m_scheme.getUnitID(baseNumber);
}

Expand Down
13 changes: 8 additions & 5 deletions Geometry/EcalAlgo/plugins/EcalBarrelGeometryLoaderFromDDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ void EcalBGL::fillGeom(EcalBarrelGeometry* geom,
const HepGeom::Transform3D& tr,
const DetId& id,
const double& scale) {
static constexpr uint32_t maxSize = 11;
std::vector<CCGFloat> pv;
pv.reserve(vv.size());
for (unsigned int i(0); i != vv.size(); ++i) {
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : (CCGFloat)scale);

pv.emplace_back(factor * vv[i]);
unsigned int size = (vv.size() > maxSize) ? maxSize : vv.size();
unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
pv.reserve(size);
for (unsigned int i(0); i != size; ++i) {
unsigned int ii = ioff + i;
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : static_cast<CCGFloat>(scale));
pv.emplace_back(factor * vv[ii]);
}

std::vector<GlobalPoint> corners(8);
Expand Down
10 changes: 7 additions & 3 deletions Geometry/EcalAlgo/plugins/EcalEndcapGeometryLoaderFromDDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ void EcalEGL::fillGeom(EcalEndcapGeometry* geom,
const HepGeom::Transform3D& tr,
const DetId& id,
const double& scale) {
static constexpr uint32_t maxSize = 11;
std::vector<CCGFloat> pv;
pv.reserve(vv.size());
for (unsigned int i(0); i != vv.size(); ++i) {
unsigned int size = (vv.size() > maxSize) ? maxSize : vv.size();
unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
pv.reserve(size);
for (unsigned int i(0); i != size; ++i) {
unsigned int ii = ioff + i;
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : scale);
pv.emplace_back(factor * vv[i]);
pv.emplace_back(factor * vv[ii]);
}

std::vector<GlobalPoint> corners(8);
Expand Down
2 changes: 1 addition & 1 deletion Geometry/EcalCommonData/src/EcalSimParametersFromDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ bool EcalSimParametersFromDD::build(const cms::DDCompactView* cpv,
mypar.filter(refs, attribute, name);
fv.mergedSpecifics(refs);
while (fv.firstChild()) {
const std::string name{fv.name().data(), fv.name().size()};
const std::string name{dd4hep::dd::noNamespace(fv.name()).data(), dd4hep::dd::noNamespace(fv.name()).size()};
const std::string matName{dd4hep::dd::noNamespace(fv.materialName()).data(),
dd4hep::dd::noNamespace(fv.materialName()).size()};
if (std::find(php.lvNames_.begin(), php.lvNames_.end(), name) == php.lvNames_.end()) {
Expand Down