Belle II Software development
PXDGainCalibrator Class Reference

Singleton class for managing gain corrections for the PXD. More...

#include <PXDGainCalibrator.h>

Public Member Functions

void initialize ()
 Initialize the PXDGainCalibrator.
 
void setGains ()
 Set gains from DB.
 
float getGainCorrection (VxdID id, unsigned int uid, unsigned int vid) const
 Get gain correction.
 
float getADUToEnergy (VxdID id, unsigned int uid, unsigned int vid) const
 Get conversion factor from ADU to energy.
 
unsigned short getBinU (VxdID id, unsigned int uid, unsigned int vid) const
 Get gain correction bin along sensor u side.
 
unsigned short getBinV (VxdID id, unsigned int vid) const
 Get gain correction bin along sensor v side.
 
unsigned short getBinU (VxdID id, unsigned int uid, unsigned int vid, unsigned short nBinsU) const
 Get gain correction bin along sensor u side.
 
unsigned short getBinV (VxdID id, unsigned int vid, unsigned short nBinsV) const
 Get gain correction bin along v side.
 
unsigned short getGlobalID (VxdID id, unsigned int uid, unsigned int vid) const
 Get global ID for gain correction on a sensor.
 
const PXDGainMapPargetGainMapParameters () const
 Return current gain correction payload.
 

Static Public Member Functions

static PXDGainCalibratorgetInstance ()
 Main (and only) way to access the PXDGainCalibrator.
 

Private Member Functions

 PXDGainCalibrator ()
 Singleton class, hidden constructor.
 
 PXDGainCalibrator (const PXDGainCalibrator &)=delete
 Singleton class, forbidden copy constructor.
 
PXDGainCalibratoroperator= (const PXDGainCalibrator &)=delete
 Singleton class, forbidden assignment operator.
 

Private Attributes

std::unique_ptr< DBObjPtr< PXDGainMapPar > > m_gainsFromDB
 Masked pixels retrieved from DB.
 
PXDGainMapPar m_gains
 Map of gain corrections.
 

Detailed Description

Singleton class for managing gain corrections for the PXD.

Definition at line 26 of file PXDGainCalibrator.h.

Constructor & Destructor Documentation

◆ PXDGainCalibrator()

PXDGainCalibrator ( )
inlineprivate

Singleton class, hidden constructor.

Definition at line 101 of file PXDGainCalibrator.h.

101{};

Member Function Documentation

◆ getADUToEnergy()

float getADUToEnergy ( Belle2::VxdID  id,
unsigned int  uid,
unsigned int  vid 
) const

Get conversion factor from ADU to energy.

Parameters
idunique ID of the sensor
uiduCell of single pixel
vidvCell of single pixel
Returns
ADUToEnergy conversion factor

Definition at line 43 of file PXDGainCalibrator.cc.

44{
45 // FIXME: These constants are hardcoded as intermediate solution.
46 // They should be obtained from GeoCache and ultimately from the condDB.
47 float ADCUnit = 130.0;
48 float Gq = 0.6;
49 return Const::ehEnergy * ADCUnit / Gq / getGainCorrection(id, uid, vid);
50}
static const double ehEnergy
Energy needed to create an electron-hole pair in Si at std.
Definition: Const.h:697
float getGainCorrection(VxdID id, unsigned int uid, unsigned int vid) const
Get gain correction.

◆ getBinU() [1/2]

unsigned short getBinU ( VxdID  id,
unsigned int  uid,
unsigned int  vid 
) const

Get gain correction bin along sensor u side.

Parameters
idunique ID of the sensor
uiduCell of single pixel
vidvCell of single pixel
Returns
uBin correction bin along u side of sensor

Definition at line 60 of file PXDGainCalibrator.cc.

61{
62 return getBinU(id, uid, vid, m_gains.getBinsU());
63}
unsigned short getBinsU() const
Get number of bins along sensor u side.
Definition: PXDGainMapPar.h:52
PXDGainMapPar m_gains
Map of gain corrections.
unsigned short getBinU(VxdID id, unsigned int uid, unsigned int vid) const
Get gain correction bin along sensor u side.

◆ getBinU() [2/2]

unsigned short getBinU ( VxdID  id,
unsigned int  uid,
unsigned int  vid,
unsigned short  nBinsU 
) const

Get gain correction bin along sensor u side.

Parameters
idunique ID of the sensor
uiduCell of single pixel
vidvCell of single pixel
nBinsUnumber of gain bins along u side
Returns
uBin correction bin along u side of sensor

Definition at line 54 of file PXDGainCalibrator.cc.

55{
56 unsigned int drainsPerBin = 4 * Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getUCells() / nBinsU;
57 return (uid * 4 + vid % 4) / drainsPerBin;
58}
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
int getUCells() const
Return number of pixel/strips in u direction.

◆ getBinV() [1/2]

unsigned short getBinV ( VxdID  id,
unsigned int  vid 
) const

Get gain correction bin along sensor v side.

Parameters
idunique ID of the sensor
vidvCell of single pixel
Returns
vBin correction bin along v side of sensor

Definition at line 71 of file PXDGainCalibrator.cc.

72{
73 return getBinV(id, vid, m_gains.getBinsV());
74}
unsigned short getBinsV() const
Get number of bins along sensor v side.
Definition: PXDGainMapPar.h:56
unsigned short getBinV(VxdID id, unsigned int vid) const
Get gain correction bin along sensor v side.

◆ getBinV() [2/2]

unsigned short getBinV ( VxdID  id,
unsigned int  vid,
unsigned short  nBinsV 
) const

Get gain correction bin along v side.

Parameters
idunique ID of the sensor
vidvCell of single pixel
nBinsVnumber of gain bins along v side
Returns
vBin correction bin along v side of sensor

Definition at line 65 of file PXDGainCalibrator.cc.

66{
67 unsigned int rowsPerBin = Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getVCells() / nBinsV;
68 return vid / rowsPerBin;
69}
int getVCells() const
Return number of pixel/strips in v direction.

◆ getGainCorrection()

float getGainCorrection ( Belle2::VxdID  id,
unsigned int  uid,
unsigned int  vid 
) const

Get gain correction.

Parameters
idunique ID of the sensor
uiduCell of single pixel
vidvCell of single pixel
Returns
gain correction

Definition at line 34 of file PXDGainCalibrator.cc.

35{
37 unsigned int drainsPerBin = 4 * Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getUCells() / m_gains.getBinsU();
38 unsigned int uBin = (uid * 4 + vid % 4) / drainsPerBin;
39 unsigned int vBin = vid / rowsPerBin;
40 return m_gains.getContent(id.getID(), uBin, vBin);
41}
float getContent(unsigned short sensorID, unsigned short globalID) const
Get content.
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition: calibTools.h:60

◆ getGainMapParameters()

const PXDGainMapPar & getGainMapParameters ( ) const
inline

Return current gain correction payload.

Definition at line 96 of file PXDGainCalibrator.h.

96{return m_gains;}

◆ getGlobalID()

unsigned short getGlobalID ( VxdID  id,
unsigned int  uid,
unsigned int  vid 
) const

Get global ID for gain correction on a sensor.

Parameters
idunique ID of the sensor
uiduCell of single pixel
vidvCell of single pixel
Returns
globalID Unique ID for gain correction

Definition at line 76 of file PXDGainCalibrator.cc.

77{
78 auto uBin = getBinU(id, uid, vid);
79 auto vBin = getBinV(id, vid);
80 return m_gains.getGlobalID(uBin, vBin);
81}
unsigned short getGlobalID(unsigned short uBin, unsigned short vBin) const
Get global id from uBin and vBin.
Definition: PXDGainMapPar.h:60

◆ getInstance()

Belle2::PXD::PXDGainCalibrator & getInstance ( )
static

Main (and only) way to access the PXDGainCalibrator.

Definition at line 27 of file PXDGainCalibrator.cc.

28{
29 static std::unique_ptr<Belle2::PXD::PXDGainCalibrator> instance(new Belle2::PXD::PXDGainCalibrator());
30 return *instance;
31}
Singleton class for managing gain corrections for the PXD.

◆ initialize()

void initialize ( )

Initialize the PXDGainCalibrator.

Definition at line 16 of file PXDGainCalibrator.cc.

17{
18 m_gainsFromDB = unique_ptr<Belle2::DBObjPtr<Belle2::PXDGainMapPar>>(new Belle2::DBObjPtr<Belle2::PXDGainMapPar>());
19
20 if ((*m_gainsFromDB).isValid()) {
21 setGains();
22 (*m_gainsFromDB).addCallback(this, &Belle2::PXD::PXDGainCalibrator::setGains);
23 }
24}
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
std::unique_ptr< DBObjPtr< PXDGainMapPar > > m_gainsFromDB
Masked pixels retrieved from DB.
void setGains()
Set gains from DB.

◆ setGains()

void setGains ( )

Set gains from DB.

Definition at line 84 of file PXDGainCalibrator.cc.

85{
87}

Member Data Documentation

◆ m_gains

PXDGainMapPar m_gains
private

Map of gain corrections.

Definition at line 111 of file PXDGainCalibrator.h.

◆ m_gainsFromDB

std::unique_ptr<DBObjPtr<PXDGainMapPar> > m_gainsFromDB
private

Masked pixels retrieved from DB.

Definition at line 108 of file PXDGainCalibrator.h.


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