 |
Belle II Software
release-05-01-25
|
15 #define TRGCDC_SHORT_NAMES
18 #include "trg/cdc/HoughPlaneBoolean.h"
28 TRGCDCHoughPlaneBoolean::TRGCDCHoughPlaneBoolean(
const std::string& name,
29 const TCHTransformation& trans,
38 _cell(new unsigned[_n]),
71 for (
unsigned i = 0; i <
nX(); i++) {
72 const float x0 =
xSize() * float(i);
74 float charge = r.cross(center).z();
75 if (targetCharge != 0)
76 if (targetCharge *
charge > 0)
80 const float x1 =
xSize() * float(i + 1);
89 if ((y0 == 0) && (y1 == 0))
91 else if ((y0 >
yMax()) && (y1 >
yMax()))
93 else if ((y0 <
yMin()) && (y1 <
yMin()))
97 if ((y0 == 0) && (y1 != 0))
99 else if ((y0 != 0) && (y1 == 0))
129 for (
unsigned j = (
unsigned) iY0; j < (unsigned)(iY1 + 1); j++) {
130 const unsigned k = i *
nY() + j;
131 const unsigned b0 = k / 32;
132 const unsigned b1 = k % 32;
134 _cell[b0] |= (1 << b1);
136 _cell[b0] &= (~(1 << b1));
151 for (
unsigned i = 0; i <
nX(); i++) {
152 const float x0 =
xSize() * float(i);
154 float charge = r.cross(phi).z();
155 if (targetCharge != 0)
156 if (targetCharge *
charge > 0)
160 const float x1 =
xSize() * float(i + 1);
170 if (iY0 >= (
int)
nY())
continue;
173 if (iY1 >= (
int)
nY())
continue;
187 if (iY1 < 0)
continue;
188 if (iY0 >= (
int)
nY())
continue;
191 if (iY0 < 0) iY0 = 0;
192 if (iY0 >= (
int)
nY()) iY0 =
nY() - 1;
193 if (iY1 < 0) iY1 = 0;
194 if (iY1 >= (
int)
nY()) iY1 =
nY() - 1;
197 for (
unsigned j = (
unsigned) iY0; j < (unsigned)(iY1 + 1); j++) {
198 const unsigned k = i *
nY() + j;
199 const unsigned b0 = k / 32;
200 const unsigned b1 = k % 32;
202 _cell[b0] |= (1 << b1);
204 _cell[b0] &= (~(1 << b1));
215 std::cout <<
"TRGCDCHoughPlaneBoolean::registerPattern !!! "
216 <<
"a pattern(id=" <<
id <<
") was already registered"
221 std::cout <<
"TRGCDCHoughPlaneBoolean::registerPattern !!! "
222 <<
"given id(" <<
id <<
") is over range(" <<
_nPatterns <<
")"
226 const unsigned n =
nX() *
nY();
229 unsigned nActive = 0;
230 for (
unsigned i = 0; i < n; i++) {
231 const unsigned j = i / 32;
232 const unsigned k = i % 32;
233 if ((
_cell[j] >> k) & 1) {
245 for (
unsigned i = 0; i < n; i++) {
246 const unsigned j = i / 32;
247 const unsigned k = i % 32;
248 if ((
_cell[j] >> k) & 1) {
259 std::cout <<
"TRGCDCHoughPlaneBoolean::preparePatterns !!! "
260 <<
"patterns were already allocated" << std::endl;
275 for (
unsigned i = 0; i < n; i++) {
void clear(void) override
clear all entries.
float yMax(void) const
returns max. of y.
void vote(float rx, float ry, int weight=1) override
Votes.
void id(unsigned serialId, unsigned &x, unsigned &y) const
returns x and y for serialID.
float charge(void) const
returns charge for this plane.
unsigned *const _cell
cell
void add(unsigned cellId, int weight) override
Add to a cell.
unsigned ** _patterns
patterns
unsigned nY(void) const
return # of y bins.
Abstract base class for different kinds of events.
unsigned * _nActive
number of active cells
void registerPattern(unsigned id) override
registers a pattern..
const TRGCDCHoughTransformation & transformation(void) const
returns Hough transformation object.
virtual ~TRGCDCHoughPlaneBoolean()
Destructor.
unsigned _nPatterns
number of patterns
float ySize(void) const
returns size of y bin.
void preparePatterns(unsigned nPatterns)
allocate memory for patterns.
void voteUsedInTrasan(float rx, float ry, float charge, int weight=1)
Votes with charge decision.
const std::vector< unsigned > & patternId(unsigned cellId) const
returns pattern ID which activates specified cell.
std::vector< unsigned > * _reverse
Pattern ID's for each cell.
unsigned nX(void) const
returns # of x bins.
float yMin(void) const
returns min. of y.
float xSize(void) const
returns size of x bin.
A class to represent a Hough parameter plane.