Belle II Software development
PXDClusterPositionEstimator Class Reference

Singleton class that estimates cluster positions taking into account the estimated track incidence angles into the sensor. More...

#include <PXDClusterPositionEstimator.h>

Public Member Functions

void initialize ()
 Initialize PXDClusterPositionEstimator from DB.
 
void setShapeIndexFromDB ()
 Set ShapeIndex from DB.
 
void setPositionEstimatorFromDB ()
 Set PositionEstimator from DB.
 
const PXDClusterPositionEstimatorPargetPositionEstimatorParameters () const
 Return cluster position estimator parameters from Database.
 
const PXDClusterShapeIndexPargetShapeIndexParameters () const
 Return shape index parameters from Database.
 
const PXDClusterOffsetPargetClusterOffset (const PXDCluster &cluster, double tu, double tv) const
 Return pointer to cluster offsets, can be nullptr.
 
float getShapeLikelyhood (const PXDCluster &cluster, double tu, double tv) const
 Return cluster shape likelihood.
 
float computeEta (const std::set< Pixel > &pixels, int vStart, int vSize, double thetaU, double thetaV) const
 Return the normed charge ratio between head and tail pixels (size>=2) or the charge of the seed (size=1) .
 
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.
 
const std::string getShortName (const std::set< Pixel > &pixels, int uStart, int vStart, int vSize, double thetaU, double thetaV) const
 Return the name for the pixel set.
 
const std::string getMirroredShortName (const std::set< Pixel > &pixels, int uStart, int vStart, int vSize, double thetaU, double thetaV) const
 Return the mirrored name for the pixel set.
 
const std::string getFullName (const std::set< Pixel > &pixels, int uStart, int vStart) const
 Return a name for the pixel set.
 
int getClusterkind (const PXDCluster &cluster) const
 Return kind of cluster needed to find cluster position correction.
 
int getClusterkind (const std::vector< Belle2::PXD::Pixel > &pixels, const Belle2::VxdID &sensorID) const
 Return kind of cluster needed to find cluster position correction.
 
int getSectorIndex (double thetaU, double thetaV) const
 Get sector index from angles.
 

Static Public Member Functions

static PXDClusterPositionEstimatorgetInstance ()
 Main (and only) way to access the PXDClusterPositionEstimator.
 

Private Member Functions

const PixelgetHeadPixel (const std::set< Pixel > &pixels, int vStart, int vSize, double thetaU, double thetaV) const
 Return reference to the head pixel in pixel set.
 
const PixelgetTailPixel (const std::set< Pixel > &pixels, int vStart, int vSize, double thetaU, double thetaV) const
 Return reference to the tail pixel in pixel set.
 
const PixelgetLastPixelWithVOffset (const std::set< Pixel > &pixels, int vStart, int vOffset) const
 Return reference to the last pixel in pixel set with given vOffset from vStart.
 
const PixelgetFirstPixelWithVOffset (const std::set< Pixel > &pixels, int vStart, int vOffset) const
 Return reference to the first pixel in pixel set with given vOffset from vStart.
 
 PXDClusterPositionEstimator ()
 Singleton class, hidden constructor.
 
 PXDClusterPositionEstimator (const PXDClusterPositionEstimator &)=delete
 Singleton class, forbidden copy constructor.
 
PXDClusterPositionEstimatoroperator= (const PXDClusterPositionEstimator &)=delete
 Singleton class, forbidden assignment operator.
 

Private Attributes

std::unique_ptr< DBObjPtr< PXDClusterShapeIndexPar > > m_shapeIndexFromDB
 PXDClusterShapeIndex retrieved from DB.
 
std::unique_ptr< DBObjPtr< PXDClusterPositionEstimatorPar > > m_positionEstimatorFromDB
 PXDClusterPositionEstimatorPar retrieved from DB.
 
PXDClusterShapeIndexPar m_shapeIndexPar
 Current valid PXDClusterShapeIndex.
 
PXDClusterPositionEstimatorPar m_positionEstimatorPar
 Current valid PXDClusterPositionEstimatorPar.
 

Detailed Description

Singleton class that estimates cluster positions taking into account the estimated track incidence angles into the sensor.

The class also provides an interface to get the likelihood that a given cluster was created by a charged track with given incidence angles.

Definition at line 34 of file PXDClusterPositionEstimator.h.

Constructor & Destructor Documentation

◆ PXDClusterPositionEstimator()

PXDClusterPositionEstimator ( )
inlineprivate

Singleton class, hidden constructor.

Definition at line 104 of file PXDClusterPositionEstimator.h.

104{};

Member Function Documentation

◆ computeEta()

float computeEta ( const std::set< Pixel > & pixels,
int vStart,
int vSize,
double thetaU,
double thetaV ) const

Return the normed charge ratio between head and tail pixels (size>=2) or the charge of the seed (size=1) .

Definition at line 85 of file PXDClusterPositionEstimator.cc.

87{
88 const Belle2::PXD::Pixel& headPixel = getHeadPixel(pixels, vStart, vSize, thetaU, thetaV);
89 const Belle2::PXD::Pixel& tailPixel = getTailPixel(pixels, vStart, vSize, thetaU, thetaV);
90 float eta = 0;
91 if (headPixel.getIndex() != tailPixel.getIndex()) {
92 eta = tailPixel.getCharge();
93 eta /= (tailPixel.getCharge() + headPixel.getCharge());
94 } else {
95 eta = tailPixel.getCharge();
96 }
97 return eta;
98}
unsigned int getIndex() const
Return the Index of the digit.
Definition Pixel.h:74
float getCharge() const
Return the Charge of the Pixel.
Definition Pixel.h:72

◆ computeShapeIndex()

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.

Definition at line 191 of file PXDClusterPositionEstimator.cc.

194{
195 // Compute shape name
196 auto shape_name = getShortName(pixels, uStart, vStart, vSize, thetaU, thetaV);
197 // Return shape index
198 return m_shapeIndexPar.getShapeIndex(shape_name);
199}

◆ getClusterkind() [1/2]

int getClusterkind ( const PXDCluster & cluster) const

Return kind of cluster needed to find cluster position correction.

Definition at line 229 of file PXDClusterPositionEstimator.cc.

230{
231 std::set<int> pixelkinds;
232 bool uEdge = false;
233 bool vEdge = false;
234
235 Belle2::VxdID sensorID = cluster.getSensorID();
236 const Belle2::PXD::SensorInfo& Info = dynamic_cast<const Belle2::PXD::SensorInfo&>
238
239 for (const Belle2::PXDDigit& digit : cluster.getRelationsTo<Belle2::PXDDigit>("PXDDigits")) {
240 int pixelkind = Info.getPixelKindNew(sensorID, digit.getVCellID());
241 pixelkinds.insert(pixelkind);
242
243 // Cluster at v sensor edge
244 if (digit.getVCellID() == 0 or digit.getVCellID() >= 767)
245 vEdge = true;
246 // Cluster at u sensor edge
247 if (digit.getUCellID() == 0 or digit.getUCellID() >= 249)
248 uEdge = true;
249 }
250
251 // In most cases, clusterkind is just pixelkind of first digit
252 int clusterkind = *pixelkinds.begin();
253
254 // Clusters with different pixelkinds or edge digits are special
255 // TODO: At the moment, clusterkind >3 will not be corrected
256 if (pixelkinds.size() > 1 || uEdge || vEdge)
257 clusterkind = 4;
258
259 return clusterkind;
260}
int getPixelKindNew(const VxdID &sensorID, int vID) const
Return pixel kind ID.
Definition SensorInfo.cc:78
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference 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

◆ getClusterkind() [2/2]

int getClusterkind ( const std::vector< Belle2::PXD::Pixel > & pixels,
const Belle2::VxdID & sensorID ) const

Return kind of cluster needed to find cluster position correction.

Definition at line 262 of file PXDClusterPositionEstimator.cc.

264{
265 std::set<int> pixelkinds;
266 bool uEdge = false;
267 bool vEdge = false;
268
269 const Belle2::PXD::SensorInfo& Info = dynamic_cast<const Belle2::PXD::SensorInfo&>
271
272 for (const Belle2::PXD::Pixel& pix : pixels) {
273 int pixelkind = Info.getPixelKindNew(sensorID, pix.getV());
274 pixelkinds.insert(pixelkind);
275
276 // Cluster at v sensor edge
277 if (pix.getV() == 0 or pix.getV() >= 767)
278 vEdge = true;
279 // Cluster at u sensor edge
280 if (pix.getU() == 0 or pix.getU() >= 249)
281 uEdge = true;
282 }
283
284 // In most cases, clusterkind is just pixelkind of first digit
285 int clusterkind = *pixelkinds.begin();
286
287 // Clusters with different pixelkinds or edge digits are special
288 // TODO: At the moment, clusterkind >3 will not be corrected
289 if (pixelkinds.size() > 1 || uEdge || vEdge)
290 clusterkind = 4;
291
292 return clusterkind;
293}

◆ getClusterOffset()

const Belle2::PXDClusterOffsetPar * getClusterOffset ( const PXDCluster & cluster,
double tu,
double tv ) const

Return pointer to cluster offsets, can be nullptr.

Definition at line 59 of file PXDClusterPositionEstimator.cc.

62{
63 double thetaU = TMath::ATan2(tu, 1.0) * 180.0 / M_PI;
64 double thetaV = TMath::ATan2(tv, 1.0) * 180.0 / M_PI;
65 int sector_index = getSectorIndex(thetaU, thetaV);
66
67 int clusterkind = cluster.getKind();
68 int shape_index = cluster.getSectorShapeIndices().at(sector_index);
69 float eta = cluster.getSectorEtaValues().at(sector_index);
70 return m_positionEstimatorPar.getOffset(shape_index, eta, thetaU, thetaV, clusterkind);
71}

◆ getFirstPixelWithVOffset()

const Belle2::PXD::Pixel & getFirstPixelWithVOffset ( const std::set< Pixel > & pixels,
int vStart,
int vOffset ) const
private

Return reference to the first pixel in pixel set with given vOffset from vStart.

Definition at line 159 of file PXDClusterPositionEstimator.cc.

162{
163 for (const Belle2::PXD::Pixel& px : pixels) {
164 int v = px.getV() - vStart;
165 if (vOffset == v) {
166 return px;
167 }
168 }
169 if (pixels.empty())
170 B2FATAL("Found cluster with empty pixel set. ");
171
172 return *pixels.cbegin();
173}

◆ getFullName()

const std::string getFullName ( const std::set< Pixel > & pixels,
int uStart,
int vStart ) const

Return a name for the pixel set.

Definition at line 220 of file PXDClusterPositionEstimator.cc.

222{
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);
226 });
227}

◆ getHeadPixel()

const Belle2::PXD::Pixel & getHeadPixel ( const std::set< Pixel > & pixels,
int vStart,
int vSize,
double thetaU,
double thetaV ) const
private

Return reference to the head pixel in pixel set.

Definition at line 100 of file PXDClusterPositionEstimator.cc.

103{
104 if (thetaV >= 0) {
105 if (thetaU >= 0) {
106 return getLastPixelWithVOffset(pixels, vStart, vSize - 1);
107 } else {
108 return getFirstPixelWithVOffset(pixels, vStart, vSize - 1);
109 }
110 } else {
111 if (thetaU >= 0) {
112 return getLastPixelWithVOffset(pixels, vStart, 0);
113 } else {
114 return getFirstPixelWithVOffset(pixels, vStart, 0);
115 }
116 }
117}

◆ getInstance()

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

Main (and only) way to access the PXDClusterPositionEstimator.

Definition at line 52 of file PXDClusterPositionEstimator.cc.

53{
54 static std::unique_ptr<Belle2::PXD::PXDClusterPositionEstimator> instance(new Belle2::PXD::PXDClusterPositionEstimator());
55 return *instance;
56}

◆ getLastPixelWithVOffset()

const Belle2::PXD::Pixel & getLastPixelWithVOffset ( const std::set< Pixel > & pixels,
int vStart,
int vOffset ) const
private

Return reference to the last pixel in pixel set with given vOffset from vStart.

Definition at line 138 of file PXDClusterPositionEstimator.cc.

141{
142 for (auto pxit = pixels.cbegin(); pxit != pixels.cend(); ++pxit) {
143 int v = pxit->getV() - vStart;
144 if (vOffset < v) {
145 if (pxit == pixels.cbegin()) {
146 } else {
147 pxit--;
148 return *pxit;
149 }
150 }
151 }
152 if (pixels.empty())
153 B2FATAL("Found cluster with empty pixel set. ");
154
155 auto pxit = --pixels.cend();
156 return *pxit;
157}

◆ getMirroredShortName()

const std::string getMirroredShortName ( const std::set< Pixel > & pixels,
int uStart,
int vStart,
int vSize,
double thetaU,
double thetaV ) const

Return the mirrored name for the pixel set.

Definition at line 202 of file PXDClusterPositionEstimator.cc.

206{
207 const Belle2::PXD::Pixel& headPixel = getHeadPixel(pixels, vStart, vSize, thetaU, thetaV);
208 const Belle2::PXD::Pixel& tailPixel = getTailPixel(pixels, vStart, vSize, thetaU, thetaV);
209 int vmax = vSize - 1;
210
211 std::string name = "S";
212 name += "D" + std::to_string(vmax - tailPixel.getV() + vStart) + '.' + std::to_string(tailPixel.getU() - uStart);
213
214 if (headPixel.getIndex() != tailPixel.getIndex()) {
215 name += "D" + std::to_string(vmax - headPixel.getV() + vStart) + '.' + std::to_string(headPixel.getU() - uStart);
216 }
217 return name;
218}
unsigned short getU() const
Return the CellID in u.
Definition Pixel.h:68
unsigned short getV() const
Return the CellID in v.
Definition Pixel.h:70

◆ getPositionEstimatorParameters()

const PXDClusterPositionEstimatorPar & getPositionEstimatorParameters ( ) const
inline

Return cluster position estimator parameters from Database.

Definition at line 48 of file PXDClusterPositionEstimator.h.

48{return m_positionEstimatorPar;}

◆ getSectorIndex()

int getSectorIndex ( double thetaU,
double thetaV ) const

Get sector index from angles.

Sectors in thetaU and thetaV are numbered ++, -+, –, +-.

Definition at line 295 of file PXDClusterPositionEstimator.cc.

296{
297 int sectorIndex = 0;
298 if (thetaU >= 0) {
299 if (thetaV >= 0) {
300 sectorIndex = 0;
301 } else {
302 sectorIndex = 3;
303 }
304 } else {
305 if (thetaV >= 0) {
306 sectorIndex = 1;
307 } else {
308 sectorIndex = 2;
309 }
310 }
311 return sectorIndex;
312}

◆ getShapeIndexParameters()

const PXDClusterShapeIndexPar & getShapeIndexParameters ( ) const
inline

Return shape index parameters from Database.

Definition at line 51 of file PXDClusterPositionEstimator.h.

51{return m_shapeIndexPar;}

◆ getShapeLikelyhood()

float getShapeLikelyhood ( const PXDCluster & cluster,
double tu,
double tv ) const

Return cluster shape likelihood.

Definition at line 74 of file PXDClusterPositionEstimator.cc.

75{
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();
79 int sector_index = getSectorIndex(thetaU, thetaV);
80 int shape_index = cluster.getSectorShapeIndices().at(sector_index);
81 return m_positionEstimatorPar.getShapeLikelyhood(shape_index, thetaU, thetaV, clusterkind);
82}

◆ getShortName()

const std::string getShortName ( const std::set< Pixel > & pixels,
int uStart,
int vStart,
int vSize,
double thetaU,
double thetaV ) const

Return the name for the pixel set.

Definition at line 175 of file PXDClusterPositionEstimator.cc.

178{
179 const Belle2::PXD::Pixel& headPixel = getHeadPixel(pixels, vStart, vSize, thetaU, thetaV);
180 const Belle2::PXD::Pixel& tailPixel = getTailPixel(pixels, vStart, vSize, thetaU, thetaV);
181 std::string name = "S";
182
183 name += "D" + std::to_string(tailPixel.getV() - vStart) + '.' + std::to_string(tailPixel.getU() - uStart);
184
185 if (headPixel.getIndex() != tailPixel.getIndex()) {
186 name += "D" + std::to_string(headPixel.getV() - vStart) + '.' + std::to_string(headPixel.getU() - uStart);
187 }
188 return name;
189}

◆ getTailPixel()

const Belle2::PXD::Pixel & getTailPixel ( const std::set< Pixel > & pixels,
int vStart,
int vSize,
double thetaU,
double thetaV ) const
private

Return reference to the tail pixel in pixel set.

Definition at line 119 of file PXDClusterPositionEstimator.cc.

122{
123 if (thetaV >= 0) {
124 if (thetaU >= 0) {
125 return getFirstPixelWithVOffset(pixels, vStart, 0);
126 } else {
127 return getLastPixelWithVOffset(pixels, vStart, 0);
128 }
129 } else {
130 if (thetaU >= 0) {
131 return getFirstPixelWithVOffset(pixels, vStart, vSize - 1);
132 } else {
133 return getLastPixelWithVOffset(pixels, vStart, vSize - 1);
134 }
135 }
136}

◆ initialize()

void initialize ( )

Initialize PXDClusterPositionEstimator from DB.

Definition at line 26 of file PXDClusterPositionEstimator.cc.

27{
28 m_shapeIndexFromDB = unique_ptr<Belle2::DBObjPtr<Belle2::PXDClusterShapeIndexPar>>(new
29 Belle2::DBObjPtr<Belle2::PXDClusterShapeIndexPar>());
30 m_positionEstimatorFromDB = unique_ptr<Belle2::DBObjPtr<Belle2::PXDClusterPositionEstimatorPar>>
31 (new Belle2::DBObjPtr<Belle2::PXDClusterPositionEstimatorPar>());
32
33 if ((*m_shapeIndexFromDB).isValid() && (*m_positionEstimatorFromDB).isValid()) {
34 setShapeIndexFromDB();
35 (*m_shapeIndexFromDB).addCallback(this, &Belle2::PXD::PXDClusterPositionEstimator::setShapeIndexFromDB);
36
37 setPositionEstimatorFromDB();
38 (*m_positionEstimatorFromDB).addCallback(this, &Belle2::PXD::PXDClusterPositionEstimator::setPositionEstimatorFromDB);
39 }
40}
void setPositionEstimatorFromDB()
Set PositionEstimator from DB.

◆ setPositionEstimatorFromDB()

void setPositionEstimatorFromDB ( )

Set PositionEstimator from DB.

Definition at line 47 of file PXDClusterPositionEstimator.cc.

48{
49 m_positionEstimatorPar = **m_positionEstimatorFromDB;
50}

◆ setShapeIndexFromDB()

void setShapeIndexFromDB ( )

Set ShapeIndex from DB.

Definition at line 42 of file PXDClusterPositionEstimator.cc.

43{
44 m_shapeIndexPar = **m_shapeIndexFromDB;
45}

Member Data Documentation

◆ m_positionEstimatorFromDB

std::unique_ptr<DBObjPtr<PXDClusterPositionEstimatorPar> > m_positionEstimatorFromDB
private

PXDClusterPositionEstimatorPar retrieved from DB.

Definition at line 113 of file PXDClusterPositionEstimator.h.

◆ m_positionEstimatorPar

PXDClusterPositionEstimatorPar m_positionEstimatorPar
private

Current valid PXDClusterPositionEstimatorPar.

Definition at line 118 of file PXDClusterPositionEstimator.h.

◆ m_shapeIndexFromDB

std::unique_ptr<DBObjPtr<PXDClusterShapeIndexPar> > m_shapeIndexFromDB
private

PXDClusterShapeIndex retrieved from DB.

Definition at line 111 of file PXDClusterPositionEstimator.h.

◆ m_shapeIndexPar

PXDClusterShapeIndexPar m_shapeIndexPar
private

Current valid PXDClusterShapeIndex.

Definition at line 116 of file PXDClusterPositionEstimator.h.


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