Belle II Software development
Clusterizend.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 <vector>
12#include <utility>
13#include <array>
14
15namespace Belle2 {
23 unsigned short iterations;
25 unsigned short omegaTrim;
27 unsigned short phiTrim;
29 unsigned short nOmega;
30 unsigned short nPhi;
31 unsigned short nCot;
32 };
33
35 class SimpleCluster {
36 public:
37 // Default constructor
38 SimpleCluster() = default;
39
41 void appendCell(const cell_index& newClusterCell) { m_clusterCells.push_back(newClusterCell); }
43 void addHitToCluster(unsigned short hit) { m_clusterHits.push_back(hit); }
44
46 void setPeakCell(const cell_index& peakCell) { m_clusterPeakCell = peakCell; }
48 void setPeakWeight(const unsigned int peakWeight) { m_clusterPeakWeight = peakWeight; }
49
51 std::vector<cell_index> getCells() const { return m_clusterCells; }
53 std::vector<unsigned short> getClusterHits() const { return m_clusterHits; }
57 unsigned int getPeakWeight() const { return m_clusterPeakWeight; }
58
59 private:
61 std::vector<cell_index> m_clusterCells;
63 std::vector<unsigned short> m_clusterHits;
67 unsigned int m_clusterPeakWeight{0};
68 };
69
71 class Clusterizend {
72 public:
75 c3index phiLowerBound;
76 c3index phiUpperBound;
77 c3index omega;
78 c3index cot;
79 };
80
81 // Default constructor
82 Clusterizend() = default;
83
85 explicit Clusterizend(const ClustererParameters& parameters): m_clustererParams(parameters) {}
86
88 void setNewPlane(c3array& houghSpace) { m_houghSpace = &houghSpace; }
90 std::vector<SimpleCluster> makeClusters();
91
92 private:
94 std::array<c3index, 2> getSectionBounds(const unsigned short quadrant, const unsigned section);
96 void iterateOverSection(const std::array<c3index, 2>& sectionBounds, std::vector<SimpleCluster>& candidateClusters);
98 std::pair<cell_index, unsigned int> getSectionPeak(const std::array<c3index, 2>& sectionBounds);
100 SimpleCluster createCluster(const cell_index& peakCell);
102 void deletePeakSurroundings(const cell_index& peakCell);
104 void clearHoughSpaceRow(const DeletionBounds& bounds);
109 };
110
111}
SimpleCluster createCluster(const cell_index &peakCell)
Creates the surrounding cluster (fixed shape) around the section peak index.
std::vector< SimpleCluster > makeClusters()
Create all the clusters in the Hough space.
void setNewPlane(c3array &houghSpace)
Set a new Hough space for clustering and track finding.
std::pair< cell_index, unsigned int > getSectionPeak(const std::array< c3index, 2 > &sectionBounds)
Returns the global section peak index and weight.
ClustererParameters m_clustererParams
The struct holding the cluster parameters.
Clusterizend(const ClustererParameters &parameters)
To set custom clustering parameters.
void deletePeakSurroundings(const cell_index &peakCell)
Deletes the surroundings of such a cluster.
void clearHoughSpaceRow(const DeletionBounds &bounds)
Method to delete a omega row for the cluster deletion in deletePeakSurroundings method.
c3array * m_houghSpace
Pointer to the Hough space.
std::array< c3index, 2 > getSectionBounds(const unsigned short quadrant, const unsigned section)
Get the phi bounds of one quadrant section.
void iterateOverSection(const std::array< c3index, 2 > &sectionBounds, std::vector< SimpleCluster > &candidateClusters)
Iterate m_clustererParams.iterations times over one section.
Type for found clusters.
unsigned int m_clusterPeakWeight
Weight of the peak index.
cell_index m_clusterPeakCell
Peak index (found as the section maximum)
cell_index getPeakCell() const
Get the peak index (found as the section peak) from the cluster.
std::vector< unsigned short > m_clusterHits
Cluster related hits ids.
void setPeakCell(const cell_index &peakCell)
Set the peak index (found as the section peak) of the cluster.
std::vector< cell_index > m_clusterCells
Cluster member cells.
void setPeakWeight(const unsigned int peakWeight)
Set the weight of the peak cluster cell.
std::vector< cell_index > getCells() const
Get member cells in the cluster.
void appendCell(const cell_index &newClusterCell)
Add a track-space cell to the cluster.
std::vector< unsigned short > getClusterHits() const
Get the TS hits added to this cluster.
unsigned int getPeakWeight() const
Get the weight of the peak cluster cell.
void addHitToCluster(unsigned short hit)
Relate a hit to the cluster.
c3array::index c3index
index of Hough space 3D array
boost::multi_array< unsigned short, 3 > c3array
The Hough space is a 3D array (omega, phi, cot)
std::array< c3index, 3 > cell_index
The cell index of one Hough space bin.
Abstract base class for different kinds of events.
Struct containing the parameters for the clustering.
unsigned short phiTrim
Number of deleted cells in phi in each direction of the peak.
unsigned short omegaTrim
Number of deleted cells in omega in each direction of the peak.
unsigned short iterations
Number of iterations of the cluster searching for each Hough space quadrant.
unsigned short nOmega
The Hough space dimensions.
Struct containing the deletion bounds of a omega row.