Belle II Software  release-08-01-10
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 (const std::vector< short int > &src)
 Array with tabulated signal waveform.
 
void setF1 (const std::vector< short int > &src)
 Array with tabulated derivative of signal waveform.
 
void setF31 (const std::vector< short int > &src)
 Array FG31, used to estimate signal amplitude. More...
 
void setF32 (const std::vector< short int > &src)
 Array FG32, used to estimate A * delta_t. More...
 
void setF33 (const std::vector< short int > &src)
 Array FG33, used to estimate pedestal height in signal. More...
 
void setF41 (const std::vector< short int > &src)
 Alternative for FG31 for signals with small amplitude.
 
void setF43 (const 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 constexpr 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 34 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 105 of file ECLDspData.h.

105  :
106  m_boardNumber(board_number),
107  m_verMaj(0),
108  m_verMin(0),
109  m_ka(0),
110  m_kb(0),
111  m_kc(0),
112  m_y0Startr(0),
113  m_chiThresh(0),
114  m_k1Chi(0),
115  m_k2Chi(0),
116  m_hitThresh(0),
117  m_lowAmpThresh(0),
118  m_skipThresh(0),
119  m_adcAlwThresh(0)
120  {}
unsigned char m_k2Chi
multipliers power of 2 for chi2 calculation
Definition: ECLDspData.h:59
short int m_lowAmpThresh
See https://confluence.desy.de/display/BI/Electronics+Thresholds.
Definition: ECLDspData.h:63
short int m_chiThresh
chi2 threshold for quality bit
Definition: ECLDspData.h:55
unsigned char m_y0Startr
start point for pedestal calculation
Definition: ECLDspData.h:49
short int m_skipThresh
See https://confluence.desy.de/display/BI/Electronics+Thresholds.
Definition: ECLDspData.h:65
short int m_hitThresh
See https://confluence.desy.de/display/BI/Electronics+Thresholds.
Definition: ECLDspData.h:61
unsigned char m_boardNumber
ShaperDSP board number, 0..11.
Definition: ECLDspData.h:37
unsigned char m_verMin
Minor version of DSP coefficients.
Definition: ECLDspData.h:41
short int m_adcAlwThresh
See https://confluence.desy.de/display/BI/Electronics+Thresholds.
Definition: ECLDspData.h:67
unsigned char m_ka
Number of bits for FG31, FG41.
Definition: ECLDspData.h:43
unsigned char m_verMaj
Major version of DSP coefficients.
Definition: ECLDspData.h:39
unsigned char m_kb
Number of bits for FG32.
Definition: ECLDspData.h:45
unsigned char m_k1Chi
multipliers power of 2 for f, f1
Definition: ECLDspData.h:57
unsigned char m_kc
Number of bits for FG33, FG43.
Definition: ECLDspData.h:47

Member Function Documentation

◆ getaAT()

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

Definition at line 178 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 135 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 149 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 156 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 162 of file ECLDspData.h.

◆ gethT()

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

Definition at line 190 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 182 of file ECLDspData.h.

◆ getPackerVersion()

static constexpr short int getPackerVersion ( )
inlinestaticconstexpr

GETTERS.

Return version of packer algorithm used in [un]packCoefVector

Definition at line 129 of file ECLDspData.h.

◆ getsT()

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

Definition at line 186 of file ECLDspData.h.

◆ getverMaj()

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

Definition at line 172 of file ECLDspData.h.

◆ getverMin()

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

Definition at line 174 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 12 of file ECLDspData.cc.

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

◆ 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 217 of file ECLDspData.h.

◆ setF31()

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

Array FG31, used to estimate signal amplitude.

Calculated from F and covariance matrix.

Definition at line 231 of file ECLDspData.h.

◆ setF32()

void setF32 ( const 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 238 of file ECLDspData.h.

◆ setF33()

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

Array FG33, used to estimate pedestal height in signal.

Calculated from F and covariance matrix.

Definition at line 244 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 79 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 55 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 92 of file ECLDspData.h.


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