Belle II Software development
TOPNominalTDC.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 <top/dbobjects/TOPGeoBase.h>
12
13namespace Belle2 {
22 class TOPNominalTDC: public TOPGeoBase {
23 public:
24
28 enum {c_WindowSize = 64,
29 c_syncWindows = 2
30 };
31
36 {}
37
51 TOPNominalTDC(int numWindows,
52 int subBits,
53 double syncTimeBase,
54 int numofBunches,
55 double offset,
56 double pileupTime,
57 double doubleHitResolution,
58 double timeJitter,
59 double efficiency,
60 const std::string& name = "TOPNominalTDC");
61
73 TOPNominalTDC(unsigned numBits,
74 double binWidth,
75 double offset,
76 double pileupTime,
77 double doubleHitResolution,
78 double timeJitter,
79 double efficiency,
80 const std::string& name = "TOPNominalTDCold"):
81 TOPGeoBase(name),
82 m_offset(offset),
83 m_pileupTime(pileupTime),
84 m_doubleHitResolution(doubleHitResolution),
85 m_timeJitter(timeJitter),
86 m_efficiency(efficiency),
87 m_numBits(numBits),
88 m_binWidth(binWidth),
89 m_sampleWidth(binWidth)
90 {}
91
96 void setADCBits(unsigned adcBits) {m_adcBits = adcBits;}
97
102 void setAveragePedestal(int averagePedestal) {m_averagePedestal = averagePedestal;}
103
108 unsigned getADCBits() const {return m_adcBits;}
109
114 unsigned getADCRange() const {return 1 << m_adcBits;}
115
121
126 unsigned getNumWindows() const {return m_numWindows;}
131 unsigned getSubBits() const {return m_subBits;}
132
137 double getSyncTimeBase() const {return m_syncTimeBase;}
138
143 unsigned getNumofBunches() const {return m_numofBunches;}
144
150
155 double getOffset() const {return m_offset;}
156
161 double getPileupTime() const {return m_pileupTime;}
162
168
173 double getTimeJitter() const {return m_timeJitter;}
174
179 double getEfficiency() const {return m_efficiency;}
180
185 unsigned getNumBits() const {return m_numBits;}
186
191 double getBinWidth() const {return m_binWidth;}
192
197 double getSampleWidth() const {return m_sampleWidth;}
198
203 int getOverflowValue() const {return 1 << m_numBits;}
204
210 double getTime(int TDC) const {return (TDC + 0.5) * m_binWidth - m_offset;}
211
216 double getTimeMin() const {return -m_offset;}
217
222 double getTimeMax() const {return getOverflowValue() * m_binWidth - m_offset;}
223
230 int getTDCcount(double time) const;
231
238 int getSample(double time) const;
239
245 double getSampleTime(int sample) const {return sample * m_sampleWidth - m_offset;}
246
252 bool isSampleValid(int sample) const;
253
258 bool isConsistent() const override;
259
264 void print(const std::string& title = "Nominal time-to-digit conversion parameters") const override;
265
266
267 private:
268
269 unsigned m_numWindows = 0;
270 unsigned m_subBits = 0;
271 float m_syncTimeBase = 0;
272 unsigned m_numofBunches = 0;
273 float m_offset = 0;
274 float m_pileupTime = 0;
276 float m_timeJitter = 0;
277 float m_efficiency = 0;
279 unsigned m_numBits = 0;
280 float m_binWidth = 0;
281 float m_sampleWidth = 0;
283 unsigned m_adcBits = 12;
288 };
289
291} // end namespace Belle2
Base class for geometry parameters.
Definition: TOPGeoBase.h:25
Nominal time-to-digit conversion parameters (simplified model)
Definition: TOPNominalTDC.h:22
float m_efficiency
electronic efficiency (fract.
unsigned m_numBits
number of bits
unsigned m_subBits
number of bits per sample
double getTimeJitter() const
Returns r.m.s.
float m_offset
time offset
float m_syncTimeBase
time width of c_syncWindows
unsigned getADCBits() const
Returns the number of ADC bits.
TOPNominalTDC(unsigned numBits, double binWidth, double offset, double pileupTime, double doubleHitResolution, double timeJitter, double efficiency, const std::string &name="TOPNominalTDCold")
Useful constructor (old xml file version)
Definition: TOPNominalTDC.h:73
unsigned getADCRange() const
Returns ADC range.
@ c_syncWindows
number of windows corresponding to syncTimeBase
Definition: TOPNominalTDC.h:29
@ c_WindowSize
number of samples per ASIC window
Definition: TOPNominalTDC.h:28
unsigned m_adcBits
number of ADC bits
float m_pileupTime
pile-up time
int getOverflowValue() const
Returns TDC overflow value.
int getAveragePedestal() const
Returns average of pedestals.
TOPNominalTDC()
Default constructor.
Definition: TOPNominalTDC.h:35
double getPileupTime() const
Returns pile-up time.
float m_doubleHitResolution
double hit resolution time
double getTime(int TDC) const
Convert TDC count to time.
double getSampleWidth() const
Returns time difference between two samples.
double getTimeMin() const
Returns time range lower limit.
double getTimeMax() const
Returns time range upper limit.
unsigned m_numofBunches
number of bunches per syncTimeBase
double getSyncTimeBase() const
Returns synchonization time base (time width of c_syncWindows)
double getOffset() const
Returns time offset.
double getDoubleHitResolution() const
Returns double hit resolution time.
void setADCBits(unsigned adcBits)
Sets the number of ADC bits.
Definition: TOPNominalTDC.h:96
double getEfficiency() const
Returns electronic efficiency.
float m_timeJitter
r.m.s.
double getSampleTime(int sample) const
Converts sample number to time.
void setAveragePedestal(int averagePedestal)
Sets average of pedestals.
unsigned getSubBits() const
Returns number of bits per sample.
float m_sampleWidth
time between two samples
double getBinWidth() const
Returns time width of a TDC bin.
float m_binWidth
time width of a TDC bin
unsigned m_numWindows
number of ASIC windows per waveform
int m_averagePedestal
average of pedestals [ADC bins]
unsigned getNumofBunches() const
Returns number of bunches in the synchonization time base.
ClassDefOverride(TOPNominalTDC, 3)
ClassDef.
unsigned getNumWindows() const
Returns number of ASIC windows per waveform.
double getBunchSeparationTime() const
Returns bunch separation time (e.g.
unsigned getNumBits() const
Returns number of bits.
bool isConsistent() const override
Check for consistency of data members.
int getTDCcount(double time) const
Converts time to TDC count.
void print(const std::string &title="Nominal time-to-digit conversion parameters") const override
Print the content of the class.
bool isSampleValid(int sample) const
Check for the validity of sample number.
int getSample(double time) const
Converts time to sample number.
Abstract base class for different kinds of events.