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())),
19 m_Subdetector(0),
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),
30 m_EnergyDeposit(0),
31 m_NPhotoelectrons(0),
32 m_NGeneratedPhotoelectrons(0),
33 m_FitStatus(0),
34 m_MCTime(0),
35 m_SiPMMCTime(0)
36{
37}
38
40 m_ElementNumbers(&(KLMElementNumbers::Instance())),
41 m_Subdetector(simHit->getSubdetector()),
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()),
52 m_EnergyDeposit(simHit->getEnergyDeposit()),
53 m_NPhotoelectrons(0),
54 m_NGeneratedPhotoelectrons(0),
55 m_FitStatus(0),
56 m_MCTime(simHit->getTime()),
57 m_SiPMMCTime(0)
58{
59}
60
61KLMDigit::KLMDigit(const KLMSimHit* simHit, int strip) :
62 m_ElementNumbers(&(KLMElementNumbers::Instance())),
63 m_Subdetector(simHit->getSubdetector()),
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()),
74 m_EnergyDeposit(simHit->getEnergyDeposit()),
75 m_NPhotoelectrons(0),
76 m_NGeneratedPhotoelectrons(0),
77 m_FitStatus(0),
78 m_MCTime(simHit->getTime()),
79 m_SiPMMCTime(0)
80{
81}
82
83unsigned int KLMDigit::getUniqueChannelID() const
84{
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}
A common base for subdetector Digits.
Definition: DigitBase.h:26
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
KLM digit (class representing a digitized hit in RPCs or scintillators).
Definition: KLMDigit.h:29
void setMCTime(float time)
Set MC time.
Definition: KLMDigit.h:384
void setNGeneratedPhotoelectrons(int nPhotoelectrons)
Set generated number of photoelectrons.
Definition: KLMDigit.h:339
EAppendStatus addBGDigit(const DigitBase *bg) override
The pile-up method.
Definition: KLMDigit.cc:89
KLMDigit()
Constructor.
Definition: KLMDigit.cc:17
bool isGood() const
Whether hit could be used late (if it passed discriminator threshold)
Definition: KLMDigit.h:348
float getTime() const
Get hit time.
Definition: KLMDigit.h:276
int getNGeneratedPhotoelectrons() const
Get generated number of photoelectrons.
Definition: KLMDigit.h:330
int m_Section
Number of section.
Definition: KLMDigit.h:416
const KLMElementNumbers * m_ElementNumbers
Element numbers.
Definition: KLMDigit.h:410
void setEnergyDeposit(float eDep)
Set energy deposit.
Definition: KLMDigit.h:303
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:419
float getMCTime() const
Get MC time.
Definition: KLMDigit.h:375
int m_Plane
Number of plane.
Definition: KLMDigit.h:425
int m_Layer
Number of layer.
Definition: KLMDigit.h:422
int m_Subdetector
ROOT streamer.
Definition: KLMDigit.h:413
uint16_t getCharge() const
Get charge.
Definition: KLMDigit.h:222
float getEnergyDeposit() const
Get energy deposit.
Definition: KLMDigit.h:294
void setCharge(uint16_t charge)
Set charge.
Definition: KLMDigit.h:231
int m_Strip
Number of strip.
Definition: KLMDigit.h:428
KLM element numbers.
KLMChannelNumber channelNumber(int subdetector, int section, int sector, int layer, int plane, int strip) const
Get channel number.
KLM simulation hit.
Definition: KLMSimHit.h:31
Abstract base class for different kinds of events.