13#define TRGCDC_SHORT_NAMES
15#include "trg/cdc/HoughPlaneBase.h"
24 const TCHTransformation& trans,
37 _xSize((xMax - xMin) / float(nX)),
41 _ySize((yMax - yMin) / float(nY)),
55 unsigned& X0,
unsigned& Y0,
56 unsigned& X1,
unsigned& Y1)
const
123 const std::string stage =
"THghPlnBase::maxEntryInRegion";
126#ifdef TRASAN_DEBUG_DETAIL
127 std::cout << Tab() <<
"target id=" << targetId <<
",#regions="
131 for (
unsigned i = 0; i < (unsigned)
_regions.size(); i++) {
132 const std::vector<unsigned>& region = *
_regions[i];
134 bool idFound =
false;
136 for (
unsigned j = 0; j < (unsigned) region.size(); j++) {
138 const unsigned id = region[j];
139 if (
id == targetId) idFound =
true;
167 for (
unsigned i = 0; i <
_nX; i++) {
168 const float x0 =
xSize() * float(i);
170 float charge = r.cross(phi).z();
171 if (targetCharge != 0)
172 if (targetCharge *
charge > 0)
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);
186 if (iY0 >= (
int)
_nY)
continue;
189 if (iY1 >= (
int)
_nY)
continue;
203 if (iY1 < 0)
continue;
204 if (iY0 >= (
int)
_nY)
continue;
207 if (iY0 < 0) iY0 = 0;
208 if (iY0 >= (
int)
_nY) iY0 =
_nY - 1;
210 if (iY1 >= (
int)
_nY) iY1 =
_nY - 1;
213 for (
unsigned j = (
unsigned) iY0; j < (unsigned)(iY1 + 1); j++) {
224 const std::string& prefix)
const
226 std::cout << prefix <<
"dump of " <<
name() <<
":" << message;
227 if (message !=
"region") {
229 const unsigned n =
_nX *
_nY;
231 for (
unsigned i = 0; i < n; i++) {
237 if (!(nDump % 10)) std::cout << std::endl;
238 std::cout << i <<
"-" <<
entry(i);
243 std::cout <<
"no active cell";
245 std::cout << std::endl;
247 for (
unsigned i = 0; i <
_regions.size(); i++) {
248 std::cout << prefix <<
" region " << i <<
":";
250 for (
unsigned j = 0; j <
_regions[i]->size(); j++) {
252 const unsigned id = (*
_regions[i])[j];
253 std::cout <<
id <<
"(" <<
entry(
id) <<
"),";
255 std::cout << std::endl;
259 std::cout << std::endl;
const TRGCDCHoughTransformation & _trans
Hough transformation.
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 unsigned entry(unsigned id) const =0
returns count of a cell.
const TRGArea2D _area
Area.
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.
float ySize(void) const
returns size of y bin.
virtual void vote(float rx, float ry, int weight=1)
Voring.
virtual void dump(const std::string &message=std::string(""), const std::string &prefix=std::string("")) const
dumps debug information.
float charge(void) const
returns charge for this plane.
TRGCDCHoughPlaneBase(const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
Contructor.
void clearRegions(void)
Clears regions.
std::string name(void) const
returns name.
bool inArea(const TRGPoint2D &x) const
returns true if give point is in the area.
float xSize(void) const
returns size of x bin.
int maxEntryInRegion(unsigned id) const
returns max. count in region.
void cross(const TRGPoint2D &x0, const TRGPoint2D &x1, unsigned &nFound, TRGPoint2D crossPoint[2]) const
returns cross-points.
float yMin(void) const
returns min. of y.
Abstract base class for different kinds of events.