Belle II Software development
PXDPixelMasker.cc
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
10#include <pxd/reconstruction/PXDPixelMasker.h>
11#include <vxd/geometry/GeoCache.h>
12
13
14using namespace std;
15
16
18{
19 m_maskedPixelsFromDB = unique_ptr<Belle2::DBObjPtr<Belle2::PXDMaskedPixelPar>>(new Belle2::DBObjPtr<Belle2::PXDMaskedPixelPar>());
20
21 if ((*m_maskedPixelsFromDB).isValid()) {
23 (*m_maskedPixelsFromDB).addCallback(this, &Belle2::PXD::PXDPixelMasker::setMaskedPixels);
24 }
25
26 m_deadPixelsFromDB = unique_ptr<Belle2::DBObjPtr<Belle2::PXDDeadPixelPar>>(new Belle2::DBObjPtr<Belle2::PXDDeadPixelPar>());
27
28 if ((*m_deadPixelsFromDB).isValid()) {
30 (*m_deadPixelsFromDB).addCallback(this, &Belle2::PXD::PXDPixelMasker::setDeadPixels);
31 }
32}
33
34
36{
37 static std::unique_ptr<Belle2::PXD::PXDPixelMasker> instance(new Belle2::PXD::PXDPixelMasker());
38 return *instance;
39}
40
41
42void Belle2::PXD::PXDPixelMasker::maskSinglePixel(Belle2::VxdID id, unsigned int uid, unsigned int vid)
43{
45 m_maskedPixels.maskSinglePixel(id.getID(), uid * vCells + vid);
46}
47
48
49
50bool Belle2::PXD::PXDPixelMasker::pixelOK(Belle2::VxdID id, unsigned int uid, unsigned int vid) const
51{
53 return m_maskedPixels.pixelOK(id.getID(), uid * vCells + vid);
54}
55
56bool Belle2::PXD::PXDPixelMasker::pixelDead(Belle2::VxdID id, unsigned int uid, unsigned int vid) const
57{
58 auto sensorID = id.getID();
59 if (m_deadPixels.isDeadSensor(sensorID))
60 return true;
61
62 if (m_deadPixels.isDeadRow(sensorID, vid))
63 return true;
64
65 if (m_deadPixels.isDeadDrain(sensorID, uid * 4 + vid % 4))
66 return true;
67
69 if (m_deadPixels.isDeadSinglePixel(sensorID, uid * vCells + vid))
70 return true;
71
72 return false;
73}
74
75
77{
78 m_maskedPixels = **m_maskedPixelsFromDB;
79}
80
82{
83 m_deadPixels = **m_deadPixelsFromDB;
84}
85
86
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Singleton class for managing pixel masking for the PXD.
std::unique_ptr< DBObjPtr< PXDDeadPixelPar > > m_deadPixelsFromDB
Dead pixels retrieved from DB.
bool pixelDead(VxdID id, unsigned int uid, unsigned int vid) const
Check whether a pixel on a given sensor is dead or not.
void initialize()
Initialize the PXDPixelMasker.
bool pixelOK(VxdID id, unsigned int uid, unsigned int vid) const
Check whether a pixel on a given sensor is OK or not.
void maskSinglePixel(VxdID id, unsigned int uid, unsigned int vid)
Mask single pixel.
void setMaskedPixels()
Set masked pixels from DB.
void setDeadPixels()
Set dead pixels from DB.
static PXDPixelMasker & getInstance()
Main (and only) way to access the PXDPixelMasker.
std::unique_ptr< DBObjPtr< PXDMaskedPixelPar > > m_maskedPixelsFromDB
Masked pixels retrieved from DB.
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 getVCells() const
Return number of pixel/strips in v direction.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Definition: calibTools.h:60
STL namespace.