CMS 3D CMS Logo

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