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

[140X backport] MTD geometry: fix BTL numbering scheme for scenario v3 #45578

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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