9#include <pxd/reconstruction/PXDGainCalibrator.h>
10#include <vxd/geometry/GeoCache.h>
11#include <framework/gearbox/Const.h>
20 if ((*m_gainsFromDB).isValid()) {
38 unsigned int uBin = (uid * 4 + vid % 4) / drainsPerBin;
39 unsigned int vBin = vid / rowsPerBin;
40 return m_gains.getContent(
id.
getID(), uBin, vBin);
47 float ADCUnit = 130.0;
49 return Const::ehEnergy * ADCUnit / Gq / getGainCorrection(
id, uid, vid);
57 return (uid * 4 + vid % 4) / drainsPerBin;
62 return getBinU(
id, uid, vid, m_gains.getBinsU());
68 return vid / rowsPerBin;
73 return getBinV(
id, vid, m_gains.getBinsV());
78 auto uBin =
getBinU(
id, uid, vid);
80 return m_gains.getGlobalID(uBin, vBin);
86 m_gains = **m_gainsFromDB;
static const double ehEnergy
Energy needed to create an electron-hole pair in Si at std.
Class for accessing objects in the database.
Singleton class for managing gain corrections for the PXD.
unsigned short getGlobalID(VxdID id, unsigned int uid, unsigned int vid) const
Get global ID for gain correction on a sensor.
unsigned short getBinV(VxdID id, unsigned int vid) const
Get gain correction bin along sensor v side.
void initialize()
Initialize the PXDGainCalibrator.
float getGainCorrection(VxdID id, unsigned int uid, unsigned int vid) const
Get gain correction.
unsigned short getBinU(VxdID id, unsigned int uid, unsigned int vid) const
Get gain correction bin along sensor u side.
float getADUToEnergy(VxdID id, unsigned int uid, unsigned int vid) const
Get conversion factor from ADU to energy.
std::unique_ptr< DBObjPtr< PXDGainMapPar > > m_gainsFromDB
Masked pixels retrieved from DB.
void setGains()
Set gains from DB.
static PXDGainCalibrator & getInstance()
Main (and only) way to access the PXDGainCalibrator.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
int getVCells() const
Return number of pixel/strips in v direction.
int getUCells() const
Return number of pixel/strips in u direction.
Class to uniquely identify a any structure of the PXD and SVD.
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
unsigned short getBinU(VxdID id, unsigned int uid, unsigned int vid, unsigned short nBinsU)
Function to return a bin number for equal sized binning in U.
unsigned short getBinV(VxdID id, unsigned int vid, unsigned short nBinsV)
Function to return a bin number for equal sized binning in V.