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
KDTreeLinkerAlgo.h
HGCal3DClustering::getEventSetup
void getEventSetup(const edm::EventSetup &es)
Definition: HGCal3DClustering.h:37
hgcal::RecHitTools
Definition: RecHitTools.h:21
mps_fire.i
i
Definition: mps_fire.py:355
HGCal3DClustering::points
std::vector< std::vector< KDNode > > points
Definition: HGCal3DClustering.h:86
HGCalClusteringAlgoBase.h
HGCal3DClustering::KDNode
KDTreeNodeInfo< ClusterRef > KDNode
Definition: HGCal3DClustering.h:85
BasicCluster.h
HGCal3DClustering::ClusterRef
Definition: HGCal3DClustering.h:77
HGCal3DClustering::KDTree
KDTreeLinkerAlgo< ClusterRef > KDTree
Definition: HGCal3DClustering.h:84
HGCal3DClustering::organizeByLayer
void organizeByLayer(const reco::HGCalMultiCluster::ClusterCollection &)
Definition: HGCal3DClustering.cc:21
HGCalMultiCluster.h
HGCal3DClustering::HGCal3DClustering
HGCal3DClustering(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Definition: HGCal3DClustering.h:30
to
HGCal3DClustering
Definition: HGCal3DClustering.h:17
HGCal3DClustering::ClusterRef::ClusterRef
ClusterRef()
Definition: HGCal3DClustering.h:81
HGCal3DClustering::minClusters
uint32_t minClusters
Definition: HGCal3DClustering.h:76
hgcal
Definition: EgammaPCAHelper.h:31
HGCal3DClustering::HGCal3DClustering
HGCal3DClustering()
Definition: HGCal3DClustering.h:19
HGCal3DClustering::zees
std::vector< float > zees
Definition: HGCal3DClustering.h:90
HGCal3DClustering::ClusterCollection
std::vector< reco::BasicCluster > ClusterCollection
Definition: HGCal3DClustering.h:51
HGCal3DClustering::ClusterRef::ind
int ind
Definition: HGCal3DClustering.h:78
edm::PtrVector
Definition: PtrVector.h:36
HGCal3DClustering::ClusterRef::z
float z
Definition: HGCal3DClustering.h:79
HGCal3DClustering::radii
std::vector< double > radii
Definition: HGCal3DClustering.h:75
HGCal3DClustering::minpos
std::vector< std::array< float, 2 > > minpos
Definition: HGCal3DClustering.h:87
KDTreeLinkerAlgo
Definition: KDTreeLinkerAlgo.h:102
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
HGCal3DClustering::maxpos
std::vector< std::array< float, 2 > > maxpos
Definition: HGCal3DClustering.h:88
hgcal::RecHitTools::lastLayerBH
unsigned int lastLayerBH() const
Definition: RecHitTools.h:66
edm::ParameterSet
Definition: ParameterSet.h:36
HGCal3DClustering::layerIntersection
void layerIntersection(std::array< double, 3 > &to, const std::array< double, 3 > &from) const
Definition: HGCal3DClustering.cc:119
HGCal3DClustering::getEvent
void getEvent(const edm::Event &ev)
Definition: HGCal3DClustering.h:36
HGCal3DClustering::reset
void reset()
Definition: HGCal3DClustering.h:57
HGCal3DClustering::HGCal3DClustering
HGCal3DClustering(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes, const std::vector< double > &radii_in, uint32_t min_clusters)
Definition: HGCal3DClustering.h:21
HGCal3DClustering::clusterTools
std::unique_ptr< hgcal::ClusterTools > clusterTools
Definition: HGCal3DClustering.h:91
edm::EventSetup
Definition: EventSetup.h:57
KDTreeNodeInfo
Definition: KDTreeLinkerAlgo.h:34
ClusterTools.h
hgcal::RecHitTools::getEventSetup
void getEventSetup(const edm::EventSetup &)
Definition: RecHitTools.cc:70
std
Definition: JetResolutionObject.h:76
HGCal3DClustering::maxlayer
unsigned int maxlayer
Definition: HGCal3DClustering.h:73
HGCal3DClustering::es
std::vector< size_t > es
Definition: HGCal3DClustering.h:89
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
HGCal3DClustering::makeClusters
std::vector< reco::HGCalMultiCluster > makeClusters(const reco::HGCalMultiCluster::ClusterCollection &)
Definition: HGCal3DClustering.cc:48
Point3D.h
HGCal3DClustering::ClusterRef::ClusterRef
ClusterRef(int ind_i, float z_i)
Definition: HGCal3DClustering.h:80
HGCal3DClustering::rhtools_
hgcal::RecHitTools rhtools_
Definition: HGCal3DClustering.h:92
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
RecHitTools.h