CMS 3D CMS Logo

MTDClusterizerBase.h
Go to the documentation of this file.
1 #ifndef RecoLocalTracker_MTDClusterizer_MTDClusterizerBase_H
2 #define RecoLocalTracker_MTDClusterizer_MTDClusterizerBase_H
3 
6 
9 
12 
13 #include <vector>
14 #include <array>
15 
20 public:
23 
24  // Virtual destructor, this is a base class.
25  virtual ~MTDClusterizerBase() {}
26 
27  // Build clusters
28  virtual void clusterize(const FTLRecHitCollection& input,
29  const MTDGeometry* geom,
30  const MTDTopology* topo,
32 
33 protected:
35  typedef unsigned short UShort;
36  static constexpr UShort MAXSIZE = 256;
37 
38  std::array<float, MAXSIZE> energy;
39  std::array<float, MAXSIZE> time;
40  std::array<float, MAXSIZE> timeError;
41  std::array<UShort, MAXSIZE> x;
42  std::array<UShort, MAXSIZE> y;
43 
44  UShort xmin = 16000;
45  UShort ymin = 16000;
46  unsigned int isize = 0;
47  unsigned int curr = 0;
48 
49  // stack interface (unsafe ok for use below)
50  UShort top() const { return curr; }
51  void pop() { ++curr; }
52  bool empty() { return curr == isize; }
53 
54  bool add(FTLCluster::FTLHitPos const& p, float const ienergy, float const itime, float const itimeError) {
55  if (isize == MAXSIZE)
56  return false;
57  xmin = std::min(xmin, (unsigned short)(p.row()));
58  ymin = std::min(ymin, (unsigned short)(p.col()));
59  energy[isize] = ienergy;
60  time[isize] = itime;
61  timeError[isize] = itimeError;
62  x[isize] = p.row();
63  y[isize] = p.col();
64  isize++;
65  return true;
66  }
67  };
68 };
69 
70 #endif
FTLRecHitCollection::const_iterator RecHitIterator
std::vector< T >::const_iterator const_iterator
bool add(FTLCluster::FTLHitPos const &p, float const ienergy, float const itime, float const itimeError)
static std::string const input
Definition: EdmProvDump.cc:47
std::array< float, MAXSIZE > timeError
FTLClusterCollection::const_iterator ClusterIterator
std::array< UShort, MAXSIZE > x
std::array< float, MAXSIZE > time
virtual void clusterize(const FTLRecHitCollection &input, const MTDGeometry *geom, const MTDTopology *topo, FTLClusterCollection &output)=0
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
std::array< UShort, MAXSIZE > y
std::array< float, MAXSIZE > energy