Belle II Software development
ClusterCache.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <deque>
12#include <pxd/reconstruction/ClusterCandidate.h>
13
14namespace Belle2 {
19 namespace PXD {
20
78 public:
80 typedef std::deque<ClusterCandidate>::iterator iterator;
82 typedef std::deque<ClusterCandidate>::const_iterator const_iterator;
83
84 enum {
87 };
89 explicit ClusterCache(unsigned int maxU = c_defaultNumberColumns);
90
92 ClusterCache(const ClusterCache&) = delete;
93
96
100 void clear();
101
109 ClusterCandidate& findCluster(unsigned int u, unsigned int v);
110
121 std::deque<ClusterCandidate>::iterator begin() { return m_clusters.begin(); }
123 std::deque<ClusterCandidate>::iterator end() { return m_currCluster; }
124
126 bool empty() const { return m_clusters.begin() == m_currCluster; }
127
128 private:
129
132
138 void switchRow(unsigned int v);
139
141 const unsigned int m_maxU;
143 unsigned int m_curV;
149 std::deque<ClusterCandidate> m_clusters;
157 std::deque<ClusterCandidate>::iterator m_currCluster;
158 };
159
160 }
161
163}
Class to remember recently assigned clusters This class will remember the current and the last pixel ...
Definition: ClusterCache.h:77
ClusterCache & operator=(const ClusterCache &)=delete
No operator=.
ClusterCandidate & findCluster(unsigned int u, unsigned int v)
Find a cluster adjacent to the given coordinates.
Definition: ClusterCache.cc:42
~ClusterCache()
Delete the cache and free the memory.
Definition: ClusterCache.cc:26
@ c_defaultNumberColumns
Default maximum number of PIXEL columns the cache can handle.
Definition: ClusterCache.h:86
std::deque< ClusterCandidate >::iterator end()
Return iterator to the end of created clusters.
Definition: ClusterCache.h:123
const unsigned int m_maxU
number of columns of the cache.
Definition: ClusterCache.h:141
std::deque< ClusterCandidate > m_clusters
list of all the clusters created so far
Definition: ClusterCache.h:149
ClusterCandidate * mergeCluster(ClusterCandidate *cls1, ClusterCandidate *cls2)
Merge two cluster and update the list of cached clusters.
Definition: ClusterCache.cc:85
bool empty() const
Check if there are any clusters.
Definition: ClusterCache.h:126
ClusterCandidate ** m_clsCur
cache of the current row
Definition: ClusterCache.h:147
ClusterCandidate ** m_clsTop
cache of the top row
Definition: ClusterCache.h:145
ClusterCache(const ClusterCache &)=delete
No copy construction.
std::deque< ClusterCandidate >::iterator m_currCluster
iterator to the next free cluster to be used if a new cluster is needed.
Definition: ClusterCache.h:157
std::deque< ClusterCandidate >::const_iterator const_iterator
Define const iterator type.
Definition: ClusterCache.h:82
std::deque< ClusterCandidate >::iterator iterator
Define iterator type.
Definition: ClusterCache.h:80
void switchRow(unsigned int v)
Switch the internal rows.
Definition: ClusterCache.cc:95
void clear()
Clear the cache structure.
Definition: ClusterCache.cc:33
unsigned int m_curV
current v coordinate, needed to switch top row
Definition: ClusterCache.h:143
std::deque< ClusterCandidate >::iterator begin()
Return iterator to the begin of of created clusters.
Definition: ClusterCache.h:121
Class representing a possible cluster during clustering of the PXD It supports merging of different c...
Abstract base class for different kinds of events.