Belle II Software  release-08-01-10
TimeDigitizer Class Reference

Time digitization of simulated hits in a single electronic channel. More...

#include <TimeDigitizer.h>

Collaboration diagram for TimeDigitizer:

Classes

struct  Hit
 hit data other than time More...
 

Public Types

enum  EType {
  c_Hit = 0 ,
  c_ChargeShare = 1 ,
  c_CrossTalk = 2 ,
  c_CalPulse = 3
}
 hit type enumerators
 

Public Member Functions

 TimeDigitizer (int moduleID, int pixelID, double timeOffset, double calErrorsSq, int shift, double rmsNoise, const TOPSampleTimes &sampleTimes)
 Constructor. More...
 
void setSampleTimes (const TOPSampleTimes *sampleTimes)
 Sets sample times. More...
 
void setNoise (double rmsNoise)
 Sets noise level. More...
 
void addTimeOfHit (double t, double pulseHeight, EType type, const TOPSimHit *simHit=0)
 Add time of simulated hit. More...
 
int getModuleID () const
 Return bar ID. More...
 
int getPixelID () const
 Return pixel ID. More...
 
unsigned getUniqueID () const
 Return unique pixel ID. More...
 
unsigned getASICWindow () const
 Returns ASIC storage window number. More...
 
unsigned int getChannel () const
 Returns hardware channel number. More...
 
unsigned getScrodID () const
 Returns SCROD ID. More...
 
unsigned getCarrierNumber () const
 Returns carrier board number. More...
 
unsigned getASICNumber () const
 Returns ASIC number. More...
 
unsigned getASICChannel () const
 Returns ASIC channel number. More...
 
bool isValid () const
 Check if digitizer instance is valid (e.g. More...
 
void digitize (StoreArray< TOPRawDigit > &rawDigits, StoreArray< TOPDigit > &digits, int threshold=0, int thresholdCount=0, double timeJitter=0) const
 Do time digitization using simplified pile-up and double-hit-resolution model. More...
 
void digitize (StoreArray< TOPRawWaveform > &waveforms, StoreArray< TOPRawDigit > &rawDigits, StoreArray< TOPDigit > &digits, int threshold, int hysteresis=0, int thresholdCount=0) const
 Do full waveform time digitization. More...
 

Static Public Member Functions

static void setStorageDepth (unsigned storageDepth)
 Sets storage depth. More...
 
static void setReadoutWindows (unsigned numWin)
 Sets the number of readout windows. More...
 
static void setOffsetWindows (int offsetWin)
 Sets the number of windows before the first ASIC window. More...
 
static void setFirstWindow (unsigned window)
 Sets first ASIC window. More...
 
static void maskSamples (bool maskThem)
 Mask samples at the end of a window to emulate phase-2 data. More...
 
static void setTimeWalk (DBObjPtr< TOPCalTimeWalk > *timeWalk)
 Stores pointer to time walk DB object defined in TOPDigitizerModule.
 

Private Member Functions

double gauss (double x, double mean, double sigma) const
 Gauss function (pulse shape approximation) More...
 
std::vector< short > generateWaveform (int startSample, const std::vector< double > &baselines, const std::vector< double > &rmsNoises, const std::vector< double > &pedestals, int ADCRange) const
 Generate waveform. More...
 
double generateTimeWalk (double hitTime, double peakTime) const
 Generate time walk by taking into account pile-up of hits. More...
 

Private Attributes

int m_moduleID = 0
 module ID (1-based)
 
int m_pixelID = 0
 pixel (e.g. More...
 
double m_timeOffset = 0
 time offset [ns]
 
double m_calErrorsSq = 0
 calibration uncertainties squared
 
double m_rmsNoise = 0
 r.m.s of noise [ADC counts]
 
const TOPSampleTimesm_sampleTimes = 0
 sample times
 
int m_windowShift = 0
 additional wf window shift due to asic mis-alignment
 
unsigned m_channel = 0
 hardware channel number (0-based)
 
unsigned m_scrodID = 0
 SCROD ID.
 
unsigned m_carrier = 0
 carrier board number
 
unsigned m_asic = 0
 ASIC number.
 
unsigned m_chan = 0
 ASIC channel number.
 
bool m_valid = false
 true, if module/pixel is mapped to hardware
 
std::multimap< double, const Hitm_times
 hits sorted by time
 

Static Private Attributes

static unsigned s_storageDepth = 0
 ASIC analog storage depth.
 
static unsigned s_readoutWindows = 0
 number of readout windows
 
static int s_offsetWindows = 0
 number of windows before first wf window
 
static unsigned s_window = 0
 first window number
 
static bool s_maskSamples = false
 mask samples at window boundary (phase-2)
 
static DBObjPtr< TOPCalTimeWalk > * s_timeWalk = 0
 pointer to DB object
 

Detailed Description

Time digitization of simulated hits in a single electronic channel.

Definition at line 33 of file TimeDigitizer.h.

Constructor & Destructor Documentation

◆ TimeDigitizer()

TimeDigitizer ( int  moduleID,
int  pixelID,
double  timeOffset,
double  calErrorsSq,
int  shift,
double  rmsNoise,
const TOPSampleTimes sampleTimes 
)

Constructor.

Parameters
moduleIDTOP module ID
pixelIDpixel ID
timeOffsettime offset [ns]
calErrorsSqcalibration uncertainies squared
shiftshift of waveform window due to asic mis-alignment [num of windows]
rmsNoiser.m.s of noise [ADC counts]
sampleTimessample times

Definition at line 31 of file TimeDigitizer.cc.

33  :
34  m_moduleID(moduleID), m_pixelID(pixelID), m_timeOffset(timeOffset),
35  m_calErrorsSq(calErrorsSq), m_rmsNoise(rmsNoise), m_sampleTimes(&sampleTimes),
36  m_windowShift(shift)
37  {
38  const auto& channelMapper = TOPGeometryPar::Instance()->getChannelMapper();
39  m_channel = channelMapper.getChannel(pixelID);
40  if (!channelMapper.isChannelValid(m_channel)) {
41  B2ERROR("TimeDigitizer::TimeDigitizer: invalid channel");
42  return;
43  }
44 
45  unsigned bs = 0;
46  channelMapper.splitChannelNumber(m_channel, bs, m_carrier, m_asic, m_chan);
47 
48  const auto& frontEndMapper = TOPGeometryPar::Instance()->getFrontEndMapper();
49  const auto* map = frontEndMapper.getMap(m_moduleID, bs);
50  if (!map) {
51  B2ERROR("TimeDigitizer::TimeDigitizer: no valid frontend map found");
52  return;
53  }
54 
55  m_scrodID = map->getScrodID();
56  m_valid = true;
57 
58  }
const TOPFrontEndMap * getMap(int moduleID, int bs) const
Return map from TOP module side.
const FrontEndMapper & getFrontEndMapper() const
Returns front-end mapper (mapping of SCROD's to positions within TOP modules)
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
const ChannelMapper & getChannelMapper() const
Returns default channel mapper (mapping of channels to pixels)
unsigned m_asic
ASIC number.
int m_windowShift
additional wf window shift due to asic mis-alignment
unsigned m_scrodID
SCROD ID.
double m_rmsNoise
r.m.s of noise [ADC counts]
unsigned m_channel
hardware channel number (0-based)
double m_calErrorsSq
calibration uncertainties squared
const TOPSampleTimes * m_sampleTimes
sample times
int m_moduleID
module ID (1-based)
bool m_valid
true, if module/pixel is mapped to hardware
double m_timeOffset
time offset [ns]
unsigned m_carrier
carrier board number
unsigned m_chan
ASIC channel number.

Member Function Documentation

◆ addTimeOfHit()

void addTimeOfHit ( double  t,
double  pulseHeight,
EType  type,
const TOPSimHit simHit = 0 
)

Add time of simulated hit.

Parameters
ttime of simulated hit
pulseHeightsimulated pulse height
typehit type
simHitpointer to simulated hit

Definition at line 60 of file TimeDigitizer.cc.

◆ digitize() [1/2]

void digitize ( StoreArray< TOPRawDigit > &  rawDigits,
StoreArray< TOPDigit > &  digits,
int  threshold = 0,
int  thresholdCount = 0,
double  timeJitter = 0 
) const

Do time digitization using simplified pile-up and double-hit-resolution model.

As a result, the digitized hits are appended to TOPRawDigits, then they are converted to TOPDigits and the relations to TOPSimHits and MCParticles are set with proper weights.

Parameters
rawDigitsarray of TOPRawDigits
digitsarray of TOPDigits
thresholdpulse height threshold [ADC counts]
thresholdCountminimal number of samples above threshold
timeJittera r.m.s. of an additional time jitter due to electronics

Definition at line 93 of file TimeDigitizer.cc.

◆ digitize() [2/2]

void digitize ( StoreArray< TOPRawWaveform > &  waveforms,
StoreArray< TOPRawDigit > &  rawDigits,
StoreArray< TOPDigit > &  digits,
int  threshold,
int  hysteresis = 0,
int  thresholdCount = 0 
) const

Do full waveform time digitization.

As a result, the digitized hits are appended to TOPRawDigits, then they are converted to TOPDigits and the relations to TOPSimHits and MCParticles are set with proper weights.

Parameters
waveformsgenerated waveforms
rawDigitsarray of TOPRawDigits
digitsarray of TOPDigits
thresholdpulse height threshold [ADC counts]
hysteresispulse height threshold hysteresis [ADC counts]
thresholdCountminimal number of samples above threshold

Definition at line 251 of file TimeDigitizer.cc.

◆ gauss()

double gauss ( double  x,
double  mean,
double  sigma 
) const
inlineprivate

Gauss function (pulse shape approximation)

Parameters
xargument
meanmean
sigmasigma
Returns
value

Definition at line 241 of file TimeDigitizer.h.

242  {
243  double xx = (x - mean) / sigma;
244  return exp(-0.5 * xx * xx);
245  }

◆ generateTimeWalk()

double generateTimeWalk ( double  hitTime,
double  peakTime 
) const
private

Generate time walk by taking into account pile-up of hits.

Parameters
hitTimetime of the hit
peakTimepeaking time of signal
Returns
time walk

Definition at line 516 of file TimeDigitizer.cc.

◆ generateWaveform()

vector< short > generateWaveform ( int  startSample,
const std::vector< double > &  baselines,
const std::vector< double > &  rmsNoises,
const std::vector< double > &  pedestals,
int  ADCRange 
) const
private

Generate waveform.

The size (number of ASIC windows) is given by the size of first argument. The size of second argument must be the same as the first one.

Parameters
startSamplestarting sample w.r.t first window number
baselinespossible baseline shifts of ASIC windows
rmsNoisesnoise levels (r.m.s) per ASIC window
pedestalsaverage pedestals per ASIC window
ADCRangeADC range (2^NumBits)
Returns
generated waveform

Definition at line 421 of file TimeDigitizer.cc.

◆ getASICChannel()

unsigned getASICChannel ( ) const
inline

Returns ASIC channel number.

Returns
ASIC channel number

Definition at line 186 of file TimeDigitizer.h.

◆ getASICNumber()

unsigned getASICNumber ( ) const
inline

Returns ASIC number.

Returns
ASIC number

Definition at line 180 of file TimeDigitizer.h.

◆ getASICWindow()

unsigned getASICWindow ( ) const
inline

Returns ASIC storage window number.

Returns
window number

Definition at line 156 of file TimeDigitizer.h.

◆ getCarrierNumber()

unsigned getCarrierNumber ( ) const
inline

Returns carrier board number.

Returns
carrier board number

Definition at line 174 of file TimeDigitizer.h.

◆ getChannel()

unsigned int getChannel ( ) const
inline

Returns hardware channel number.

Returns
hardware channel number

Definition at line 162 of file TimeDigitizer.h.

◆ getModuleID()

int getModuleID ( ) const
inline

Return bar ID.

Returns
bar ID

Definition at line 138 of file TimeDigitizer.h.

◆ getPixelID()

int getPixelID ( ) const
inline

Return pixel ID.

Returns
pixel ID (e.g. software channel)

Definition at line 144 of file TimeDigitizer.h.

◆ getScrodID()

unsigned getScrodID ( ) const
inline

Returns SCROD ID.

Returns
SCROD ID

Definition at line 168 of file TimeDigitizer.h.

◆ getUniqueID()

unsigned getUniqueID ( ) const
inline

Return unique pixel ID.

Returns
unique pixel ID

Definition at line 150 of file TimeDigitizer.h.

◆ isValid()

bool isValid ( ) const
inline

Check if digitizer instance is valid (e.g.

module/pixel is mapped to hardware)

Returns
true if valid

Definition at line 192 of file TimeDigitizer.h.

◆ maskSamples()

static void maskSamples ( bool  maskThem)
inlinestatic

Mask samples at the end of a window to emulate phase-2 data.

Parameters
maskThemmask (true) or not mask (false)

Definition at line 98 of file TimeDigitizer.h.

◆ setFirstWindow()

static void setFirstWindow ( unsigned  window)
inlinestatic

Sets first ASIC window.

Parameters
windowstorage window number

Definition at line 92 of file TimeDigitizer.h.

◆ setNoise()

void setNoise ( double  rmsNoise)
inline

Sets noise level.

Parameters
rmsNoiser.m.s. of noise [ADC counts]

Definition at line 122 of file TimeDigitizer.h.

◆ setOffsetWindows()

static void setOffsetWindows ( int  offsetWin)
inlinestatic

Sets the number of windows before the first ASIC window.

Parameters
offsetWinnumber of offset windows

Definition at line 86 of file TimeDigitizer.h.

◆ setReadoutWindows()

static void setReadoutWindows ( unsigned  numWin)
inlinestatic

Sets the number of readout windows.

Parameters
numWinnumber of readout windows

Definition at line 80 of file TimeDigitizer.h.

◆ setSampleTimes()

void setSampleTimes ( const TOPSampleTimes sampleTimes)
inline

Sets sample times.

Parameters
sampleTimessample times

Definition at line 109 of file TimeDigitizer.h.

◆ setStorageDepth()

static void setStorageDepth ( unsigned  storageDepth)
inlinestatic

Sets storage depth.

Parameters
storageDepthanalog storage depth

Definition at line 74 of file TimeDigitizer.h.

Member Data Documentation

◆ m_pixelID

int m_pixelID = 0
private

pixel (e.g.

software channel) ID (1-based)

Definition at line 280 of file TimeDigitizer.h.


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