Belle II Software  release-05-01-25
PXDDigit.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Peter Kvasnicka, Zbynek Drasal, Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef PXDDIGIT_H
12 #define PXDDIGIT_H
13 
14 #include <vxd/dataobjects/VxdID.h>
15 
16 #include <framework/dataobjects/DigitBase.h>
17 
18 namespace Belle2 {
30  class PXDDigit : public DigitBase {
31  public:
32 
39  PXDDigit(VxdID sensorID, unsigned short uCellID, unsigned short vCellID,
40  unsigned short charge):
41  m_sensorID(sensorID),
42  m_uCellID(uCellID), m_vCellID(vCellID),
44  {;}
45 
47  PXDDigit(): PXDDigit(0, 0, 0, 0) {}
48 
52  short int getFrameNumber() const { return VxdID(m_sensorID).getSegmentNumber(); }
53 
57  void setFrameNumber(unsigned short frame)
58  {
59  VxdID id(m_sensorID);
60  id.setSegmentNumber(frame);
61  m_sensorID = id;
62  }
63 
67  VxdID getSensorID() const { return m_sensorID; }
68 
72  unsigned short getUCellID() const { return m_uCellID; }
73 
77  unsigned short getVCellID() const { return m_vCellID; }
78 
82  unsigned short getCharge() const { return m_charge; }
83 
87  void setCharge(unsigned short charge) { m_charge = charge; }
88 
94  unsigned int getUniqueChannelID() const override
95  {
96  // shift segment part of sensorID by two bits to make place for u+v
97  VxdID sensorID(m_sensorID);
98  sensorID.setSegmentNumber(sensorID.getSegmentNumber() << 2);
99  return m_vCellID + (m_uCellID << 10) + (sensorID << 16);
100  }
101 
108  DigitBase::EAppendStatus addBGDigit(const DigitBase* bg) override
109  {
110  m_charge += dynamic_cast<const PXDDigit*>(bg)->getCharge();
112  }
113 
114 
115  private:
116 
117  unsigned short m_sensorID;
118  unsigned short m_uCellID;
119  unsigned short m_vCellID;
120  unsigned short m_charge;
122  ClassDefOverride(PXDDigit, 5)
123 
124  }; // class PXDDigit
125 
126 
128 } // end namespace Belle2
129 
130 #endif
Belle2::EvtPDLUtil::charge
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:46
Belle2::DigitBase::EAppendStatus
EAppendStatus
Enum for return state of addBGDigit function.
Definition: DigitBase.h:42
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::PXDDigit::PXDDigit
PXDDigit(VxdID sensorID, unsigned short uCellID, unsigned short vCellID, unsigned short charge)
Useful Constructor.
Definition: PXDDigit.h:47
Belle2::PXDDigit::m_vCellID
unsigned short m_vCellID
Cell z coordinate in pitch units.
Definition: PXDDigit.h:127
Belle2::PXDDigit::m_uCellID
unsigned short m_uCellID
Cell r-phi coordinate in pitch units.
Definition: PXDDigit.h:126
Belle2::PXDDigit::getCharge
unsigned short getCharge() const
Get collected charge.
Definition: PXDDigit.h:90
Belle2::PXDDigit::addBGDigit
DigitBase::EAppendStatus addBGDigit(const DigitBase *bg) override
Implementation of the base class function.
Definition: PXDDigit.h:116
Belle2::PXDDigit
The PXD digit class.
Definition: PXDDigit.h:38
Belle2::PXDDigit::getUCellID
unsigned short getUCellID() const
Get cell ID in u.
Definition: PXDDigit.h:80
Belle2::PXDDigit::setCharge
void setCharge(unsigned short charge)
Set digit charge.
Definition: PXDDigit.h:95
Belle2::PXDDigit::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: PXDDigit.h:75
Belle2::DigitBase::c_DontAppend
@ c_DontAppend
do not append BG digit to digits
Definition: DigitBase.h:43
Belle2::PXDDigit::m_sensorID
unsigned short m_sensorID
Compressed sensor identifier.
Definition: PXDDigit.h:125
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VxdID::setSegmentNumber
void setSegmentNumber(baseType segment)
Set the sensor segment.
Definition: VxdID.h:123
Belle2::PXDDigit::getFrameNumber
short int getFrameNumber() const
Get frame number of this digit.
Definition: PXDDigit.h:60
Belle2::PXDDigit::PXDDigit
PXDDigit()
Default constructor for the ROOT IO.
Definition: PXDDigit.h:55
Belle2::PXDDigit::setFrameNumber
void setFrameNumber(unsigned short frame)
Set frame number of this digit.
Definition: PXDDigit.h:65
Belle2::PXDDigit::getVCellID
unsigned short getVCellID() const
Get cell ID in v.
Definition: PXDDigit.h:85
Belle2::DigitBase
A common base for subdetector Digits.
Definition: DigitBase.h:36
Belle2::PXDDigit::m_charge
unsigned short m_charge
Digitized charge in ADC units.
Definition: PXDDigit.h:128
Belle2::PXDDigit::getUniqueChannelID
unsigned int getUniqueChannelID() const override
Implementation of the base class function.
Definition: PXDDigit.h:102
Belle2::VxdID::getSegmentNumber
baseType getSegmentNumber() const
Get the sensor segment.
Definition: VxdID.h:112