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

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) {}

◆ 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)) {}

Member Function Documentation

◆ getEvent()

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

Definition at line 35 of file HGCalDepthPreClusterer.h.

35 { clusterTools->getEvent(ev); }

References clusterTools, and ev.

◆ getEventSetup()

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

◆ makePreClusters()

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

Definition at line 33 of file HGCalDepthPreClusterer.cc.

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 }

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

Member Data Documentation

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

mps_fire.i
i
Definition: mps_fire.py:428
hgcal_clustering::sorted_indices
std::vector< size_t > sorted_indices(const std::vector< T > &v)
Definition: HGCalClusteringAlgoBase.h:18
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
HGCalDepthPreClusterer::realSpaceCone
bool realSpaceCone
Definition: HGCalDepthPreClusterer.h:51
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
HGCalDepthPreClusterer::clusterTools
std::unique_ptr< hgcal::ClusterTools > clusterTools
Definition: HGCalDepthPreClusterer.h:53
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DDAxes::z
edm::ESHandle< CaloGeometry >
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCalDepthPreClusterer::minClusters
uint32_t minClusters
Definition: HGCalDepthPreClusterer.h:50
HGCalDepthPreClusterer::rhtools_
hgcal::RecHitTools rhtools_
Definition: HGCalDepthPreClusterer.h:54
hgcal::RecHitTools::lastLayerEE
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:64
get
#define get
HGCalDepthPreClusterer::radii
std::vector< float > radii
Definition: HGCalDepthPreClusterer.h:49
reco::HGCalMultiCluster
Definition: HGCalMultiCluster.h:12
hgcal::RecHitTools::firstLayerBH
unsigned int firstLayerBH() const
Definition: RecHitTools.h:66
hgcal::RecHitTools::setGeometry
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:68
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66