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 
13 
15 
17 public:
18  HGCal3DClustering() : radii({0., 0., 0.}), minClusters(0), clusterTools(nullptr) {}
19 
22  const std::vector<double>& radii_in,
23  uint32_t min_clusters)
24  : radii(radii_in),
25  minClusters(min_clusters),
26  es(0),
27  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);
39  const CaloGeometry& geom = es.getData(caloGeomToken_);
42  points.clear();
43  minpos.clear();
44  maxpos.clear();
45  zees.clear();
46  points.resize(2 * (maxlayer + 1));
47  minpos.resize(2 * (maxlayer + 1), {{0.0f, 0.0f}});
48  maxpos.resize(2 * (maxlayer + 1), {{0.0f, 0.0f}});
49  zees.resize(2 * (maxlayer + 1), 0.);
50  }
51 
52  typedef std::vector<reco::BasicCluster> ClusterCollection;
53 
54  std::vector<reco::HGCalMultiCluster> makeClusters(const reco::HGCalMultiCluster::ClusterCollection&);
55 
56 private:
58  void reset() {
59  for (auto& it : points) {
60  it.clear();
61  std::vector<KDNode>().swap(it);
62  }
63  std::fill(zees.begin(), zees.end(), 0.);
64  for (unsigned int i = 0; i < minpos.size(); i++) {
65  minpos[i][0] = 0.;
66  minpos[i][1] = 0.;
67  maxpos[i][0] = 0.;
68  maxpos[i][1] = 0.;
69  }
70  }
71  void layerIntersection(std::array<double, 3>& to, const std::array<double, 3>& from) const;
72 
73  //max number of layers
74  unsigned int maxlayer;
75 
76  std::vector<double> radii;
77  uint32_t minClusters;
78  struct ClusterRef {
79  int ind;
80  float z;
81  ClusterRef(int ind_i, float z_i) : ind(ind_i), z(z_i) {}
82  ClusterRef() : ind(-1), z(0.) {}
83  };
84 
87  std::vector<std::vector<KDNode>> points;
88  std::vector<std::array<float, 2>> minpos;
89  std::vector<std::array<float, 2>> maxpos;
90  std::vector<size_t> es;
91  std::vector<float> zees;
92  std::unique_ptr<hgcal::ClusterTools> clusterTools;
95 };
96 
97 #endif
KDTreeLinkerAlgo.h
HGCal3DClustering::getEventSetup
void getEventSetup(const edm::EventSetup &es)
Definition: HGCal3DClustering.h:37
hgcal::RecHitTools
Definition: RecHitTools.h:23
mps_fire.i
i
Definition: mps_fire.py:428
HGCal3DClustering::points
std::vector< std::vector< KDNode > > points
Definition: HGCal3DClustering.h:87
HGCal3DClustering::KDNode
KDTreeNodeInfo< ClusterRef > KDNode
Definition: HGCal3DClustering.h:86
BasicCluster.h
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
HGCal3DClustering::ClusterRef
Definition: HGCal3DClustering.h:78
RecHitTools.h
HGCal3DClustering::KDTree
KDTreeLinkerAlgo< ClusterRef > KDTree
Definition: HGCal3DClustering.h:85
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:16
HGCal3DClustering::ClusterRef::ClusterRef
ClusterRef()
Definition: HGCal3DClustering.h:82
HGCal3DClustering::minClusters
uint32_t minClusters
Definition: HGCal3DClustering.h:77
hgcal
Definition: EgammaPCAHelper.h:31
HGCal3DClustering::HGCal3DClustering
HGCal3DClustering()
Definition: HGCal3DClustering.h:18
HGCal3DClustering::zees
std::vector< float > zees
Definition: HGCal3DClustering.h:91
HGCal3DClustering::ClusterCollection
std::vector< reco::BasicCluster > ClusterCollection
Definition: HGCal3DClustering.h:52
CaloGeometry
Definition: CaloGeometry.h:21
HGCal3DClustering::ClusterRef::ind
int ind
Definition: HGCal3DClustering.h:79
edm::PtrVector
Definition: PtrVector.h:36
HGCal3DClustering::ClusterRef::z
float z
Definition: HGCal3DClustering.h:80
HGCal3DClustering::radii
std::vector< double > radii
Definition: HGCal3DClustering.h:76
HGCal3DClustering::minpos
std::vector< std::array< float, 2 > > minpos
Definition: HGCal3DClustering.h:88
KDTreeLinkerAlgo
Definition: KDTreeLinkerAlgo.h:102
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
HGCal3DClustering::maxpos
std::vector< std::array< float, 2 > > maxpos
Definition: HGCal3DClustering.h:89
hgcal::RecHitTools::lastLayerBH
unsigned int lastLayerBH() const
Definition: RecHitTools.h:70
edm::ParameterSet
Definition: ParameterSet.h:47
HGCal3DClustering::layerIntersection
void layerIntersection(std::array< double, 3 > &to, const std::array< double, 3 > &from) const
Definition: HGCal3DClustering.cc:119
HGCal3DClustering::caloGeomToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
Definition: HGCal3DClustering.h:94
HGCal3DClustering::getEvent
void getEvent(const edm::Event &ev)
Definition: HGCal3DClustering.h:36
HGCal3DClustering::reset
void reset()
Definition: HGCal3DClustering.h:58
HGCal3DClustering::HGCal3DClustering
HGCal3DClustering(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes, const std::vector< double > &radii_in, uint32_t min_clusters)
Definition: HGCal3DClustering.h:20
HGCal3DClustering::clusterTools
std::unique_ptr< hgcal::ClusterTools > clusterTools
Definition: HGCal3DClustering.h:92
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:58
KDTreeNodeInfo
Definition: KDTreeLinkerAlgo.h:34
ClusterTools.h
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
std
Definition: JetResolutionObject.h:76
HGCal3DClustering::maxlayer
unsigned int maxlayer
Definition: HGCal3DClustering.h:74
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
HGCal3DClustering::es
std::vector< size_t > es
Definition: HGCal3DClustering.h:90
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
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:81
HGCal3DClustering::rhtools_
hgcal::RecHitTools rhtools_
Definition: HGCal3DClustering.h:93
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:45