CMS 3D CMS Logo

HGCal3DClustering.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_HGCalRecAlgos_HGCal3DClustering
2 #define RecoLocalCalo_HGCalRecAlgos_HGCal3DClustering
3 
7 
8 #include <vector>
9 #include <array>
10 
14 
16 
18 public:
19  HGCal3DClustering() : radii({0., 0., 0.}), minClusters(0), clusterTools(nullptr) {}
20 
23  const std::vector<double>& radii_in,
24  uint32_t min_clusters)
25  : radii(radii_in),
26  minClusters(min_clusters),
27  es(0),
28  clusterTools(std::make_unique<hgcal::ClusterTools>(conf, sumes)) {}
29 
31  : HGCal3DClustering(conf,
32  sumes,
33  conf.getParameter<std::vector<double>>("multiclusterRadii"),
34  conf.getParameter<unsigned>("minClusters")) {}
35 
36  void getEvent(const edm::Event& ev) { clusterTools->getEvent(ev); }
38  clusterTools->getEventSetup(es);
41  points.clear();
42  minpos.clear();
43  maxpos.clear();
44  zees.clear();
45  points.resize(2 * (maxlayer + 1));
46  minpos.resize(2 * (maxlayer + 1), {{0.0f, 0.0f}});
47  maxpos.resize(2 * (maxlayer + 1), {{0.0f, 0.0f}});
48  zees.resize(2 * (maxlayer + 1), 0.);
49  }
50 
51  typedef std::vector<reco::BasicCluster> ClusterCollection;
52 
53  std::vector<reco::HGCalMultiCluster> makeClusters(const reco::HGCalMultiCluster::ClusterCollection&);
54 
55 private:
57  void reset() {
58  for (auto& it : points) {
59  it.clear();
60  std::vector<KDNode>().swap(it);
61  }
62  std::fill(zees.begin(), zees.end(), 0.);
63  for (unsigned int i = 0; i < minpos.size(); i++) {
64  minpos[i][0] = 0.;
65  minpos[i][1] = 0.;
66  maxpos[i][0] = 0.;
67  maxpos[i][1] = 0.;
68  }
69  }
70  void layerIntersection(std::array<double, 3>& to, const std::array<double, 3>& from) const;
71 
72  //max number of layers
73  unsigned int maxlayer;
74 
75  std::vector<double> radii;
76  uint32_t minClusters;
77  struct ClusterRef {
78  int ind;
79  float z;
80  ClusterRef(int ind_i, float z_i) : ind(ind_i), z(z_i) {}
81  ClusterRef() : ind(-1), z(0.) {}
82  };
83 
86  std::vector<std::vector<KDNode>> points;
87  std::vector<std::array<float, 2>> minpos;
88  std::vector<std::array<float, 2>> maxpos;
89  std::vector<size_t> es;
90  std::vector<float> zees;
91  std::unique_ptr<hgcal::ClusterTools> clusterTools;
93 };
94 
95 #endif
std::vector< std::vector< KDNode > > points
ClusterRef(int ind_i, float z_i)
KDTreeNodeInfo< ClusterRef > KDNode
void getEventSetup(const edm::EventSetup &es)
HGCal3DClustering(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
bool ev
std::vector< reco::BasicCluster > ClusterCollection
std::vector< double > radii
unsigned int lastLayerBH() const
Definition: RecHitTools.h:65
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
void organizeByLayer(const reco::HGCalMultiCluster::ClusterCollection &)
KDTreeLinkerAlgo< ClusterRef > KDTree
void getEventSetup(const edm::EventSetup &)
Definition: RecHitTools.cc:70
std::vector< float > zees
void layerIntersection(std::array< double, 3 > &to, const std::array< double, 3 > &from) const
std::vector< std::array< float, 2 > > maxpos
std::vector< std::array< float, 2 > > minpos
void getEvent(const edm::Event &ev)
HGCal3DClustering(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes, const std::vector< double > &radii_in, uint32_t min_clusters)
std::unique_ptr< hgcal::ClusterTools > clusterTools
hgcal::RecHitTools rhtools_
unsigned int maxlayer
std::vector< size_t > es
std::vector< reco::HGCalMultiCluster > makeClusters(const reco::HGCalMultiCluster::ClusterCollection &)