CMS 3D CMS Logo

MTDArrayBuffer.h
Go to the documentation of this file.
1 #ifndef RecoLocalTracker_FTLClusterizer_MTDArrayBuffer_H
2 #define RecoLocalTracker_FTLClusterizer_MTDArrayBuffer_H
3 
4 //----------------------------------------------------------------------------
8 //----------------------------------------------------------------------------
9 
10 // We use FTLHitPos which is an inner class of FTLCluster:
12 
16 
17 #include <vector>
18 #include <iostream>
19 
21 public:
22  typedef unsigned int uint;
23 
24  inline MTDArrayBuffer(uint rows, uint cols);
25  inline MTDArrayBuffer() {}
26 
27  inline void setSize(uint rows, uint cols);
28 
30  inline GeomDetEnumerators::Location subDet(uint row, uint col) const;
32  inline float energy(uint row, uint col) const;
33  inline float energy(const FTLCluster::FTLHitPos&) const;
34  inline float time(uint row, uint col) const;
35  inline float time(const FTLCluster::FTLHitPos&) const;
36  inline float time_error(uint row, uint col) const;
37  inline float time_error(const FTLCluster::FTLHitPos&) const;
38 
39  inline LocalError local_error(uint row, uint col) const;
40  inline LocalError local_error(const FTLCluster::FTLHitPos&) const;
41  inline LocalPoint local_point(uint row, uint col) const;
42  inline LocalPoint local_point(const FTLCluster::FTLHitPos&) const;
43 
44  inline float xpos(uint row, uint col) const;
45  inline float xpos(const FTLCluster::FTLHitPos&) const;
46 
47  inline uint rows() const { return nrows; }
48  inline uint columns() const { return ncols; }
49 
50  inline bool inside(uint row, uint col) const;
51 
52  inline void clear(uint row, uint col) {
53  LocalError le_n(0, 0, 0);
54  LocalPoint lp_n(0, 0, 0);
56  set_energy(row, col, 0.);
57  set_time(row, col, 0.);
58  set_time_error(row, col, 0.);
59  set_local_error(row, col, le_n);
60  set_local_point(row, col, lp_n);
61  set_xpos(row, col, 0.);
62  }
63  inline void clear(const FTLCluster::FTLHitPos& pos) { clear(pos.row(), pos.col()); }
64 
65  inline void set(uint row,
66  uint col,
68  float energy,
69  float time,
70  float time_error,
71  const LocalError& local_error,
72  const LocalPoint& local_point,
73  float xpos);
74  inline void set(const FTLCluster::FTLHitPos&,
76  float energy,
77  float time,
78  float time_error,
79  const LocalError& local_error,
80  const LocalPoint& local_point,
81  float xpos);
82 
85 
86  inline void set_energy(uint row, uint col, float energy);
87  inline void set_energy(const FTLCluster::FTLHitPos&, float energy);
88  inline void add_energy(uint row, uint col, float energy);
89 
90  inline void set_time(uint row, uint col, float time);
91  inline void set_time(const FTLCluster::FTLHitPos&, float time);
92 
93  inline void set_time_error(uint row, uint col, float time_error);
94  inline void set_time_error(const FTLCluster::FTLHitPos&, float time_error);
95 
96  inline void set_local_point(uint row, uint col, const LocalPoint& lp);
97  inline void set_local_point(const FTLCluster::FTLHitPos&, const LocalPoint& lp);
98 
99  inline void set_local_error(uint row, uint col, const LocalError& le);
100  inline void set_local_error(const FTLCluster::FTLHitPos&, const LocalError& le);
101 
102  inline void set_xpos(uint row, uint col, float xpos);
103  inline void set_xpos(const FTLCluster::FTLHitPos&, float xpos);
104 
105  uint size() const { return hitEnergy_vec.size(); }
106 
108  uint index(uint row, uint col) const { return col * nrows + row; }
109  uint index(const FTLCluster::FTLHitPos& pix) const { return index(pix.row(), pix.col()); }
110 
111 private:
112  std::vector<GeomDetEnumerators::Location> hitSubDet_vec;
113  std::vector<float> hitEnergy_vec;
114  std::vector<float> hitTime_vec;
115  std::vector<float> hitTimeError_vec;
116  std::vector<LocalPoint> hitGP_vec;
117  std::vector<LocalError> hitLE_vec;
118  std::vector<float> xpos_vec;
121 };
122 
124  : hitSubDet_vec(rows * cols, GeomDetEnumerators::invalidLoc),
125  hitEnergy_vec(rows * cols, 0),
126  hitTime_vec(rows * cols, 0),
127  hitTimeError_vec(rows * cols, 0),
128  hitGP_vec(rows * cols),
129  hitLE_vec(rows * cols),
130  xpos_vec(rows * cols),
131  nrows(rows),
132  ncols(cols) {}
133 
136  hitEnergy_vec.resize(rows * cols, 0);
137  hitTime_vec.resize(rows * cols, 0);
138  hitTimeError_vec.resize(rows * cols, 0);
139  hitGP_vec.resize(rows * cols);
140  hitLE_vec.resize(rows * cols);
141  xpos_vec.resize(rows * cols), nrows = rows;
142  ncols = cols;
143 }
144 
145 bool MTDArrayBuffer::inside(uint row, uint col) const { return (row < nrows && col < ncols); }
146 
149  return hitSubDet_vec[index(pix)];
150 }
151 
152 float MTDArrayBuffer::energy(uint row, uint col) const { return hitEnergy_vec[index(row, col)]; }
153 float MTDArrayBuffer::energy(const FTLCluster::FTLHitPos& pix) const { return hitEnergy_vec[index(pix)]; }
154 
155 float MTDArrayBuffer::time(uint row, uint col) const { return hitTime_vec[index(row, col)]; }
156 float MTDArrayBuffer::time(const FTLCluster::FTLHitPos& pix) const { return hitTime_vec[index(pix)]; }
157 
158 float MTDArrayBuffer::time_error(uint row, uint col) const { return hitTimeError_vec[index(row, col)]; }
160 
163 
166 
167 float MTDArrayBuffer::xpos(uint row, uint col) const { return xpos_vec[index(row, col)]; }
168 float MTDArrayBuffer::xpos(const FTLCluster::FTLHitPos& pix) const { return xpos_vec[index(pix)]; }
169 
171  uint col,
173  float energy,
174  float time,
175  float time_error,
176  const LocalError& local_error,
177  const LocalPoint& local_point,
178  float xpos) {
179  hitSubDet_vec[index(row, col)] = subDet;
180  hitEnergy_vec[index(row, col)] = energy;
181  hitTime_vec[index(row, col)] = time;
183  hitGP_vec[index(row, col)] = local_point;
184  hitLE_vec[index(row, col)] = local_error;
185  xpos_vec[index(row, col)] = xpos;
186 }
189  float energy,
190  float time,
191  float time_error,
192  const LocalError& local_error,
193  const LocalPoint& local_point,
194  float xpos) {
195  set(pix.row(), pix.col(), subDet, energy, time, time_error, local_error, local_point, xpos);
196 }
197 
199  hitSubDet_vec[index(row, col)] = subDet;
200 }
202  hitSubDet_vec[index(pix)] = subDet;
203 }
204 
208 
211 
212 void MTDArrayBuffer::set_time_error(uint row, uint col, float time_error) {
214 }
215 void MTDArrayBuffer::set_time_error(const FTLCluster::FTLHitPos& pix, float time_error) {
217 }
218 
221  hitGP_vec[index(pix)] = lp;
222 }
223 
226  hitLE_vec[index(pix)] = le;
227 }
228 
229 void MTDArrayBuffer::set_xpos(uint row, uint col, float xpos) { xpos_vec[index(row, col)] = xpos; }
230 void MTDArrayBuffer::set_xpos(const FTLCluster::FTLHitPos& pix, float xpos) { xpos_vec[index(pix)] = xpos; }
231 
232 #endif
uint index(const FTLCluster::FTLHitPos &pix) const
void set_energy(uint row, uint col, float energy)
uint rows() const
void set(uint row, uint col, GeomDetEnumerators::Location subDet, float energy, float time, float time_error, const LocalError &local_error, const LocalPoint &local_point, float xpos)
std::vector< float > hitEnergy_vec
float energy(uint row, uint col) const
float time(uint row, uint col) const
LocalError local_error(uint row, uint col) const
uint index(uint row, uint col) const
Definition of indexing within the buffer.
Class to store ADC counts and times during clustering.
uint columns() const
std::vector< float > xpos_vec
std::vector< LocalPoint > hitGP_vec
GeomDetEnumerators::Location subDet(uint row, uint col) const
Use subDet to identify whether the Hit is in BTL or ETL.
std::vector< GeomDetEnumerators::Location > hitSubDet_vec
void set_local_error(uint row, uint col, const LocalError &le)
float time_error(uint row, uint col) const
bool inside(uint row, uint col) const
void set_time(uint row, uint col, float time)
void clear(const FTLCluster::FTLHitPos &pos)
constexpr int row() const
Definition: FTLCluster.h:61
void set_local_point(uint row, uint col, const LocalPoint &lp)
std::vector< float > hitTime_vec
uint size() const
unsigned int uint
void set_subDet(uint row, uint col, GeomDetEnumerators::Location subDet)
float xpos(uint row, uint col) const
void set_xpos(uint row, uint col, float xpos)
col
Definition: cuy.py:1009
rows
Definition: mysort.py:12
constexpr int col() const
Definition: FTLCluster.h:62
void clear(uint row, uint col)
LocalPoint local_point(uint row, uint col) const
std::vector< float > hitTimeError_vec
void add_energy(uint row, uint col, float energy)
std::vector< LocalError > hitLE_vec
void set_time_error(uint row, uint col, float time_error)
void setSize(uint rows, uint cols)