Skip to content

Commit e458989

Browse files
committed
Revert "overall update of BTLDetId to match BTL geo v2,v3 (v1 not supported), BTL electronics mapping introduced"
This reverts commit 15bd342.
1 parent 1616a45 commit e458989

File tree

10 files changed

+147
-520
lines changed

10 files changed

+147
-520
lines changed

DataFormats/ForwardDetId/interface/BTLDetId.h

Lines changed: 41 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
#define DataFormats_BTLDetId_BTLDetId_h
33

44
#include "DataFormats/ForwardDetId/interface/MTDDetId.h"
5-
#include <iostream>
65
#include <ostream>
76
#include <array>
8-
#include <bitset>
97

108
/**
119
@class BTLDetId
@@ -16,59 +14,29 @@
1614
bit 9-8 : crystal type (1 - 3)
1715
bit 7-6 : readout unit sequential number within a type ( 1 - 2 )
1816
bit 5-0 : crystal sequential number within a module ( 0 - 15 )
19-
20-
// Geometry v3 new DetID (all type 1 modules)
21-
bit 15: kBTLNewFormat (0 - old BTLDetID, 1 - new BTLDetID)
22-
bit 12-10: Readout unit number ( 1 - 6 )
23-
bit 9-6 : Detector Module ( 1 - 12 )
24-
bit 5 : Sensor Module inside DM ( 0 - 1 )
25-
bit 4-0 : Crystal number in a SM ( 1 - 16 )
2617
*/
2718

2819
class BTLDetId : public MTDDetId {
2920
public:
30-
// old BTLDetID RU and module number scheme
31-
static constexpr uint32_t kBTLoldModuleOffset = 10;
32-
static constexpr uint32_t kBTLoldModuleMask = 0x3F;
33-
static constexpr uint32_t kBTLoldModTypeOffset = 8;
34-
static constexpr uint32_t kBTLoldModTypeMask = 0x3;
35-
static constexpr uint32_t kBTLoldRUOffset = 6;
36-
static constexpr uint32_t kBTLoldRUMask = 0x3;
37-
38-
// New BTLDetID
39-
static constexpr uint32_t kBTLRodOffset = 16;
40-
static constexpr uint32_t kBTLRodMask = 0x3F;
41-
static constexpr uint32_t kBTLRUOffset = 10;
42-
static constexpr uint32_t kBTLRUMask = 0x7;
43-
static constexpr uint32_t kBTLdetectorModOffset = 6;
44-
static constexpr uint32_t kBTLdetectorModMask = 0xF;
45-
static constexpr uint32_t kBTLsensorModOffset = 5;
46-
static constexpr uint32_t kBTLsensorModMask = 0x1;
21+
static constexpr uint32_t kBTLmoduleOffset = 10;
22+
static constexpr uint32_t kBTLmoduleMask = 0x3F;
23+
static constexpr uint32_t kBTLmodTypeOffset = 8;
24+
static constexpr uint32_t kBTLmodTypeMask = 0x3;
25+
static constexpr uint32_t kBTLRUOffset = 6;
26+
static constexpr uint32_t kBTLRUMask = 0x3;
4727
static constexpr uint32_t kBTLCrystalOffset = 0;
48-
static constexpr uint32_t kBTLCrystalMask = 0x1F;
28+
static constexpr uint32_t kBTLCrystalMask = 0x3F;
4929

5030
/// range constants, need two sets for the time being (one for tiles and one for bars)
5131
static constexpr uint32_t HALF_ROD = 36;
5232
static constexpr uint32_t kModulesPerRODBarPhiFlat = 48;
5333
static constexpr uint32_t kModulePerTypeBarPhiFlat = 48 / 3;
5434
static constexpr uint32_t kRUPerTypeV2 = 2;
55-
static constexpr uint32_t kRUPerRod = 6;
5635
static constexpr uint32_t kModulesPerRUV2 = 24;
57-
static constexpr uint32_t kDModulesPerRU = 12;
58-
static constexpr uint32_t kSModulesPerDM = 2;
59-
static constexpr uint32_t kDModulesInRUCol = 3;
60-
static constexpr uint32_t kDModulesInRURow = 4;
61-
static constexpr uint32_t kSModulesInDM = 2;
6236
static constexpr uint32_t kCrystalsPerModuleV2 = 16;
6337
static constexpr uint32_t kModulesPerTrkV2 = 3;
6438
static constexpr uint32_t kCrystalTypes = 3;
6539

66-
// conversion
67-
static constexpr uint32_t kBTLoldFieldMask = 0x3FFFFF;
68-
static constexpr uint32_t kBTLNewFormat = 1 << 15;
69-
70-
//
71-
7240
// Number of crystals in BTL according to TDR design, valid also for barphiflat scenario:
7341
// 16 crystals x 24 modules x 2 readout units/type x 3 types x 36 rods/side x 2 sides
7442
//
@@ -82,120 +50,67 @@ class BTLDetId : public MTDDetId {
8250
/** Construct a null id */
8351
BTLDetId() : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) {
8452
id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset;
85-
id_ |= kBTLNewFormat;
8653
}
8754

8855
/** Construct from a raw value */
89-
BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) {
90-
uint32_t tmpId = raw_id;
91-
if ((tmpId & kBTLNewFormat) == 0) {
92-
tmpId = newForm(tmpId);
93-
}
94-
id_ = MTDDetId(tmpId).rawId();
95-
}
56+
BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) { ; }
9657

9758
/** Construct from generic DetId */
98-
BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) {
99-
uint32_t tmpId = det_id.rawId();
100-
if ((tmpId & kBTLNewFormat) == 0) {
101-
tmpId = newForm(tmpId);
102-
}
103-
id_ = MTDDetId(tmpId).rawId();
104-
}
59+
BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) { ; }
10560

106-
/** Construct from complete geometry information, v2, v3 **/
107-
/** Geometry v1 is obsolete and not supported **/
108-
BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t dmodule, uint32_t smodule, uint32_t crystal)
61+
/** Construct from complete geometry information, v1 **/
62+
BTLDetId(uint32_t zside, uint32_t rod, uint32_t module, uint32_t modtyp, uint32_t crystal)
10963
: MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) {
110-
//RU, DM, SM & Xtal numbers start from 0
11164
id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
112-
(rod & kRodRingMask) << kRodRingOffset | (runit & kBTLRUMask) << kBTLRUOffset |
113-
(dmodule & kBTLdetectorModMask) << kBTLdetectorModOffset |
114-
(smodule & kBTLsensorModMask) << kBTLsensorModOffset |
115-
(crystal & kBTLCrystalMask) << kBTLCrystalOffset;
116-
id_ |= kBTLNewFormat;
65+
(rod & kRodRingMask) << kRodRingOffset | (module & kBTLmoduleMask) << kBTLmoduleOffset |
66+
(modtyp & kBTLmodTypeMask) << kBTLmodTypeOffset | ((crystal - 1) & kBTLCrystalMask) << kBTLCrystalOffset;
11767
}
11868

119-
// ---------- Common methods ----------
120-
121-
/** Returns BTL crystal number. */
122-
inline int crystal() const { return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask);}
123-
124-
/** Returns BTL crystal number in construction database. */
125-
inline int crystalConsDB() const {
126-
if (crystal() == kCrystalsPerModuleV2) return -1;
127-
if (smodule() == 0) return kCrystalsPerModuleV2-1 - crystal() ;
128-
else return crystal();
69+
/** Construct from complete geometry information, v2 **/
70+
BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t module, uint32_t modtyp, uint32_t crystal)
71+
: MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) {
72+
id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset |
73+
(rod & kRodRingMask) << kRodRingOffset | (module & kBTLmoduleMask) << kBTLmoduleOffset |
74+
(modtyp & kBTLmodTypeMask) << kBTLmodTypeOffset | (runit & kBTLRUMask) << kBTLRUOffset |
75+
((crystal - 1) & kBTLCrystalMask) << kBTLCrystalOffset;
12976
}
13077

131-
/** Returns BTL detector module number. */
132-
inline int dmodule() const { return ((id_ >> kBTLdetectorModOffset) & kBTLdetectorModMask); }
78+
// ---------- Common methods ----------
13379

134-
/** Returns BTL sensor module number. */
135-
inline int smodule() const { return ((id_ >> kBTLsensorModOffset) & kBTLsensorModMask); }
80+
/** Returns BTL module number. */
81+
inline int module() const { return (id_ >> kBTLmoduleOffset) & kBTLmoduleMask; }
13682

137-
/** Returns BTL module number [1-24] (OLD BTL NUMBERING). */
138-
inline int module() const {
139-
int mod = ((dmodule() % kDModulesInRURow) * (kSModulesInDM * kDModulesInRUCol) + int(dmodule() / kDModulesInRURow) + kDModulesInRUCol * smodule()) + 1;
140-
return mod;
141-
}
83+
/** Returns BTL crystal type number. */
84+
inline int modType() const { return (id_ >> kBTLmodTypeOffset) & kBTLmodTypeMask; }
14285

143-
/** Returns BTL crystal type number [1-3] (OLD BTL NUMBERING). */
144-
inline int modType() const {
145-
int gRU = runit();
146-
return int(gRU / kRUPerTypeV2 + 1);
147-
}
86+
/** Returns BTL crystal number. */
87+
inline int crystal() const { return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask) + 1; }
14888

149-
/** Returns BTL readout unit number per type [1-2], from Global RU number [1-6]. */
150-
inline int runitByType() const { return (runit() % kRUPerTypeV2); }
89+
/** Returns BTL readout unit number per type. */
90+
inline int runit() const { return (id_ >> kBTLRUOffset) & kBTLRUMask; }
15191

15292
/** Returns BTL global readout unit number. */
153-
inline int runit() const { return ((id_ >> kBTLRUOffset) & kBTLRUMask); }
93+
inline int globalRunit() const {
94+
if (runit() == 0) {
95+
// pre-V2: build a RU identifier from available information
96+
return (module() - 1) / kModulePerTypeBarPhiFlat / kRUPerTypeV2 + 1;
97+
} else if (runit() > 0 && modType() > 0) {
98+
// V2/V3: build global RU identifier from RU per type and type
99+
return (modType() - 1) * kRUPerTypeV2 + runit();
100+
}
101+
return 0;
102+
}
154103

155104
/** return the row in GeomDet language **/
156105
inline int row(unsigned nrows = kCrystalsPerModuleV2) const {
157-
return crystal() % nrows; // anything else for now
106+
return (crystal() - 1) % nrows; // anything else for now
158107
}
159108

160109
/** return the column in GeomDetLanguage **/
161-
inline int column(unsigned nrows = kCrystalsPerModuleV2) const { return crystal() / nrows; }
110+
inline int column(unsigned nrows = kCrystalsPerModuleV2) const { return (crystal() - 1) / nrows; }
162111

163112
/** create a Geographical DetId for Tracking **/
164113
BTLDetId geographicalId(CrysLayout lay) const;
165-
166-
/** conversion from old to new BTLDetID**/
167-
uint32_t newForm(const uint32_t& rawid) {
168-
uint32_t fixedP = rawid & (0xFFFFFFFF - kBTLoldFieldMask); // unchanged part of id
169-
170-
// convert old tray number into new tray nymber
171-
uint32_t oldTray = (rawid >> kBTLRodOffset) & kBTLRodMask;
172-
uint32_t newTray = oldTray - 1;
173-
174-
// convert old module number into detector module + sensor module numbers
175-
uint32_t oldModule = (rawid >> kBTLoldModuleOffset) & kBTLoldModuleMask;
176-
uint32_t detModule = int((oldModule - 1) % (kDModulesInRUCol)) * kDModulesInRURow +
177-
int((oldModule - 1) / (kDModulesInRUCol * kSModulesInDM));
178-
uint32_t senModule = int((oldModule - 1) / kDModulesInRUCol) % kSModulesInDM;
179-
180-
// change detector module number if on the negative side
181-
int zside = int(mtdSide());
182-
if (zside < 1) detModule = detModule - 2 * kDModulesInRURow * (int(detModule/kDModulesInRURow) - 1);
183-
184-
// convert old RU and type number into new RU number
185-
uint32_t oldRU = (rawid >> kBTLoldRUOffset) & kBTLoldRUMask;
186-
uint32_t oldType = (rawid >> kBTLoldModTypeOffset) & kBTLoldModTypeMask;
187-
uint32_t newRU = ((oldType - 1) * kRUPerTypeV2) + (oldRU-1);
188-
189-
// get crystal number
190-
uint32_t crystal = (rawid & kBTLCrystalMask) >> kBTLCrystalOffset;
191-
192-
// return new BTLDetID for v3 geom
193-
return (fixedP | (newTray & kBTLRodMask) << kBTLRodOffset | (newRU & kBTLRUMask) << kBTLRUOffset |
194-
(detModule & kBTLdetectorModMask) << kBTLdetectorModOffset |
195-
(senModule & kBTLsensorModMask) << kBTLsensorModOffset |
196-
((crystal & kBTLCrystalMask) << kBTLCrystalOffset)) |
197-
kBTLNewFormat;
198-
}
199114
};
200115

201116
std::ostream& operator<<(std::ostream&, const BTLDetId&);
Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
#include "DataFormats/ForwardDetId/interface/BTLDetId.h"
2-
#include "FWCore/MessageLogger/interface/MessageLogger.h"
32

43
BTLDetId BTLDetId::geographicalId(CrysLayout lay) const {
5-
64
// For tracking geometry navigation
7-
// v2,v3: set number of crystals to 17 to distinguish from crystal BTLDetId
8-
// v1: obsolete and not supported
9-
10-
if (lay == CrysLayout::v2 || lay == CrysLayout::v3) {
11-
return BTLDetId(mtdSide(), mtdRR(), runit(), dmodule(), smodule(), kCrystalsPerModuleV2);
12-
} else {
13-
edm::LogWarning("MTDGeom") << "CrysLayout could only be v2 or v3";
5+
6+
if (lay == CrysLayout::barphiflat) {
7+
// barphiflat: count modules in a rod, combining all types
8+
return BTLDetId(mtdSide(), mtdRR(), module() + kModulePerTypeBarPhiFlat * (modType() - 1), 0, 1);
9+
} else if (lay == CrysLayout::v2 || lay == CrysLayout::v3) {
10+
// v2: set number of crystals to 17 to distinguish from crystal BTLDetId
11+
// v3: set number of crystals to 17 to distinguish from crystal BTLDetId, build V2-like type and RU number as in BTLNumberingScheme
12+
return BTLDetId(mtdSide(), mtdRR(), runit(), module(), modType(), kCrystalsPerModuleV2 + 1);
1413
}
1514

1615
return 0;
@@ -21,15 +20,12 @@ BTLDetId BTLDetId::geographicalId(CrysLayout lay) const {
2120
std::ostream& operator<<(std::ostream& os, const BTLDetId& id) {
2221
os << (MTDDetId&)id;
2322
os << " BTL " << std::endl
24-
<< " Side : " << id.mtdSide() << std::endl
25-
<< " Rod : " << id.mtdRR() << std::endl
26-
<< " Crystal type : " << id.modType() << std::endl // crystal type in v1 geometry scheme
27-
<< " Runit by Type : " << id.runitByType() << std::endl
28-
<< " Readout unit : " << id.runit() << std::endl
29-
<< " Detector module: " << id.dmodule() << std::endl
30-
<< " Sensor module : " << id.smodule() << std::endl
31-
<< " Module : " << id.module() << std::endl
32-
<< " Crystal : " << id.crystal() << std::endl
33-
<< " Crystal in ConsDB: " << id.crystalConsDB() << std::endl;
23+
<< " Side : " << id.mtdSide() << std::endl
24+
<< " Rod : " << id.mtdRR() << std::endl
25+
<< " Crystal type: " << id.modType() << std::endl
26+
<< " Readout unit: " << id.runit() << std::endl
27+
<< " Global RU : " << id.globalRunit() << std::endl
28+
<< " Module : " << id.module() << std::endl
29+
<< " Crystal : " << id.crystal() << std::endl;
3430
return os;
3531
}

DataFormats/ForwardDetId/src/classes_def.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,8 @@
2323
<class name="MTDDetId" ClassVersion="3">
2424
<version ClassVersion="3" checksum="1210976889"/>
2525
</class>
26-
<class name="BTLDetId" ClassVersion="4">
27-
<version ClassVersion="4" checksum="1515591716"/>
26+
<class name="BTLDetId" ClassVersion="3">
2827
<version ClassVersion="3" checksum="1515591716"/>
29-
<ioread sourceClass = "BTLDetId" version="[-3]" targetClass="BTLDetId" source="" target="">
30-
<![CDATA[
31-
BTLDetId tmp(newObj->newForm(newObj->rawId()));
32-
*newObj=tmp;
33-
]]>
34-
</ioread>
3528
</class>
3629
<class name="ETLDetId" ClassVersion="4">
3730
<version ClassVersion="4" checksum="1644731879"/>

DataFormats/TrackReco/src/HitPattern.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace {
143143
MTDDetId mtdid(id);
144144
switch (mtdid.mtdSubDetector()) {
145145
case MTDDetId::BTL:
146-
layer = BTLDetId(id).runit();
146+
layer = BTLDetId(id).globalRunit();
147147
break;
148148
case MTDDetId::ETL:
149149
layer = ETLDetId(id).mtdRR();

Geometry/MTDCommonData/interface/BTLElectronicsMapping.h

Lines changed: 0 additions & 80 deletions
This file was deleted.

Geometry/MTDCommonData/interface/BTLNumberingScheme.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ class BTLNumberingScheme : public MTDNumberingScheme {
99
static constexpr uint32_t kBTLcrystalLevel = 9;
1010
static constexpr uint32_t kBTLmoduleLevel = 8;
1111

12+
static constexpr std::array<uint32_t, BTLDetId::kModulesPerRUV2> negModCopy{
13+
{3, 2, 1, 6, 5, 4, 9, 8, 7, 12, 11, 10, 15, 14, 13, 18, 17, 16, 21, 20, 19, 24, 23, 22}};
14+
1215
// to temporarily map V3 into V2-like input
1316
static constexpr std::array<uint32_t, BTLDetId::kRUPerTypeV2 * BTLDetId::kCrystalTypes> globalru2type{
1417
{1, 1, 2, 2, 3, 3}};

0 commit comments

Comments
 (0)