Belle II Software development
VXDElectronDeposit Class Reference

Packed class to represent energy deposit along a path in electrons. More...

#include <VXDElectronDeposit.h>

Public Types

enum  EBits {
  c_FractionBits = 10 ,
  c_ElectronBits = 22 ,
  c_TotalBits = c_FractionBits + c_ElectronBits ,
  c_MaxFraction = (1 << c_FractionBits) - 1 ,
  c_MaxElectrons = (1 << c_ElectronBits) - 1
}
 Enum storing the bit informations for the packed information. More...
 

Public Member Functions

 VXDElectronDeposit (unsigned int packed)
 Create a new instance from a packed value.
 
 VXDElectronDeposit (float fraction, float electrons)
 create a new instance from a fraction along the path and a number of electrons.
 
float getFraction () const
 get the fraction along the path
 
unsigned int getElectrons () const
 get the number of deposited electrons
 
unsigned int getPacked () const
 get the packed value
 
 operator unsigned int () const
 convert to unsigned int using the packed representation
 

Private Attributes

unsigned int m_packed: c_TotalBits
 packed representation of the fraction and electron deposition
 

Detailed Description

Packed class to represent energy deposit along a path in electrons.

This class is used by the VXD to efficiently store the number of electrons deposited in the silicon along a given path by storing the fraction along the path and the number of electrons at that point in a packed way. The fraction is encoded between 0 and 1 using 8 bits and the number of electrons is stored as 24bit unsigned integer which allows for 16.7 million electrons per step. As the electron hole pair production energy is 3eV in silicon this corresponds to an energy loss of around 50GeV so there should be no problem at all.

Definition at line 32 of file VXDElectronDeposit.h.

Member Enumeration Documentation

◆ EBits

enum EBits

Enum storing the bit informations for the packed information.

Enumerator
c_FractionBits 

Number of bits to encode the fraction along the path.

c_ElectronBits 

Number of bits to encode the number of electrons.

c_TotalBits 

Total number of bits needed for the packed structure.

c_MaxFraction 

Maximum integer value allowed for the fraction part.

c_MaxElectrons 

Maximum number of electrons allowed.

Definition at line 35 of file VXDElectronDeposit.h.

35 {
37 c_FractionBits = 10,
39 c_ElectronBits = 22,
43 c_MaxFraction = (1 << c_FractionBits) - 1,
45 c_MaxElectrons = (1 << c_ElectronBits) - 1,
46 };
@ c_TotalBits
Total number of bits needed for the packed structure.
@ c_MaxFraction
Maximum integer value allowed for the fraction part.
@ c_ElectronBits
Number of bits to encode the number of electrons.
@ c_FractionBits
Number of bits to encode the fraction along the path.
@ c_MaxElectrons
Maximum number of electrons allowed.

Constructor & Destructor Documentation

◆ VXDElectronDeposit() [1/2]

VXDElectronDeposit ( unsigned int  packed)
inlineexplicit

Create a new instance from a packed value.

Parameters
packedvalue to be interpreted as packed fraction/electrons

Definition at line 50 of file VXDElectronDeposit.h.

50: m_packed(packed) {}
unsigned int m_packed
packed representation of the fraction and electron deposition

◆ VXDElectronDeposit() [2/2]

VXDElectronDeposit ( float  fraction,
float  electrons 
)
inline

create a new instance from a fraction along the path and a number of electrons.

Parameters
fractionfraction along the path, should be 0<=x<=1
electronsnumber of electrons deposited

Definition at line 57 of file VXDElectronDeposit.h.

58 {
59 const unsigned int intfrac = std::round(std::max(0.f, fraction) * static_cast<float>(c_MaxFraction));
60 const unsigned int intelec = std::round(std::max(0.f, electrons));
61 m_packed = std::min(intfrac, static_cast<unsigned int>(c_MaxFraction))
62 + (std::min(intelec, static_cast<unsigned int>(c_MaxElectrons)) << c_FractionBits);
63 }

Member Function Documentation

◆ getElectrons()

unsigned int getElectrons ( ) const
inline

get the number of deposited electrons

Definition at line 70 of file VXDElectronDeposit.h.

71 {
73 }

◆ getFraction()

float getFraction ( ) const
inline

get the fraction along the path

Definition at line 65 of file VXDElectronDeposit.h.

66 {
67 return (m_packed & c_MaxFraction) * 1.0 / static_cast<float>(c_MaxFraction);
68 }

◆ getPacked()

unsigned int getPacked ( ) const
inline

get the packed value

Definition at line 75 of file VXDElectronDeposit.h.

75{ return m_packed; }

◆ operator unsigned int()

operator unsigned int ( ) const
inline

convert to unsigned int using the packed representation

Definition at line 77 of file VXDElectronDeposit.h.

77{ return m_packed; }

Member Data Documentation

◆ m_packed

unsigned int m_packed
private

packed representation of the fraction and electron deposition

Definition at line 80 of file VXDElectronDeposit.h.


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