Belle II Software development
ClusterProjection Class Reference

Helper struct to collect information about the 1D projection of a Pixel cluster. More...

#include <ClusterProjection.h>

Public Member Functions

 ClusterProjection ()
 Constructor.
 
void add (unsigned int cell, float position, float charge)
 Add Pixel information to the projection.
 
void finalize ()
 Finish calculation of center of gravity and set correct cluster size.
 
double getPos () const
 Return the projected position of the cluster.
 
double getError () const
 Return the error of the cluster.
 
unsigned int getSize () const
 Return the projected size of the cluster.
 
unsigned int getMinCell () const
 Return the minimum cell part of the cluster.
 
unsigned int getMaxCell () const
 Return the maximum cell part of the cluster.
 
double getCharge () const
 Return the total charge of the cluster.
 
double getMinCharge () const
 Return the charge in the minimum cell of the cluster.
 
double getMaxCharge () const
 Return the charge in the maximum cell of the cluster.
 
double getCenterCharge () const
 Return the center charge of the cluster, that is total charge minus minimum and maximum cell charge.
 
double getMinPos () const
 Return the position of the minimum cell of the cluster.
 
double getMaxPos () const
 Return the position of the maximum cell of the cluster.
 
void setPos (double pos)
 Set the position of the cluster.
 
void setError (double error)
 Set the error of the cluster.
 

Private Attributes

double m_pos
 Center of gravity of the cluster.
 
unsigned int m_min
 Minimum row or column of the cluster.
 
unsigned int m_max
 Maximum row or column of the cluster.
 
double m_minCharge
 Charge collected in the minimum row/column.
 
double m_maxCharge
 Charge collected in the maximum row/column.
 
double m_minPos
 Position of the minimum row/column.
 
double m_maxPos
 Position of the maximum row/column.
 
double m_error
 Position error of the cluster.
 
double m_charge
 Charge of the full cluster.
 
unsigned int m_size
 Projected size of the cluster.
 

Detailed Description

Helper struct to collect information about the 1D projection of a Pixel cluster.

This class just collects some information necessary to calculate the cluster position and errors: the minimum and maximum pixel row or column as well as the corresponding sensor position and charge in that row or column and the weighted (by charge) sum of positions for center of gravity determination

Definition at line 26 of file ClusterProjection.h.

Constructor & Destructor Documentation

◆ ClusterProjection()

ClusterProjection ( )
inline

Constructor.

Definition at line 29 of file ClusterProjection.h.

29 : m_pos(0), m_min(-1), m_max(0), m_minCharge(0),
30 m_maxCharge(0), m_minPos(0), m_maxPos(0), m_error(0), m_charge(0),
31 m_size(0) {}
double m_maxCharge
Charge collected in the maximum row/column.
double m_pos
Center of gravity of the cluster.
unsigned int m_min
Minimum row or column of the cluster.
double m_minPos
Position of the minimum row/column.
unsigned int m_max
Maximum row or column of the cluster.
double m_minCharge
Charge collected in the minimum row/column.
double m_charge
Charge of the full cluster.
double m_error
Position error of the cluster.
double m_maxPos
Position of the maximum row/column.
unsigned int m_size
Projected size of the cluster.

Member Function Documentation

◆ add()

void add ( unsigned int  cell,
float  position,
float  charge 
)
inline

Add Pixel information to the projection.

This will adjust the minimal and maximal coordinates and the charge collected at these coordinates as well as increment the weighted position to calculate the center of gravity

Parameters
cellpixel coordinate
positionpixel center position on the sensor
chargecharge in that pixel

Definition at line 101 of file ClusterProjection.h.

102 {
103 //If the new cell is smaller than the last minimum cell than change that
104 if (cell < m_min) {
105 m_min = cell;
107 m_minPos = position;
108 } else if (cell == m_min) {
109 //But if it is equal to the last known minimum cell sum up the charge
111 }
112 //Same as above for maximum cell.
113 if (cell > m_max || m_max == 0) {
114 m_max = cell;
116 m_maxPos = position;
117 } else if (cell == m_max) {
119 }
120 //Add weighted positions for center of gravity
121 m_pos += charge * position;
122 m_charge += charge;
123 }
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ finalize()

void finalize ( )
inline

Finish calculation of center of gravity and set correct cluster size.

Should only be used once

Definition at line 43 of file ClusterProjection.h.

44 {
45 m_pos /= m_charge;
46 m_size = m_max - m_min + 1;
47 }

◆ getCenterCharge()

double getCenterCharge ( ) const
inline

Return the center charge of the cluster, that is total charge minus minimum and maximum cell charge.

Definition at line 66 of file ClusterProjection.h.

66{ return m_charge - m_minCharge - m_maxCharge; }

◆ getCharge()

double getCharge ( ) const
inline

Return the total charge of the cluster.

Definition at line 60 of file ClusterProjection.h.

60{ return m_charge; }

◆ getError()

double getError ( ) const
inline

Return the error of the cluster.

Definition at line 52 of file ClusterProjection.h.

52{ return m_error; }

◆ getMaxCell()

unsigned int getMaxCell ( ) const
inline

Return the maximum cell part of the cluster.

Definition at line 58 of file ClusterProjection.h.

58{ return m_max; }

◆ getMaxCharge()

double getMaxCharge ( ) const
inline

Return the charge in the maximum cell of the cluster.

Definition at line 64 of file ClusterProjection.h.

64{ return m_maxCharge; }

◆ getMaxPos()

double getMaxPos ( ) const
inline

Return the position of the maximum cell of the cluster.

Definition at line 70 of file ClusterProjection.h.

70{ return m_maxPos; }

◆ getMinCell()

unsigned int getMinCell ( ) const
inline

Return the minimum cell part of the cluster.

Definition at line 56 of file ClusterProjection.h.

56{ return m_min; }

◆ getMinCharge()

double getMinCharge ( ) const
inline

Return the charge in the minimum cell of the cluster.

Definition at line 62 of file ClusterProjection.h.

62{ return m_minCharge; }

◆ getMinPos()

double getMinPos ( ) const
inline

Return the position of the minimum cell of the cluster.

Definition at line 68 of file ClusterProjection.h.

68{ return m_minPos; }

◆ getPos()

double getPos ( ) const
inline

Return the projected position of the cluster.

Should only be used after a call to finalize

Definition at line 50 of file ClusterProjection.h.

50{ return m_pos; }

◆ getSize()

unsigned int getSize ( ) const
inline

Return the projected size of the cluster.

Should only be used after a call to finalize

Definition at line 54 of file ClusterProjection.h.

54{ return m_size; }

◆ setError()

void setError ( double  error)
inline

Set the error of the cluster.

Definition at line 75 of file ClusterProjection.h.

75{ m_error = error; }

◆ setPos()

void setPos ( double  pos)
inline

Set the position of the cluster.

Should only be used after a call to finalize

Definition at line 73 of file ClusterProjection.h.

73{ m_pos = pos; }

Member Data Documentation

◆ m_charge

double m_charge
private

Charge of the full cluster.

Definition at line 96 of file ClusterProjection.h.

◆ m_error

double m_error
private

Position error of the cluster.

Definition at line 94 of file ClusterProjection.h.

◆ m_max

unsigned int m_max
private

Maximum row or column of the cluster.

Definition at line 84 of file ClusterProjection.h.

◆ m_maxCharge

double m_maxCharge
private

Charge collected in the maximum row/column.

Definition at line 88 of file ClusterProjection.h.

◆ m_maxPos

double m_maxPos
private

Position of the maximum row/column.

Definition at line 92 of file ClusterProjection.h.

◆ m_min

unsigned int m_min
private

Minimum row or column of the cluster.

Definition at line 82 of file ClusterProjection.h.

◆ m_minCharge

double m_minCharge
private

Charge collected in the minimum row/column.

Definition at line 86 of file ClusterProjection.h.

◆ m_minPos

double m_minPos
private

Position of the minimum row/column.

Definition at line 90 of file ClusterProjection.h.

◆ m_pos

double m_pos
private

Center of gravity of the cluster.

Definition at line 80 of file ClusterProjection.h.

◆ m_size

unsigned int m_size
private

Projected size of the cluster.

Definition at line 98 of file ClusterProjection.h.


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