13#ifndef TRGCDCHoughPlaneBase_FLAG_
14#define TRGCDCHoughPlaneBase_FLAG_
18#include "trg/trg/Point2D.h"
19#include "trg/trg/Area2D.h"
20#include "trg/cdc/HoughTransformation.h"
22#ifdef TRGCDC_SHORT_NAMES
23#define TCHPlaneBase TRGCDCHoughPlaneBase
53 std::string
name(
void)
const;
62 unsigned nX(
void)
const;
65 float xMin(
void)
const;
68 float xMax(
void)
const;
71 float xSize(
void)
const;
74 unsigned nY(
void)
const;
77 float yMin(
void)
const;
80 float yMax(
void)
const;
83 float ySize(
void)
const;
86 virtual unsigned entry(
unsigned id)
const = 0;
89 virtual unsigned entry(
unsigned x,
unsigned y)
const = 0;
98 unsigned serialId(
unsigned x,
unsigned y)
const;
104 void id(
unsigned serialId,
unsigned& x,
unsigned& y)
const;
110 unsigned neighbor(
unsigned serialID,
unsigned direction)
const;
113 std::vector<unsigned>
neighbors(
unsigned serialID,
114 unsigned windowSize = 1)
const;
117 const std::vector<std::vector<unsigned> *>&
regions(
void)
const;
122 unsigned& iX0,
unsigned& iY0,
123 unsigned& iX1,
unsigned& iY1)
const;
126 virtual void dump(
const std::string& message = std::string(
""),
127 const std::string& prefix = std::string(
""))
const;
135 float xMin(
float newXMin);
138 float xMax(
float newXMax);
141 float yMin(
float newYMin);
144 float yMax(
float newYMax);
152 virtual void vote(
float rx,
158 virtual void vote(
float xOffset,
int weight = 1);
176 virtual void clear(
void) = 0;
181 virtual void add(
unsigned cellId,
int weight) = 0;
351 static const unsigned invalidPoint =
_nX *
_nY;
352 if ((p.x() <
_xMin) || (p.x() >
_xMax))
return invalidPoint;
353 if ((p.y() <
_yMin) || (p.y() >
_yMax))
return invalidPoint;
365#ifdef TRASAN_DEBUG_DETAIL
376 std::vector<unsigned>
379 const int maxi =
_nY *
_nX;
380 std::vector<unsigned> tmp;
382 const int xmin = - (int) windowSize;
383 const int xmax = (int) windowSize;
384 int ymin = - (int) windowSize;
385 int ymax = (int) windowSize;
390 if (((
int) y + ymin) < 0) ymin = - (int) y;
391 if (((
int) y + ymax) >= (int)
_nY) ymax =
_nY - (int) y;
393 for (
int i = xmin; i <= xmax; i++) {
394 for (
int j = ymin; j <= ymax; j++) {
395 int ii = a + i *
_nY + j;
396 if (ii == (
int) a)
continue;
397 if (ii < 0) ii += maxi;
398 if (ii >= maxi) ii -= maxi;
415 const std::vector<std::vector<unsigned> *>&
425 const unsigned maxi =
_nY *
_nX;
427 if ((
id %
_nY) !=
_nY - 1)
429 }
else if (dir == 1) {
430 if ((
id %
_nY) !=
_nY - 1) {
431 const unsigned i =
id +
_nY + 1;
437 }
else if (dir == 2) {
438 const unsigned i =
id +
_nY;
443 }
else if (dir == 3) {
444 if ((
id %
_nY) != 0) {
445 const unsigned i =
id +
_nY - 1;
451 }
else if (dir == 4) {
454 }
else if (dir == 5) {
455 if ((
id %
_nY) != 0) {
456 const int i =
id +
_nY - 1;
460 return (
unsigned) i + maxi;
462 }
else if (dir == 6) {
463 const int i =
id -
_nY;
467 return (
unsigned) i + maxi;
468 }
else if (dir == 7) {
469 if ((
id %
_nY) !=
_nY - 1) {
470 const int i =
id -
_nY + 1;
474 return (
unsigned) i + maxi;
510 vote(rx, ry, 0, weight);
A class to represent an 2D area.
A class to represent a Hough parameter plane.
const TRGCDCHoughTransformation & _trans
Hough transformation.
const std::string _name
Name.
const unsigned _nX
# of x bins.
float _xSize
Size of x bin.
virtual void add(unsigned cellId, int weight)=0
Add to a cell.
float _ySize
Size of y bin.
virtual void registerPattern(unsigned id)=0
registers a pattern..
virtual unsigned entry(unsigned x, unsigned y) const =0
returns count of a cell.
virtual unsigned setEntry(unsigned serialId, unsigned n)=0
smoothing
virtual unsigned entry(unsigned id) const =0
returns count of a cell.
const TRGArea2D _area
Area.
float _charge
Track charge for this plane.
std::vector< std::vector< unsigned > * > _regions
Regions.
virtual int maxEntry(void) const =0
returns max. count in a plane.
const unsigned _nY
# of y bins.
A class to represent a point in 2D.
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.
virtual ~TRGCDCHoughPlaneBase()
Destructor.
virtual void clear(void)=0
Clears all entries.
float ySize(void) const
returns size of y bin.
virtual void vote(float rx, float ry, int weight=1)
Voring.
float xMin(void) const
returns min. of x.
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
void setRegion(std::vector< unsigned > *)
Sets region.
unsigned nY(void) const
return # of y bins.
float xMax(void) const
returns max. of x.
float charge(void) const
returns charge for this plane.
void id(unsigned serialId, unsigned &x, unsigned &y) const
returns x and y for serialID.
const std::vector< std::vector< unsigned > * > & regions(void) const
returns regions.
unsigned serialId(unsigned x, unsigned y) const
returns serial ID for position (x, y).
std::vector< unsigned > neighbors(unsigned serialID, unsigned windowSize=1) const
returns neighbors.
void clearRegions(void)
Clears regions.
float yMax(void) const
returns max. of y.
const TRGCDCHoughTransformation & transformation(void) const
returns Hough transformation object.
std::string name(void) const
returns name.
float xSize(void) const
returns size of x bin.
int maxEntryInRegion(unsigned id) const
returns max. count in region.
unsigned neighbor(unsigned serialID, unsigned direction) const
returns neighbor cell.
unsigned nX(void) const
returns # of x bins.
float yMin(void) const
returns min. of y.
TRGPoint2D position(unsigned x, unsigned y) const
returns position in Hough plain for a cell (x, y)..
Abstract base class for different kinds of events.