11 LogDebug(
"MTDGeom") <<
"Creating BTLNumberingScheme";
18 const uint32_t nLevels(baseNumber.
getLevels());
20 LogDebug(
"MTDGeom") <<
"BTLNumberingScheme geometry levels = " << nLevels;
22 uint32_t
zside(999), rodCopy(0), runitCopy(0), modCopy(0), modtyp(0), crystal(0);
24 bool isDD4hepOK(
false);
31 auto bareBaseName = [&](std::string_view
name) {
32 size_t ipos =
name.rfind(
'_');
33 return (isDD4hepOK) ?
name.substr(0, ipos) :
name;
38 <<
", " << bareBaseName(baseNumber.
getLevelName(2)) <<
", " 40 <<
", " << bareBaseName(baseNumber.
getLevelName(5)) <<
", " 46 if (baseNumber.
getLevelName(0).find(
"Timingactive") != std::string_view::npos) {
52 const std::string_view& modName(baseNumber.
getLevelName(2));
53 uint32_t
pos = modName.find(
"Positive");
55 zside = (
pos <= modName.size() ? 1 : 0);
56 std::string_view baseName = modName.substr(modName.find(
':') + 1);
58 modtyp = ::atoi(&baseName.at(7));
61 }
else if (modtyp == 33) {
67 if (1 > crystal || 64 < crystal) {
69 <<
"****************** Bad crystal number = " << crystal
74 if (1 > modtyp || 3 < modtyp) {
76 <<
"****************** Bad module name = " << modName
81 if (1 > modCopy || 54 < modCopy) {
83 <<
"****************** Bad module copy = " << modCopy
88 if (1 > rodCopy || 36 < rodCopy) {
90 <<
"****************** Bad rod copy = " << rodCopy
97 <<
"****************** Bad side = " <<
zside 101 }
else if (baseNumber.
getLevelName(0).find(
"BTLCrystal") != std::string_view::npos) {
109 const std::string_view& rodName(baseNumber.
getLevelName(3));
110 uint32_t
pos = rodName.find(
"Zpos");
111 zside = (
pos <= rodName.size() ? 1 : 0);
119 modtyp = ::atoi(&bareBaseName(baseNumber.
getLevelName(2)).back());
125 <<
"****************** Bad crystal number = " << crystal
130 if (1 > modtyp || 3 < modtyp) {
132 <<
"****************** Bad RU name, Volume Name = " 139 <<
"****************** Bad module copy = " << modCopy
146 <<
"****************** Bad readout unit copy = " << runitCopy
153 <<
"****************** Bad rod copy = " << rodCopy
160 <<
"****************** Bad side = " <<
zside 168 BTLDetId thisBTLdetid(
zside, rodCopy, runitCopy, modCopy, modtyp, crystal);
169 intindex = thisBTLdetid.
rawId();
175 <<
", " << bareBaseName(baseNumber.
getLevelName(2)) <<
", " 177 <<
", " << bareBaseName(baseNumber.
getLevelName(5)) <<
", " 184 const std::string_view& rodName(baseNumber.
getLevelName(2));
185 uint32_t
pos = rodName.find(
"Zpos");
186 zside = (
pos <= rodName.size() ? 1 : 0);
194 modtyp = ::atoi(&bareBaseName(baseNumber.
getLevelName(1)).back());
198 if (1 > modtyp || 3 < modtyp) {
200 <<
"****************** Bad RU name, Volume Name = " 207 <<
"****************** Bad module copy = " << modCopy
214 <<
"****************** Bad readout unit copy = " << runitCopy
221 <<
"****************** Bad rod copy = " << rodCopy
228 <<
"****************** Bad side = " <<
zside 235 BTLDetId thisBTLdetid(
zside, rodCopy, runitCopy, modCopy, modtyp, 0);
240 <<
"Not enough levels found in MTDBaseNumber ( " << nLevels
241 <<
") or not correct path. Returning 0";
245 LogDebug(
"MTDGeom") <<
"BTL Numbering scheme: " 246 <<
" zside = " <<
zside <<
" rod = " << rodCopy <<
" modtyp = " << modtyp <<
" RU = " << runitCopy
247 <<
" module = " << modCopy <<
" crystal = " << crystal <<
" Raw Id = " << intindex <<
"\n" int getCopyNumber(int level) const
~BTLNumberingScheme() override
static constexpr std::array< uint32_t, BTLDetId::kModulesPerRUV2 > negModCopy
std::string_view const & getLevelName(int level) const
static constexpr uint32_t HALF_ROD
range constants, need two sets for the time being (one for tiles and one for bars) ...
static constexpr uint32_t kModulesPerRUV2
static constexpr uint32_t kBTLcrystalLevel
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
constexpr uint32_t rawId() const
get the raw id
static constexpr uint32_t kRUPerTypeV2
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
static constexpr uint32_t kCrystalsPerModuleV2
static constexpr uint32_t kBTLmoduleLevel
Log< level::Warning, false > LogWarning
BTLDetId geographicalId(CrysLayout lay) const