CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HGCalDepthPreClusterer Class Reference

#include <HGCalDepthPreClusterer.h>

Public Types

typedef std::vector< reco::BasicClusterClusterCollection
 

Public Member Functions

void getEvent (const edm::Event &ev)
 
void getEventSetup (const edm::EventSetup &es)
 
 HGCalDepthPreClusterer ()
 
 HGCalDepthPreClusterer (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes, std::vector< float > radii_in, uint32_t min_clusters, bool real_space_cone)
 
std::vector< reco::HGCalMultiClustermakePreClusters (const reco::HGCalMultiCluster::ClusterCollection &) const
 

Private Attributes

edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeomToken_
 
std::unique_ptr< hgcal::ClusterToolsclusterTools
 
uint32_t minClusters
 
std::vector< float > radii
 
bool realSpaceCone
 
hgcal::RecHitTools rhtools_
 

Detailed Description

Definition at line 13 of file HGCalDepthPreClusterer.h.

Member Typedef Documentation

◆ ClusterCollection

Definition at line 43 of file HGCalDepthPreClusterer.h.

Constructor & Destructor Documentation

◆ HGCalDepthPreClusterer() [1/2]

HGCalDepthPreClusterer::HGCalDepthPreClusterer ( )
inline

Definition at line 15 of file HGCalDepthPreClusterer.h.

16  : radii({
17  0.,
18  0.,
19  0.,
20  }),
21  minClusters(0),
22  realSpaceCone(false),
23  clusterTools(nullptr) {}
std::unique_ptr< hgcal::ClusterTools > clusterTools
std::vector< float > radii

◆ HGCalDepthPreClusterer() [2/2]

HGCalDepthPreClusterer::HGCalDepthPreClusterer ( const edm::ParameterSet conf,
edm::ConsumesCollector sumes,
std::vector< float >  radii_in,
uint32_t  min_clusters,
bool  real_space_cone 
)
inline

Definition at line 25 of file HGCalDepthPreClusterer.h.

30  : radii(radii_in),
31  minClusters(min_clusters),
32  realSpaceCone(real_space_cone),
33  clusterTools(std::make_unique<hgcal::ClusterTools>(conf, sumes)),
std::unique_ptr< hgcal::ClusterTools > clusterTools
std::vector< float > radii
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_

Member Function Documentation

◆ getEvent()

void HGCalDepthPreClusterer::getEvent ( const edm::Event ev)
inline

Definition at line 36 of file HGCalDepthPreClusterer.h.

References clusterTools, and makeMEIFBenchmarkPlots::ev.

36 { clusterTools->getEvent(ev); }
std::unique_ptr< hgcal::ClusterTools > clusterTools

◆ getEventSetup()

void HGCalDepthPreClusterer::getEventSetup ( const edm::EventSetup es)
inline

Definition at line 37 of file HGCalDepthPreClusterer.h.

References caloGeomToken_, clusterTools, relativeConstraints::geom, edm::EventSetup::getHandle(), rhtools_, and hgcal::RecHitTools::setGeometry().

37  {
38  clusterTools->getEventSetup(es);
41  }
std::unique_ptr< hgcal::ClusterTools > clusterTools
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:79
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_

◆ makePreClusters()

std::vector< reco::HGCalMultiCluster > HGCalDepthPreClusterer::makePreClusters ( const reco::HGCalMultiCluster::ClusterCollection thecls) const

Definition at line 33 of file HGCalDepthPreClusterer.cc.

References clusterTools, ALCARECOPPSCalTrackBasedSel_cff::detid, hgcal::RecHitTools::firstLayerBH(), mps_fire::i, dqmiolumiharvest::j, hgcal::RecHitTools::lastLayerEE(), nano_mu_digi_cff::layer, minClusters, radii, CosmicsPD_Skims::radius, realSpaceCone, rhtools_, hgcal_clustering::sorted_indices(), groupFilesInBlocks::temp, and z.

34  {
35  std::vector<reco::HGCalMultiCluster> thePreClusters;
36  std::vector<size_t> es = sorted_indices(thecls);
37  std::vector<int> vused(es.size(), 0);
38 
39  for (unsigned int i = 0; i < es.size(); ++i) {
40  if (vused[i] == 0) {
42  temp.push_back(thecls[es[i]]);
43  vused[i] = (thecls[es[i]]->z() > 0) ? 1 : -1;
44  for (unsigned int j = i + 1; j < es.size(); ++j) {
45  if (vused[j] == 0) {
46  float distanceCheck = 9999.;
47  if (realSpaceCone)
48  distanceCheck = distAxisCluster2(thecls[es[i]], thecls[es[j]]);
49  else
50  distanceCheck = dist2(thecls[es[i]], thecls[es[j]]);
51  DetId detid = thecls[es[j]]->hitsAndFractions()[0].first();
52  unsigned int layer = clusterTools->getLayer(detid);
53  float radius = radii[2];
54  if (layer <= rhtools_.lastLayerEE())
55  radius = radii[0];
56  else if (layer < rhtools_.firstLayerBH())
57  radius = radii[1];
58  float radius2 = radius * radius;
59  if (distanceCheck < radius2 && int(thecls[es[j]]->z() * vused[i]) > 0) {
60  temp.push_back(thecls[es[j]]);
61  vused[j] = vused[i];
62  }
63  }
64  }
65  if (temp.size() > minClusters) {
66  thePreClusters.push_back(temp);
67  auto &back = thePreClusters.back();
68  back.setPosition(clusterTools->getMultiClusterPosition(back));
69  back.setEnergy(clusterTools->getMultiClusterEnergy(back));
70  }
71  }
72  }
73 
74  return thePreClusters;
75 }
unsigned int firstLayerBH() const
Definition: RecHitTools.h:78
std::unique_ptr< hgcal::ClusterTools > clusterTools
std::vector< size_t > sorted_indices(const std::vector< T > &v)
Definition: DetId.h:17
std::vector< float > radii
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:76

Member Data Documentation

◆ caloGeomToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HGCalDepthPreClusterer::caloGeomToken_
private

Definition at line 55 of file HGCalDepthPreClusterer.h.

Referenced by getEventSetup().

◆ clusterTools

std::unique_ptr<hgcal::ClusterTools> HGCalDepthPreClusterer::clusterTools
private

Definition at line 53 of file HGCalDepthPreClusterer.h.

Referenced by getEvent(), getEventSetup(), and makePreClusters().

◆ minClusters

uint32_t HGCalDepthPreClusterer::minClusters
private

Definition at line 50 of file HGCalDepthPreClusterer.h.

Referenced by makePreClusters().

◆ radii

std::vector<float> HGCalDepthPreClusterer::radii
private

Definition at line 49 of file HGCalDepthPreClusterer.h.

Referenced by makePreClusters().

◆ realSpaceCone

bool HGCalDepthPreClusterer::realSpaceCone
private

flag to use cartesian space clustering.

Definition at line 51 of file HGCalDepthPreClusterer.h.

Referenced by makePreClusters().

◆ rhtools_

hgcal::RecHitTools HGCalDepthPreClusterer::rhtools_
private

instance of tools to access RecHit information.

Definition at line 54 of file HGCalDepthPreClusterer.h.

Referenced by getEventSetup(), and makePreClusters().