Belle II Software development
TRGCDCHoughPlaneMulti2 Class Reference

A class to represent a Hough parameter plane. More...

#include <HoughPlaneMulti2.h>

Inheritance diagram for TRGCDCHoughPlaneMulti2:
TRGCDCHoughPlane TRGCDCHoughPlaneBase

Public Member Functions

 TRGCDCHoughPlaneMulti2 (const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax, unsigned nLayers)
 Contructor.
 
virtual ~TRGCDCHoughPlaneMulti2 ()
 Destructor.
 
unsigned nLayers (void) const
 returns # of Hough Boolean layers.
 
const std::vector< unsigned > & patternId (unsigned cellId) const
 returns pattern ID which activates specified cell.
 
const std::vector< unsigned > & patternId (unsigned layer, unsigned cellId) const
 returns pattern ID in a layer which activates specified cell.
 
void dump (unsigned layerId) const
 Dumps debug information.
 
void dump (const std::string &message=std::string(""), const std::string &prefix=std::string("")) const override
 Dumps debug information.
 
void clear (void) override
 Clears all entries and regions.
 
void clear (unsigned layerId)
 Clears only specified layer ID.
 
void clearCells (void)
 Clears entires only.
 
void vote (float rx, float ry, int charge, unsigned layerId, int weight=1)
 Voting.
 
void vote (unsigned layerId, unsigned localId, int weight=1)
 Voting.
 
void vote (float rx, float ry, unsigned layerId, int weight=1)
 Voting.
 
unsigned setEntry (unsigned serialId, unsigned layerId, unsigned n)
 Sets entry.
 
void merge (void)
 Merge layers into one.
 
void mergeOuters (void)
 Merge outer layers into one.
 
void preparePatterns (unsigned layerId, unsigned nPatterns)
 allocate memory for patterns.
 
void registerPattern (unsigned layerId, unsigned id)
 registers a pattern..
 
void finalizePatterns (void)
 finalize patterns.
 
virtual void vote (float rx, float ry, int weight=1)
 Voting.
 
virtual void vote (float rx, float ry, int charge, int weight=1)
 Voting.
 
virtual void vote (float xOffset, int weight=1)
 Voting.
 
unsigned setEntry (unsigned serialId, unsigned n) override
 Sets entry.
 
void registerPattern (unsigned id) override
 registers a pattern..
 
unsigned entry (unsigned id) const override
 returns entry in a cell.
 
unsigned entry (unsigned x, unsigned y) const override
 returns entry in a cell.
 
int maxEntry (void) const override
 returns max. entry in a plane.
 
virtual unsigned nActiveCellsInPattern (void) const
 returns # of active cells in the pattern.
 
virtual void voteByPattern (float xOffset, int weight=1)
 Votes using a pattern.
 
std::string name (void) const
 returns name.
 
const TRGCDCHoughTransformationtransformation (void) const
 returns Hough transformation object.
 
float charge (void) const
 returns charge for this plane.
 
float charge (float charge)
 sets and returns charge for this plane.
 
unsigned nX (void) const
 returns # of x bins.
 
float xMin (void) const
 returns min. of x.
 
float xMin (float newXMin)
 sets and returns min. of x.
 
float xMax (void) const
 returns max. of x.
 
float xMax (float newXMax)
 sets and returns max. of x.
 
float xSize (void) const
 returns size of x bin.
 
unsigned nY (void) const
 return # of y bins.
 
float yMin (void) const
 returns min. of y.
 
float yMin (float newYMin)
 sets and returns min. of y.
 
float yMax (void) const
 returns max. of y.
 
float yMax (float newYMax)
 sets and returns max. of y.
 
float ySize (void) const
 returns size of y bin.
 
int maxEntryInRegion (unsigned id) const
 returns max. count in region.
 
unsigned serialId (unsigned x, unsigned y) const
 returns serial ID for position (x, y).
 
unsigned serialId (const TRGPoint2D &p) const
 returns serial ID for position p.
 
void id (unsigned serialId, unsigned &x, unsigned &y) const
 returns x and y for serialID.
 
TRGPoint2D position (unsigned x, unsigned y) const
 returns position in Hough plain for a cell (x, y)..
 
unsigned neighbor (unsigned serialID, unsigned direction) const
 returns neighbor cell.
 
std::vector< unsigned > neighbors (unsigned serialID, unsigned windowSize=1) const
 returns neighbors.
 
const std::vector< std::vector< unsigned > * > & regions (void) const
 returns regions.
 
void locationInPlane (float x0, float y0, float x1, float y1, unsigned &nFound, unsigned &iX0, unsigned &iY0, unsigned &iX1, unsigned &iY1) const
 returns cell positions in the region.
 
void setRegion (std::vector< unsigned > *)
 Sets region.
 
void clearRegions (void)
 Clears regions.
 

Protected Member Functions

void add (unsigned cellId, int weight) override
 Add to a cell.
 

Private Attributes

unsigned _nLayers
 # of layers.
 
TRGCDCHoughPlaneBoolean_layers [N_LAYERS]
 Hough plane for each layer.
 
bool _usage [N_LAYERS]
 Used or not.
 
std::vector< unsigned > * _reverse
 Pattern ID's for each cell.
 
int *const _cell
 Counters.
 
unsigned * _patterns
 Curve patterns.
 
unsigned _nPatterns
 # of curve patterns.
 
const std::string _name
 Name.
 
const TRGCDCHoughTransformation_trans
 Hough transformation.
 
float _charge
 Track charge for this plane.
 
const unsigned _nX
 # of x bins.
 
float _xMin
 x min.
 
float _xMax
 x max.
 
float _xSize
 Size of x bin.
 
const unsigned _nY
 # of y bins.
 
float _yMin
 y min.
 
float _yMax
 y max.
 
float _ySize
 Size of y bin.
 
const TRGArea2D _area
 Area.
 
std::vector< std::vector< unsigned > * > _regions
 Regions.
 

Detailed Description

A class to represent a Hough parameter plane.

Definition at line 33 of file HoughPlaneMulti2.h.

Member Function Documentation

◆ registerPattern()

void registerPattern ( unsigned  id)
overridevirtual

registers a pattern..

Reimplemented from TRGCDCHoughPlane.

Definition at line 80 of file HoughPlane.cc.

203 {
204 if (_patterns) {
205 delete [] _patterns;
206 _nPatterns = 0;
207 }
208 const unsigned n = nX() * nY();
209
210 //...Check # of active cells...
211 for (unsigned i = 0; i < n; i++)
212 if (_cell[i]) ++_nPatterns;
213
214 //...Create array...
215 _patterns = new unsigned[_nPatterns];
216
217 //...Store them...
218 unsigned j = 0;
219 for (unsigned i = 0; i < n; i++)
220 if (_cell[i]) _patterns[j++] = i;
221 }
unsigned * _patterns
Curve patterns.
Definition: HoughPlane.h:96
int *const _cell
Counters.
Definition: HoughPlane.h:93
unsigned _nPatterns
# of curve patterns.
Definition: HoughPlane.h:99
unsigned nY(void) const
return # of y bins.
unsigned nX(void) const
returns # of x bins.

◆ setEntry()

unsigned setEntry ( unsigned  serialId,
unsigned  n 
)
inlineoverridevirtual

Sets entry.

Reimplemented from TRGCDCHoughPlane.

Definition at line 70 of file HoughPlane.h.

109 {
110 return _cell[serialId] = n;
111 }
unsigned serialId(unsigned x, unsigned y) const
returns serial ID for position (x, y).

◆ vote() [1/3]

void vote ( float  rx,
float  ry,
int  charge,
int  weight = 1 
)
virtual

Voting.

Reimplemented from TRGCDCHoughPlaneBase.

Definition at line 152 of file HoughPlaneBase.cc.

162 {
163
164 const HepGeom::Point3D<double> r(rx, ry, 0);
165
166 //...phi loop...
167 for (unsigned i = 0; i < _nX; i++) {
168 const float x0 = xSize() * float(i);
169 const HepGeom::Point3D<double> phi(cos(x0), sin(x0), 0);
170 float charge = r.cross(phi).z();
171 if (targetCharge != 0)
172 if (targetCharge * charge > 0)
173 continue;
174
175 const float y0 = _trans.y(rx, ry, x0);
176 const float x1 = xSize() * float(i + 1);
177 const float y1 = _trans.y(rx, ry, x1);
178
179 //...Location in the plane...
180 int iY0 = int((y0 - yMin()) / ySize());
181 int iY1 = int((y1 - yMin()) / ySize());
182
183 //...This is special implementation for Circle Hough...
184 if (_trans.diverge(rx, ry, x0, x1)) {
185 if (iY0 > 0) {
186 if (iY0 >= (int) _nY) continue;
187 iY1 = _nY - 1;
188 } else {
189 if (iY1 >= (int) _nY) continue;
190 iY0 = iY1;
191 iY1 = _nY - 1;
192 }
193 }
194
195 //...Sorting...
196 if (iY0 > iY1) {
197 const int tmp = iY0;
198 iY0 = iY1;
199 iY1 = tmp;
200 }
201
202 //...Both out of region ?...
203 if (iY1 < 0) continue;
204 if (iY0 >= (int) _nY) continue;
205
206 //...In region ?...
207 if (iY0 < 0) iY0 = 0;
208 if (iY0 >= (int) _nY) iY0 = _nY - 1;
209 //if (iY1 < 0) iY1 = 0; //redundant condition
210 if (iY1 >= (int) _nY) iY1 = _nY - 1;
211
212 //...Voting...
213 for (unsigned j = (unsigned) iY0; j < (unsigned)(iY1 + 1); j++) {
214// _cell[i * _nY + j] += weight;
215 add(i * _nY + j, weight);
216// if (_cell[i * _nY + j] < 0)
217// _cell[i * _nY + j] = 0;
218 }
219 }
220 }
const TRGCDCHoughTransformation & _trans
Hough transformation.
const unsigned _nX
# of x bins.
const unsigned _nY
# of y bins.
virtual float y(float xReal, float yReal, float x) const =0
returns Y coordinate in a Hough parameter plane.
virtual bool diverge(float xReal, float yReal, float x0, float x1) const =0
returns true if Y diverges in given region.
float ySize(void) const
returns size of y bin.
void add(unsigned cellId, int weight) override
Add to a cell.
Definition: HoughPlane.h:166
float charge(void) const
returns charge for this plane.
float xSize(void) const
returns size of x bin.
float yMin(void) const
returns min. of y.

◆ vote() [2/3]

void vote ( float  rx,
float  ry,
int  weight = 1 
)
inlinevirtual

Voting.

Reimplemented from TRGCDCHoughPlaneBase.

Definition at line 147 of file HoughPlaneBase.h.

509 {
510 vote(rx, ry, 0, weight);
511 }
void vote(float rx, float ry, int charge, unsigned layerId, int weight=1)
Voting.

◆ vote() [3/3]

void vote ( float  xOffset,
int  weight = 1 
)
inlinevirtual

Voting.

Reimplemented from TRGCDCHoughPlaneBase.

Definition at line 158 of file HoughPlaneBase.h.

516 {
517// do nothing
518 }

Member Data Documentation

◆ _area

const TRGArea2D _area
privateinherited

Area.

Definition at line 219 of file HoughPlaneBase.h.

◆ _cell

int* const _cell
privateinherited

Counters.

Definition at line 93 of file HoughPlane.h.

◆ _charge

float _charge
privateinherited

Track charge for this plane.

Definition at line 192 of file HoughPlaneBase.h.

◆ _layers

TRGCDCHoughPlaneBoolean* _layers[N_LAYERS]
private

Hough plane for each layer.

Definition at line 130 of file HoughPlaneMulti2.h.

◆ _name

const std::string _name
privateinherited

Name.

Definition at line 186 of file HoughPlaneBase.h.

◆ _nLayers

unsigned _nLayers
private

# of layers.

Definition at line 127 of file HoughPlaneMulti2.h.

◆ _nPatterns

unsigned _nPatterns
privateinherited

# of curve patterns.

Definition at line 99 of file HoughPlane.h.

◆ _nX

const unsigned _nX
privateinherited

# of x bins.

Definition at line 195 of file HoughPlaneBase.h.

◆ _nY

const unsigned _nY
privateinherited

# of y bins.

Definition at line 207 of file HoughPlaneBase.h.

◆ _patterns

unsigned* _patterns
privateinherited

Curve patterns.

Definition at line 96 of file HoughPlane.h.

◆ _regions

std::vector<std::vector<unsigned> *> _regions
privateinherited

Regions.

Definition at line 222 of file HoughPlaneBase.h.

◆ _reverse

std::vector<unsigned>* _reverse
private

Pattern ID's for each cell.

Definition at line 136 of file HoughPlaneMulti2.h.

◆ _trans

const TRGCDCHoughTransformation& _trans
privateinherited

Hough transformation.

Definition at line 189 of file HoughPlaneBase.h.

◆ _usage

bool _usage[N_LAYERS]
private

Used or not.

Definition at line 133 of file HoughPlaneMulti2.h.

◆ _xMax

float _xMax
privateinherited

x max.

Definition at line 201 of file HoughPlaneBase.h.

◆ _xMin

float _xMin
privateinherited

x min.

Definition at line 198 of file HoughPlaneBase.h.

◆ _xSize

float _xSize
privateinherited

Size of x bin.

Definition at line 204 of file HoughPlaneBase.h.

◆ _yMax

float _yMax
privateinherited

y max.

Definition at line 213 of file HoughPlaneBase.h.

◆ _yMin

float _yMin
privateinherited

y min.

Definition at line 210 of file HoughPlaneBase.h.

◆ _ySize

float _ySize
privateinherited

Size of y bin.

Definition at line 216 of file HoughPlaneBase.h.


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