Belle II Software development
PXDPixelThresholdPar Class Reference

The payload telling which charge threshold to use for PXD pixel. More...

#include <PXDPixelThresholdPar.h>

Inheritance diagram for PXDPixelThresholdPar:

Public Types

typedef std::unordered_map< unsigned int, unsigned short > SinglePixelThresholdsSet
 Structure to hold set of single pixels indexed by their unique id (unsigned int), stored in hash table, together with corresponding charge threshold.
 

Public Member Functions

 PXDPixelThresholdPar (unsigned short defaultThr=7)
 Default constructor.
 
 ~PXDPixelThresholdPar ()
 Destructor.
 
void setSinglePixelThreshold (unsigned short sensorID, unsigned int pixID, unsigned short pixThr=255)
 Set threshold for single pixel.
 
unsigned short getPixelThreshold (unsigned short sensorID, unsigned int pixID) const
 Check whether a pixel on a given sensor is OK or not and get threshold.
 
const std::unordered_map< unsigned short, SinglePixelThresholdsSet > & getPixelThresholdMap () const
 Return unordered_map with all masked single pixels in PXD.
 

Private Member Functions

 ClassDef (PXDPixelThresholdPar, 1)
 ClassDef.
 

Private Attributes

unsigned short m_defaultThreshold
 Default value for charge threshold.
 
std::unordered_map< unsigned short, SinglePixelThresholdsSetm_MapSingleThresholds
 Structure holding sets of masked single pixels for all sensors by sensor id (unsigned short).
 

Detailed Description

The payload telling which charge threshold to use for PXD pixel.

Definition at line 22 of file PXDPixelThresholdPar.h.

Member Typedef Documentation

◆ SinglePixelThresholdsSet

typedef std::unordered_map<unsigned int, unsigned short> SinglePixelThresholdsSet

Structure to hold set of single pixels indexed by their unique id (unsigned int), stored in hash table, together with corresponding charge threshold.

Definition at line 27 of file PXDPixelThresholdPar.h.

Constructor & Destructor Documentation

◆ PXDPixelThresholdPar()

PXDPixelThresholdPar ( unsigned short defaultThr = 7)
inline

Default constructor.

Definition at line 30 of file PXDPixelThresholdPar.h.

30: m_defaultThreshold(defaultThr), m_MapSingleThresholds() {}

◆ ~PXDPixelThresholdPar()

~PXDPixelThresholdPar ( )
inline

Destructor.

Definition at line 33 of file PXDPixelThresholdPar.h.

33{}

Member Function Documentation

◆ getPixelThreshold()

unsigned short getPixelThreshold ( unsigned short sensorID,
unsigned int pixID ) const
inline

Check whether a pixel on a given sensor is OK or not and get threshold.

Parameters
sensorIDunique ID of the sensor
pixIDunique ID of single pixel to set threshold
Returns
charge threshold of the single pixel.

Definition at line 62 of file PXDPixelThresholdPar.h.

63 {
64 auto singleSensorThresholds = m_MapSingleThresholds.find(sensorID);
65 if (singleSensorThresholds != m_MapSingleThresholds.end()) {
66 // Found some masked single pixels on sensor
67 auto& singleThresholds = singleSensorThresholds->second;
68 // Look if this is a single masked pixel
69 auto singleThr = singleThresholds.find(pixID);
70 if (singleThr != singleThresholds.end()) {
71 return singleThr->second;
72 }
73 }
74 // Pixel not found in the threshold map
75 return m_defaultThreshold;
76 }

◆ getPixelThresholdMap()

const std::unordered_map< unsigned short, SinglePixelThresholdsSet > & getPixelThresholdMap ( ) const
inline

Return unordered_map with all masked single pixels in PXD.

Definition at line 79 of file PXDPixelThresholdPar.h.

79{return m_MapSingleThresholds;}

◆ setSinglePixelThreshold()

void setSinglePixelThreshold ( unsigned short sensorID,
unsigned int pixID,
unsigned short pixThr = 255 )
inline

Set threshold for single pixel.

Parameters
sensorIDunique ID of the sensor
pixIDunique ID of single pixel to set threshold
pixThrcharge threshold of the single pixel

Definition at line 41 of file PXDPixelThresholdPar.h.

42 {
43 auto mapIterSingles = m_MapSingleThresholds.find(sensorID);
44 if (mapIterSingles != m_MapSingleThresholds.end()) {
45 // Already some single pixel thresholds on sensor
46 auto& singles = mapIterSingles->second;
47 singles.insert(std::pair <unsigned int, unsigned short>(pixID, pixThr));
48 } else {
49 // Create an empty set of thresholds for single pixels
50 PXDPixelThresholdPar::SinglePixelThresholdsSet singleThresholds;
51 // pixID will be used to generate hash in unordered_map for quick access
52 singleThresholds.insert(std::pair <unsigned int, unsigned short>(pixID, pixThr));
53 m_MapSingleThresholds[sensorID] = singleThresholds;
54 }
55 }

Member Data Documentation

◆ m_defaultThreshold

unsigned short m_defaultThreshold
private

Default value for charge threshold.

Charge > Thr

Definition at line 84 of file PXDPixelThresholdPar.h.

◆ m_MapSingleThresholds

std::unordered_map<unsigned short, SinglePixelThresholdsSet> m_MapSingleThresholds
private

Structure holding sets of masked single pixels for all sensors by sensor id (unsigned short).

Definition at line 87 of file PXDPixelThresholdPar.h.


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