9#include <framework/logging/Logger.h>
10#include <pxd/reconstruction/PXDClusterPositionEstimator.h>
11#include <pxd/reconstruction/Pixel.h>
12#include <pxd/dataobjects/PXDCluster.h>
13#include <vxd/dataobjects/VxdID.h>
14#include <pxd/geometry/SensorInfo.h>
15#include <vxd/geometry/GeoCache.h>
33 if ((*m_shapeIndexFromDB).isValid() && (*m_positionEstimatorFromDB).isValid()) {
63 double thetaU = TMath::ATan2(tu, 1.0) * 180.0 / M_PI;
64 double thetaV = TMath::ATan2(tv, 1.0) * 180.0 / M_PI;
67 int clusterkind = cluster.getKind();
68 int shape_index = cluster.getSectorShapeIndices().at(sector_index);
69 float eta = cluster.getSectorEtaValues().at(sector_index);
76 double thetaU = TMath::ATan2(tu, 1.0) * 180.0 / M_PI;
77 double thetaV = TMath::ATan2(tv, 1.0) * 180.0 / M_PI;
78 int clusterkind = cluster.getKind();
80 int shape_index = cluster.getSectorShapeIndices().at(sector_index);
86 double thetaU,
double thetaV)
101 int vStart,
int vSize,
double thetaU,
120 int vStart,
int vSize,
double thetaU,
140 int vStart,
int vOffset)
142 for (
auto pxit = pixels.cbegin(); pxit != pixels.cend(); ++pxit) {
143 int v = pxit->getV() - vStart;
145 if (pxit == pixels.cbegin()) {
153 B2FATAL(
"Found cluster with empty pixel set. ");
155 auto pxit = --pixels.cend();
160 const std::set<Belle2::PXD::Pixel>& pixels,
161 int vStart,
int vOffset)
164 int v = px.getV() - vStart;
170 B2FATAL(
"Found cluster with empty pixel set. ");
172 return *pixels.cbegin();
176 int vStart,
int vSize,
double thetaU,
181 std::string name =
"S";
183 name +=
"D" + std::to_string(tailPixel.
getV() - vStart) +
'.' + std::to_string(tailPixel.
getU() - uStart);
186 name +=
"D" + std::to_string(headPixel.
getV() - vStart) +
'.' + std::to_string(headPixel.
getU() - uStart);
192 int vSize,
double thetaU,
196 auto shape_name =
getShortName(pixels, uStart, vStart, vSize, thetaU, thetaV);
204 int vStart,
int vSize,
double thetaU,
209 int vmax = vSize - 1;
211 std::string name =
"S";
212 name +=
"D" + std::to_string(vmax - tailPixel.
getV() + vStart) +
'.' + std::to_string(tailPixel.
getU() - uStart);
215 name +=
"D" + std::to_string(vmax - headPixel.
getV() + vStart) +
'.' + std::to_string(headPixel.
getU() - uStart);
223 return std::accumulate(pixels.begin(), pixels.end(), std::string(
"F"),
224 [uStart, vStart](
auto name,
auto px) {
225 return name +
"D" + std::to_string(px.getV() - vStart) +
"." + std::to_string(px.getU() - uStart);
231 std::set<int> pixelkinds;
240 int pixelkind = Info.getPixelKindNew(sensorID, digit.getVCellID());
241 pixelkinds.insert(pixelkind);
244 if (digit.getVCellID() == 0 or digit.getVCellID() >= 767)
247 if (digit.getUCellID() == 0 or digit.getUCellID() >= 249)
252 int clusterkind = *pixelkinds.begin();
256 if (pixelkinds.size() > 1 || uEdge || vEdge)
265 std::set<int> pixelkinds;
273 int pixelkind = Info.getPixelKindNew(sensorID, pix.getV());
274 pixelkinds.insert(pixelkind);
277 if (pix.getV() == 0 or pix.getV() >= 767)
280 if (pix.getU() == 0 or pix.getU() >= 249)
285 int clusterkind = *pixelkinds.begin();
289 if (pixelkinds.size() > 1 || uEdge || vEdge)
Class for accessing objects in the database.
The class for PXD cluster position offset payload.
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Singleton class that estimates cluster positions taking into account the estimated track incidence an...
static int getSectorIndex(double thetaU, double thetaV)
Get sector index from angles.
static const Pixel & getHeadPixel(const std::set< Pixel > &pixels, int vStart, int vSize, double thetaU, double thetaV)
Return reference to the head pixel in pixel set.
void initialize()
Initialize PXDClusterPositionEstimator from DB.
PXDClusterPositionEstimatorPar m_positionEstimatorPar
Current valid PXDClusterPositionEstimatorPar.
static PXDClusterPositionEstimator & getInstance()
Main (and only) way to access the PXDClusterPositionEstimator.
const PXDClusterOffsetPar * getClusterOffset(const PXDCluster &cluster, double tu, double tv) const
Return pointer to cluster offsets, can be nullptr.
static const Pixel & getFirstPixelWithVOffset(const std::set< Pixel > &pixels, int vStart, int vOffset)
Return reference to the first pixel in pixel set with given vOffset from vStart.
PXDClusterShapeIndexPar m_shapeIndexPar
Current valid PXDClusterShapeIndex.
float getShapeLikelyhood(const PXDCluster &cluster, double tu, double tv) const
Return cluster shape likelihood.
static const Pixel & getLastPixelWithVOffset(const std::set< Pixel > &pixels, int vStart, int vOffset)
Return reference to the last pixel in pixel set with given vOffset from vStart.
std::unique_ptr< DBObjPtr< PXDClusterPositionEstimatorPar > > m_positionEstimatorFromDB
PXDClusterPositionEstimatorPar retrieved from DB.
static float computeEta(const std::set< Pixel > &pixels, int vStart, int vSize, double thetaU, double thetaV)
Return the normed charge ratio between head and tail pixels (size>=2) or the charge of the seed (size...
int computeShapeIndex(const std::set< Pixel > &pixels, int uStart, int vStart, int vSize, double thetaU, double thetaV) const
Return the shape index of the pixels.
std::unique_ptr< DBObjPtr< PXDClusterShapeIndexPar > > m_shapeIndexFromDB
PXDClusterShapeIndex retrieved from DB.
static const std::string getFullName(const std::set< Pixel > &pixels, int uStart, int vStart)
Return a name for the pixel set.
void setPositionEstimatorFromDB()
Set PositionEstimator from DB.
static const std::string getShortName(const std::set< Pixel > &pixels, int uStart, int vStart, int vSize, double thetaU, double thetaV)
Return the name for the pixel set.
static const std::string getMirroredShortName(const std::set< Pixel > &pixels, int uStart, int vStart, int vSize, double thetaU, double thetaV)
Return the mirrored name for the pixel set.
int getClusterkind(const PXDCluster &cluster) const
Return kind of cluster needed to find cluster position correction.
void setShapeIndexFromDB()
Set ShapeIndex from DB.
static const Pixel & getTailPixel(const std::set< Pixel > &pixels, int vStart, int vSize, double thetaU, double thetaV)
Return reference to the tail pixel in pixel set.
Class to represent one pixel, used in clustering for fast access.
unsigned short getU() const
Return the CellID in u.
unsigned int getIndex() const
Return the Index of the digit.
float getCharge() const
Return the Charge of the Pixel.
unsigned short getV() const
Return the CellID in v.
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Class to uniquely identify a any structure of the PXD and SVD.