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 std::deque<ClusterCandidate> m_clusters;
149 std::deque<ClusterCandidate>::iterator m_currCluster;
150
156 const unsigned int m_maxU;
158 unsigned int m_curV;
159 };
160
161 }
162
164}
ClusterCache & operator=(const ClusterCache &)=delete
No operator=.
ClusterCandidate & findCluster(unsigned int u, unsigned int v)
Find a cluster adjacent to the given coordinates.
~ClusterCache()
Delete the cache and free the memory.
std::deque< ClusterCandidate >::iterator end()
Return iterator to the end of created clusters.
const unsigned int m_maxU
number of columns of the cache.
std::deque< ClusterCandidate > m_clusters
list of all the clusters created so far
ClusterCandidate * mergeCluster(ClusterCandidate *cls1, ClusterCandidate *cls2)
Merge two cluster and update the list of cached clusters.
bool empty() const
Check if there are any clusters.
ClusterCandidate ** m_clsCur
cache of the current row
ClusterCandidate ** m_clsTop
cache of the top row
ClusterCache(const ClusterCache &)=delete
No copy construction.
@ c_defaultNumberColumns
Default maximum number of PIXEL columns the cache can handle.
std::deque< ClusterCandidate >::iterator m_currCluster
iterator to the next free cluster to be used if a new cluster is needed.
std::deque< ClusterCandidate >::const_iterator const_iterator
Define const iterator type.
ClusterCache(unsigned int maxU=c_defaultNumberColumns)
Create a new cache.
std::deque< ClusterCandidate >::iterator iterator
Define iterator type.
void switchRow(unsigned int v)
Switch the internal rows.
void clear()
Clear the cache structure.
unsigned int m_curV
current v coordinate, needed to switch top row
std::deque< ClusterCandidate >::iterator begin()
Return iterator to the begin of of created clusters.
Class representing a possible cluster during clustering of the PXD It supports merging of different c...
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.