Mantid
Loading...
Searching...
No Matches
DetectorSearcher.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidAPI/DllConfig.h"
14#include "MantidKernel/V3D.h"
15
16#include <Eigen/Core>
17
36namespace Mantid {
37namespace API {
38
39class MANTID_API_DLL DetectorSearcher {
40public:
43 using DetectorSearchResult = std::tuple<bool, size_t>;
44
48 DetectorSearchResult findDetectorIndex(const Kernel::V3D &q);
49
50private:
52 DetectorSearchResult searchUsingInstrumentRayTracing(const Kernel::V3D &q);
54 DetectorSearchResult searchUsingNearestNeighbours(const Kernel::V3D &q);
57 std::tuple<bool, size_t>
58 checkInteceptWithNeighbours(const Kernel::V3D &direction,
61 void createDetectorCache();
63 Kernel::V3D convertQtoDirection(const Kernel::V3D &q) const;
65 DetectorSearchResult handleTubeGap(const Kernel::V3D &detectorDir,
67
68 // Instance variables
69
79 std::vector<size_t> m_indexMap;
81 std::unique_ptr<Kernel::NearestNeighbours<3>> m_detectorCacheSearch;
83 std::unique_ptr<Geometry::InstrumentRayTracer> m_rayTracer;
84};
85} // namespace API
86} // namespace Mantid
Geometry::Instrument_const_sptr m_instrument
handle to the instrument to search for detectors in
std::tuple< bool, size_t > DetectorSearchResult
Search result type representing whether a detector was found and if so which detector index it was.
const double m_crystallography_convention
flag for whether the crystallography convention is to be used
std::unique_ptr< Geometry::InstrumentRayTracer > m_rayTracer
instrument ray tracer object for searching in rectangular detectors
std::unique_ptr< Kernel::NearestNeighbours< 3 > > m_detectorCacheSearch
Detector search cache for fast look-up of detectors.
std::vector< size_t > m_indexMap
vector of detector indicies used in the search
const bool m_usingFullRayTrace
flag for whether to use InstrumentRayTracer or NearestNeighbours
const Geometry::DetectorInfo & m_detInfo
detector info for the instrument
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
Definition: DetectorInfo.h:49
std::vector< std::tuple< VectorType, size_t, double > > NearestNeighbourResults
Class for 3D vectors.
Definition: V3D.h:34
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
Helper class which provides the Collimation Length for SANS instruments.