Belle II Software development
TOPASICGains.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TObject.h>
12
13namespace Belle2 {
22 class TOPASICGains : public TObject {
23 public:
24
28 enum {c_WindowSize = 64,
29 c_Unit = 0x1000
30 };
31
36 {
37 for (unsigned i = 0; i < c_WindowSize; i++) m_gains[i] = c_Unit;
38 }
39
44 explicit TOPASICGains(unsigned short asicWindow):
45 m_asicWindow(asicWindow), m_unit(c_Unit), m_gainError(0)
46 {
47 for (unsigned i = 0; i < c_WindowSize; i++) m_gains[i] = c_Unit;
48 }
49
56 bool setGains(const std::vector<float>& gains, float error = 0);
57
62 unsigned getASICWindow() const {return m_asicWindow;}
63
68 unsigned getSize() const {return c_WindowSize;}
69
75 float getValue(unsigned i) const
76 {
77 if (i < c_WindowSize) {
78 return float(m_gains[i]) / float(m_unit);
79 }
80 return 0;
81 }
82
87 float getError() const
88 {
89 return float(m_gainError) / float(m_unit);
90 }
91
92
93 private:
94
95 unsigned short m_asicWindow;
96 unsigned short m_unit;
97 unsigned short m_gainError;
98 unsigned short m_gains[c_WindowSize];
102 };
103
105} // end namespace Belle2
106
Calibration constants of a single ASIC window: gains.
Definition: TOPASICGains.h:22
TOPASICGains(unsigned short asicWindow)
Constructor with ASIC window.
Definition: TOPASICGains.h:44
unsigned short m_gains[c_WindowSize]
gains (in fixed point format)
Definition: TOPASICGains.h:98
ClassDef(TOPASICGains, 1)
ClassDef.
float getValue(unsigned i) const
Return relative gain for i-th sample.
Definition: TOPASICGains.h:75
unsigned getSize() const
Return window size (number of pedestal samples)
Definition: TOPASICGains.h:68
unsigned getASICWindow() const
Return ASIC window number.
Definition: TOPASICGains.h:62
unsigned short m_asicWindow
ASIC window number.
Definition: TOPASICGains.h:95
@ c_Unit
unit of fixed point number
Definition: TOPASICGains.h:29
@ c_WindowSize
number of samples
Definition: TOPASICGains.h:28
unsigned short m_gainError
gain error (fixed point format)
Definition: TOPASICGains.h:97
unsigned short m_unit
unit of fixed point number
Definition: TOPASICGains.h:96
float getError() const
Return gain uncertainly.
Definition: TOPASICGains.h:87
TOPASICGains()
Default constructor.
Definition: TOPASICGains.h:35
bool setGains(const std::vector< float > &gains, float error=0)
Set gains.
Definition: TOPASICGains.cc:20
Abstract base class for different kinds of events.