Belle II Software development
CDCTrigger3DFitterModule::HoughVoter Class Reference

Class for the Hough voter. More...

Public Member Functions

void vote (const std::vector< std::vector< double > > &sCand, const std::vector< std::vector< double > > &zCand)
 
std::tuple< double, double, int > findPeak ()
 

Private Member Functions

int digitizeZ0 (double z0)
 
int digitizeCot (double cot)
 
double getZ0CellValue (double iZ0)
 get value at the center of parameter cell
 
double getCotCellValue (double iCot)
 

Private Attributes

const int nCellZ0 = 16
 
const int nCellCot = 16
 
const double minZ0 = -50
 
const double maxZ0 = 78
 
const double minCot = -0.8
 
const double maxCot = 1.5
 
const double cellWidthZ0 = (maxZ0 - minZ0) / nCellZ0
 
const double cellWidthCot = (maxCot - minCot) / nCellCot
 
std::vector< std::vector< int > > votingCell
 

Detailed Description

Class for the Hough voter.

Definition at line 53 of file CDCTrigger3DFitterModule.h.

Constructor & Destructor Documentation

◆ HoughVoter()

Definition at line 238 of file CDCTrigger3DFitterModule.cc.

239{
240 votingCell.resize(nCellZ0, vector<int>(nCellZ0, 0));
241}

Member Function Documentation

◆ digitizeCot()

int digitizeCot ( double cot)
inlineprivate

Definition at line 68 of file CDCTrigger3DFitterModule.h.

68{return floor((cot - minCot) / cellWidthCot);}

◆ digitizeZ0()

int digitizeZ0 ( double z0)
inlineprivate

Definition at line 67 of file CDCTrigger3DFitterModule.h.

67{return floor((maxZ0 - z0) / cellWidthZ0);}

◆ findPeak()

tuple< double, double, int > findPeak ( )

Definition at line 275 of file CDCTrigger3DFitterModule.cc.

276{
277 int maxCount = 0;
278 double z0, cot;
279 for (int iZ0 = 0; iZ0 < nCellZ0; iZ0++) {
280 for (int iCot = nCellCot - 1; iCot >= 0; iCot--) {
281 int count = __builtin_popcount(votingCell[iZ0][iCot]);
282 if (maxCount <= count) {
283 maxCount = count;
284 z0 = getZ0CellValue(iZ0);
285 cot = getCotCellValue(iCot);
286 }
287 }
288 }
289 return make_tuple(z0, cot, maxCount);
290}
double getZ0CellValue(double iZ0)
get value at the center of parameter cell

◆ getCotCellValue()

double getCotCellValue ( double iCot)
inlineprivate

Definition at line 71 of file CDCTrigger3DFitterModule.h.

71{return minCot + (iCot + 0.5) * cellWidthCot;}

◆ getZ0CellValue()

double getZ0CellValue ( double iZ0)
inlineprivate

get value at the center of parameter cell

Definition at line 70 of file CDCTrigger3DFitterModule.h.

70{return maxZ0 - (iZ0 + 0.5) * cellWidthZ0;}

◆ vote()

void vote ( const std::vector< std::vector< double > > & sCand,
const std::vector< std::vector< double > > & zCand )

Definition at line 244 of file CDCTrigger3DFitterModule.cc.

245{
246 // iCot=0(minCot) ... iCot=m(maxCot)
247 // iZ0=0(maxZ0)
248 // ...
249 // iZ0=n(minZ0)
250 for (int iLayer = 0; iLayer < m_nStereoLayer; iLayer++) {
251 for (int iHit = 0; iHit < (int)sCand[iLayer].size(); iHit++) {
252 double s = sCand[iLayer][iHit];
253 double z = zCand[iLayer][iHit];
254
255 for (int iCot = 0; iCot < nCellCot; iCot++) {
256 int iZ0Shift = floor((z - (-cellWidthZ0 / 2)) / cellWidthZ0);
257
258 double cotLower = getCotCellValue(iCot - 0.5);
259 double z0Lower = -s * cotLower;
260 int iZ0Lower = digitizeZ0(z0Lower) - iZ0Shift;
261
262 double cotUpper = getCotCellValue(iCot + 0.5);
263 double z0Upper = -s * cotUpper;
264 int iZ0Upper = digitizeZ0(z0Upper) - iZ0Shift;
265
266 for (int iZ0 = max(iZ0Lower, 0); iZ0 < min(iZ0Upper + 1, nCellZ0); iZ0++) {
267 votingCell[iZ0][iCot] |= (1 << iLayer);
268 }
269 }
270 }
271 }
272}

Member Data Documentation

◆ cellWidthCot

const double cellWidthCot = (maxCot - minCot) / nCellCot
private

Definition at line 62 of file CDCTrigger3DFitterModule.h.

◆ cellWidthZ0

const double cellWidthZ0 = (maxZ0 - minZ0) / nCellZ0
private

Definition at line 61 of file CDCTrigger3DFitterModule.h.

◆ maxCot

const double maxCot = 1.5
private

Definition at line 60 of file CDCTrigger3DFitterModule.h.

◆ maxZ0

const double maxZ0 = 78
private

Definition at line 58 of file CDCTrigger3DFitterModule.h.

◆ minCot

const double minCot = -0.8
private

Definition at line 59 of file CDCTrigger3DFitterModule.h.

◆ minZ0

const double minZ0 = -50
private

Definition at line 57 of file CDCTrigger3DFitterModule.h.

◆ nCellCot

const int nCellCot = 16
private

Definition at line 56 of file CDCTrigger3DFitterModule.h.

◆ nCellZ0

const int nCellZ0 = 16
private

Definition at line 55 of file CDCTrigger3DFitterModule.h.

◆ votingCell

std::vector<std::vector<int> > votingCell
private

Definition at line 65 of file CDCTrigger3DFitterModule.h.


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