Belle II Software  release-08-01-10
HoughPlaneMulti2.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 (version 2)
11 //-----------------------------------------------------------------------------
12 
13 #define TRG_SHORT_NAMES
14 #define TRGCDC_SHORT_NAMES
15 
16 #include "trg/trg/Utilities.h"
17 #include "trg/cdc/HoughPlaneMulti2.h"
18 
19 namespace Belle2 {
26  const TCHTransformation& trans,
27  unsigned nX,
28  float xMin,
29  float xMax,
30  unsigned nY,
31  float yMin,
32  float yMax,
33  unsigned nLayers)
34  : TRGCDCHoughPlane(name, trans, nX, xMin, xMax, nY, yMin, yMax),
35  _nLayers(nLayers),
36  _reverse{} // 2019/07/31 by ytlai
37  {
38 
39  for (unsigned i = 0; i < N_LAYERS; i++)
40  _usage[i] = false;
41  for (unsigned i = 0; i < _nLayers; i++)
42  _layers[i] = new TCHPlaneBoolean(name +
43  ":layer" +
44  TRGUtil::itostring(i),
45  trans,
46  nX,
47  xMin,
48  xMax,
49  nY,
50  yMin,
51  yMax);
52  if (nLayers > N_LAYERS)
53  std::cout
54  << "Too many layers requested(" << _nLayers << ") : "
55  << "max #layers = " << N_LAYERS << std::endl;
56  }
57 
59  {
60  for (unsigned i = 0; i < _nLayers; i++)
61  delete _layers[i];
62  }
63 
64  void
66  {
67  const unsigned n = _layers[0]->_n;
68  for (unsigned i = 0; i < _nLayers; i++) {
69 
70  //...Use _usage here...
71  if (! _usage[i]) continue;
72 
73  for (unsigned j = 0; j < n; j++) {
74  if (! _layers[i]->_cell[j]) continue;
75  for (unsigned k = 0; k < 32; k++) {
76  if ((_layers[i]->_cell[j] >> k) & 1) {
77  add(j * 32 + k, 1);
78  }
79  }
80  }
81  }
82  }
83 
84  void
86  {
87  const unsigned n = _layers[0]->_n;
88  for (unsigned i = 1; i < _nLayers; i++) {
89 
90  //...Use _usage here...
91  if (! _usage[i]) continue;
92 
93  for (unsigned j = 0; j < n; j++) {
94  if (! _layers[i]->_cell[j]) continue;
95  for (unsigned k = 0; k < 32; k++) {
96  if ((_layers[i]->_cell[j] >> k) & 1) {
97  add(j * 32 + k, 1);
98  }
99  }
100  }
101  }
102  }
103 
105 } // namespace Belle2
unsigned _n
nX * nY / 32 + 1
TRGCDCHoughPlaneBoolean * _layers[N_LAYERS]
Hough plane for each layer.
bool _usage[N_LAYERS]
Used or not.
A class to represent a Hough parameter plane.
Definition: HoughPlane.h:30
int *const _cell
Counters.
Definition: HoughPlane.h:93
float xMin(void) const
returns min. of x.
virtual ~TRGCDCHoughPlaneMulti2()
Destructor.
unsigned nY(void) const
return # of y bins.
void mergeOuters(void)
Merge outer layers into one.
TRGCDCHoughPlaneMulti2(const std::string &name, const TRGCDCHoughTransformation &transformation, unsigned nX, float xMin, float xMax, unsigned nY, float yMin, float yMax, unsigned nLayers)
Contructor.
void add(unsigned cellId, int weight) override
Add to a cell.
Definition: HoughPlane.h:166
float xMax(void) const
returns max. of x.
#define N_LAYERS
number of layers
void merge(void)
Merge layers into one.
float yMax(void) const
returns max. of y.
unsigned nLayers(void) const
returns # of Hough Boolean layers.
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.