Belle II Software  release-08-01-10
PXDDigit.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 <vxd/dataobjects/VxdID.h>
12 
13 #include <framework/dataobjects/DigitBase.h>
14 
15 namespace Belle2 {
27  class PXDDigit : public DigitBase {
28  public:
29 
36  PXDDigit(VxdID sensorID, unsigned short uCellID, unsigned short vCellID,
37  unsigned short charge):
38  m_sensorID(sensorID),
39  m_uCellID(uCellID), m_vCellID(vCellID),
40  m_charge(charge)
41  {;}
42 
44  PXDDigit(): PXDDigit(0, 0, 0, 0) {}
45 
49  short int getFrameNumber() const { return VxdID(m_sensorID).getSegmentNumber(); }
50 
54  void setFrameNumber(unsigned short frame)
55  {
56  VxdID id(m_sensorID);
57  id.setSegmentNumber(frame);
58  m_sensorID = id;
59  }
60 
64  VxdID getSensorID() const { return m_sensorID; }
65 
69  unsigned short getUCellID() const { return m_uCellID; }
70 
74  unsigned short getVCellID() const { return m_vCellID; }
75 
79  unsigned short getCharge() const { return m_charge; }
80 
84  void setCharge(unsigned short charge) { m_charge = charge; }
85 
91  unsigned int getUniqueChannelID() const override
92  {
93  // shift segment part of sensorID by two bits to make place for u+v
94  VxdID sensorID(m_sensorID);
95  sensorID.setSegmentNumber(sensorID.getSegmentNumber() << 2);
96  return m_vCellID + (m_uCellID << 10) + (sensorID << 16);
97  }
98 
106  {
107  m_charge += dynamic_cast<const PXDDigit*>(bg)->getCharge();
109  }
110 
111 
112  private:
113 
114  unsigned short m_sensorID;
115  unsigned short m_uCellID;
116  unsigned short m_vCellID;
117  unsigned short m_charge;
119  ClassDefOverride(PXDDigit, 5)
120 
121  }; // class PXDDigit
122 
123 
125 } // end namespace Belle2
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
The PXD digit class.
Definition: PXDDigit.h:27
PXDDigit()
Default constructor for the ROOT IO.
Definition: PXDDigit.h:44
DigitBase::EAppendStatus addBGDigit(const DigitBase *bg) override
Implementation of the base class function.
Definition: PXDDigit.h:105
unsigned short m_vCellID
Cell z coordinate in pitch units.
Definition: PXDDigit.h:116
PXDDigit(VxdID sensorID, unsigned short uCellID, unsigned short vCellID, unsigned short charge)
Useful Constructor.
Definition: PXDDigit.h:36
unsigned short m_sensorID
Compressed sensor identifier.
Definition: PXDDigit.h:114
unsigned short getVCellID() const
Get cell ID in v.
Definition: PXDDigit.h:74
void setFrameNumber(unsigned short frame)
Set frame number of this digit.
Definition: PXDDigit.h:54
unsigned short getUCellID() const
Get cell ID in u.
Definition: PXDDigit.h:69
unsigned short getCharge() const
Get collected charge.
Definition: PXDDigit.h:79
unsigned short m_charge
Digitized charge in ADC units.
Definition: PXDDigit.h:117
short int getFrameNumber() const
Get frame number of this digit.
Definition: PXDDigit.h:49
void setCharge(unsigned short charge)
Set digit charge.
Definition: PXDDigit.h:84
unsigned int getUniqueChannelID() const override
Implementation of the base class function.
Definition: PXDDigit.h:91
unsigned short m_uCellID
Cell r-phi coordinate in pitch units.
Definition: PXDDigit.h:115
VxdID getSensorID() const
Get the sensor ID.
Definition: PXDDigit.h:64
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
void setSegmentNumber(baseType segment)
Set the sensor segment.
Definition: VxdID.h:113
baseType getSegmentNumber() const
Get the sensor segment.
Definition: VxdID.h:102
Abstract base class for different kinds of events.