Belle II Software development
TOPDigitizerModule.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 <framework/core/Module.h>
12
13#include <framework/datastore/StoreArray.h>
14#include <top/dataobjects/TOPSimHit.h>
15#include <top/dataobjects/TOPSimCalPulse.h>
16#include <top/dataobjects/TOPDigit.h>
17#include <top/dataobjects/TOPRawDigit.h>
18#include <top/dataobjects/TOPRawWaveform.h>
19#include <mdst/dataobjects/MCParticle.h>
20#include <simulation/dataobjects/SimClockState.h>
21
22#include <framework/database/DBObjPtr.h>
23#include <top/dbobjects/TOPSampleTimes.h>
24#include <top/dbobjects/TOPCalTimebase.h>
25#include <top/dbobjects/TOPCalChannelT0.h>
26#include <top/dbobjects/TOPCalAsicShift.h>
27#include <top/dbobjects/TOPCalModuleT0.h>
28#include <top/dbobjects/TOPCalCommonT0.h>
29#include <top/dbobjects/TOPCalChannelPulseHeight.h>
30#include <top/dbobjects/TOPCalChannelThreshold.h>
31#include <top/dbobjects/TOPCalChannelNoise.h>
32#include <top/dbobjects/TOPFrontEndSetting.h>
33#include <top/dbobjects/TOPCalTimeWalk.h>
34
35#include <top/modules/TOPDigitizer/PulseHeightGenerator.h>
36
37
38namespace Belle2 {
50 class TOPDigitizerModule : public Module {
51
52 public:
53
58
63 virtual void initialize() override;
64
68 virtual void beginRun() override;
69
73 virtual void event() override;
74
75 private:
76
80 struct TimeOffset {
81 double value = 0;
82 double error = 0;
83 int windowShift = 0;
84 double timeShift = 0;
88 TimeOffset(double v, double e, int n, double t):
89 value(v), error(e), windowShift(n), timeShift(t)
90 {}
91 };
92
100 TimeOffset getTimeOffset(double trgOffset, int moduleID, int pixelID);
101
108 double generatePulseHeight(int moduleID, int pixelID) const;
109
110 // module steering parameters
113 double m_darkNoise;
114 double m_ADCx0;
115 double m_ADCp1;
116 double m_ADCp2;
117 double m_ADCmax;
118 double m_rmsNoise;
130 // datastore objects
139 // constants from conditions DB
151 // default for no DB or calibration not available
155 // other
156 double m_syncTimeBase = 0;
158 };
159
161} // Belle2 namespace
162
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Base class for Modules.
Definition: Module.h:72
Optional DBObjPtr: This class behaves the same as the DBObjPtr except that it will not raise errors w...
Definition: DBObjPtr.h:48
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
double m_ADCx0
pulse height distribution parameter [ADC counts]
StoreArray< TOPRawWaveform > m_waveforms
collection of waveforms
double m_electronicJitter
r.m.s of electronic jitter
StoreArray< TOPRawDigit > m_rawDigits
collection of raw digits
int m_lookBackWindows
number of "look back" windows
DBObjPtr< TOPCalAsicShift > m_asicShift
ASIC shifts calibration constants.
DBObjPtr< TOPFrontEndSetting > m_feSetting
front-end settings
double m_rmsNoise
r.m.s of noise [ADC counts]
int m_hysteresis
pulse height threshold hysteresis [ADC counts]
DBObjPtr< TOPCalCommonT0 > m_commonT0
common T0 calibration constants
TOP::PulseHeightGenerator m_pulseHeightGenerator
default generator
bool m_useSampleTimeCalibration
if true, use time base calibration
StoreArray< TOPSimCalPulse > m_simCalPulses
collection of simuated cal pulses
double m_timeZeroJitter
r.m.s of T0 jitter
double m_ADCmax
pulse height upper bound of range [ADC counts]
bool m_simulateTTS
if true, add TTS to simulated hits
double m_ADCp2
pulse height distribution parameter, must be positive
DBObjPtr< TOPCalChannelT0 > m_channelT0
channel T0 calibration constants
bool m_allChannels
if true, always make waveforms for all channels
int m_threshold
pulse height threshold [ADC counts]
DBObjPtr< TOPCalChannelNoise > m_noises
channel noise levels (r.m.s)
double m_ADCp1
pulse height distribution parameter, must be non-negative
double m_syncTimeBase
SSTin period.
bool m_useWaveforms
if true, use full waveform digitization
OptionalDBObjPtr< TOPCalTimeWalk > m_timeWalk
time-walk calibration constants
DBObjPtr< TOPCalChannelThreshold > m_thresholds
channel thresholds
DBObjPtr< TOPCalTimebase > m_timebases
sample times from database
StoreArray< TOPDigit > m_digits
collection of digits
DBObjPtr< TOPCalModuleT0 > m_moduleT0
module T0 calibration constants
int m_thresholdCount
minimal number of samples above threshold
StoreArray< MCParticle > m_mcParticles
collection of MC particles
bool m_useDatabase
if true, use calibration constants from database
double m_minWidthXheight
minimal width * height [ns * ADC counts]
DBObjPtr< TOPCalChannelPulseHeight > m_pulseHeights
pulse height param.
double m_darkNoise
uniform dark noise (hits per bar)
StoreObjPtr< SimClockState > m_simClockState
generated hardware clock state
StoreArray< TOPSimHit > m_simHits
collection of simuated hits
TOPSampleTimes m_sampleTimes
equidistant sample times
Calibration constants of a singe ASIC channel: time axis (sample times)
Generates pulse height according to distribution: P(x) = (x/x0)^p1 * exp(-(x/x0)^p2),...
double generatePulseHeight(int moduleID, int pixelID) const
Generates and returns pulse height.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
TimeOffset getTimeOffset(double trgOffset, int moduleID, int pixelID)
Returns a complete time offset by adding time mis-calibration to trgOffset.
virtual void beginRun() override
Called when entering a new run.
Abstract base class for different kinds of events.
Utility structure for time offset.
int windowShift
number of shifted windows
TimeOffset(double v, double e, int n, double t)
Full constructor.
double timeShift
shift expressed in time