Belle II Software development
HoughPlaneMulti.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9//-----------------------------------------------------------------------------
10// Description : A class to represent multi Hough parameter planes
11//-----------------------------------------------------------------------------
12
13#define TRGCDC_SHORT_NAMES
14
15#include "trg/cdc/HoughPlaneMulti.h"
16
17namespace Belle2 {
23 TRGCDCHoughPlaneMulti::TRGCDCHoughPlaneMulti(const std::string& name,
24 const TCHTransformation& trans,
25 unsigned nX,
26 float xMin,
27 float xMax,
28 unsigned nY,
29 float yMin,
30 float yMax,
31 unsigned nLayers)
32 : TRGCDCHoughPlane(name, trans, nX, xMin, xMax, nY, yMin, yMax),
33 _nLayers(nLayers)
34 {
35
36 for (unsigned i = 0; i < N_LAYERS; i++)
37 _usage[i] = false;
38 for (unsigned i = 0; i < _nLayers; i++)
40 trans,
41 nX,
42 xMin,
43 xMax,
44 nY,
45 yMin,
46 yMax);
47 if (nLayers > N_LAYERS)
48 std::cout << "Too many layers requested("
49 << _nLayers << ") : "
50 << "max #layers = "
51 << N_LAYERS << std::endl;
52 }
53
55 {
56 for (unsigned i = 0; i < _nLayers; i++)
57 delete _layers[i];
58 }
59
60 void
62 float ry,
63 float targetCharge,
65 unsigned weight,
66 unsigned layerId)
67 {
68
69#ifdef TRASAN_DEBUG
70 if (layerId >= N_LAYERS)
71 std::cout << "TRGCDCHoughPlaneMulti::vote !!! (" << name()
72 << ") given layerId(" << layerId << ") is too big : max="
73 << _nLayers - 1 << std::endl;
74#endif
75
76// const unsigned a = layerId / 32;
77// _usage[a] |= (1 << (layerId % 32));
78 _usage[layerId] = true;
79 _layers[layerId]->vote(rx, ry, (int) targetCharge, weight);
80 }
81
82 void
84 {
85 const unsigned nCells = nX() * nY();
86
87// for (unsigned i = 0; i < nCells; i++) {
88// unsigned n = 0;
89// for (unsigned j = 0; j < _layers.length(); j++)
90// // if (_layers[j]->entry(i))
91// if (_layers[j]->_cell[i])
92// ++n;
93// setEntry(i, n);
94// }
95
96 memset(_cell, 0, nCells * sizeof(unsigned));
97// for (unsigned j = 0; j < _layers.length(); j++) {
98 for (unsigned j = 0; j < _nLayers; j++) {
99// const unsigned a = j / 32;
100// if (! (_usage[a] & (1 << (j % 32)))) continue;
101 if (! _usage[j]) continue;
102 for (unsigned i = 0; i < nCells; i++) {
103 if (_layers[j]->_cell[i])
104 ++_cell[i];
105 }
106 }
107 }
108
109 void
110 TRGCDCHoughPlaneMulti::vote(float phi, unsigned layerId, int weight)
111 {
112 _layers[layerId]->vote(phi, weight);
113 }
114
116} // namespace Belle2
unsigned _nLayers
number of layers
TRGCDCHoughPlane * _layers[N_LAYERS]
layers of TRGCDCHoughPlane
bool _usage[N_LAYERS]
usage of each layer
A class to represent a Hough parameter plane.
Definition: HoughPlane.h:30
int *const _cell
Counters.
Definition: HoughPlane.h:93
An abstract class to represent a Hough transformation.
virtual void vote(float rx, float ry, int weight=1)
Voring.
float xMin(void) const
returns min. of x.
unsigned nY(void) const
return # of y bins.
virtual ~TRGCDCHoughPlaneMulti()
Destructor.
float xMax(void) const
returns max. of x.
#define N_LAYERS
number of layers
void vote(float rx, float ry, float charge, const TRGCDCHoughTransformation &hough, unsigned weight, unsigned layerId)
vote
void merge(void)
merge function
float yMax(void) const
returns max. of y.
std::string name(void) const
returns name.
unsigned nX(void) const
returns # of x bins.
float yMin(void) const
returns min. of y.
Abstract base class for different kinds of events.