 |
Belle II Software
release-05-01-25
|
11 #include <pxd/reconstruction/ClusterCache.h>
12 #include <gtest/gtest.h>
50 for (
int v = 0; v < 4; ++v) {
51 for (
int u = 0; u < 5; ++u) {
52 if (v == 0 && u <= 2)
continue;
55 if ((v == 0 && u == 3) || (v == 1 && u >= 1 && u <= 3)) {
57 EXPECT_EQ(&cls1, &cache.
findCluster(u, v)) <<
"u: " << u <<
" v: " << v;
60 EXPECT_NE(&cls1, &cache.
findCluster(u, v)) <<
"u: " << u <<
" v: " << v;
106 ASSERT_EQ(2u, foundX.
size());
108 EXPECT_TRUE(&foundX == &cls1 || &foundX == &cls2);
110 EXPECT_EQ(3u, foundX.
pixels()[0].getIndex() + foundX.
pixels()[1].getIndex());
112 EXPECT_TRUE((cls1.
size() == 0 && cls2.
size() == 2) || (cls1.
size() == 2 && cls2.
size() == 0));
118 EXPECT_EQ(4u, foundY.
size());
123 EXPECT_EQ(foundX.
merge(t1), foundY.
merge(t2));
129 ASSERT_EQ(7u, foundY.
size());
134 EXPECT_EQ(foundX.
merge(t1), foundZ.
merge(t2));
138 std::bitset<7> check_index(-1);
140 ASSERT_LT(0u, px.getIndex());
141 ASSERT_GE(7u, px.getIndex());
142 EXPECT_TRUE(check_index[px.getIndex() - 1]) <<
"index: " << px.getIndex();
143 check_index[px.getIndex() - 1] =
false;
145 EXPECT_TRUE(check_index.none());
154 ASSERT_TRUE(cache.
empty());
156 ASSERT_FALSE(cache.
empty());
163 for (
int i = -10; i < 260; ++i) {
164 if (i >= 0 && i < 250) {
167 ASSERT_THROW(cache.
findCluster(i, 0), std::out_of_range);
void clear()
Clear the cache structure.
const std::vector< Pixel > & pixels() const
get a reference to all pixels in the cluster
Class representing a possible cluster during clustering of the PXD It supports merging of different c...
Class to represent one pixel, used in clustering for fast access.
Abstract base class for different kinds of events.
ClusterCandidate * merge(ClusterCandidate &cls)
Merge the given cluster with this one.
Class to remember recently assigned clusters This class will remember the current and the last pixel ...
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
bool empty() const
Check if there are any clusters.
size_t size() const
get the cluster size
ClusterCandidate & findCluster(unsigned int u, unsigned int v)
Find a cluster adjacent to the given coordinates.
void add(const Pixel &pixel)
Add a Pixel to the current cluster.