Belle II Software  release-05-01-25
HoughPlaneMulti.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : HoughPlaneMulti.cc
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent multi Hough parameter planes
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #define TRGCDC_SHORT_NAMES
15 
16 #include "trg/cdc/HoughPlaneMulti.h"
17 
18 namespace Belle2 {
24  TRGCDCHoughPlaneMulti::TRGCDCHoughPlaneMulti(const std::string& name,
25  const TCHTransformation& trans,
26  unsigned nX,
27  float xMin,
28  float xMax,
29  unsigned nY,
30  float yMin,
31  float yMax,
32  unsigned nLayers)
33  : TRGCDCHoughPlane(name, trans, nX, xMin, xMax, nY, yMin, yMax),
34  _nLayers(nLayers)
35  {
36 
37  for (unsigned i = 0; i < N_LAYERS; i++)
38  _usage[i] = false;
39  for (unsigned i = 0; i < _nLayers; i++)
40  _layers[i] = new TRGCDCHoughPlane(name,
41  trans,
42  nX,
43  xMin,
44  xMax,
45  nY,
46  yMin,
47  yMax);
48  if (nLayers > N_LAYERS)
49  std::cout << "Too many layers requested("
50  << _nLayers << ") : "
51  << "max #layers = "
52  << N_LAYERS << std::endl;
53  }
54 
56  {
57  for (unsigned i = 0; i < _nLayers; i++)
58  delete _layers[i];
59  }
60 
61  void
63  float ry,
64  float targetCharge,
66  unsigned weight,
67  unsigned layerId)
68  {
69 
70 #ifdef TRASAN_DEBUG
71  if (layerId >= N_LAYERS)
72  std::cout << "TRGCDCHoughPlaneMulti::vote !!! (" << name()
73  << ") given layerId(" << layerId << ") is too big : max="
74  << _nLayers - 1 << std::endl;
75 #endif
76 
77 // const unsigned a = layerId / 32;
78 // _usage[a] |= (1 << (layerId % 32));
79  _usage[layerId] = true;
80  _layers[layerId]->vote(rx, ry, (int) targetCharge, weight);
81  }
82 
83  void
85  {
86  const unsigned nCells = nX() * nY();
87 
88 // for (unsigned i = 0; i < nCells; i++) {
89 // unsigned n = 0;
90 // for (unsigned j = 0; j < _layers.length(); j++)
91 // // if (_layers[j]->entry(i))
92 // if (_layers[j]->_cell[i])
93 // ++n;
94 // setEntry(i, n);
95 // }
96 
97  memset(_cell, 0, nCells * sizeof(unsigned));
98 // for (unsigned j = 0; j < _layers.length(); j++) {
99  for (unsigned j = 0; j < _nLayers; j++) {
100 // const unsigned a = j / 32;
101 // if (! (_usage[a] & (1 << (j % 32)))) continue;
102  if (! _usage[j]) continue;
103  for (unsigned i = 0; i < nCells; i++) {
104  if (_layers[j]->_cell[i])
105  ++_cell[i];
106  }
107  }
108  }
109 
110  void
111  TRGCDCHoughPlaneMulti::vote(float phi, unsigned layerId, int weight)
112  {
113  _layers[layerId]->vote(phi, weight);
114  }
115 
117 } // namespace Belle2
Belle2::TRGCDCHoughPlane
A class to represent a Hough parameter plane.
Definition: HoughPlane.h:31
Belle2::TRGCDCHoughPlaneMulti::vote
void vote(float rx, float ry, float charge, const TRGCDCHoughTransformation &hough, unsigned weight, unsigned layerId)
vote
Definition: HoughPlaneMulti.cc:62
Belle2::TRGCDCHoughPlaneMulti::_layers
TRGCDCHoughPlane * _layers[N_LAYERS]
layers of TRGCDCHoughPlane
Definition: HoughPlaneMulti.h:88
Belle2::TRGCDCHoughPlaneBase::yMax
float yMax(void) const
returns max. of y.
Definition: HoughPlaneBase.h:320
Belle2::TRGCDCHoughPlaneBase::name
std::string name(void) const
returns name.
Definition: HoughPlaneBase.h:244
Belle2::TRGCDCHoughPlaneMulti::~TRGCDCHoughPlaneMulti
virtual ~TRGCDCHoughPlaneMulti()
Destructor.
Definition: HoughPlaneMulti.cc:55
Belle2::TRGCDCHoughTransformation
An abstract class to represent a Hough transformation.
Definition: HoughTransformation.h:32
Belle2::TRGCDCHoughPlane::TRGCDCHoughPlane
TRGCDCHoughPlane(const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax)
Contructor.
Definition: HoughPlane.cc:24
Belle2::TRGCDCHoughPlaneBase::nY
unsigned nY(void) const
return # of y bins.
Definition: HoughPlaneBase.h:297
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCHoughPlaneMulti::merge
void merge(void)
merge function
Definition: HoughPlaneMulti.cc:84
N_LAYERS
#define N_LAYERS
number of layers
Definition: HoughPlaneMulti.h:31
Belle2::TRGCDCHoughPlaneBase::xMin
float xMin(void) const
returns min. of x.
Definition: HoughPlaneBase.h:258
Belle2::TRGCDCHoughPlaneMulti::_nLayers
unsigned _nLayers
number of layers
Definition: HoughPlaneMulti.h:86
Belle2::TRGCDCHoughPlaneBase::xMax
float xMax(void) const
returns max. of x.
Definition: HoughPlaneBase.h:274
Belle2::TRGCDCHoughPlaneBase::vote
virtual void vote(float rx, float ry, int weight=1)
Voring.
Definition: HoughPlaneBase.h:507
Belle2::TRGCDCHoughPlaneBase::nX
unsigned nX(void) const
returns # of x bins.
Definition: HoughPlaneBase.h:251
Belle2::TRGCDCHoughPlaneBase::yMin
float yMin(void) const
returns min. of y.
Definition: HoughPlaneBase.h:304
Belle2::TRGCDCHoughPlane::_cell
int *const _cell
Counters.
Definition: HoughPlane.h:87
Belle2::TRGCDCHoughPlaneMulti::_usage
bool _usage[N_LAYERS]
usage of each layer
Definition: HoughPlaneMulti.h:90