Skip to content

Commit 2383795

Browse files
authored
Merge pull request cms-sw#31998 from bsunanda/Run3-gex32
Run3-gex32 Updates geometry building for EB/EE and solves the issue of failure
2 parents 8445e80 + 9acca18 commit 2383795

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
#include "DetectorDescription/Core/interface/DDScope.h"
2121
#include "DetectorDescription/Core/interface/DDFilter.h"
2222

23+
#include "DD4hep/Filter.h"
2324
#include "CLHEP/Units/GlobalSystemOfUnits.h"
2425

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

2728
#include <vector>
29+
//#define EDM_ML_DEBUG
2830

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

132134
unsigned int counter(0);
133135
while (fv.firstChild()) {
134-
if (boost::starts_with(fv.name(), "EA")) {
136+
#ifdef EDM_ML_DEBUG
137+
edm::LogVerbatim("EcalGeom") << "Do child " << fv.name();
138+
#endif
139+
if (boost::starts_with(dd4hep::dd::noNamespace(fv.name()), "EA")) {
135140
continue;
136141
}
137142
++counter;
@@ -202,8 +207,10 @@ unsigned int CaloGeometryLoader<T>::getDetIdForDD4HepNode(const cms::DDFilteredV
202207
EcalBaseNumber baseNumber;
203208
baseNumber.setSize(psize);
204209

205-
size_t n = path.find("/") + 1;
206-
edm::LogVerbatim("CaloGeometryBuilder") << path << " n " << n;
210+
size_t n = path.find('/') + 1;
211+
#ifdef EDM_ML_DEBUG
212+
edm::LogVerbatim("EcalGeom") << path << " n " << n;
213+
#endif
207214
size_t start = n, startold = n;
208215
std::string det(""), num("");
209216
bool done(false);
@@ -222,7 +229,12 @@ unsigned int CaloGeometryLoader<T>::getDetIdForDD4HepNode(const cms::DDFilteredV
222229
}
223230
}
224231
baseNumber.reverse();
225-
232+
#ifdef EDM_ML_DEBUG
233+
edm::LogVerbatim("EcalGeom") << "Base number with " << baseNumber.getLevels() << " levels";
234+
for (int k = 0; k < baseNumber.getLevels(); ++k)
235+
edm::LogVerbatim("EcalGeom") << "[" << k << "] " << baseNumber.getLevelName(k) << ":"
236+
<< baseNumber.getCopyNumber(k);
237+
#endif
226238
return m_scheme.getUnitID(baseNumber);
227239
}
228240

Geometry/EcalAlgo/plugins/EcalBarrelGeometryLoaderFromDDD.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ void EcalBGL::fillGeom(EcalBarrelGeometry* geom,
2929
const HepGeom::Transform3D& tr,
3030
const DetId& id,
3131
const double& scale) {
32+
static constexpr uint32_t maxSize = 11;
3233
std::vector<CCGFloat> pv;
33-
pv.reserve(vv.size());
34-
for (unsigned int i(0); i != vv.size(); ++i) {
35-
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : (CCGFloat)scale);
36-
37-
pv.emplace_back(factor * vv[i]);
34+
unsigned int size = (vv.size() > maxSize) ? maxSize : vv.size();
35+
unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
36+
pv.reserve(size);
37+
for (unsigned int i(0); i != size; ++i) {
38+
unsigned int ii = ioff + i;
39+
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : static_cast<CCGFloat>(scale));
40+
pv.emplace_back(factor * vv[ii]);
3841
}
3942

4043
std::vector<GlobalPoint> corners(8);

Geometry/EcalAlgo/plugins/EcalEndcapGeometryLoaderFromDDD.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ void EcalEGL::fillGeom(EcalEndcapGeometry* geom,
2727
const HepGeom::Transform3D& tr,
2828
const DetId& id,
2929
const double& scale) {
30+
static constexpr uint32_t maxSize = 11;
3031
std::vector<CCGFloat> pv;
31-
pv.reserve(vv.size());
32-
for (unsigned int i(0); i != vv.size(); ++i) {
32+
unsigned int size = (vv.size() > maxSize) ? maxSize : vv.size();
33+
unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
34+
pv.reserve(size);
35+
for (unsigned int i(0); i != size; ++i) {
36+
unsigned int ii = ioff + i;
3337
const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : scale);
34-
pv.emplace_back(factor * vv[i]);
38+
pv.emplace_back(factor * vv[ii]);
3539
}
3640

3741
std::vector<GlobalPoint> corners(8);

Geometry/EcalCommonData/src/EcalSimParametersFromDD.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ bool EcalSimParametersFromDD::build(const cms::DDCompactView* cpv,
159159
mypar.filter(refs, attribute, name);
160160
fv.mergedSpecifics(refs);
161161
while (fv.firstChild()) {
162-
const std::string name{fv.name().data(), fv.name().size()};
162+
const std::string name{dd4hep::dd::noNamespace(fv.name()).data(), dd4hep::dd::noNamespace(fv.name()).size()};
163163
const std::string matName{dd4hep::dd::noNamespace(fv.materialName()).data(),
164164
dd4hep::dd::noNamespace(fv.materialName()).size()};
165165
if (std::find(php.lvNames_.begin(), php.lvNames_.end(), name) == php.lvNames_.end()) {

0 commit comments

Comments
 (0)