Belle II Software development
CDCADCDeltaPedestals Class Reference

Database object for ADC pedestals. More...

#include <CDCADCDeltaPedestals.h>

Inheritance diagram for CDCADCDeltaPedestals:

Public Member Functions

 CDCADCDeltaPedestals ()
 Default constructor.
 
void setSamplingWindow (unsigned short sample)
 Set time window for sampling.
 
void setPedestal (int board, int ch, float pedestal)
 Set ADC pedestals in the list.
 
unsigned short getEntries () const
 Get the no.
 
std::map< unsigned short, float > getPedestals () const
 Get the whole list.
 
float getPedestal (const unsigned short &board, const unsigned short &ch) const
 Get ADC pedestal for the specified board.
 
void dump () const
 Print out all contents.
 

Private Member Functions

 ClassDef (CDCADCDeltaPedestals, 1)
 ClassDef.
 

Private Attributes

std::map< unsigned short, float > m_pedestals
 ADC pedestal list.
 
unsigned short m_samplingWindow = 10
 ADC sampling window.
 

Detailed Description

Database object for ADC pedestals.

Definition at line 23 of file CDCADCDeltaPedestals.h.

Constructor & Destructor Documentation

◆ CDCADCDeltaPedestals()

Default constructor.

Definition at line 29 of file CDCADCDeltaPedestals.h.

29{}

Member Function Documentation

◆ dump()

void dump ( ) const
inline

Print out all contents.

Definition at line 98 of file CDCADCDeltaPedestals.h.

99 {
100 std::cout << " " << std::endl;
101 std::cout << "ADC pedestal list" << std::endl;
102 std::cout << "samle" << m_samplingWindow << std::endl;
103 std::cout << "# of entries= " << m_pedestals.size() << std::endl;
104 std::cout << "in order of board#, ch#, pedestal" << std::endl;
105 for (auto const& ent : m_pedestals) {
106 if ((ent.first & 0x8000) > 0) {
107 std::cout << (ent.first & 0x1ff) << " " << -1 << " " << ent.second << std::endl;
108 } else {
109 std::cout << (ent.first & 0x1ff) << " " << ((ent.first & 0x7e00) >> 9) << " " << ent.second << std::endl;
110 }
111 }
112 }
std::map< unsigned short, float > m_pedestals
ADC pedestal list.
unsigned short m_samplingWindow
ADC sampling window.

◆ getEntries()

unsigned short getEntries ( ) const
inline

Get the no.

of entries in the list.

Definition at line 59 of file CDCADCDeltaPedestals.h.

60 {
61 return m_pedestals.size();
62 }

◆ getPedestal()

float getPedestal ( const unsigned short &  board,
const unsigned short &  ch 
) const
inline

Get ADC pedestal for the specified board.

Parameters
boardBoard id.
chChannel id.
Returns
pedestal for the board (and channel).

Definition at line 78 of file CDCADCDeltaPedestals.h.

79 {
80 unsigned short id0 = (0x8000 | board);
81 std::map<unsigned short, float>::const_iterator it0 = m_pedestals.find(id0);
82 if (it0 != m_pedestals.end()) { // board by board delta pedestal
83 return it0->second;
84 } else {
85 unsigned short id = ((ch << 9) | board);
86 std::map<unsigned short, float>::const_iterator it = m_pedestals.find(id);
87 if (it != m_pedestals.end()) { //delta pedetal with (board, ch).
88 return it->second;
89 } else {
90 return 0.0;
91 }
92 }
93 }

◆ getPedestals()

std::map< unsigned short, float > getPedestals ( ) const
inline

Get the whole list.

Definition at line 67 of file CDCADCDeltaPedestals.h.

68 {
69 return m_pedestals;
70 }

◆ setPedestal()

void setPedestal ( int  board,
int  ch,
float  pedestal 
)
inline

Set ADC pedestals in the list.

Parameters
boardBoard id
chChannel id
pedestalPedestal value

Definition at line 47 of file CDCADCDeltaPedestals.h.

48 {
49 unsigned short mask = ch == -1 ? 0x8000 : 0;
50 unsigned short id = mask == 0x8000 ? (mask | board) : (mask | (ch << 9) | board);
51 pedestal *= m_samplingWindow;
52 m_pedestals.insert(std::pair<unsigned short, float>(id, pedestal));
53 }

◆ setSamplingWindow()

void setSamplingWindow ( unsigned short  sample)
inline

Set time window for sampling.

Parameters
sample

Definition at line 36 of file CDCADCDeltaPedestals.h.

37 {
38 m_samplingWindow = sample;
39 }

Member Data Documentation

◆ m_pedestals

std::map<unsigned short, float> m_pedestals
private

ADC pedestal list.

Definition at line 115 of file CDCADCDeltaPedestals.h.

◆ m_samplingWindow

unsigned short m_samplingWindow = 10
private

ADC sampling window.

Definition at line 116 of file CDCADCDeltaPedestals.h.


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