CMS 3D CMS Logo

List of all members | Public Member Functions
HGCalHistoClusteringImplSA Class Reference

#include <HGCalHistoClusteringImpl_SA.h>

Public Member Functions

std::vector< l1thgcfirmware::HGCalMulticlusterclusterSeedMulticluster_SA (const std::vector< l1thgcfirmware::HGCalCluster > &clusters, const std::vector< l1thgcfirmware::HGCalSeed > &seeds, std::vector< l1thgcfirmware::HGCalCluster > &rejected_clusters, const l1thgcfirmware::ClusterAlgoConfig &configuration) const
 
void finalizeClusters_SA (const std::vector< l1thgcfirmware::HGCalMulticluster > &, const std::vector< l1thgcfirmware::HGCalCluster > &, std::vector< l1thgcfirmware::HGCalMulticluster > &, std::vector< l1thgcfirmware::HGCalCluster > &, const l1thgcfirmware::ClusterAlgoConfig &configuration) const
 
 HGCalHistoClusteringImplSA ()=default
 
void runAlgorithm () const
 
 ~HGCalHistoClusteringImplSA ()=default
 

Detailed Description

Definition at line 13 of file HGCalHistoClusteringImpl_SA.h.

Constructor & Destructor Documentation

◆ HGCalHistoClusteringImplSA()

HGCalHistoClusteringImplSA::HGCalHistoClusteringImplSA ( )
default

◆ ~HGCalHistoClusteringImplSA()

HGCalHistoClusteringImplSA::~HGCalHistoClusteringImplSA ( )
default

Member Function Documentation

◆ clusterSeedMulticluster_SA()

std::vector< l1thgcfirmware::HGCalMulticluster > HGCalHistoClusteringImplSA::clusterSeedMulticluster_SA ( const std::vector< l1thgcfirmware::HGCalCluster > &  clusters,
const std::vector< l1thgcfirmware::HGCalSeed > &  seeds,
std::vector< l1thgcfirmware::HGCalCluster > &  rejected_clusters,
const l1thgcfirmware::ClusterAlgoConfig configuration 
) const

Definition at line 6 of file HGCalHistoClusteringImpl_SA.cc.

References funct::abs(), bsc_activity_cfg::clusters, JetHT_cfg::configuration, ztail::d, hcalRecHitTable_cff::energy, iseed, fileCollector::seed, and HLT_2024v13_cff::seeds.

Referenced by HGCalHistoClusteringWrapper::clusterizeHisto().

10  {
11  std::map<int, l1thgcfirmware::HGCalMulticluster> mapSeedMulticluster;
12  std::vector<l1thgcfirmware::HGCalMulticluster> multiclustersOut;
13 
14  for (const auto& clu : clusters) {
15  int z_side = clu.zside();
16 
17  double radiusCoefficientA = configuration.dr_byLayer_coefficientA().empty()
18  ? configuration.dr()
19  : configuration.dr_byLayer_coefficientA()[clu.layer()];
20  double radiusCoefficientB =
21  configuration.dr_byLayer_coefficientB().empty() ? 0 : configuration.dr_byLayer_coefficientB()[clu.layer()];
22 
23  double minDistSqrd = radiusCoefficientA + radiusCoefficientB * (configuration.midRadius() - std::abs(clu.eta()));
24  minDistSqrd *= minDistSqrd;
25 
26  std::vector<std::pair<int, double>> targetSeedsEnergy;
27 
28  unsigned int iseed = 0;
29  for (const auto& seed : seeds) {
30  if (z_side * seed.z() < 0) {
31  ++iseed;
32  continue;
33  }
34 
35  double seedEnergy = seed.energy();
36 
37  double d = (clu.x() - seed.x()) * (clu.x() - seed.x()) + (clu.y() - seed.y()) * (clu.y() - seed.y());
38 
39  if (d < minDistSqrd) {
40  // NearestNeighbour
41  minDistSqrd = d;
42 
43  if (targetSeedsEnergy.empty()) {
44  targetSeedsEnergy.emplace_back(iseed, seedEnergy);
45  } else {
46  targetSeedsEnergy.at(0).first = iseed;
47  targetSeedsEnergy.at(0).second = seedEnergy;
48  }
49  }
50  ++iseed;
51  }
52 
53  if (targetSeedsEnergy.empty()) {
54  rejected_clusters.emplace_back(clu);
55  continue;
56  }
57 
58  // N.B. as I have only implemented NearestNeighbour option
59  // then targetSeedsEnergy has at most 1 seed for this cluster
60  // Leaving in some redundant functionality in case we need
61  // EnergySplit option
62 
63  for (const auto& energy : targetSeedsEnergy) {
64  double seedWeight = 1;
65  if (mapSeedMulticluster[energy.first].size() == 0) {
66  mapSeedMulticluster[energy.first] = l1thgcfirmware::HGCalMulticluster(clu, 1);
67  } else {
68  mapSeedMulticluster[energy.first].addConstituent(clu, true, seedWeight);
69  }
70  }
71  }
72 
73  multiclustersOut.reserve(mapSeedMulticluster.size());
74  for (const auto& mclu : mapSeedMulticluster)
75  multiclustersOut.emplace_back(mclu.second);
76 
77  return multiclustersOut;
78 }
dictionary configuration
Definition: JetHT_cfg.py:38
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
d
Definition: ztail.py:151
int iseed
Definition: AMPTWrapper.h:134

◆ finalizeClusters_SA()

void HGCalHistoClusteringImplSA::finalizeClusters_SA ( const std::vector< l1thgcfirmware::HGCalMulticluster > &  multiclusters_in,
const std::vector< l1thgcfirmware::HGCalCluster > &  rejected_clusters_in,
std::vector< l1thgcfirmware::HGCalMulticluster > &  multiclusters_out,
std::vector< l1thgcfirmware::HGCalCluster > &  rejected_clusters_out,
const l1thgcfirmware::ClusterAlgoConfig configuration 
) const

Definition at line 80 of file HGCalHistoClusteringImpl_SA.cc.

References JetHT_cfg::configuration.

Referenced by HGCalHistoClusteringWrapper::clusterizeHisto().

85  {
86  for (const auto& tc : rejected_clusters_in) {
87  rejected_clusters_out.push_back(tc);
88  }
89 
90  for (const auto& multicluster : multiclusters_in) {
91  if (multicluster.sumPt() > configuration.ptC3dThreshold()) {
92  multiclusters_out.push_back(multicluster);
93  } else {
94  for (const auto& tc : multicluster.constituents()) {
95  rejected_clusters_out.push_back(tc);
96  }
97  }
98  }
99 }
dictionary configuration
Definition: JetHT_cfg.py:38

◆ runAlgorithm()

void HGCalHistoClusteringImplSA::runAlgorithm ( ) const