Mantid
Loading...
Searching...
No Matches
EdgePixel.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
12
13namespace Mantid::Geometry {
14
23bool edgePixel(ComponentInfo const &compInfo, const std::string &bankName, int col, int row, int Edge) {
24 if (bankName == "None") {
25 return false;
26 }
27 size_t parentIndex = compInfo.indexOfAny(bankName);
28 if (compInfo.isGridDetector(parentIndex)) {
29 auto const grid = compInfo.pixelGridComponent(parentIndex);
30
31 return col < Edge || col >= (grid.nX - Edge) || row < Edge || row >= (grid.nY - Edge);
32 } else {
33
34 // get the children and grandchildren from the component info
35 auto children = compInfo.children(parentIndex);
36 int startI = 1;
37 if (!children.empty() && compInfo.name(children[0]) == "sixteenpack") {
38 startI = 0;
39 children = compInfo.children(children[0]);
40 }
41 auto grandchildren = compInfo.children(children[0]);
42
43 // calculate if the pixel is on the edge of the bank
44 auto NROWS = static_cast<int>(grandchildren.size());
45 auto NCOLS = static_cast<int>(children.size());
46 // Wish pixels and tubes start at 1 not 0
47 return col - startI < Edge || col - startI >= (NCOLS - Edge) || row - startI < Edge ||
48 row - startI >= (NROWS - Edge);
49 }
50}
51} // namespace Mantid::Geometry
ComponentInfo : Provides a component centric view on to the instrument.
size_t indexOfAny(const std::string &name) const
bool isGridDetector(size_t const componentIndex) const
const std::vector< size_t > & children(size_t componentIndex) const
Beamline::PixelGridComponent pixelGridComponent(const size_t componentIndex) const
const std::string & name(const size_t componentIndex) const
MANTID_GEOMETRY_DLL bool edgePixel(ComponentInfo const &info, const std::string &bankName, int col, int row, int Edge)
Function to find peaks near detector edge.
Definition EdgePixel.cpp:23