CMS 3D CMS Logo

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

#include <HGCalHistoClusteringImpl.h>

Public Member Functions

void clusterizeHisto (const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtr, const std::vector< std::pair< GlobalPoint, double >> &seedPositionsEnergy, const HGCalTriggerGeometryBase &triggerGeometry, l1t::HGCalMulticlusterBxCollection &multiclusters) const
 
float dR (const l1t::HGCalCluster &clu, const GlobalPoint &seed) const
 
void eventSetup (const edm::EventSetup &es)
 
 HGCalHistoClusteringImpl (const edm::ParameterSet &conf)
 

Private Types

enum  ClusterAssociationStrategy { NearestNeighbour, EnergySplit }
 

Private Member Functions

std::vector< l1t::HGCalMulticlusterclusterSeedMulticluster (const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs, const std::vector< std::pair< GlobalPoint, double >> &seeds) const
 
void finalizeClusters (std::vector< l1t::HGCalMulticluster > &, l1t::HGCalMulticlusterBxCollection &, const HGCalTriggerGeometryBase &) const
 

Private Attributes

std::string cluster_association_input_
 
ClusterAssociationStrategy cluster_association_strategy_
 
double dr_
 
std::vector< double > dr_byLayer_coefficientA_
 
std::vector< double > dr_byLayer_coefficientB_
 
std::unique_ptr< HGCalTriggerClusterIdentificationBaseid_
 
double ptC3dThreshold_
 
HGCalShowerShape shape_
 
HGCalTriggerTools triggerTools_
 

Static Private Attributes

static constexpr double kMidRadius_ = 2.3
 

Detailed Description

Definition at line 14 of file HGCalHistoClusteringImpl.h.

Member Enumeration Documentation

◆ ClusterAssociationStrategy

Enumerator
NearestNeighbour 
EnergySplit 

Definition at line 38 of file HGCalHistoClusteringImpl.h.

Constructor & Destructor Documentation

◆ HGCalHistoClusteringImpl()

HGCalHistoClusteringImpl::HGCalHistoClusteringImpl ( const edm::ParameterSet conf)

Definition at line 6 of file HGCalHistoClusteringImpl.cc.

7  : dr_(conf.getParameter<double>("dR_multicluster")),
8  dr_byLayer_coefficientA_(conf.existsAs<std::vector<double>>("dR_multicluster_byLayer_coefficientA")
9  ? conf.getParameter<std::vector<double>>("dR_multicluster_byLayer_coefficientA")
10  : std::vector<double>()),
11  dr_byLayer_coefficientB_(conf.existsAs<std::vector<double>>("dR_multicluster_byLayer_coefficientB")
12  ? conf.getParameter<std::vector<double>>("dR_multicluster_byLayer_coefficientB")
13  : std::vector<double>()),
14  ptC3dThreshold_(conf.getParameter<double>("minPt_multicluster")),
15  cluster_association_input_(conf.getParameter<string>("cluster_association")),
16  shape_(conf) {
17  if (cluster_association_input_ == "NearestNeighbour") {
19  } else if (cluster_association_input_ == "EnergySplit") {
21  } else {
22  throw cms::Exception("HGCTriggerParameterError")
23  << "Unknown cluster association strategy'" << cluster_association_strategy_;
24  }
25 
26  edm::LogInfo("HGCalMulticlusterParameters")
27  << "Multicluster dR: " << dr_ << "\nMulticluster minimum transverse-momentum: " << ptC3dThreshold_;
28 
29  id_ = std::unique_ptr<HGCalTriggerClusterIdentificationBase>{
30  HGCalTriggerClusterIdentificationFactory::get()->create("HGCalTriggerClusterIdentificationBDT")};
31  id_->initialize(conf.getParameter<edm::ParameterSet>("EGIdentification"));
32 }

References cluster_association_input_, cluster_association_strategy_, dr_, EnergySplit, Exception, get, edm::ParameterSet::getParameter(), id_, NearestNeighbour, and ptC3dThreshold_.

Member Function Documentation

◆ clusterizeHisto()

void HGCalHistoClusteringImpl::clusterizeHisto ( const std::vector< edm::Ptr< l1t::HGCalCluster >> &  clustersPtr,
const std::vector< std::pair< GlobalPoint, double >> &  seedPositionsEnergy,
const HGCalTriggerGeometryBase triggerGeometry,
l1t::HGCalMulticlusterBxCollection multiclusters 
) const

Definition at line 106 of file HGCalHistoClusteringImpl.cc.

109  {
110  /* clusterize clusters around seeds */
111  std::vector<l1t::HGCalMulticluster> multiclustersTmp = clusterSeedMulticluster(clustersPtrs, seedPositionsEnergy);
112  /* making the collection of multiclusters */
113  finalizeClusters(multiclustersTmp, multiclusters, triggerGeometry);
114 }

References clusterSeedMulticluster(), and finalizeClusters().

◆ clusterSeedMulticluster()

std::vector< l1t::HGCalMulticluster > HGCalHistoClusteringImpl::clusterSeedMulticluster ( const std::vector< edm::Ptr< l1t::HGCalCluster >> &  clustersPtrs,
const std::vector< std::pair< GlobalPoint, double >> &  seeds 
) const
private

Definition at line 38 of file HGCalHistoClusteringImpl.cc.

40  {
41  std::map<int, l1t::HGCalMulticluster> mapSeedMulticluster;
42  std::vector<l1t::HGCalMulticluster> multiclustersTmp;
43 
44  for (const auto& clu : clustersPtrs) {
45  int z_side = triggerTools_.zside(clu->detId());
46 
47  double radiusCoefficientA =
49  double radiusCoefficientB =
51 
52  double minDist = radiusCoefficientA + radiusCoefficientB * (kMidRadius_ - std::abs(clu->eta()));
53 
54  std::vector<pair<int, double>> targetSeedsEnergy;
55 
56  for (unsigned int iseed = 0; iseed < seeds.size(); iseed++) {
57  GlobalPoint seedPosition = seeds[iseed].first;
58  double seedEnergy = seeds[iseed].second;
59 
60  if (z_side * seedPosition.z() < 0)
61  continue;
62  double d = this->dR(*clu, seeds[iseed].first);
63 
64  if (d < minDist) {
66  targetSeedsEnergy.emplace_back(iseed, seedEnergy);
68  minDist = d;
69 
70  if (targetSeedsEnergy.empty()) {
71  targetSeedsEnergy.emplace_back(iseed, seedEnergy);
72  } else {
73  targetSeedsEnergy.at(0).first = iseed;
74  targetSeedsEnergy.at(0).second = seedEnergy;
75  }
76  }
77  }
78  }
79 
80  if (targetSeedsEnergy.empty())
81  continue;
82  //Loop over target seeds and divide up the clusters energy
83  double totalTargetSeedEnergy = 0;
84  for (const auto& energy : targetSeedsEnergy) {
85  totalTargetSeedEnergy += energy.second;
86  }
87 
88  for (const auto& energy : targetSeedsEnergy) {
89  double seedWeight = 1;
91  seedWeight = energy.second / totalTargetSeedEnergy;
92  if (mapSeedMulticluster[energy.first].size() == 0) {
93  mapSeedMulticluster[energy.first] = l1t::HGCalMulticluster(clu, seedWeight);
94  } else {
95  mapSeedMulticluster[energy.first].addConstituent(clu, true, seedWeight);
96  }
97  }
98  }
99 
100  for (const auto& mclu : mapSeedMulticluster)
101  multiclustersTmp.emplace_back(mclu.second);
102 
103  return multiclustersTmp;
104 }

References funct::abs(), cluster_association_strategy_, ztail::d, dR(), dr_, dr_byLayer_coefficientA_, dr_byLayer_coefficientB_, HCALHighEnergyHPDFilter_cfi::energy, EnergySplit, dqmdumpme::first, iseed, kMidRadius_, HGCalTriggerTools::layerWithOffset(), NearestNeighbour, InitialStep_cff::seeds, triggerTools_, PV3DBase< T, PVType, FrameType >::z(), and HGCalTriggerTools::zside().

Referenced by clusterizeHisto().

◆ dR()

float HGCalHistoClusteringImpl::dR ( const l1t::HGCalCluster clu,
const GlobalPoint seed 
) const

Definition at line 34 of file HGCalHistoClusteringImpl.cc.

34  {
35  return (seed - clu.centreProj()).mag();
36 }

References l1t::HGCalClusterT< C >::centreProj(), mag(), and SurveyInfoScenario_cff::seed.

Referenced by clusterSeedMulticluster().

◆ eventSetup()

void HGCalHistoClusteringImpl::eventSetup ( const edm::EventSetup es)
inline

Definition at line 18 of file HGCalHistoClusteringImpl.h.

18  {
20  shape_.eventSetup(es);
23  throw cms::Exception("Configuration")
24  << "The per-layer dR values go up to " << (dr_byLayer_coefficientA_.size() - 1) << "(A) and "
25  << (dr_byLayer_coefficientB_.size() - 1) << "(B), while layers go up to " << triggerTools_.lastLayerBH()
26  << "\n";
27  }
28  }

References dr_byLayer_coefficientA_, dr_byLayer_coefficientB_, HGCalShowerShape::eventSetup(), HGCalTriggerTools::eventSetup(), Exception, HGCalTriggerTools::lastLayerBH(), shape_, and triggerTools_.

◆ finalizeClusters()

void HGCalHistoClusteringImpl::finalizeClusters ( std::vector< l1t::HGCalMulticluster > &  multiclusters_in,
l1t::HGCalMulticlusterBxCollection multiclusters_out,
const HGCalTriggerGeometryBase triggerGeometry 
) const
private

Definition at line 116 of file HGCalHistoClusteringImpl.cc.

118  {
119  for (auto& multicluster : multiclusters_in) {
120  // compute the eta, phi from its barycenter
121  // + pT as scalar sum of pT of constituents
122  double sumPt = multicluster.sumPt();
123 
124  math::PtEtaPhiMLorentzVector multiclusterP4(sumPt, multicluster.centre().eta(), multicluster.centre().phi(), 0.);
125  multicluster.setP4(multiclusterP4);
126 
127  if (multicluster.pt() > ptC3dThreshold_) {
128  //compute shower shapes
129  shape_.fillShapes(multicluster, triggerGeometry);
130  // fill quality flag
131  multicluster.setHwQual(id_->decision(multicluster));
132  // fill H/E
133  multicluster.saveHOverE();
134 
135  multiclusters_out.push_back(0, multicluster);
136  }
137  }
138 }

References HGCalShowerShape::fillShapes(), id_, ptC3dThreshold_, BXVector< T >::push_back(), shape_, and TtFullHadEvtBuilder_cfi::sumPt.

Referenced by clusterizeHisto().

Member Data Documentation

◆ cluster_association_input_

std::string HGCalHistoClusteringImpl::cluster_association_input_
private

Definition at line 53 of file HGCalHistoClusteringImpl.h.

Referenced by HGCalHistoClusteringImpl().

◆ cluster_association_strategy_

ClusterAssociationStrategy HGCalHistoClusteringImpl::cluster_association_strategy_
private

Definition at line 54 of file HGCalHistoClusteringImpl.h.

Referenced by clusterSeedMulticluster(), and HGCalHistoClusteringImpl().

◆ dr_

double HGCalHistoClusteringImpl::dr_
private

Definition at line 48 of file HGCalHistoClusteringImpl.h.

Referenced by clusterSeedMulticluster(), and HGCalHistoClusteringImpl().

◆ dr_byLayer_coefficientA_

std::vector<double> HGCalHistoClusteringImpl::dr_byLayer_coefficientA_
private

Definition at line 49 of file HGCalHistoClusteringImpl.h.

Referenced by clusterSeedMulticluster(), and eventSetup().

◆ dr_byLayer_coefficientB_

std::vector<double> HGCalHistoClusteringImpl::dr_byLayer_coefficientB_
private

Definition at line 50 of file HGCalHistoClusteringImpl.h.

Referenced by clusterSeedMulticluster(), and eventSetup().

◆ id_

std::unique_ptr<HGCalTriggerClusterIdentificationBase> HGCalHistoClusteringImpl::id_
private

Definition at line 58 of file HGCalHistoClusteringImpl.h.

Referenced by finalizeClusters(), and HGCalHistoClusteringImpl().

◆ kMidRadius_

constexpr double HGCalHistoClusteringImpl::kMidRadius_ = 2.3
staticconstexprprivate

Definition at line 60 of file HGCalHistoClusteringImpl.h.

Referenced by clusterSeedMulticluster().

◆ ptC3dThreshold_

double HGCalHistoClusteringImpl::ptC3dThreshold_
private

Definition at line 51 of file HGCalHistoClusteringImpl.h.

Referenced by finalizeClusters(), and HGCalHistoClusteringImpl().

◆ shape_

HGCalShowerShape HGCalHistoClusteringImpl::shape_
private

Definition at line 56 of file HGCalHistoClusteringImpl.h.

Referenced by eventSetup(), and finalizeClusters().

◆ triggerTools_

HGCalTriggerTools HGCalHistoClusteringImpl::triggerTools_
private

Definition at line 57 of file HGCalHistoClusteringImpl.h.

Referenced by clusterSeedMulticluster(), and eventSetup().

HGCalShowerShape::fillShapes
void fillShapes(l1t::HGCalMulticluster &, const HGCalTriggerGeometryBase &) const
Definition: HGCalShowerShape.cc:515
HGCalTriggerTools::eventSetup
void eventSetup(const edm::EventSetup &)
Definition: HGCalTriggerTools.cc:35
HGCalHistoClusteringImpl::kMidRadius_
static constexpr double kMidRadius_
Definition: HGCalHistoClusteringImpl.h:60
HGCalHistoClusteringImpl::dR
float dR(const l1t::HGCalCluster &clu, const GlobalPoint &seed) const
Definition: HGCalHistoClusteringImpl.cc:34
HGCalHistoClusteringImpl::cluster_association_input_
std::string cluster_association_input_
Definition: HGCalHistoClusteringImpl.h:53
edm::LogInfo
Definition: MessageLogger.h:254
HGCalHistoClusteringImpl::finalizeClusters
void finalizeClusters(std::vector< l1t::HGCalMulticluster > &, l1t::HGCalMulticlusterBxCollection &, const HGCalTriggerGeometryBase &) const
Definition: HGCalHistoClusteringImpl.cc:116
HGCalHistoClusteringImpl::clusterSeedMulticluster
std::vector< l1t::HGCalMulticluster > clusterSeedMulticluster(const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs, const std::vector< std::pair< GlobalPoint, double >> &seeds) const
Definition: HGCalHistoClusteringImpl.cc:38
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
dqmdumpme.first
first
Definition: dqmdumpme.py:55
TtFullHadEvtBuilder_cfi.sumPt
sumPt
Definition: TtFullHadEvtBuilder_cfi.py:38
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
HGCalHistoClusteringImpl::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalHistoClusteringImpl.h:57
l1t::HGCalMulticluster
Definition: HGCalMulticluster.h:13
HGCalHistoClusteringImpl::dr_byLayer_coefficientA_
std::vector< double > dr_byLayer_coefficientA_
Definition: HGCalHistoClusteringImpl.h:49
HGCalTriggerTools::lastLayerBH
unsigned lastLayerBH() const
Definition: HGCalTriggerTools.h:56
HGCalHistoClusteringImpl::ptC3dThreshold_
double ptC3dThreshold_
Definition: HGCalHistoClusteringImpl.h:51
HGCalHistoClusteringImpl::dr_
double dr_
Definition: HGCalHistoClusteringImpl.h:48
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HGCalTriggerTools::layerWithOffset
unsigned layerWithOffset(const DetId &) const
Definition: HGCalTriggerTools.cc:134
HGCalTriggerTools::zside
int zside(const DetId &) const
Definition: HGCalTriggerTools.cc:210
Point3DBase< float, GlobalTag >
HGCalHistoClusteringImpl::EnergySplit
Definition: HGCalHistoClusteringImpl.h:38
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:232
edm::ParameterSet
Definition: ParameterSet.h:36
iseed
int iseed
Definition: AMPTWrapper.h:134
HGCalShowerShape::eventSetup
void eventSetup(const edm::EventSetup &es)
Definition: HGCalShowerShape.h:21
HGCalHistoClusteringImpl::id_
std::unique_ptr< HGCalTriggerClusterIdentificationBase > id_
Definition: HGCalHistoClusteringImpl.h:58
get
#define get
HGCalHistoClusteringImpl::dr_byLayer_coefficientB_
std::vector< double > dr_byLayer_coefficientB_
Definition: HGCalHistoClusteringImpl.h:50
HGCalHistoClusteringImpl::cluster_association_strategy_
ClusterAssociationStrategy cluster_association_strategy_
Definition: HGCalHistoClusteringImpl.h:54
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
Exception
Definition: hltDiff.cc:246
HGCalHistoClusteringImpl::shape_
HGCalShowerShape shape_
Definition: HGCalHistoClusteringImpl.h:56
l1t::HGCalClusterT::centreProj
const GlobalPoint & centreProj() const
Definition: HGCalClusterT.h:103
ztail.d
d
Definition: ztail.py:151
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCalHistoClusteringImpl::NearestNeighbour
Definition: HGCalHistoClusteringImpl.h:38
BXVector::push_back
void push_back(int bx, T object)
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295