Skip to content

Commit a372e6b

Browse files
committed
Fixes and debugging printouts
1 parent 387021e commit a372e6b

File tree

5 files changed

+31
-25
lines changed

5 files changed

+31
-25
lines changed

Geometry/MTDGeometryBuilder/plugins/MTDTopologyEP.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ void MTDTopologyEP::fillBTLtopology(const MTDGeometry& mtdgeo, MTDTopology::BTLV
7373
tmpLayout.btlDetId_[index] = det->geographicalId().rawId();
7474
tmpLayout.btlPhi_[index] = iphi;
7575
tmpLayout.btlEta_[index] = ieta;
76+
#ifdef EDM_ML_DEBUG
77+
edm::LogVerbatim("MTDTopologyEP") << "MTDTopology BTL# " << index << " id= " << det->geographicalId().rawId()
78+
<< " iphi/ieta= " << iphi << " / " << ieta;
79+
#endif
7680
if (ieta == tmpLayout.nBTLeta_) {
7781
iphi++;
7882
ieta = 0;

Geometry/MTDGeometryBuilder/src/MTDTopology.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ uint32_t MTDTopology::btlidFromIndex(const uint32_t iphi, const uint32_t ieta) c
3333
res = btlVals_.btlDetId_[index];
3434
break;
3535
}
36-
index++;
3736
}
3837
return res;
3938
}
@@ -56,9 +55,9 @@ uint32_t MTDTopology::phishiftBTL(const uint32_t detid, const int phiShift) cons
5655
}
5756
if (found) {
5857
int newIndex = index + sh * btlVals_.nBTLeta_;
59-
if (newIndex > static_cast<int>(btlVals_.nBTLmodules_)) {
58+
if (newIndex >= static_cast<int>(btlVals_.nBTLmodules_)) {
6059
newIndex = newIndex - btlVals_.nBTLmodules_;
61-
} else if (newIndex < 1) {
60+
} else if (newIndex < 0) {
6261
newIndex = newIndex + btlVals_.nBTLmodules_;
6362
}
6463
return newIndex;
@@ -86,9 +85,9 @@ uint32_t MTDTopology::etashiftBTL(const uint32_t detid, const int etaShift) cons
8685
}
8786
if (found) {
8887
int newIndex = index + sh;
89-
if (newIndex < 1 || newIndex > static_cast<int>(btlVals_.nBTLmodules_)) {
88+
if (newIndex < 0 || newIndex >= static_cast<int>(btlVals_.nBTLmodules_)) {
9089
return failIndex_;
91-
} else if (btlVals_.btlEta_[newIndex] != btlVals_.btlEta_[index]) {
90+
} else if (btlVals_.btlPhi_[newIndex] != btlVals_.btlPhi_[index]) {
9291
return failIndex_;
9392
}
9493
return newIndex;

Geometry/MTDNumberingBuilder/plugins/DDCmsMTDConstruction.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//#define EDM_ML_DEBUG
2+
13
#include "Geometry/MTDNumberingBuilder/plugins/DDCmsMTDConstruction.h"
24

35
#include <utility>
@@ -224,8 +226,8 @@ std::unique_ptr<GeometricTimingDet> DDCmsMTDConstruction::construct(const DDComp
224226
std::stringstream after(std::stringstream::in | std::stringstream::out);
225227
for (const auto& it : comp) {
226228
after << "ORDER2 " << it->geographicalId().rawId() << " " << static_cast<MTDDetId>(it->geographicalId()).mtdRR()
227-
<< " " << it->type() << " " << it->translation().z() << " "
228-
<< convertRadToDeg(angle0to2pi::make0To2pi(it->phi())) << "\n";
229+
<< " " << it->type() << " " << it->translation().z() << " " << convertRadToDeg(makempiToppi(it->phi()))
230+
<< "\n";
229231
}
230232
edm::LogVerbatim("MTDNumbering") << "GeometricTimingDet order after sorting \n" << after.str();
231233
#endif
@@ -396,8 +398,8 @@ std::unique_ptr<GeometricTimingDet> DDCmsMTDConstruction::construct(const cms::D
396398
std::stringstream after(std::stringstream::in | std::stringstream::out);
397399
for (const auto& it : comp) {
398400
after << "ORDER2 " << it->geographicalId().rawId() << " " << static_cast<MTDDetId>(it->geographicalId()).mtdRR()
399-
<< " " << it->type() << " " << it->translation().z() << " "
400-
<< convertRadToDeg(angle0to2pi::make0To2pi(it->phi())) << "\n";
401+
<< " " << it->type() << " " << it->translation().z() << " " << convertRadToDeg(makempiToppi(it->phi()))
402+
<< "\n";
401403
}
402404
edm::LogVerbatim("DD4hep_MTDNumbering") << "GeometricTimingDet order after sorting \n" << after.str();
403405
#endif

RecoMTD/DetLayers/test/TestBTLNavigation.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ void TestBTLNavigation::analyze(edm::StreamID, edm::Event const&, edm::EventSetu
7979
<< layer->basicComponents().size();
8080

8181
unsigned int irodInd(0);
82+
unsigned int imodInd(0);
8283
for (const auto& irod : layer->rods()) {
8384
irodInd++;
8485
LogVerbatim("MTDLayerDumpFull") << std::fixed << "\nTray " << std::setw(4) << irodInd << "\n"
@@ -97,7 +98,6 @@ void TestBTLNavigation::analyze(edm::StreamID, edm::Event const&, edm::EventSetu
9798
<< fround(irod->specificSurface().bounds().thickness(), 2)
9899
<< " normal phi = " << fround(irod->specificSurface().normalVector().phi(), 2)
99100
<< std::endl;
100-
unsigned int imodInd(0);
101101
for (const auto& imod : irod->basicComponents()) {
102102
imodInd++;
103103
BTLDetId modId(imod->geographicalId().rawId());
@@ -121,50 +121,50 @@ void TestBTLNavigation::analyze(edm::StreamID, edm::Event const&, edm::EventSetu
121121
}
122122
for (int iside = -1; iside <= 1; iside += 2) {
123123
size_t idetNew = topo.product()->phishiftBTL(modId.rawId(), iside);
124-
if (idetNew > irod->basicComponents().size()) {
124+
if (idetNew >= layer->basicComponents().size()) {
125125
LogVerbatim("MTDLayerDumpFull")
126126
<< "...............phishift= " << std::fixed << std::setw(2) << iside << " out of range";
127127
LogVerbatim("MTDLayerDump") << "...............phishift= " << std::fixed << std::setw(2) << iside
128128
<< " out of range";
129129
} else {
130-
BTLDetId newId(irod->basicComponents()[idetNew]->geographicalId().rawId());
131-
auto newTopoId = topo.product()->btlIndex(newId.rawId());
130+
BTLDetId newId(layer->basicComponents()[idetNew]->geographicalId().rawId());
131+
auto const& newTopoId = topo.product()->btlIndex(newId.rawId());
132132
LogVerbatim("MTDLayerDumpFull")
133133
<< std::fixed << "...............phishift= "
134134
<< " iphi/ieta = " << std::setw(4) << newTopoId.first << " / " << std::setw(4) << newTopoId.second
135-
<< std::setw(2) << iside << " side = " << std::setw(4) << newId.mtdSide() << " RU = " << std::setw(4)
135+
<< std::setw(4) << iside << " side = " << std::setw(4) << newId.mtdSide() << " RU = " << std::setw(4)
136136
<< newId.runit() << " mod = " << std::setw(4) << newId.module()
137-
<< " pos = " << fvecround(irod->basicComponents()[idetNew]->position(), 4);
137+
<< " pos = " << fvecround(layer->basicComponents()[idetNew]->position(), 4);
138138
LogVerbatim("MTDLayerDump") << std::fixed << "...............phishift= "
139139
<< " iphi/ieta = " << std::setw(4) << newTopoId.first << " / " << std::setw(4)
140-
<< newTopoId.second << std::setw(2) << iside << " side = " << std::setw(4)
140+
<< newTopoId.second << std::setw(4) << iside << " side = " << std::setw(4)
141141
<< newId.mtdSide() << " RU = " << std::setw(4) << newId.runit()
142142
<< " mod = " << std::setw(4) << newId.module()
143-
<< " pos = " << fvecround(irod->basicComponents()[idetNew]->position(), 2);
143+
<< " pos = " << fvecround(layer->basicComponents()[idetNew]->position(), 2);
144144
}
145145
}
146146
for (int iside = -1; iside <= 1; iside += 2) {
147147
auto idetNew = topo.product()->etashiftBTL(modId, iside);
148-
if (idetNew > irod->basicComponents().size()) {
148+
if (idetNew >= layer->basicComponents().size()) {
149149
LogVerbatim("MTDLayerDumpFull")
150150
<< "...............etashift= " << std::fixed << std::setw(2) << iside << " out of range";
151151
LogVerbatim("MTDLayerDump") << "...............etashift= " << std::fixed << std::setw(2) << iside
152152
<< " out of range";
153153
} else {
154-
BTLDetId newId(irod->basicComponents()[idetNew]->geographicalId().rawId());
154+
BTLDetId newId(layer->basicComponents()[idetNew]->geographicalId().rawId());
155155
auto const& newTopoId = topo.product()->btlIndex(newId.rawId());
156156
LogVerbatim("MTDLayerDumpFull")
157157
<< std::fixed << "...............etashift= "
158158
<< " iphi/ieta = " << std::setw(4) << newTopoId.first << " / " << std::setw(4) << newTopoId.second
159-
<< std::setw(2) << iside << " side = " << std::setw(4) << newId.mtdSide() << " RU = " << std::setw(4)
159+
<< std::setw(4) << iside << " side = " << std::setw(4) << newId.mtdSide() << " RU = " << std::setw(4)
160160
<< newId.runit() << " mod = " << std::setw(4) << newId.module()
161-
<< " pos = " << fvecround(irod->basicComponents()[idetNew]->position(), 4);
161+
<< " pos = " << fvecround(layer->basicComponents()[idetNew]->position(), 4);
162162
LogVerbatim("MTDLayerDump") << std::fixed << "...............etashift= "
163163
<< " iphi/ieta = " << std::setw(4) << newTopoId.first << " / " << std::setw(4)
164-
<< newTopoId.second << std::setw(2) << iside << " side = " << std::setw(4)
164+
<< newTopoId.second << std::setw(4) << iside << " side = " << std::setw(4)
165165
<< newId.mtdSide() << " RU = " << std::setw(4) << newId.runit()
166166
<< " mod = " << std::setw(4) << newId.module()
167-
<< " pos = " << fvecround(irod->basicComponents()[idetNew]->position(), 2);
167+
<< " pos = " << fvecround(layer->basicComponents()[idetNew]->position(), 2);
168168
}
169169
}
170170
}

RecoMTD/DetLayers/test/mtd_cfg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
process.Timing = cms.Service("Timing")
6363

6464
process.prod = cms.EDAnalyzer("MTDRecoGeometryAnalyzer")
65-
process.prod1 = cms.EDAnalyzer("TestETLNavigation")
65+
process.prod1 = cms.EDAnalyzer("TestBTLNavigation")
66+
process.prod2 = cms.EDAnalyzer("TestETLNavigation")
6667

67-
process.p1 = cms.Path(cms.wait(process.prod)+process.prod1)
68+
process.p1 = cms.Path(cms.wait(process.prod)+cms.wait(process.prod1)+process.prod2)

0 commit comments

Comments
 (0)