CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HGCalHistoClusteringWrapper Class Reference
Inheritance diagram for HGCalHistoClusteringWrapper:
HGCalAlgoWrapperBaseT< InputCollection, OutputCollection, Tparam >

Public Member Functions

void configure (const std::pair< const HGCalTriggerGeometryBase *const, const edm::ParameterSet &> &configuration) override
 
 HGCalHistoClusteringWrapper (const edm::ParameterSet &conf)
 
void process (const std::pair< const std::vector< edm::Ptr< l1t::HGCalCluster >>, const std::vector< std::pair< GlobalPoint, double >>> &inputClustersAndSeeds, std::pair< l1t::HGCalMulticlusterBxCollection &, l1t::HGCalClusterBxCollection &> &outputMulticlustersAndRejectedClusters) const override
 
 ~HGCalHistoClusteringWrapper () override
 
- Public Member Functions inherited from HGCalAlgoWrapperBaseT< InputCollection, OutputCollection, Tparam >
virtual void configure (const Tparam &parameters)=0
 
 HGCalAlgoWrapperBaseT (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual void process (const InputCollection &inputCollection, OutputCollection &outputCollection) const =0
 
virtual ~HGCalAlgoWrapperBaseT ()
 

Private Member Functions

void clusterizeHisto (const l1thgcfirmware::HGCalClusterSACollection &inputClusters, const l1thgcfirmware::HGCalSeedSACollection &inputSeeds, l1thgcfirmware::HGCalMulticlusterSACollection &outputMulticlusters, l1thgcfirmware::HGCalClusterSACollection &outputRejectedClusters) const
 
void convertAlgorithmOutputs (const l1thgcfirmware::HGCalMulticlusterSACollection &multiclusters_out, const l1thgcfirmware::HGCalClusterSACollection &rejected_clusters_out, const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs, l1t::HGCalMulticlusterBxCollection &multiclusters, l1t::HGCalClusterBxCollection &rejected_clusters) const
 
void convertCMSSWInputs (const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs, l1thgcfirmware::HGCalClusterSACollection &clusters_SA, const std::vector< std::pair< GlobalPoint, double >> &seeds, l1thgcfirmware::HGCalSeedSACollection &seeds_SA) const
 
void setGeometry (const HGCalTriggerGeometryBase *const geom)
 

Private Attributes

HGCalHistoClusteringImplSA theAlgo_
 
l1thgcfirmware::ClusterAlgoConfig theConfiguration_
 
HGCalTriggerTools triggerTools_
 

Static Private Attributes

static constexpr double kMidRadius_ = 2.3
 

Detailed Description

Definition at line 18 of file HGCalHistoClusteringWrapper.cc.

Constructor & Destructor Documentation

◆ HGCalHistoClusteringWrapper()

HGCalHistoClusteringWrapper::HGCalHistoClusteringWrapper ( const edm::ParameterSet conf)

Definition at line 58 of file HGCalHistoClusteringWrapper.cc.

60  theAlgo_(),
62  conf.getParameter<double>("dR_multicluster"),
63  conf.existsAs<std::vector<double>>("dR_multicluster_byLayer_coefficientA")
64  ? conf.getParameter<std::vector<double>>("dR_multicluster_byLayer_coefficientA")
65  : std::vector<double>(),
66  conf.existsAs<std::vector<double>>("dR_multicluster_byLayer_coefficientB")
67  ? conf.getParameter<std::vector<double>>("dR_multicluster_byLayer_coefficientB")
68  : std::vector<double>(),
69  conf.getParameter<double>("minPt_multicluster")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
HGCalHistoClusteringImplSA theAlgo_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
l1thgcfirmware::ClusterAlgoConfig theConfiguration_
HGCalAlgoWrapperBaseT< std::pair< const std::vector< edm::Ptr< l1t::HGCalCluster > >, const std::vector< std::pair< GlobalPoint, double > > >, std::pair< l1t::HGCalMulticlusterBxCollection &, l1t::HGCalClusterBxCollection & >, std::pair< const HGCalTriggerGeometryBase *const, const edm::ParameterSet & > > HGCalHistoClusteringWrapperBase

◆ ~HGCalHistoClusteringWrapper()

HGCalHistoClusteringWrapper::~HGCalHistoClusteringWrapper ( )
inlineoverride

Definition at line 21 of file HGCalHistoClusteringWrapper.cc.

21 {}

Member Function Documentation

◆ clusterizeHisto()

void HGCalHistoClusteringWrapper::clusterizeHisto ( const l1thgcfirmware::HGCalClusterSACollection inputClusters,
const l1thgcfirmware::HGCalSeedSACollection inputSeeds,
l1thgcfirmware::HGCalMulticlusterSACollection outputMulticlusters,
l1thgcfirmware::HGCalClusterSACollection outputRejectedClusters 
) const
private

Definition at line 155 of file HGCalHistoClusteringWrapper.cc.

References HGCalHistoClusteringImplSA::clusterSeedMulticluster_SA(), HGCalHistoClusteringImplSA::finalizeClusters_SA(), HLT_FULL_cff::inputClusters, theAlgo_, and theConfiguration_.

Referenced by process().

159  {
160  // Call SA clustering
161  std::vector<l1thgcfirmware::HGCalCluster> rejected_clusters_vec_SA;
162  std::vector<l1thgcfirmware::HGCalMulticluster> multiclusters_vec_SA =
163  theAlgo_.clusterSeedMulticluster_SA(inputClusters, inputSeeds, rejected_clusters_vec_SA, theConfiguration_);
164 
166  multiclusters_vec_SA, rejected_clusters_vec_SA, outputMulticlusters, outputRejectedClusters, theConfiguration_);
167 }
HGCalHistoClusteringImplSA theAlgo_
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
std::vector< l1thgcfirmware::HGCalMulticluster > 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
l1thgcfirmware::ClusterAlgoConfig theConfiguration_

◆ configure()

void HGCalHistoClusteringWrapper::configure ( const std::pair< const HGCalTriggerGeometryBase *const, const edm::ParameterSet &> &  configuration)
override

Definition at line 169 of file HGCalHistoClusteringWrapper.cc.

References JetHT_cfg::configuration, l1thgcfirmware::ClusterAlgoConfig::dr_byLayer_coefficientA(), l1thgcfirmware::ClusterAlgoConfig::dr_byLayer_coefficientB(), Exception, HGCalTriggerTools::lastLayerBH(), setGeometry(), theConfiguration_, and triggerTools_.

170  {
171  setGeometry(configuration.first);
172 
173  // theConfiguration_.setParameters( ... );
174 
175  if ((!theConfiguration_.dr_byLayer_coefficientA().empty() &&
179  throw cms::Exception("Configuration")
180  << "The per-layer dR values go up to " << (theConfiguration_.dr_byLayer_coefficientA().size() - 1) << "(A) and "
181  << (theConfiguration_.dr_byLayer_coefficientB().size() - 1) << "(B), while layers go up to "
182  << triggerTools_.lastLayerBH() << "\n";
183  }
184 };
void setGeometry(const HGCalTriggerGeometryBase *const geom)
const std::vector< double > & dr_byLayer_coefficientA() const
const std::vector< double > & dr_byLayer_coefficientB() const
dictionary configuration
Definition: JetHT_cfg.py:38
unsigned lastLayerBH() const
l1thgcfirmware::ClusterAlgoConfig theConfiguration_

◆ convertAlgorithmOutputs()

void HGCalHistoClusteringWrapper::convertAlgorithmOutputs ( const l1thgcfirmware::HGCalMulticlusterSACollection multiclusters_out,
const l1thgcfirmware::HGCalClusterSACollection rejected_clusters_out,
const std::vector< edm::Ptr< l1t::HGCalCluster >> &  clustersPtrs,
l1t::HGCalMulticlusterBxCollection multiclusters,
l1t::HGCalClusterBxCollection rejected_clusters 
) const
private

Definition at line 99 of file HGCalHistoClusteringWrapper.cc.

References BXVector< T >::push_back().

Referenced by process().

104  {
105  // Not doing completely the correct thing here
106  // Taking the multiclusters from the stand alone emulation
107  // Getting their consistuent clusters (stand alone objects)
108  // Linking back to the original CMSSW-type cluster
109  // And creating a CMSSW-type multicluster based from these clusters
110  // So the output multiclusters will not be storing bit accurate quantities (or whatever was derived by the stand along emulation)
111  // As these inherit from L1Candidate, could set their HW quantities to the bit accurate ones
112  for (const auto& rejected_cluster : rejected_clusters_out) {
113  rejected_clusters.push_back(0, *clustersPtrs.at(rejected_cluster.index_cmssw()));
114  }
115 
116  std::vector<l1t::HGCalMulticluster> multiclusters;
117  multiclusters.reserve(multiclusters_out.size());
118  for (unsigned int imulticluster = 0; imulticluster < multiclusters_out.size(); ++imulticluster) {
119  bool firstConstituent = true;
120  for (const auto& constituent : multiclusters_out[imulticluster].constituents()) {
121  if (firstConstituent) {
122  multiclusters.emplace_back(clustersPtrs.at(constituent.index_cmssw()), 1.);
123  } else {
124  multiclusters.at(imulticluster).addConstituent(clustersPtrs.at(constituent.index_cmssw()), 1.);
125  }
126  firstConstituent = false;
127  }
128  }
129 
130  for (const auto& multicluster : multiclusters) {
131  multiclustersBXCollection.push_back(0, multicluster);
132  }
133 }
const T & at(int bx, unsigned i) const
void push_back(int bx, T object)

◆ convertCMSSWInputs()

void HGCalHistoClusteringWrapper::convertCMSSWInputs ( const std::vector< edm::Ptr< l1t::HGCalCluster >> &  clustersPtrs,
l1thgcfirmware::HGCalClusterSACollection clusters_SA,
const std::vector< std::pair< GlobalPoint, double >> &  seeds,
l1thgcfirmware::HGCalSeedSACollection seeds_SA 
) const
private

Definition at line 71 of file HGCalHistoClusteringWrapper.cc.

References HGCalTriggerTools::layerWithOffset(), fileCollector::seed, HLT_2024v12_cff::seeds, triggerTools_, and HGCalTriggerTools::zside().

Referenced by process().

74  {
75  clusters_SA.clear();
76  clusters_SA.reserve(clustersPtrs.size());
77  unsigned int clusterIndex = 0;
78  for (const auto& cluster : clustersPtrs) {
79  clusters_SA.emplace_back(cluster->centreProj().x(),
80  cluster->centreProj().y(),
81  cluster->centre().z(),
82  triggerTools_.zside(cluster->detId()),
83  triggerTools_.layerWithOffset(cluster->detId()),
84  cluster->eta(),
85  cluster->phi(),
86  cluster->pt(),
87  cluster->mipPt(),
88  clusterIndex);
89  ++clusterIndex;
90  }
91 
92  seeds_SA.clear();
93  seeds_SA.reserve(seeds.size());
94  for (const auto& seed : seeds) {
95  seeds_SA.emplace_back(seed.first.x(), seed.first.y(), seed.first.z(), seed.second);
96  }
97 }
int zside(const DetId &) const
unsigned layerWithOffset(const DetId &) const

◆ process()

void HGCalHistoClusteringWrapper::process ( const std::pair< const std::vector< edm::Ptr< l1t::HGCalCluster >>, const std::vector< std::pair< GlobalPoint, double >>> &  inputClustersAndSeeds,
std::pair< l1t::HGCalMulticlusterBxCollection &, l1t::HGCalClusterBxCollection &> &  outputMulticlustersAndRejectedClusters 
) const
override

Definition at line 135 of file HGCalHistoClusteringWrapper.cc.

References clusterizeHisto(), convertAlgorithmOutputs(), and convertCMSSWInputs().

139  {
142  convertCMSSWInputs(inputClustersAndSeeds.first, clusters_SA, inputClustersAndSeeds.second, seeds_SA);
143 
144  l1thgcfirmware::HGCalClusterSACollection rejected_clusters_finalized_SA;
145  l1thgcfirmware::HGCalMulticlusterSACollection multiclusters_finalized_SA;
146  clusterizeHisto(clusters_SA, seeds_SA, multiclusters_finalized_SA, rejected_clusters_finalized_SA);
147 
148  convertAlgorithmOutputs(multiclusters_finalized_SA,
149  rejected_clusters_finalized_SA,
150  inputClustersAndSeeds.first,
151  outputMulticlustersAndRejectedClusters.first,
152  outputMulticlustersAndRejectedClusters.second);
153 }
std::vector< HGCalCluster > HGCalClusterSACollection
void convertAlgorithmOutputs(const l1thgcfirmware::HGCalMulticlusterSACollection &multiclusters_out, const l1thgcfirmware::HGCalClusterSACollection &rejected_clusters_out, const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs, l1t::HGCalMulticlusterBxCollection &multiclusters, l1t::HGCalClusterBxCollection &rejected_clusters) const
void convertCMSSWInputs(const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs, l1thgcfirmware::HGCalClusterSACollection &clusters_SA, const std::vector< std::pair< GlobalPoint, double >> &seeds, l1thgcfirmware::HGCalSeedSACollection &seeds_SA) const
std::vector< HGCalSeed > HGCalSeedSACollection
Definition: HGCalSeed_SA.h:24
void clusterizeHisto(const l1thgcfirmware::HGCalClusterSACollection &inputClusters, const l1thgcfirmware::HGCalSeedSACollection &inputSeeds, l1thgcfirmware::HGCalMulticlusterSACollection &outputMulticlusters, l1thgcfirmware::HGCalClusterSACollection &outputRejectedClusters) const
std::vector< HGCalMulticluster > HGCalMulticlusterSACollection

◆ setGeometry()

void HGCalHistoClusteringWrapper::setGeometry ( const HGCalTriggerGeometryBase *const  geom)
inlineprivate

Member Data Documentation

◆ kMidRadius_

constexpr double HGCalHistoClusteringWrapper::kMidRadius_ = 2.3
staticprivate

Definition at line 55 of file HGCalHistoClusteringWrapper.cc.

◆ theAlgo_

HGCalHistoClusteringImplSA HGCalHistoClusteringWrapper::theAlgo_
private

Definition at line 51 of file HGCalHistoClusteringWrapper.cc.

Referenced by clusterizeHisto().

◆ theConfiguration_

l1thgcfirmware::ClusterAlgoConfig HGCalHistoClusteringWrapper::theConfiguration_
private

Definition at line 53 of file HGCalHistoClusteringWrapper.cc.

Referenced by clusterizeHisto(), and configure().

◆ triggerTools_

HGCalTriggerTools HGCalHistoClusteringWrapper::triggerTools_
private

Definition at line 49 of file HGCalHistoClusteringWrapper.cc.

Referenced by configure(), convertCMSSWInputs(), and setGeometry().