 |
Belle II Software
release-05-01-25
|
14 #ifndef TRGCDCHoughPlaneBase_FLAG_
15 #define TRGCDCHoughPlaneBase_FLAG_
19 #include "trg/trg/Point2D.h"
20 #include "trg/trg/Area2D.h"
21 #include "trg/cdc/HoughTransformation.h"
23 #ifdef TRGCDC_SHORT_NAMES
24 #define TCHPlaneBase TRGCDCHoughPlaneBase
33 class TRGCDCHoughPlaneBase {
54 std::string
name(
void)
const;
63 unsigned nX(
void)
const;
66 float xMin(
void)
const;
69 float xMax(
void)
const;
72 float xSize(
void)
const;
75 unsigned nY(
void)
const;
78 float yMin(
void)
const;
81 float yMax(
void)
const;
84 float ySize(
void)
const;
87 virtual unsigned entry(
unsigned id)
const = 0;
90 virtual unsigned entry(
unsigned x,
unsigned y)
const = 0;
93 virtual int maxEntry(
void)
const = 0;
99 unsigned serialId(
unsigned x,
unsigned y)
const;
102 unsigned serialId(
const TRGPoint2D& p)
const;
105 void id(
unsigned serialId,
unsigned& x,
unsigned& y)
const;
108 TRGPoint2D
position(
unsigned x,
unsigned y)
const;
111 unsigned neighbor(
unsigned serialID,
unsigned direction)
const;
114 std::vector<unsigned>
neighbors(
unsigned serialID,
115 unsigned windowSize = 1)
const;
118 const std::vector<std::vector<unsigned> *>&
regions(
void)
const;
123 unsigned& iX0,
unsigned& iY0,
124 unsigned& iX1,
unsigned& iY1)
const;
127 virtual void dump(
const std::string& message = std::string(
""),
128 const std::string& prefix = std::string(
""))
const;
136 float xMin(
float newXMin);
139 float xMax(
float newXMax);
142 float yMin(
float newYMin);
145 float yMax(
float newYMax);
148 virtual void vote(
float rx,
153 virtual void vote(
float rx,
159 virtual void vote(
float xOffset,
int weight = 1);
177 virtual void clear(
void) = 0;
182 virtual void add(
unsigned cellId,
int weight) = 0;
352 static const unsigned invalidPoint =
_nX *
_nY;
353 if ((p.x() <
_xMin) || (p.x() >
_xMax))
return invalidPoint;
354 if ((p.y() <
_yMin) || (p.y() >
_yMax))
return invalidPoint;
366 #ifdef TRASAN_DEBUG_DETAIL
377 std::vector<unsigned>
380 const int maxi =
_nY *
_nX;
381 std::vector<unsigned> tmp;
383 const int xmin = - (int) windowSize;
384 const int xmax = (int) windowSize;
385 int ymin = - (int) windowSize;
386 int ymax = (int) windowSize;
391 if (((
int) y + ymin) < 0) ymin = - (int) y;
392 if (((
int) y + ymax) >= (int)
_nY) ymax =
_nY - (int) y;
394 for (
int i = xmin; i <= xmax; i++) {
395 for (
int j = ymin; j <= ymax; j++) {
396 int ii = a + i *
_nY + j;
397 if (ii == (
int) a)
continue;
398 if (ii < 0) ii += maxi;
399 if (ii >= maxi) ii -= maxi;
416 const std::vector<std::vector<unsigned> *>&
426 const unsigned maxi =
_nY *
_nX;
428 if ((
id %
_nY) !=
_nY - 1)
430 }
else if (dir == 1) {
431 if ((
id %
_nY) !=
_nY - 1) {
432 const unsigned i =
id +
_nY + 1;
438 }
else if (dir == 2) {
439 const unsigned i =
id +
_nY;
444 }
else if (dir == 3) {
445 if ((
id %
_nY) != 0) {
446 const unsigned i =
id +
_nY - 1;
452 }
else if (dir == 4) {
455 }
else if (dir == 5) {
456 if ((
id %
_nY) != 0) {
457 const int i =
id +
_nY - 1;
461 return (
unsigned) i + maxi;
463 }
else if (dir == 6) {
464 const int i =
id -
_nY;
468 return (
unsigned) i + maxi;
469 }
else if (dir == 7) {
470 if ((
id %
_nY) !=
_nY - 1) {
471 const int i =
id -
_nY + 1;
475 return (
unsigned) i + maxi;
511 vote(rx, ry, 0, weight);
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
A class to represent a point in 2D.
float yMax(void) const
returns max. of y.
unsigned serialId(unsigned x, unsigned y) const
returns serial ID for position (x, y).
std::string name(void) const
returns name.
void id(unsigned serialId, unsigned &x, unsigned &y) const
returns x and y for serialID.
float charge(void) const
returns charge for this plane.
std::vector< unsigned > neighbors(unsigned serialID, unsigned windowSize=1) const
returns neighbors.
virtual int maxEntry(void) const =0
returns max. count in a plane.
void clearRegions(void)
Clears regions.
const unsigned _nX
# of x bins.
virtual void add(unsigned cellId, int weight)=0
Add to a cell.
unsigned neighbor(unsigned serialID, unsigned direction) const
returns neighbor cell.
TRGCDCHoughPlaneBase(const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
Contructor.
virtual unsigned entry(unsigned id) const =0
returns count of a cell.
unsigned nY(void) const
return # of y bins.
virtual void clear(void)=0
Clears all entries.
std::vector< std::vector< unsigned > * > _regions
Regions.
float _xSize
Size of x bin.
const std::vector< std::vector< unsigned > * > & regions(void) const
returns regions.
Abstract base class for different kinds of events.
int maxEntryInRegion(unsigned id) const
returns max. count in region.
TRGPoint2D position(unsigned x, unsigned y) const
returns position in Hough plain for a cell (x, y)..
const TRGCDCHoughTransformation & transformation(void) const
returns Hough transformation object.
const unsigned _nY
# of y bins.
float _charge
Track charge for this plane.
void setRegion(std::vector< unsigned > *)
Sets region.
float ySize(void) const
returns size of y bin.
float xMin(void) const
returns min. of x.
float xMax(void) const
returns max. of x.
virtual void vote(float rx, float ry, int weight=1)
Voring.
virtual unsigned setEntry(unsigned serialId, unsigned n)=0
smoothing
const TRGArea2D _area
Area.
A class to represent an 2D area.
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.
const std::string _name
Name.
float _ySize
Size of y bin.
unsigned nX(void) const
returns # of x bins.
const TRGCDCHoughTransformation & _trans
Hough transformation.
float yMin(void) const
returns min. of y.
float xSize(void) const
returns size of x bin.
virtual void registerPattern(unsigned id)=0
registers a pattern..
virtual ~TRGCDCHoughPlaneBase()
Destructor.