Belle II Software prerelease-11-00-00d
PXDClusterPositionEstimatorPar Class Reference

The class for PXD cluster position lookup table payload. More...

#include <PXDClusterPositionEstimatorPar.h>

Inheritance diagram for PXDClusterPositionEstimatorPar:
Collaboration diagram for PXDClusterPositionEstimatorPar:

Public Member Functions

 PXDClusterPositionEstimatorPar ()
 Default constructor.
 
 ~PXDClusterPositionEstimatorPar ()
 Destructor.
 
void addGrid (int clusterkind, const TH2F &grid)
 Add grid for clusterkind.
 
const std::map< int, TH2F > & getGridMap () const
 Return grid map.
 
void setShapeClassifier (const PXDClusterShapeClassifierPar &classifier, int uBin, int vBin, int clusterkind)
 Set shape classifier.
 
const PXDClusterShapeClassifierPar & getShapeClassifier (int uBin, int vBin, int clusterkind) const
 Returns shape classifier.
 
const PXDClusterShapeClassifierPar & getShapeClassifier (double thetaU, double thetaV, int clusterkind) const
 Returns shape classifier for incidence angles and clusterkind.
 
bool hasClassifier (double thetaU, double thetaV, int clusterkind) const
 Returns True if there is a classifier available.
 
const PXDClusterOffsetPar * getOffset (int shape_index, float eta, double thetaU, double thetaV, int clusterkind) const
 Returns correction (offset) for cluster shape relative to center of pixel (startU/startV) if available, otherwise returns nullptr.
 
float getShapeLikelyhood (int shape_index, double thetaU, double thetaV, int clusterkind) const
 Returns shape likelihood.
 

Private Member Functions

 ClassDef (PXDClusterPositionEstimatorPar, 2)
 ClassDef, must be the last term before the closing {}.
 

Private Attributes

std::map< int, TH2F > m_gridmap
 Map of angular grids for different clusterkinds.
 
std::map< int, std::vector< PXDClusterShapeClassifierPar > > m_shapeClassifiers
 Map of cluster shape classifiers for different clusterkinds.
 

Detailed Description

The class for PXD cluster position lookup table payload.

Definition at line 27 of file PXDClusterPositionEstimatorPar.h.

Constructor & Destructor Documentation

◆ PXDClusterPositionEstimatorPar()

Default constructor.

Definition at line 30 of file PXDClusterPositionEstimatorPar.h.

30{}

◆ ~PXDClusterPositionEstimatorPar()

Destructor.

Definition at line 33 of file PXDClusterPositionEstimatorPar.h.

33{}

Member Function Documentation

◆ addGrid()

void addGrid ( int clusterkind,
const TH2F & grid )
inline

Add grid for clusterkind.

Definition at line 36 of file PXDClusterPositionEstimatorPar.h.

37 {
38 m_gridmap[clusterkind] = grid;
39 m_shapeClassifiers[clusterkind] = std::vector<PXDClusterShapeClassifierPar>();
40
41 for (auto uBin = 1; uBin <= m_gridmap[clusterkind].GetXaxis()->GetNbins(); uBin++) {
42 for (auto vBin = 1; vBin <= m_gridmap[clusterkind].GetYaxis()->GetNbins(); vBin++) {
43 auto size = m_shapeClassifiers[clusterkind].size();
44 m_gridmap[clusterkind].SetBinContent(uBin, vBin, size);
45 m_shapeClassifiers[clusterkind].push_back(PXDClusterShapeClassifierPar());
46 }
47 }
48 }

◆ getGridMap()

const std::map< int, TH2F > & getGridMap ( ) const
inline

Return grid map.

Definition at line 51 of file PXDClusterPositionEstimatorPar.h.

52 {
53 return m_gridmap;
54 }

◆ getOffset()

const PXDClusterOffsetPar * getOffset ( int shape_index,
float eta,
double thetaU,
double thetaV,
int clusterkind ) const
inline

Returns correction (offset) for cluster shape relative to center of pixel (startU/startV) if available, otherwise returns nullptr.

Definition at line 102 of file PXDClusterPositionEstimatorPar.h.

103 {
104 //Check if there is a classifier
105 if (not hasClassifier(thetaU, thetaV, clusterkind)) {
106 return nullptr;
107 }
108 const PXDClusterShapeClassifierPar& classifier = getShapeClassifier(thetaU, thetaV, clusterkind);
109 return classifier.getOffset(shape_index, eta);
110 }

◆ getShapeClassifier() [1/2]

const PXDClusterShapeClassifierPar & getShapeClassifier ( double thetaU,
double thetaV,
int clusterkind ) const
inline

Returns shape classifier for incidence angles and clusterkind.

Definition at line 72 of file PXDClusterPositionEstimatorPar.h.

73 {
74 auto grid = m_gridmap.at(clusterkind);
75 int uBin = grid.GetXaxis()->FindBin(thetaU);
76 int vBin = grid.GetYaxis()->FindBin(thetaV);
77 int key = grid.GetBinContent(uBin, vBin);
78 return m_shapeClassifiers.at(clusterkind)[key];
79 }

◆ getShapeClassifier() [2/2]

const PXDClusterShapeClassifierPar & getShapeClassifier ( int uBin,
int vBin,
int clusterkind ) const
inline

Returns shape classifier.

Definition at line 64 of file PXDClusterPositionEstimatorPar.h.

65 {
66 int key = m_gridmap.at(clusterkind).GetBinContent(uBin, vBin);
67 const PXDClusterShapeClassifierPar& classifier = m_shapeClassifiers.at(clusterkind)[key];
68 return classifier;
69 }

◆ getShapeLikelyhood()

float getShapeLikelyhood ( int shape_index,
double thetaU,
double thetaV,
int clusterkind ) const
inline

Returns shape likelihood.

Returns zero if shape not known, otherwise positive float

Definition at line 113 of file PXDClusterPositionEstimatorPar.h.

114 {
115 // Return zero if there no classifier
116 if (not hasClassifier(thetaU, thetaV, clusterkind)) {
117 return 0;
118 }
119 auto likelyhoodMap = getShapeClassifier(thetaU, thetaV, clusterkind).getShapeLikelyhoodMap();
120
121 // Return zero if no likelihood was estimated
122 auto it = likelyhoodMap.find(shape_index);
123 if (it == likelyhoodMap.end())
124 return 0;
125
126 return it->second;
127 }

◆ hasClassifier()

bool hasClassifier ( double thetaU,
double thetaV,
int clusterkind ) const
inline

Returns True if there is a classifier available.

Definition at line 82 of file PXDClusterPositionEstimatorPar.h.

83 {
84 //Check clusterkind is valid
85 if (m_gridmap.find(clusterkind) == m_gridmap.end()) {
86 return false;
87 }
88
89 // Check thetaU, thetaV are inside grid
90 auto grid = m_gridmap.at(clusterkind);
91 int uBin = grid.GetXaxis()->FindBin(thetaU);
92 int vBin = grid.GetYaxis()->FindBin(thetaV);
93 int uBins = grid.GetXaxis()->GetNbins();
94 int vBins = grid.GetYaxis()->GetNbins();
95 if ((uBin < 1) || (uBin > uBins) || (vBin < 1) || (vBin > vBins))
96 return false;
97
98 return true;
99 }

◆ setShapeClassifier()

void setShapeClassifier ( const PXDClusterShapeClassifierPar & classifier,
int uBin,
int vBin,
int clusterkind )
inline

Set shape classifier.

Definition at line 57 of file PXDClusterPositionEstimatorPar.h.

58 {
59 int key = m_gridmap[clusterkind].GetBinContent(uBin, vBin);
60 m_shapeClassifiers[clusterkind][key] = classifier;
61 }

Member Data Documentation

◆ m_gridmap

std::map<int, TH2F> m_gridmap
private

Map of angular grids for different clusterkinds.

Definition at line 132 of file PXDClusterPositionEstimatorPar.h.

◆ m_shapeClassifiers

std::map<int, std::vector<PXDClusterShapeClassifierPar> > m_shapeClassifiers
private

Map of cluster shape classifiers for different clusterkinds.

Definition at line 134 of file PXDClusterPositionEstimatorPar.h.


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