Belle II Software development
TOPASICPedestals Class Reference

Calibration constants of a single ASIC window: pedestals. More...

#include <TOPASICPedestals.h>

Inheritance diagram for TOPASICPedestals:

Public Types

enum  {
  c_WindowSize = 64 ,
  c_Bits = 9
}
 Various constants. More...
 

Public Member Functions

 TOPASICPedestals ()
 Default constructor.
 
 TOPASICPedestals (unsigned short asicWindow)
 Constructor with ASIC window number.
 
int setPedestals (const TProfile *profile, double average=0)
 Set pedestals from profile histogram with c_WindowSize bins.
 
unsigned getASICWindow () const
 Return ASIC window number.
 
unsigned getSize () const
 Return window size (number of pedestal samples)
 
float getValue (unsigned i) const
 Return pedestal value of i-th sample.
 
float getError (unsigned i) const
 Return pedestal uncertainly of i-th sample.
 
bool isValid (unsigned i) const
 Check whether the pedestal of i-th sample is valid.
 
unsigned getNumofUnvalid () const
 Return number of un-valid pedestals (e.g.
 

Private Member Functions

unsigned getOptimizedOffset (const std::vector< unsigned > &values, const std::vector< unsigned > &errors, unsigned maxDif, unsigned maxErr)
 Return the offset that can allow for the maximal number of good pedestal samples.
 
 ClassDef (TOPASICPedestals, 1)
 ClassDef.
 

Private Attributes

unsigned short m_asicWindow
 ASIC window number.
 
unsigned short m_offset
 common pedestal offset
 
unsigned short m_pedestals [c_WindowSize]
 pedestals (packed: value, error)
 

Detailed Description

Calibration constants of a single ASIC window: pedestals.

Definition at line 24 of file TOPASICPedestals.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Various constants.

Enumerator
c_WindowSize 

number of samples

c_Bits 

number of bits reserved for pedestal value

Definition at line 30 of file TOPASICPedestals.h.

30 {c_WindowSize = 64,
31 c_Bits = 9
32 };
@ c_Bits
number of bits reserved for pedestal value
@ c_WindowSize
number of samples

Constructor & Destructor Documentation

◆ TOPASICPedestals() [1/2]

TOPASICPedestals ( )
inline

Default constructor.

Definition at line 37 of file TOPASICPedestals.h.

37 : m_asicWindow(0), m_offset(0)
38 {
39 for (unsigned i = 0; i < c_WindowSize; i++) m_pedestals[i] = 0;
40 }
unsigned short m_pedestals[c_WindowSize]
pedestals (packed: value, error)
unsigned short m_asicWindow
ASIC window number.
unsigned short m_offset
common pedestal offset

◆ TOPASICPedestals() [2/2]

TOPASICPedestals ( unsigned short  asicWindow)
inlineexplicit

Constructor with ASIC window number.

Parameters
asicWindowASIC window number

Definition at line 46 of file TOPASICPedestals.h.

46 : m_asicWindow(asicWindow),
47 m_offset(0)
48 {
49 for (unsigned i = 0; i < c_WindowSize; i++) m_pedestals[i] = 0;
50 }

Member Function Documentation

◆ getASICWindow()

unsigned getASICWindow ( ) const
inline

Return ASIC window number.

Returns
window number

Definition at line 64 of file TOPASICPedestals.h.

64{return m_asicWindow;}

◆ getError()

float getError ( unsigned  i) const
inline

Return pedestal uncertainly of i-th sample.

Parameters
isample number
Returns
pedestal uncertainty

Definition at line 92 of file TOPASICPedestals.h.

93 {
94 if (i < c_WindowSize) {
95 return (m_pedestals[i] >> c_Bits);
96 }
97 return 0;
98 }

◆ getNumofUnvalid()

unsigned getNumofUnvalid ( ) const
inline

Return number of un-valid pedestals (e.g.

those cannot be packed into 16-bit word)

Returns
number of un-valid pedestals

Definition at line 118 of file TOPASICPedestals.h.

119 {
120 unsigned bad = 0;
121 for (int i = 0; i < c_WindowSize; i++) {
122 if (!isValid(i)) bad++;
123 }
124 return bad;
125 }
bool isValid(unsigned i) const
Check whether the pedestal of i-th sample is valid.

◆ getSize()

unsigned getSize ( ) const
inline

Return window size (number of pedestal samples)

Returns
window size

Definition at line 70 of file TOPASICPedestals.h.

70{return c_WindowSize;}

◆ getValue()

float getValue ( unsigned  i) const
inline

Return pedestal value of i-th sample.

Parameters
isample number
Returns
pedestal value

Definition at line 77 of file TOPASICPedestals.h.

78 {
79 if (i < c_WindowSize) {
80 unsigned short mask = (1 << c_Bits);
81 mask--;
82 return (m_pedestals[i] & mask) + m_offset;
83 }
84 return 0;
85 }

◆ isValid()

bool isValid ( unsigned  i) const
inline

Check whether the pedestal of i-th sample is valid.

Parameters
isample number
Returns
true if available

Definition at line 105 of file TOPASICPedestals.h.

106 {
107 if (i < c_WindowSize) {
108 return (m_pedestals[i] != 0);
109 }
110 return false;
111 }

Member Data Documentation

◆ m_asicWindow

unsigned short m_asicWindow
private

ASIC window number.

Definition at line 142 of file TOPASICPedestals.h.

◆ m_offset

unsigned short m_offset
private

common pedestal offset

Definition at line 143 of file TOPASICPedestals.h.

◆ m_pedestals

unsigned short m_pedestals[c_WindowSize]
private

pedestals (packed: value, error)

Definition at line 144 of file TOPASICPedestals.h.


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