Skip to content

Commit

Permalink
Partial backport of cms-sw#45211 to 140X to allow MTD geometry on DD4…
Browse files Browse the repository at this point in the history
…hep without issues
  • Loading branch information
fabiocos committed Jul 29, 2024
1 parent 05bac56 commit 3981c84
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Geometry/MTDCommonData/src/BTLNumberingScheme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
}
}

#ifdef EDM_ML_DEBUG
LogDebug("MTDGeom") << "BTLNumberingScheme::getUnitID(): isDD4hep " << isDD4hepOK;
#endif

auto bareBaseName = [&](std::string_view name) {
size_t ipos = name.rfind('_');
return (isDD4hepOK) ? name.substr(0, ipos) : name;
Expand Down Expand Up @@ -117,7 +121,11 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
modCopy = negModCopy[modCopy - 1];
}

bool isV2(baseNumber.getLevelName(0).back() != 'l');
bool isV2(bareBaseName(baseNumber.getLevelName(0)).back() != 'l');

#ifdef EDM_ML_DEBUG
LogDebug("MTDGeom") << "BTLNumberingScheme::getUnitID(): isV2 " << isV2;
#endif

if (isV2) {
// V2: the type is embedded in crystal name
Expand Down Expand Up @@ -204,7 +212,11 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
modCopy = negModCopy[modCopy - 1];
}

bool isV2(baseNumber.getLevelName(0).back() != 'e');
bool isV2(bareBaseName(baseNumber.getLevelName(0)).back() != 'e');

#ifdef EDM_ML_DEBUG
LogDebug("MTDGeom") << "BTLNumberingScheme::getUnitID(): isV2 " << isV2;
#endif

if (isV2) {
// V2: the type is embedded in crystal name
Expand Down

0 comments on commit 3981c84

Please sign in to comment.