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 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 
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;
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 
194 
195 void MTDArrayBuffer::set_time_error(uint row, uint col, float 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 
209  hitLE_vec[index(pix)] = le;
210 }
211 
212 #endif
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
MTDArrayBuffer::set_time
void set_time(uint row, uint col, float time)
Definition: MTDArrayBuffer.h:192
MTDArrayBuffer::clear
void clear(const FTLCluster::FTLHitPos &pos)
Definition: MTDArrayBuffer.h:59
MTDArrayBuffer::columns
uint columns() const
Definition: MTDArrayBuffer.h:45
MTDArrayBuffer::set_subDet
void set_subDet(uint row, uint col, GeomDetEnumerators::Location subDet)
Definition: MTDArrayBuffer.h:181
MTDArrayBuffer::hitLE_vec
std::vector< LocalError > hitLE_vec
Definition: MTDArrayBuffer.h:108
cuy.col
col
Definition: cuy.py:1010
pos
Definition: PixelAliasList.h:18
protons_cff.time
time
Definition: protons_cff.py:39
MTDArrayBuffer::rows
uint rows() const
Definition: MTDArrayBuffer.h:44
MTDArrayBuffer::ncols
uint ncols
Definition: MTDArrayBuffer.h:110
MTDArrayBuffer::hitGP_vec
std::vector< GlobalPoint > hitGP_vec
Definition: MTDArrayBuffer.h:107
FTLCluster::FTLHitPos
Definition: FTLCluster.h:58
MTDArrayBuffer::global_point
GlobalPoint global_point(uint row, uint col) const
Definition: MTDArrayBuffer.h:153
MTDArrayBuffer::MTDArrayBuffer
MTDArrayBuffer()
Definition: MTDArrayBuffer.h:25
MTDArrayBuffer::add_energy
void add_energy(uint row, uint col, float energy)
Definition: MTDArrayBuffer.h:190
MTDArrayBuffer::hitEnergy_vec
std::vector< float > hitEnergy_vec
Definition: MTDArrayBuffer.h:104
LocalError.h
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
MTDArrayBuffer::hitTimeError_vec
std::vector< float > hitTimeError_vec
Definition: MTDArrayBuffer.h:106
FTLCluster::FTLHitPos::row
constexpr int row() const
Definition: FTLCluster.h:62
Point3DBase< float, GlobalTag >
MTDArrayBuffer::time
float time(uint row, uint col) const
Definition: MTDArrayBuffer.h:144
GeomDetEnumerators::invalidLoc
Definition: GeomDetEnumerators.h:9
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
MTDArrayBuffer::clear
void clear(uint row, uint col)
Definition: MTDArrayBuffer.h:49
MTDArrayBuffer::inside
bool inside(uint row, uint col) const
Definition: MTDArrayBuffer.h:134
LocalError
Definition: LocalError.h:12
MTDArrayBuffer::local_error
LocalError local_error(uint row, uint col) const
Definition: MTDArrayBuffer.h:150
MTDArrayBuffer::energy
float energy(uint row, uint col) const
Definition: MTDArrayBuffer.h:141
MTDArrayBuffer::index
uint index(uint row, uint col) const
Definition of indexing within the buffer.
Definition: MTDArrayBuffer.h:99
MTDArrayBuffer::set_energy
void set_energy(uint row, uint col, float energy)
Definition: MTDArrayBuffer.h:188
MTDArrayBuffer::setSize
void setSize(uint rows, uint cols)
Definition: MTDArrayBuffer.h:123
MTDArrayBuffer::set
void set(uint row, uint col, GeomDetEnumerators::Location subDet, float energy, float time, float time_error, const LocalError &local_error, const GlobalPoint &global_point)
Definition: MTDArrayBuffer.h:156
MTDArrayBuffer::index
uint index(const FTLCluster::FTLHitPos &pix) const
Definition: MTDArrayBuffer.h:100
FTLCluster.h
MTDArrayBuffer
Class to store ADC counts and times during clustering.
Definition: MTDArrayBuffer.h:20
GeomDetEnumerators
Definition: GeomDetEnumerators.h:8
MTDArrayBuffer::set_time_error
void set_time_error(uint row, uint col, float time_error)
Definition: MTDArrayBuffer.h:195
GeomDetEnumerators::Location
Location
Definition: GeomDetEnumerators.h:9
MTDArrayBuffer::nrows
uint nrows
Definition: MTDArrayBuffer.h:109
MTDArrayBuffer::hitSubDet_vec
std::vector< GeomDetEnumerators::Location > hitSubDet_vec
Definition: MTDArrayBuffer.h:103
MTDArrayBuffer::set_local_error
void set_local_error(uint row, uint col, const LocalError &le)
Definition: MTDArrayBuffer.h:207
GeomDetEnumerators.h
postprocess-scan-build.rows
rows
Definition: postprocess-scan-build.py:20
MTDArrayBuffer::time_error
float time_error(uint row, uint col) const
Definition: MTDArrayBuffer.h:147
GlobalPoint.h
FTLCluster::FTLHitPos::col
constexpr int col() const
Definition: FTLCluster.h:63
MTDArrayBuffer::set_global_point
void set_global_point(uint row, uint col, const GlobalPoint &gp)
Definition: MTDArrayBuffer.h:202
MTDArrayBuffer::subDet
GeomDetEnumerators::Location subDet(uint row, uint col) const
Use subDet to identify whether the Hit is in BTL or ETL.
Definition: MTDArrayBuffer.h:136
MTDArrayBuffer::size
uint size() const
Definition: MTDArrayBuffer.h:96
MTDArrayBuffer::hitTime_vec
std::vector< float > hitTime_vec
Definition: MTDArrayBuffer.h:105
MTDArrayBuffer::uint
unsigned int uint
Definition: MTDArrayBuffer.h:22