CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 GlobalPoint global_point(uint row, uint col) const;
42  inline GlobalPoint global_point(const FTLCluster::FTLHitPos&) const;
43 
44  inline uint rows() const { return nrows; }
45  inline uint columns() const { return ncols; }
46 
47  inline bool inside(uint row, uint col) const;
48 
49  inline void clear(uint row, uint col) {
50  LocalError le_n(0, 0, 0);
51  GlobalPoint gp_n(0, 0, 0);
53  set_energy(row, col, 0.);
54  set_time(row, col, 0.);
55  set_time_error(row, col, 0.);
56  set_local_error(row, col, le_n);
57  set_global_point(row, col, gp_n);
58  }
59  inline void clear(const FTLCluster::FTLHitPos& pos) { clear(pos.row(), pos.col()); }
60 
61  inline void set(uint row,
62  uint col,
64  float energy,
65  float time,
66  float time_error,
67  const LocalError& local_error,
68  const GlobalPoint& global_point);
69  inline void set(const FTLCluster::FTLHitPos&,
71  float energy,
72  float time,
73  float time_error,
74  const LocalError& local_error,
75  const GlobalPoint& global_point);
76 
79 
80  inline void set_energy(uint row, uint col, float energy);
81  inline void set_energy(const FTLCluster::FTLHitPos&, float energy);
82  inline void add_energy(uint row, uint col, float energy);
83 
84  inline void set_time(uint row, uint col, float time);
85  inline void set_time(const FTLCluster::FTLHitPos&, float time);
86 
87  inline void set_time_error(uint row, uint col, float time_error);
88  inline void set_time_error(const FTLCluster::FTLHitPos&, float time_error);
89 
90  inline void set_global_point(uint row, uint col, const GlobalPoint& gp);
91  inline void set_global_point(const FTLCluster::FTLHitPos&, const GlobalPoint& gp);
92 
93  inline void set_local_error(uint row, uint col, const LocalError& le);
94  inline void set_local_error(const FTLCluster::FTLHitPos&, const LocalError& le);
95 
96  uint size() const { return hitEnergy_vec.size(); }
97 
99  uint index(uint row, uint col) const { return col * nrows + row; }
100  uint index(const FTLCluster::FTLHitPos& pix) const { return index(pix.row(), pix.col()); }
101 
102 private:
103  std::vector<GeomDetEnumerators::Location> hitSubDet_vec;
104  std::vector<float> hitEnergy_vec;
105  std::vector<float> hitTime_vec;
106  std::vector<float> hitTimeError_vec;
107  std::vector<GlobalPoint> hitGP_vec;
108  std::vector<LocalError> hitLE_vec;
111 };
112 
114  : hitSubDet_vec(rows * cols, GeomDetEnumerators::invalidLoc),
115  hitEnergy_vec(rows * cols, 0),
116  hitTime_vec(rows * cols, 0),
117  hitTimeError_vec(rows * cols, 0),
118  hitGP_vec(rows * cols),
119  hitLE_vec(rows * cols),
120  nrows(rows),
121  ncols(cols) {}
122 
124  hitSubDet_vec.resize(rows * cols, GeomDetEnumerators::invalidLoc);
125  hitEnergy_vec.resize(rows * cols, 0);
126  hitTime_vec.resize(rows * cols, 0);
127  hitTimeError_vec.resize(rows * cols, 0);
128  hitGP_vec.resize(rows * cols);
129  hitLE_vec.resize(rows * cols);
130  nrows = rows;
131  ncols = cols;
132 }
133 
134 bool MTDArrayBuffer::inside(uint row, uint col) const { return (row < nrows && col < ncols); }
135 
138  return hitSubDet_vec[index(pix)];
139 }
140 
141 float MTDArrayBuffer::energy(uint row, uint col) const { return hitEnergy_vec[index(row, col)]; }
142 float MTDArrayBuffer::energy(const FTLCluster::FTLHitPos& pix) const { return hitEnergy_vec[index(pix)]; }
143 
144 float MTDArrayBuffer::time(uint row, uint col) const { return hitTime_vec[index(row, col)]; }
145 float MTDArrayBuffer::time(const FTLCluster::FTLHitPos& pix) const { return hitTime_vec[index(pix)]; }
146 
147 float MTDArrayBuffer::time_error(uint row, uint col) const { return hitTimeError_vec[index(row, col)]; }
149 
152 
155 
157  uint col,
159  float energy,
160  float time,
161  float time_error,
162  const LocalError& local_error,
163  const GlobalPoint& global_point) {
164  hitSubDet_vec[index(row, col)] = subDet;
165  hitEnergy_vec[index(row, col)] = energy;
166  hitTime_vec[index(row, col)] = time;
167  hitTimeError_vec[index(row, col)] = time_error;
168  hitGP_vec[index(row, col)] = global_point;
169  hitLE_vec[index(row, col)] = local_error;
170 }
173  float energy,
174  float time,
175  float time_error,
176  const LocalError& local_error,
177  const GlobalPoint& global_point) {
179 }
180 
182  hitSubDet_vec[index(row, col)] = subDet;
183 }
185  hitSubDet_vec[index(pix)] = subDet;
186 }
187 
191 
192 void MTDArrayBuffer::set_time(uint row, uint col, float time) { hitTime_vec[index(row, col)] = time; }
193 void MTDArrayBuffer::set_time(const FTLCluster::FTLHitPos& pix, float time) { hitTime_vec[index(pix)] = time; }
194 
195 void MTDArrayBuffer::set_time_error(uint row, uint col, float time_error) {
196  hitTimeError_vec[index(row, col)] = time_error;
197 }
198 void MTDArrayBuffer::set_time_error(const FTLCluster::FTLHitPos& pix, float time_error) {
200 }
201 
204  hitGP_vec[index(pix)] = gp;
205 }
206 
207 void MTDArrayBuffer::set_local_error(uint row, uint col, const LocalError& le) { hitLE_vec[index(row, col)] = le; }
209  hitLE_vec[index(pix)] = le;
210 }
211 
212 #endif
float time_error(uint row, uint col) const
GeomDetEnumerators::Location subDet(uint row, uint col) const
Use subDet to identify whether the Hit is in BTL or ETL.
void set_energy(uint row, uint col, float energy)
std::vector< GlobalPoint > hitGP_vec
uint rows() const
std::vector< float > hitEnergy_vec
Class to store ADC counts and times during clustering.
uint columns() const
std::vector< GeomDetEnumerators::Location > hitSubDet_vec
void set_local_error(uint row, uint col, const LocalError &le)
LocalError local_error(uint row, uint col) const
float time(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)
uint index(const FTLCluster::FTLHitPos &pix) const
constexpr int row() const
Definition: FTLCluster.h:61
float energy(uint row, uint col) const
GlobalPoint global_point(uint row, uint col) const
std::vector< float > hitTime_vec
uint index(uint row, uint col) const
Definition of indexing within the buffer.
unsigned int uint
void set_subDet(uint row, uint col, GeomDetEnumerators::Location subDet)
uint size() const
void set_global_point(uint row, uint col, const GlobalPoint &gp)
void set(uint row, uint col, GeomDetEnumerators::Location subDet, float energy, float time, float time_error, const LocalError &local_error, const GlobalPoint &global_point)
constexpr int col() const
Definition: FTLCluster.h:62
int col
Definition: cuy.py:1009
void clear(uint row, uint col)
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)