Belle II Software  release-05-01-25
ECLDspData Class Reference

This object contains ECL DSP coefs – electromagnetic calorimeter digital signal processing coefficients. More...

#include <ECLDspData.h>

Inheritance diagram for ECLDspData:
Collaboration diagram for ECLDspData:

Public Member Functions

 ECLDspData (unsigned char board_number=0)
 Initialize DSP coefficients class from binary file. More...
 
std::vector< short int > getExtraData () const
 
void getF (std::vector< short int > &dst) const
 Array with tabulated signal waveform.
 
void getF1 (std::vector< short int > &dst) const
 Array with tabulated derivative of signal waveform.
 
void getF31 (std::vector< short int > &dst) const
 Array FG31, used to estimate signal amplitude. More...
 
void getF32 (std::vector< short int > &dst) const
 Array FG32, used to estimate A * delta_t. More...
 
void getF33 (std::vector< short int > &dst) const
 Array FG33, used to estimate pedestal height in signal. More...
 
void getF41 (std::vector< short int > &dst) const
 Alternative for FG31 for signals with small amplitude.
 
void getF43 (std::vector< short int > &dst) const
 Alternative for FG33 for signals with small amplitude.
 
unsigned char getverMaj () const
 
unsigned char getverMin () const
 
short int getaAT () const
 
short int getlAT () const
 
short int getsT () const
 
short int gethT () const
 
short int getchiThresh () const
 chi2 threshold for fit quality flag
 
unsigned char getk1 () const
 multipliers power of 2 for f, f1
 
unsigned char getk2 () const
 multipliers power of 2 for chi2 calculation
 
unsigned char getka () const
 Number of bits for FG31, FG41.
 
unsigned char getkb () const
 Number of bits for FG32.
 
unsigned char getkc () const
 Number of bits for FG33, FG43.
 
unsigned char gety0Startr () const
 start point for pedestal calculation
 
unsigned char getBoardNumber () const
 Return ShaperDSP board number, 0..11.
 
void setExtraData (const std::vector< short int > &newval)
 SETTERS. More...
 
void setF (std::vector< short int > &src)
 Array with tabulated signal waveform.
 
void setF1 (std::vector< short int > &src)
 Array with tabulated derivative of signal waveform.
 
void setF31 (std::vector< short int > &src)
 Array FG31, used to estimate signal amplitude. More...
 
void setF32 (std::vector< short int > &src)
 Array FG32, used to estimate A * delta_t. More...
 
void setF33 (std::vector< short int > &src)
 Array FG33, used to estimate pedestal height in signal. More...
 
void setF41 (std::vector< short int > &src)
 Alternative for FG31 for signals with small amplitude.
 
void setF43 (std::vector< short int > &src)
 Alternative for FG33 for signals with small amplitude.
 
void setverMaj (unsigned char val)
 Sets major version of DSP coefficients.
 
void setverMin (unsigned char val)
 Sets minor version of DSP coefficients.
 
void setaAT (short int val)
 Set Low amp threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)
 
void setlAT (short int val)
 Set Low amp threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)
 
void setsT (short int val)
 Set Skip threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)
 
void sethT (short int val)
 Set Hit threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)
 
void setchiThresh (short int val)
 Set chi2 threshold for fit quality flag.
 
void setk1 (unsigned char val)
 Set multipliers power of 2 for f, f1.
 
void setk2 (unsigned char val)
 Set multipliers power of 2 for chi2 calculation.
 
void setka (unsigned char val)
 Set number of bits for FG31, FG41.
 
void setkb (unsigned char val)
 Set number of bits for FG32.
 
void setkc (unsigned char val)
 Set number of bits for FG33, FG43.
 
void sety0Startr (unsigned char val)
 Set start point for pedestal calculation.
 

Static Public Member Functions

static short int getPackerVersion ()
 GETTERS. More...
 

Private Member Functions

void packCoefVector (const std::vector< short int > &src, std::vector< short int > &dst)
 Convert vector of DSP coefficients (src) to ECLDspData internal format (dst). More...
 
void unpackCoefVector (const std::vector< short int > &src, std::vector< short int > &dst) const
 Convert vector of DSP coefficients (src) to ECLDspData internal format (dst). More...
 
 ClassDef (ECLDspData, 1)
 ClassDef.
 

Private Attributes

unsigned char m_boardNumber
 ShaperDSP board number, 0..11.
 
unsigned char m_verMaj
 Major version of DSP coefficients.
 
unsigned char m_verMin
 Minor version of DSP coefficients.
 
unsigned char m_ka
 Number of bits for FG31, FG41.
 
unsigned char m_kb
 Number of bits for FG32.
 
unsigned char m_kc
 Number of bits for FG33, FG43.
 
unsigned char m_y0Startr
 start point for pedestal calculation
 
short int m_chiThresh
 chi2 threshold for quality bit More...
 
unsigned char m_k1Chi
 multipliers power of 2 for f, f1
 
unsigned char m_k2Chi
 multipliers power of 2 for chi2 calculation
 
short int m_hitThresh
 See https://confluence.desy.de/display/BI/Electronics+Thresholds.
 
short int m_lowAmpThresh
 See https://confluence.desy.de/display/BI/Electronics+Thresholds.
 
short int m_skipThresh
 See https://confluence.desy.de/display/BI/Electronics+Thresholds.
 
short int m_adcAlwThresh
 See https://confluence.desy.de/display/BI/Electronics+Thresholds.
 
std::vector< short int > m_fg31
 See documentation for method 'getF31'.
 
std::vector< short int > m_fg32
 See documentation for method 'getF32'.
 
std::vector< short int > m_fg33
 See documentation for method 'getF33'.
 
std::vector< short int > m_fg41
 See documentation for method 'getF41'.
 
std::vector< short int > m_fg43
 See documentation for method 'getF43'.
 
std::vector< short int > m_f
 See documentation for method 'getF'.
 
std::vector< short int > m_f1
 See documentation for method 'getF1'.
 
std::vector< short int > m_extraData
 This vector contains all parameters that didn't exist in the initial version of ECL DSP file format. More...
 

Static Private Attributes

static const short int c_packerVersion = 2
 Version of packer used in packCoefVector by default Versioon of unpacker is dynamically determined from the data.
 

Detailed Description

This object contains ECL DSP coefs – electromagnetic calorimeter digital signal processing coefficients.

Payloads with these objects are used in two use cases.

  1. They are uploaded to ShaperDSP boards and then used in waveform fitting (amplitude and time reconstruction).
  2. ECL DQM uses these payloads with ShaperDSP emulator to quickly detect ShaperDSP boards that started sending corrupted data. (ECL expert then resets these modules)

For detailed overview of ECLDSP file structure see Confluence, https://confluence.desy.de/display/BI/ECL+Technical+Notes Attached file ECL-TN-2013-02 (digi.pdf)

Definition at line 44 of file ECLDspData.h.

Constructor & Destructor Documentation

◆ ECLDspData()

ECLDspData ( unsigned char  board_number = 0)
inlineexplicit

Initialize DSP coefficients class from binary file.

Parameters
board_numberId of specific shaperDSP, 0..11

Definition at line 115 of file ECLDspData.h.

129  {}
131  ~ECLDspData() {};
132 
133  /*************/
135  /*************/
136 

Member Function Documentation

◆ getaAT()

short int getaAT ( ) const
inline
Returns
ADC always threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)

Definition at line 195 of file ECLDspData.h.

◆ getExtraData()

std::vector<short int> getExtraData ( ) const
inline
Returns
Vector with all parameters that haven't been included in basic ECL DSP file format

Definition at line 152 of file ECLDspData.h.

◆ getF31()

void getF31 ( std::vector< short int > &  dst) const
inline

Array FG31, used to estimate signal amplitude.

Calculated from F and covariance matrix.

Definition at line 166 of file ECLDspData.h.

◆ getF32()

void getF32 ( std::vector< short int > &  dst) const
inline

Array FG32, used to estimate A * delta_t.

(A – amplitude, delta_t – time shift for linearization)

Calculated from F and covariance matrix.

Definition at line 173 of file ECLDspData.h.

◆ getF33()

void getF33 ( std::vector< short int > &  dst) const
inline

Array FG33, used to estimate pedestal height in signal.

Calculated from F and covariance matrix.

Definition at line 179 of file ECLDspData.h.

◆ gethT()

short int gethT ( ) const
inline
Returns
Hit threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)

Definition at line 207 of file ECLDspData.h.

◆ getlAT()

short int getlAT ( ) const
inline
Returns
Low amp threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)

Definition at line 199 of file ECLDspData.h.

◆ getPackerVersion()

static short int getPackerVersion ( )
inlinestatic

GETTERS.

Return version of packer algorithm used in [un]packCoefVector

Definition at line 146 of file ECLDspData.h.

◆ getsT()

short int getsT ( ) const
inline
Returns
Skip threshold (https://confluence.desy.de/display/BI/Electronics+Thresholds)

Definition at line 203 of file ECLDspData.h.

◆ getverMaj()

unsigned char getverMaj ( ) const
inline
Returns
Major version of DSP coefficients

Definition at line 189 of file ECLDspData.h.

◆ getverMin()

unsigned char getverMin ( ) const
inline
Returns
Minor version of DSP coefficients

Definition at line 191 of file ECLDspData.h.

◆ packCoefVector()

void packCoefVector ( const std::vector< short int > &  src,
std::vector< short int > &  dst 
)
private

Convert vector of DSP coefficients (src) to ECLDspData internal format (dst).

The internal format of coefficient vectors stored in this object is different from their real values: this improves data compression by ~200%. Thus, any accessor methods to m_f* vectors utilize packCoefVector and unpackCoefVector.

Definition at line 5 of file ECLDspData.cc.

6 {
7  const int N_CHANNELS = 16;
8  int size = src.size();
9 
10  if (getPackerVersion() == 0) {
11  dst = src;
12  } else if (getPackerVersion() >= 1) {
13  // Apply reversible transformation to shrink the range
14  // of saved coefficients into much smaller interval.
15  // This improves the compression by a factor of ~2.
16 
17  dst.resize(size);
18  for (int i = size - 1; i >= 0; i--) {
19  if (i >= 2 * N_CHANNELS)
20  dst[i] = src[i] - 2 * src[i - N_CHANNELS] + src[i - 2 * N_CHANNELS];
21  else if (i >= N_CHANNELS)
22  dst[i] = src[i] - 2 * src[i - N_CHANNELS];
23  else
24  dst[i] = src[i];
25  }
26  }
27 
28  if (getPackerVersion() == 2) {
29  // Rearrange the data in such a way that each coeff
30  // only takes up 4 bits (special value 0xF indicates
31  // coefficients that are too big to be packed)
32  //
33  // Vector structure after packing:
34  // [big_coefs | packed_coefs | packed_coefs.size()]
35 
36  // Bits allocated for each value
37  const int value_bits = 4;
38  const long value_max = 0xF;
39  const int values_packed = sizeof(short) * 8 / value_bits;
40 
41  int shift = -6;
42 
43  std::vector<short> packed(size / values_packed);
44  int len = -1;
45  for (int i = 0; i < size; i++) {
46  if (i % values_packed == 0) packed[i / values_packed] = 0;
47 
48  short val = dst[i] - shift;
49  if (val >= 0 && val < value_max) {
50  if (len < 0) len = i;
51  packed[i / values_packed] |= val << (value_bits * (i % values_packed));
52  } else {
53  if (len >= 0 && len < i) {
54  dst[len++] = dst[i];
55  }
56  packed[i / values_packed] |= short(value_max) << (value_bits * (i % values_packed));
57  }
58  }
59 
60  int packed_size = 0;
61 
62  if (len >= 0) {
63  dst.resize(len + packed.size());
64  packed_size = packed.size();
65  for (int i = 0; i < packed_size; i++) {
66  dst[len + i] = packed[i];
67  }
68  }
69  dst.push_back(packed_size);
70  }
71 }

◆ setExtraData()

void setExtraData ( const std::vector< short int > &  newval)
inline

SETTERS.

Sets vector with all parameters that haven't been included in basic ECL DSP file format

Definition at line 234 of file ECLDspData.h.

◆ setF31()

void setF31 ( std::vector< short int > &  src)
inline

Array FG31, used to estimate signal amplitude.

Calculated from F and covariance matrix.

Definition at line 248 of file ECLDspData.h.

◆ setF32()

void setF32 ( std::vector< short int > &  src)
inline

Array FG32, used to estimate A * delta_t.

(A – amplitude, delta_t – time shift for linearization)

Calculated from F and covariance matrix.

Definition at line 255 of file ECLDspData.h.

◆ setF33()

void setF33 ( std::vector< short int > &  src)
inline

Array FG33, used to estimate pedestal height in signal.

Calculated from F and covariance matrix.

Definition at line 261 of file ECLDspData.h.

◆ unpackCoefVector()

void unpackCoefVector ( const std::vector< short int > &  src,
std::vector< short int > &  dst 
) const
private

Convert vector of DSP coefficients (src) to ECLDspData internal format (dst).

See documentation for packCoefVector on why this was necessary.

Definition at line 72 of file ECLDspData.cc.

Member Data Documentation

◆ m_chiThresh

short int m_chiThresh
private

chi2 threshold for quality bit

We use condition chi^2 < (Amp^2 / (2^{k2Chi}) + chiThresh)

Definition at line 65 of file ECLDspData.h.

◆ m_extraData

std::vector<short int> m_extraData
private

This vector contains all parameters that didn't exist in the initial version of ECL DSP file format.

This vector allows loose coupling between ECLDspData class and ECL DSP file format.

m_extraData[0] – FORMAT_VERSION m_extraData[1] – PACKER_VERSION

Definition at line 102 of file ECLDspData.h.


The documentation for this class was generated from the following files:
Belle2::ECLDspData::getPackerVersion
static short int getPackerVersion()
GETTERS.
Definition: ECLDspData.h:146
Belle2::ECLDspData::ECLDspData
ECLDspData(unsigned char board_number=0)
Initialize DSP coefficients class from binary file.
Definition: ECLDspData.h:115