Belle II Software  release-08-01-10
ClusterCandidate Class Reference

Class representing a possible cluster during clustering of the PXD It supports merging of different clusters and keeps track of the highest charge inside the cluster. More...

#include <ClusterCandidate.h>

Collaboration diagram for ClusterCandidate:

Public Types

enum  {
  c_defaultCapacity = 10 ,
  c_maxCapacity = 4 * c_defaultCapacity
}
 

Public Member Functions

 ClusterCandidate ()
 Constructor to create an empty Cluster.
 
void clear ()
 Clear the Cluster information (to reuse the same cluster instance)
 
ClusterCandidatemerge (ClusterCandidate &cls)
 Merge the given cluster with this one. More...
 
void add (const Pixel &pixel)
 Add a Pixel to the current cluster. More...
 
float getCharge () const
 get the charge of the cluster
 
float getSeedCharge () const
 get the seed charge of the cluster
 
const PixelgetSeed () const
 get the seed pixel of the cluster, i.e. More...
 
size_t size () const
 get the cluster size
 
const std::vector< Pixel > & pixels () const
 get a reference to all pixels in the cluster
 

Protected Attributes

ClusterCandidatem_merged
 Pointer to the cluster this cluster was merged into.
 
float m_charge
 Charge of the cluster.
 
Pixel m_seed
 Seed pixel of the cluster, i.e. More...
 
std::vector< Pixelm_pixels
 List of all pixels in the cluster.
 

Detailed Description

Class representing a possible cluster during clustering of the PXD It supports merging of different clusters and keeps track of the highest charge inside the cluster.

To save relocation time, each Instance is created with a default capacity of 10 pixels before relocation will occur.

Definition at line 30 of file ClusterCandidate.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
c_defaultCapacity 

Reserve space for this number of pixels on construction.

c_maxCapacity 

If the capacity exceeds this value, shrink the vector back to c_defaultCapacity after clearing.

Definition at line 32 of file ClusterCandidate.h.

32  {
34  c_defaultCapacity = 10,
37  };
@ c_defaultCapacity
Reserve space for this number of pixels on construction.
@ c_maxCapacity
If the capacity exceeds this value, shrink the vector back to c_defaultCapacity after clearing.

Member Function Documentation

◆ add()

void add ( const Pixel pixel)

Add a Pixel to the current cluster.

Increases the charge of the cluster and checks if the seed pixel changes. If this method is called on a cluster which has been merged with another cluster, the add method of the merged cluster will be called,

Parameters
pixelPixel to add to the cluster

Definition at line 57 of file ClusterCandidate.cc.

58  {
59  //Delegate to the correct cluster
60  if (m_merged) {
61  m_merged->add(pixel);
62  return;
63  }
64  //check seed charge
65  float charge = pixel.getCharge();
66  m_charge += charge;
67  if (m_seed.getCharge() < charge) {
68  m_seed = pixel;
69  }
70  //add pixel
71  m_pixels.push_back(pixel);
72  }
Pixel m_seed
Seed pixel of the cluster, i.e.
ClusterCandidate * m_merged
Pointer to the cluster this cluster was merged into.
float m_charge
Charge of the cluster.
std::vector< Pixel > m_pixels
List of all pixels in the cluster.
void add(const Pixel &pixel)
Add a Pixel to the current cluster.
float getCharge() const
Return the Charge of the Pixel.
Definition: Pixel.h:70
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ getSeed()

const Pixel& getSeed ( ) const
inline

get the seed pixel of the cluster, i.e.

the pixel with the highes charge

Definition at line 79 of file ClusterCandidate.h.

◆ merge()

ClusterCandidate * merge ( ClusterCandidate cls)

Merge the given cluster with this one.

This method will remove all pixels from a given cluster and add it to this one. In addition we set a pointer to this instance in the other cluster so that new pixels will be directly added to the correct cluster when add is called on an already merged cluster

Parameters
clsCluster to merge into this one
Returns
the address of the cluster containing all pixels

Definition at line 21 of file ClusterCandidate.cc.

Member Data Documentation

◆ m_seed

Pixel m_seed
protected

Seed pixel of the cluster, i.e.

the pixel with the highest charge

Definition at line 91 of file ClusterCandidate.h.


The documentation for this class was generated from the following files: