Skip to content

Commit 1616a45

Browse files
committed
Revert "removed useless portion of code, add error message if BTL v1 geometry used"
This reverts commit 32a553b.
1 parent be2cbc8 commit 1616a45

File tree

2 files changed

+59
-4
lines changed

2 files changed

+59
-4
lines changed

Geometry/MTDCommonData/interface/BTLElectronicsMapping.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class BTLElectronicsMapping {
6262
// Get xtal from TOFHIR Channel number
6363
int THChToXtal(uint32_t smodCopy, uint32_t THCh);
6464
BTLDetId THChToBTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t dmodule, uint32_t smodCopy, uint32_t THCh);
65+
// int BTLElectronicsMapping::SiPMChToXtal(uint32_t zside, uint32_t smodCopy, uint32_t SiPMCh);
6566

6667
/** Returns TOFHIR ASIC number in construction database. */
6768
int TOFHIRASIC(uint32_t dmodule, uint32_t smodCopy);

Geometry/MTDCommonData/src/BTLNumberingScheme.cc

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,60 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
4747

4848

4949
if (baseNumber.getLevelName(0).find("Timingactive") != std::string_view::npos) {
50-
edm::LogError("MTDGeom") << "Geometry v1 of BTL not supported, run on a Geometry configuration D95 or latest ";
51-
throw cms::Exception("Configuration") << "Invalid BTL Geometry configuration (v1)";
50+
crystal = baseNumber.getCopyNumber(0);
51+
52+
modCopy = baseNumber.getCopyNumber(2);
53+
rodCopy = baseNumber.getCopyNumber(3);
54+
55+
const std::string_view& modName(baseNumber.getLevelName(2)); // name of module volume
56+
uint32_t pos = modName.find("Positive");
57+
58+
zside = (pos <= modName.size() ? 1 : 0);
59+
std::string_view baseName = modName.substr(modName.find(':') + 1);
60+
61+
modtyp = ::atoi(&baseName.at(7));
62+
if (modtyp == 17) {
63+
modtyp = 2;
64+
} else if (modtyp == 33) {
65+
modtyp = 3;
66+
}
67+
68+
// error checking
69+
70+
if (1 > crystal || 64 < crystal) {
71+
edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
72+
<< "****************** Bad crystal number = " << crystal
73+
<< ", Volume Number = " << baseNumber.getCopyNumber(0);
74+
return 0;
75+
}
76+
77+
if (1 > modtyp || 3 < modtyp) {
78+
edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
79+
<< "****************** Bad module name = " << modName
80+
<< ", Volume Name = " << baseNumber.getLevelName(2);
81+
return 0;
82+
}
83+
84+
if (1 > modCopy || 54 < modCopy) {
85+
edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
86+
<< "****************** Bad module copy = " << modCopy
87+
<< ", Volume Number = " << baseNumber.getCopyNumber(2);
88+
return 0;
89+
}
90+
91+
if (1 > rodCopy || 36 < rodCopy) {
92+
edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
93+
<< "****************** Bad rod copy = " << rodCopy
94+
<< ", Volume Number = " << baseNumber.getCopyNumber(4);
95+
return 0;
96+
}
97+
98+
if (1 < zside) {
99+
edm::LogWarning("MTDGeom") << "BTLNumberingScheme::getUnitID(): "
100+
<< "****************** Bad side = " << zside
101+
<< ", Volume Name = " << baseNumber.getLevelName(2);
102+
return 0;
103+
}
52104
} else if (baseNumber.getLevelName(0).find("BTLCrystal") != std::string_view::npos) {
53105
// v2 or v3 scenario
54106

@@ -61,7 +113,8 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
61113
rodCopy = baseNumber.getCopyNumber(3) - 1;
62114

63115
// RU, global module and crystal copy numbers
64-
// (everything start from 0)
116+
// (make everything start from 0)
117+
65118
// V3: RU number is global RU number
66119
runitCopy = baseNumber.getCopyNumber(2) - 1;
67120
// V2: the type is embedded in crystal name and RU number is by type
@@ -155,7 +208,8 @@ uint32_t BTLNumberingScheme::getUnitID(const MTDBaseNumber& baseNumber) const {
155208
rodCopy = baseNumber.getCopyNumber(2) - 1;
156209

157210
// RU, and global module copy numbers
158-
// (everything start from 0)
211+
// (make everything start from 0)
212+
159213
// V3: RU number is global RU number
160214
runitCopy = baseNumber.getCopyNumber(1) - 1;
161215
// V2: the type is embedded in crystal name and RU number is by type

0 commit comments

Comments
 (0)