21#include <fairlogger/Logger.h>
33auto Mapping::addNeighbour(MpPad& pad)
36 return [&pad](
int neighbourID) {
37 if (pad.nNeighbours == 10) {
38 throw runtime_error(
"maximum number of neighbouring pads exceeded");
40 pad.neighbours[pad.nNeighbours] = neighbourID;
46auto Mapping::addPad(MpDE&
de,
const mapping::Segmentation& segmentation)
50 MpPad& pad =
de.pads[padID];
55 pad.area[0][0] = padX -
padSizeX / 2.;
56 pad.area[0][1] = padX +
padSizeX / 2.;
57 pad.area[1][0] = padY -
padSizeY / 2.;
58 pad.area[1][1] = padY +
padSizeY / 2.;
65auto Mapping::removeNeighbouringPadsInCorners(MpDE&
de)
69 return [&
de](
int padID) {
70 auto connectedByCorners = [](
float area1[2][2],
float area2[2][2]) ->
bool {
72 return (area1[0][0] - area2[0][1] >
precision || area2[0][0] - area1[0][1] >
precision) &&
75 MpPad& pad =
de.pads[padID];
76 uint8_t nSelectedNeighbours = 0;
77 for (
auto i = 0;
i < pad.nNeighbours; ++
i) {
78 MpPad& neighbour =
de.pads[pad.neighbours[
i]];
79 if (!connectedByCorners(pad.area, neighbour.area)) {
80 pad.neighbours[nSelectedNeighbours] = pad.neighbours[
i];
81 ++nSelectedNeighbours;
84 pad.nNeighbours = nSelectedNeighbours;
93 std::vector<std::unique_ptr<MpDE>> detectionElements{};
98 detectionElements.push_back(std::make_unique<MpDE>());
99 MpDE&
de(*(detectionElements.back()));
103 de.pads = std::make_unique<MpPad[]>(
de.nPads[0] +
de.nPads[1]);
106 segmentation.
forEachPad(removeNeighbouringPadsInCorners(
de));
110 return detectionElements;
119 if (area1[0][0] - area2[0][1] >
precision) {
122 if (area2[0][0] - area1[0][1] >
precision) {
125 if (area1[1][0] - area2[1][1] >
precision) {
128 if (area2[1][0] - area1[1][1] >
precision) {
144 for (
int ip1 = 0; ip1 < 2; ++ip1) {
145 for (
int ip2 = 0; ip2 < 2; ++ip2) {
146 if (TMath::Abs(area1[0][ip1] - area2[0][1 - ip1]) <
precision &&
147 TMath::Abs(area1[1][ip2] - area2[1][1 - ip2]) <
precision) {
Configurable parameters for MCH preclustering.
static const PreClusterFinderParam & Instance()
static std::vector< std::unique_ptr< MpDE > > createMapping()
static bool areOverlappingExcludeCorners(float area1[2][2], float area2[2][2])
static bool areOverlapping(float area1[2][2], float area2[2][2], float precision)
double padPositionX(int dePadIndex) const
double padSizeY(int dePadIndex) const
const CathodeSegmentation & nonBending() const
const CathodeSegmentation & bending() const
void forEachNeighbouringPad(int dePadIndex, CALLABLE &&func) const
void forEachPad(CALLABLE &&func) const
double padPositionY(int dePadIndex) const
double padSizeX(int dePadIndex) const
GLenum GLint GLint * precision
uint8_t itsSharedClusterMap uint8_t
RuntimeErrorRef runtime_error(const char *)
O2MCHMAPPINGIMPL3_EXPORT const Segmentation & segmentation(int detElemId)
void forEachDetectionElement(CALLABLE &&func)
Defining DataPointCompositeObject explicitly as copiable.