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:68
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, hgcal::RecHitTools::firstLayerBH(), mps_fire::i, dqmiolumiharvest::j, hgcal::RecHitTools::lastLayerEE(), pixelTopology::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  unsigned int used = 0;
39 
40  for (unsigned int i = 0; i < es.size(); ++i) {
41  if (vused[i] == 0) {
43  temp.push_back(thecls[es[i]]);
44  vused[i] = (thecls[es[i]]->z() > 0) ? 1 : -1;
45  ++used;
46  for (unsigned int j = i + 1; j < es.size(); ++j) {
47  if (vused[j] == 0) {
48  float distanceCheck = 9999.;
49  if (realSpaceCone)
50  distanceCheck = distAxisCluster2(thecls[es[i]], thecls[es[j]]);
51  else
52  distanceCheck = dist2(thecls[es[i]], thecls[es[j]]);
53  DetId detid = thecls[es[j]]->hitsAndFractions()[0].first();
54  unsigned int layer = clusterTools->getLayer(detid);
55  float radius = radii[2];
56  if (layer <= rhtools_.lastLayerEE())
57  radius = radii[0];
58  else if (layer < rhtools_.firstLayerBH())
59  radius = radii[1];
60  float radius2 = radius * radius;
61  if (distanceCheck<radius2 &&int(thecls[es[j]]->z() * vused[i])> 0) {
62  temp.push_back(thecls[es[j]]);
63  vused[j] = vused[i];
64  ++used;
65  }
66  }
67  }
68  if (temp.size() > minClusters) {
69  thePreClusters.push_back(temp);
70  auto &back = thePreClusters.back();
71  back.setPosition(clusterTools->getMultiClusterPosition(back));
72  back.setEnergy(clusterTools->getMultiClusterEnergy(back));
73  }
74  }
75  }
76 
77  return thePreClusters;
78 }
unsigned int firstLayerBH() const
Definition: RecHitTools.h:77
std::unique_ptr< hgcal::ClusterTools > clusterTools
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
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:75

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().