Skip to content

Commit 5c3b3dc

Browse files
committed
switch to getDetectorIDAtXY
1 parent 0f5fe09 commit 5c3b3dc

File tree

10 files changed

+30
-40
lines changed

10 files changed

+30
-40
lines changed

Framework/Algorithms/src/SmoothNeighbours.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void SmoothNeighbours::findNeighboursRectangular() {
250250
std::vector<std::pair<int, int>> idToIndexMap;
251251
idToIndexMap.reserve(detList.size());
252252
for (int i = 0; i < static_cast<int>(detList.size()); i++)
253-
idToIndexMap.emplace_back(detList[i]->getAtXY(0, 0)->getID(), i);
253+
idToIndexMap.emplace_back(detList[i]->getDetectorIDAtXY(0, 0), i);
254254

255255
// To sort in descending order
256256
if (sum)
@@ -277,7 +277,7 @@ void SmoothNeighbours::findNeighboursRectangular() {
277277
continue;
278278
if (k + iy >= det->ypixels() - m_edge || k + iy < m_edge)
279279
continue;
280-
int pixelID = det->getAtXY(j + ix, k + iy)->getID();
280+
int pixelID = det->getDetectorIDAtXY(j + ix, k + iy);
281281

282282
// Find the corresponding workspace index, if any
283283
auto mapEntry = pixel_to_wi.find(pixelID);

Framework/Crystal/src/CentroidPeaks.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,7 @@ int CentroidPeaks::findPixelID(const std::string &bankName, int col, int row) {
319319
std::shared_ptr<const IComponent> parent = m_inst->getComponentByName(bankName);
320320
if (parent->type() == "RectangularDetector") {
321321
std::shared_ptr<const RectangularDetector> RDet = std::dynamic_pointer_cast<const RectangularDetector>(parent);
322-
323-
std::shared_ptr<Detector> pixel = RDet->getAtXY(col, row);
324-
return pixel->getID();
322+
return RDet->getDetectorIDAtXY(col, row);
325323
} else {
326324
std::string bankName0 = bankName;
327325
// Only works for WISH

Framework/Crystal/src/LoadIsawPeaks.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,7 @@ int LoadIsawPeaks::findPixelID(const PeaksWorkspace_sptr &ws, const std::string
354354

355355
if (parent->type() == "RectangularDetector") {
356356
std::shared_ptr<const RectangularDetector> RDet = std::dynamic_pointer_cast<const RectangularDetector>(parent);
357-
358-
std::shared_ptr<Detector> pixel = RDet->getAtXY(col, row);
359-
return pixel->getID();
357+
return RDet->getDetectorIDAtXY(col, row);
360358
} else {
361359
const auto &componentInfo = ws->componentInfo();
362360
const size_t parentIndex = componentInfo.indexOfAny(bankName);

Framework/Crystal/src/MaskPeaksWorkspace.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ size_t MaskPeaksWorkspace::getWkspIndex(const detid2index_map &pixel_to_wi, cons
195195
return EMPTY_INT();
196196
}
197197

198-
int pixelID = det->getAtXY(x, y)->getID();
198+
int pixelID = det->getDetectorIDAtXY(x, y);
199199

200200
// Find the corresponding workspace index, if any
201201
auto wiEntry = pixel_to_wi.find(pixelID);
@@ -278,9 +278,7 @@ int MaskPeaksWorkspace::findPixelID(const std::string &bankName, int col, int ro
278278

279279
if (parent->type() == "RectangularDetector") {
280280
std::shared_ptr<const RectangularDetector> RDet = std::dynamic_pointer_cast<const RectangularDetector>(parent);
281-
282-
std::shared_ptr<Detector> pixel = RDet->getAtXY(col, row);
283-
return pixel->getID();
281+
return RDet->getDetectorIDAtXY(col, row);
284282
} else if (Iptr->getName().compare("CORELLI") == 0) {
285283
// Checking for CORELLI
286284
// pixel full name example

Framework/Crystal/src/PeakIntegration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ int PeakIntegration::fitneighbours(int ipeak, const std::string &det_name, int x
333333

334334
outputW->getSpectrum(idet).clearDetectorIDs();
335335
// Find the pixel ID at that XY position on the rectangular detector
336-
int pixelID = peak.getDetectorID(); // det->getAtXY(x0,y0)->getID();
336+
int pixelID = peak.getDetectorID();
337337

338338
// Find the corresponding workspace index, if any
339339
auto wiEntry = pixel_to_wi.find(pixelID);

Framework/Crystal/test/IntegratePeakTimeSlicesTest.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ class IntegratePeakTimeSlicesTest : public CxxTest::TestSuite {
9696
std::shared_ptr<const Geometry::RectangularDetector> bankR =
9797
std::dynamic_pointer_cast<const Geometry::RectangularDetector>(bankC);
9898

99-
std::shared_ptr<Geometry::Detector> pixelp = bankR->getAtXY(PeakCol, PeakRow);
99+
detid_t pixelID = bankR->getDetectorIDAtXY(PeakCol, PeakRow);
100100
const auto &detectorInfo = wsPtr->detectorInfo();
101-
const auto detInfoIndex = detectorInfo.indexOf(pixelp->getID());
101+
const auto detInfoIndex = detectorInfo.indexOf(pixelID);
102102

103103
// Now get Peak.
104104
double PeakTime = 18000 + (PeakChan + .5) * 100;
@@ -113,7 +113,7 @@ class IntegratePeakTimeSlicesTest : public CxxTest::TestSuite {
113113
wl.fromTOF(x, x, L1, 0, {{Kernel::UnitParams::l2, L2}, {Kernel::UnitParams::twoTheta, ScatAng}});
114114
double wavelength = x[0];
115115

116-
Peak peak(instP, pixelp->getID(), wavelength);
116+
Peak peak(instP, pixelID, wavelength);
117117

118118
// Now set up data in workspace2D
119119
double dQ = 0;
@@ -122,10 +122,7 @@ class IntegratePeakTimeSlicesTest : public CxxTest::TestSuite {
122122

123123
for (int row = 0; row < NRC; row++)
124124
for (int col = 0; col < NRC; col++) {
125-
126-
std::shared_ptr<Detector> detP = bankR->getAtXY(col, row);
127-
128-
detid2index_map::const_iterator it = map.find(detP->getID());
125+
detid2index_map::const_iterator it = map.find(bankR->getDetectorIDAtXY(col, row));
129126
size_t wsIndex = (*it).second;
130127

131128
double MaxR = max<double>(0.0, MaxPeakIntensity * (1 - abs(row - PeakRow) / MaxPeakRCSpan));
@@ -220,8 +217,7 @@ class IntegratePeakTimeSlicesTest : public CxxTest::TestSuite {
220217
*/
221218
double calcQ(const RectangularDetector_const_sptr &bankP, const DetectorInfo &detectorInfo, int row, int col,
222219
double time) {
223-
std::shared_ptr<Detector> detP = bankP->getAtXY(col, row);
224-
const auto detInfoIndex = detectorInfo.indexOf(detP->getID());
220+
const auto detInfoIndex = detectorInfo.indexOf(bankP->getDetectorIDAtXY(col, row));
225221
const auto L1 = detectorInfo.l1();
226222
const auto L2 = detectorInfo.l2(detInfoIndex);
227223

Framework/Geometry/test/GridDetectorTest.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,17 @@ class GridDetectorTest : public CxxTest::TestSuite {
198198

199199
void do_test_bounds(const GridDetector &det) {
200200
// Go out of bounds
201-
TS_ASSERT_THROWS(det.getAtXYZ(-1, 0, 0), const std::runtime_error &);
202-
TS_ASSERT_THROWS(det.getAtXYZ(0, -1, 0), const std::runtime_error &);
203-
TS_ASSERT_THROWS(det.getAtXYZ(100, 0, 0), const std::runtime_error &);
204-
TS_ASSERT_THROWS(det.getAtXYZ(0, 205, 0), const std::runtime_error &);
201+
TS_ASSERT_THROWS(det.getDetectorIDAtXYZ(-1, 0, 0), const std::runtime_error &);
202+
TS_ASSERT_THROWS(det.getDetectorIDAtXYZ(0, -1, 0), const std::runtime_error &);
203+
TS_ASSERT_THROWS(det.getDetectorIDAtXYZ(100, 0, 0), const std::runtime_error &);
204+
TS_ASSERT_THROWS(det.getDetectorIDAtXYZ(0, 205, 0), const std::runtime_error &);
205205
}
206206

207207
void do_test_ids(const GridDetector &det) {
208208
// Check some ids
209-
TS_ASSERT_EQUALS(det.getAtXYZ(0, 0, 1)->getID() - 1000000, 1);
210-
TS_ASSERT_EQUALS(det.getAtXYZ(0, 1, 0)->getID() - 1000000, 3);
211-
TS_ASSERT_EQUALS(det.getAtXYZ(1, 0, 0)->getID() - 1000000, 21);
209+
TS_ASSERT_EQUALS(det.getDetectorIDAtXYZ(0, 0, 1) - 1000000, 1);
210+
TS_ASSERT_EQUALS(det.getDetectorIDAtXYZ(0, 1, 0) - 1000000, 3);
211+
TS_ASSERT_EQUALS(det.getDetectorIDAtXYZ(1, 0, 0) - 1000000, 21);
212212
TS_ASSERT_EQUALS(det.getDetectorIDAtXYZ(0, 0, 1), 1000001);
213213
TS_ASSERT_EQUALS(det.getDetectorIDAtXYZ(0, 1, 0), 1000003);
214214
TS_ASSERT_EQUALS(det.getDetectorIDAtXYZ(1, 0, 0), 1000021);

Framework/Geometry/test/InstrumentDefinitionParserTest.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,10 @@ class InstrumentDefinitionParserTest : public CxxTest::TestSuite {
514514
TS_ASSERT_DELTA(bank1->getAtXY(1, 1)->getPos().Y(), -0.198, 1e-4);
515515

516516
// Some IDs
517-
TS_ASSERT_EQUALS(bank1->getAtXY(0, 0)->getID(), 1000);
518-
TS_ASSERT_EQUALS(bank1->getAtXY(0, 1)->getID(), 1001);
519-
TS_ASSERT_EQUALS(bank1->getAtXY(1, 0)->getID(), 1300);
520-
TS_ASSERT_EQUALS(bank1->getAtXY(1, 1)->getID(), 1301);
517+
TS_ASSERT_EQUALS(bank1->getDetectorIDAtXY(0, 0), 1000);
518+
TS_ASSERT_EQUALS(bank1->getDetectorIDAtXY(0, 1), 1001);
519+
TS_ASSERT_EQUALS(bank1->getDetectorIDAtXY(1, 0), 1300);
520+
TS_ASSERT_EQUALS(bank1->getDetectorIDAtXY(1, 1), 1301);
521521

522522
// The total number of detectors
523523
detid2det_map dets;

Framework/Geometry/test/RectangularDetectorTest.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ class RectangularDetectorTest : public CxxTest::TestSuite {
118118
TS_ASSERT_THROWS(det->getAtXY(0, 205), const std::runtime_error &);
119119

120120
// Check some ids
121-
TS_ASSERT_EQUALS(det->getAtXY(0, 0)->getID() - 1000000, 0);
122-
TS_ASSERT_EQUALS(det->getAtXY(0, 12)->getID() - 1000000, 12);
123-
TS_ASSERT_EQUALS(det->getAtXY(0, 112)->getID() - 1000000, 112);
124-
TS_ASSERT_EQUALS(det->getAtXY(1, 12)->getID() - 1000000, 1012);
121+
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 0) - 1000000, 0);
122+
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 12) - 1000000, 12);
123+
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 112) - 1000000, 112);
124+
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(1, 12) - 1000000, 1012);
125125
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 0), 1000000);
126126
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 12), 1000012);
127127
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 112), 1000112);

Framework/Geometry/test/StructuredDetectorTest.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ class StructuredDetectorTest : public CxxTest::TestSuite {
209209
TS_ASSERT_THROWS(det->getAtXY(0, 6), const std::runtime_error &);
210210

211211
// Check some ids
212-
TS_ASSERT_EQUALS(det->getAtXY(0, 0)->getID(), 0);
213-
TS_ASSERT_EQUALS(det->getAtXY(0, 1)->getID(), 1);
214-
TS_ASSERT_EQUALS(det->getAtXY(1, 1)->getID(), 3);
212+
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 0), 0);
213+
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(0, 1), 1);
214+
TS_ASSERT_EQUALS(det->getDetectorIDAtXY(1, 1), 3);
215215

216216
std::pair<size_t, size_t> xy;
217217
size_t x;

0 commit comments

Comments
 (0)