Belle II Software development
KLMDigit.cc
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/* Own header. */
10#include <klm/dataobjects/KLMDigit.h>
11
12/* Basf2 headers. */
13#include <framework/logging/Logger.h>
14
15using namespace Belle2;
16
18 m_ElementNumbers(&(KLMElementNumbers::Instance())),
20 m_Section(0),
21 m_Sector(0),
22 m_Layer(0),
23 m_Plane(0),
24 m_Strip(0),
25 m_LastStrip(0),
26 m_Charge(0),
27 m_CTime(0),
28 m_TDC(0),
29 m_Time(0),
33 m_FitStatus(0),
34 m_MCTime(0),
36{
37}
38
40 m_ElementNumbers(&(KLMElementNumbers::Instance())),
42 m_Section(simHit->getSection()),
43 m_Sector(simHit->getSector()),
44 m_Layer(simHit->getLayer()),
45 m_Plane(simHit->getPlane()),
46 m_Strip(simHit->getStrip()),
47 m_LastStrip(0),
48 m_Charge(0),
49 m_CTime(0),
50 m_TDC(0),
51 m_Time(simHit->getTime() + simHit->getPropagationTime()),
55 m_FitStatus(0),
56 m_MCTime(simHit->getTime()),
58{
59}
60
61KLMDigit::KLMDigit(const KLMSimHit* simHit, int strip) :
62 m_ElementNumbers(&(KLMElementNumbers::Instance())),
64 m_Section(simHit->getSection()),
65 m_Sector(simHit->getSector()),
66 m_Layer(simHit->getLayer()),
67 m_Plane(simHit->getPlane()),
68 m_Strip(strip),
69 m_LastStrip(0),
70 m_Charge(0),
71 m_CTime(0),
72 m_TDC(0),
73 m_Time(simHit->getTime() + simHit->getPropagationTime()),
77 m_FitStatus(0),
78 m_MCTime(simHit->getTime()),
80{
81}
82
83unsigned int KLMDigit::getUniqueChannelID() const
84{
85 return m_ElementNumbers->channelNumber(m_Subdetector, m_Section, m_Sector,
87}
88
90{
91 const KLMDigit* bgDigit = (KLMDigit*)bg;
92 if (!bgDigit->isGood())
94 if (!this->isGood())
96 /* MC data from digit with larger energy. */
97 if (this->getEnergyDeposit() < bgDigit->getEnergyDeposit())
98 this->setMCTime(bgDigit->getMCTime());
100 bgDigit->getEnergyDeposit());
101 if (this->getTime() > bgDigit->getTime())
102 this->setTime(bgDigit->getTime());
103 this->setCharge(std::min(this->getCharge(), bgDigit->getCharge()));
106 bgDigit->getNGeneratedPhotoelectrons());
108}
109
111{
113 B2FATAL("Function isPhiReadout() is called for EKLM digit.");
115}
EAppendStatus
Enum for return state of addBGDigit function.
Definition DigitBase.h:32
@ c_DontAppend
do not append BG digit to digits
Definition DigitBase.h:33
@ c_Append
append BG digit to digits
Definition DigitBase.h:34
DigitBase()
Constructor.
Definition DigitBase.h:40
void setMCTime(float time)
Set MC time.
Definition KLMDigit.h:421
uint16_t m_Charge
Charge (integral of ADC signal).
Definition KLMDigit.h:474
void setNGeneratedPhotoelectrons(int nPhotoelectrons)
Set generated number of photoelectrons.
Definition KLMDigit.h:376
int getSubdetector() const
Get subdetector number.
Definition KLMDigit.h:72
EAppendStatus addBGDigit(const DigitBase *bg) override
The pile-up method.
Definition KLMDigit.cc:89
int m_NGeneratedPhotoelectrons
Generated number of photoelectrons (MC only) for scintillators.
Definition KLMDigit.h:494
int getLayer() const
Get layer number.
Definition KLMDigit.h:126
KLMDigit()
Constructor.
Definition KLMDigit.cc:17
uint16_t m_TDC
TDC (time provided by ASIC).
Definition KLMDigit.h:480
float m_Time
Time of the hit.
Definition KLMDigit.h:483
bool isGood() const
Whether hit could be used late (if it passed discriminator threshold)
Definition KLMDigit.h:385
float getTime() const
Get hit time.
Definition KLMDigit.h:276
int getNGeneratedPhotoelectrons() const
Get generated number of photoelectrons.
Definition KLMDigit.h:367
float m_SiPMMCTime
MC time at SiPM.
Definition KLMDigit.h:505
int m_Section
Number of section.
Definition KLMDigit.h:453
int getSection() const
Get section number.
Definition KLMDigit.h:90
int getPlane() const
Get plane number.
Definition KLMDigit.h:144
const KLMElementNumbers * m_ElementNumbers
Element numbers.
Definition KLMDigit.h:447
float m_MCTime
MC time for scintillators.
Definition KLMDigit.h:502
int getStrip() const
Get strip number.
Definition KLMDigit.h:162
float m_EnergyDeposit
Energy deposition.
Definition KLMDigit.h:486
void setEnergyDeposit(float eDep)
Set energy deposit.
Definition KLMDigit.h:340
int getSector() const
Get sector number.
Definition KLMDigit.h:108
bool isPhiReadout() const
Whether BKLM digit is in phi or z plane.
Definition KLMDigit.cc:110
unsigned int getUniqueChannelID() const override
Get unique channel identifier.
Definition KLMDigit.cc:83
void setTime(float time)
Set hit time.
Definition KLMDigit.h:285
int m_Sector
Number of sector.
Definition KLMDigit.h:456
int m_LastStrip
Number of last strip (for multi-strip digits).
Definition KLMDigit.h:471
float getMCTime() const
Get MC time.
Definition KLMDigit.h:412
int m_Plane
Number of plane.
Definition KLMDigit.h:462
int m_FitStatus
Fit status.
Definition KLMDigit.h:497
float m_NPhotoelectrons
Number of photoelectrons.
Definition KLMDigit.h:489
int m_Layer
Number of layer.
Definition KLMDigit.h:459
int m_Subdetector
ROOT streamer.
Definition KLMDigit.h:450
uint16_t getCharge() const
Get charge.
Definition KLMDigit.h:222
float getEnergyDeposit() const
Get energy deposit.
Definition KLMDigit.h:331
uint16_t m_CTime
CTIME (time provided by B2TT).
Definition KLMDigit.h:477
void setCharge(uint16_t charge)
Set charge.
Definition KLMDigit.h:231
int m_Strip
Number of strip.
Definition KLMDigit.h:465
KLM simulation hit.
Definition KLMSimHit.h:31
Abstract base class for different kinds of events.