diff --git a/Framework/NexusGeometry/src/InstrumentBuilder.cpp b/Framework/NexusGeometry/src/InstrumentBuilder.cpp index 544143e818d930feaa2cdebcf38a435da33ceed2..4b62666a0a28b026f44c9a44b82d13611dc1bbe4 100644 --- a/Framework/NexusGeometry/src/InstrumentBuilder.cpp +++ b/Framework/NexusGeometry/src/InstrumentBuilder.cpp @@ -96,7 +96,8 @@ void InstrumentBuilder::doAddTube( for (size_t i = 0; i < tube.detPositions().size(); ++i) { auto *detector = new Geometry::Detector(baseName + std::to_string(i), tube.detIDs()[i], objComp); - detector->translate(Mantid::Kernel::toV3D(tube.detPositions()[i])); + detector->translate( + Mantid::Kernel::toV3D(tube.detPositions()[i] - tube.tubePosition())); detector->setShape(pixelShape); objComp->add(detector); m_instrument->markAsDetectorIncomplete(detector); diff --git a/Framework/NexusGeometry/src/NexusGeometryParser.cpp b/Framework/NexusGeometry/src/NexusGeometryParser.cpp index f4a508cc6abfff998ac761d8765139d7ab48163d..5b819a9b8eb861b68d1c6440eafd4cb3ce0e0013 100644 --- a/Framework/NexusGeometry/src/NexusGeometryParser.cpp +++ b/Framework/NexusGeometry/src/NexusGeometryParser.cpp @@ -637,7 +637,7 @@ extractInstrument(const H5File &file, const Group &root) { std::vector<detail::TubeBuilder> tubes; if (searchTubes) { tubes = - TubeHelpers::findAndSortTubes(*detShape, pixelOffsets, detectorIds); + TubeHelpers::findAndSortTubes(*detShape, detectorPixels, detectorIds); builder.addTubes(bankName, tubes, detShape); } else { for (size_t i = 0; i < detectorIds.size(); ++i) { diff --git a/Framework/NexusGeometry/test/NexusGeometryParserTest.h b/Framework/NexusGeometry/test/NexusGeometryParserTest.h index 72ebde24bacbbbd3f337bd185876e72d2e69b14a..0581dbc408e63225a689f8ec2a69e64283358406 100644 --- a/Framework/NexusGeometry/test/NexusGeometryParserTest.h +++ b/Framework/NexusGeometry/test/NexusGeometryParserTest.h @@ -52,10 +52,11 @@ public: auto beamline = extractBeamline(*instrument); auto componentInfo = std::move(beamline.first); auto detectorInfo = std::move(beamline.second); + TSM_ASSERT_EQUALS("Detectors + 1 monitor", detectorInfo->size(), 128 * 2 + 1); - TSM_ASSERT_EQUALS("Detectors + 2 banks + root + source + sample", - componentInfo->size(), detectorInfo->size() + 5); + TSM_ASSERT_EQUALS("Detectors + 2 banks + 16 tubes + root + source + sample", + componentInfo->size(), detectorInfo->size() + 21); // Check 128 detectors in first bank TS_ASSERT_EQUALS( 128, @@ -68,7 +69,7 @@ public: // Check 128 detectors in second bank TS_ASSERT_EQUALS( 128, - componentInfo->detectorsInSubtree(componentInfo->root() - 4).size()); + componentInfo->detectorsInSubtree(componentInfo->root() - 12).size()); } void test_source_is_where_expected() {