11 #include <framework/logging/Logger.h>
12 #include <pxd/reconstruction/PXDClusterPositionEstimator.h>
13 #include <vxd/dataobjects/VxdID.h>
14 #include <pxd/geometry/SensorInfo.h>
15 #include <vxd/geometry/GeoCache.h>
27 m_shapeIndexFromDB = unique_ptr<Belle2::DBObjPtr<Belle2::PXDClusterShapeIndexPar>>(
new
29 m_positionEstimatorFromDB = unique_ptr<Belle2::DBObjPtr<Belle2::PXDClusterPositionEstimatorPar>>
32 if ((*m_shapeIndexFromDB).isValid() && (*m_positionEstimatorFromDB).isValid()) {
33 setShapeIndexFromDB();
36 setPositionEstimatorFromDB();
43 m_shapeIndexPar = **m_shapeIndexFromDB;
48 m_positionEstimatorPar = **m_positionEstimatorFromDB;
62 double thetaU = TMath::ATan2(tu, 1.0) * 180.0 / M_PI;
63 double thetaV = TMath::ATan2(tv, 1.0) * 180.0 / M_PI;
64 int sector_index = getSectorIndex(thetaU, thetaV);
66 int clusterkind = cluster.getKind();
67 int shape_index = cluster.getSectorShapeIndices().at(sector_index);
68 float eta = cluster.getSectorEtaValues().at(sector_index);
69 return m_positionEstimatorPar.getOffset(shape_index, eta, thetaU, thetaV, clusterkind);
75 double thetaU = TMath::ATan2(tu, 1.0) * 180.0 / M_PI;
76 double thetaV = TMath::ATan2(tv, 1.0) * 180.0 / M_PI;
77 int clusterkind = cluster.getKind();
78 int sector_index = getSectorIndex(thetaU, thetaV);
79 int shape_index = cluster.getSectorShapeIndices().at(sector_index);
80 return m_positionEstimatorPar.getShapeLikelyhood(shape_index, thetaU, thetaV, clusterkind);
85 double thetaU,
double thetaV)
const
87 const Belle2::PXD::Pixel& headPixel = getHeadPixel(pixels, vStart, vSize, thetaU, thetaV);
88 const Belle2::PXD::Pixel& tailPixel = getTailPixel(pixels, vStart, vSize, thetaU, thetaV);
100 int vStart,
int vSize,
double thetaU,
105 return getLastPixelWithVOffset(pixels, vStart, vSize - 1);
107 return getFirstPixelWithVOffset(pixels, vStart, vSize - 1);
111 return getLastPixelWithVOffset(pixels, vStart, 0);
113 return getFirstPixelWithVOffset(pixels, vStart, 0);
119 int vStart,
int vSize,
double thetaU,
124 return getFirstPixelWithVOffset(pixels, vStart, 0);
126 return getLastPixelWithVOffset(pixels, vStart, 0);
130 return getFirstPixelWithVOffset(pixels, vStart, vSize - 1);
132 return getLastPixelWithVOffset(pixels, vStart, vSize - 1);
139 int vStart,
int vOffset)
const
141 for (
auto pxit = pixels.cbegin(); pxit != pixels.cend(); ++pxit) {
142 int v = pxit->getV() - vStart;
144 if (pxit == pixels.cbegin()) {
152 B2FATAL(
"Found cluster with empty pixel set. ");
154 auto pxit = --pixels.cend();
159 const std::set<Belle2::PXD::Pixel>& pixels,
160 int vStart,
int vOffset)
const
163 int v = px.getV() - vStart;
169 B2FATAL(
"Found cluster with empty pixel set. ");
171 return *pixels.cbegin();
175 int vStart,
int vSize,
double thetaU,
178 const Belle2::PXD::Pixel& headPixel = getHeadPixel(pixels, vStart, vSize, thetaU, thetaV);
179 const Belle2::PXD::Pixel& tailPixel = getTailPixel(pixels, vStart, vSize, thetaU, thetaV);
180 std::string name =
"S";
182 name +=
"D" + std::to_string(tailPixel.
getV() - vStart) +
'.' + std::to_string(tailPixel.
getU() - uStart);
185 name +=
"D" + std::to_string(headPixel.
getV() - vStart) +
'.' + std::to_string(headPixel.
getU() - uStart);
191 int vSize,
double thetaU,
195 auto shape_name = getShortName(pixels, uStart, vStart, vSize, thetaU, thetaV);
197 return m_shapeIndexPar.getShapeIndex(shape_name);
203 int vStart,
int vSize,
double thetaU,
206 const Belle2::PXD::Pixel& headPixel = getHeadPixel(pixels, vStart, vSize, thetaU, thetaV);
207 const Belle2::PXD::Pixel& tailPixel = getTailPixel(pixels, vStart, vSize, thetaU, thetaV);
208 int vmax = vSize - 1;
210 std::string name =
"S";
211 name +=
"D" + std::to_string(vmax - tailPixel.
getV() + vStart) +
'.' + std::to_string(tailPixel.
getU() - uStart);
214 name +=
"D" + std::to_string(vmax - headPixel.
getV() + vStart) +
'.' + std::to_string(headPixel.
getU() - uStart);
222 return std::accumulate(pixels.begin(), pixels.end(), std::string(
"F"),
223 [uStart, vStart](
auto name,
auto px) {
224 return name +
"D" + std::to_string(px.getV() - vStart) +
"." + std::to_string(px.getU() - uStart);
230 std::set<int> pixelkinds;
239 pixelkinds.insert(pixelkind);
242 if (digit.getVCellID() == 0 or digit.getVCellID() >= 767)
245 if (digit.getUCellID() == 0 or digit.getUCellID() >= 249)
250 int clusterkind = *pixelkinds.begin();
254 if (pixelkinds.size() > 1 || uEdge || vEdge)
263 std::set<int> pixelkinds;
271 pixelkinds.insert(pixelkind);
274 if (pix.getV() == 0 or pix.getV() >= 767)
277 if (pix.getU() == 0 or pix.getU() >= 249)
282 int clusterkind = *pixelkinds.begin();
286 if (pixelkinds.size() > 1 || uEdge || vEdge)