CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
l1tpf_calo::SimpleCaloLinkerBase Class Referenceabstract

#include <CaloClusterer.h>

Inheritance diagram for l1tpf_calo::SimpleCaloLinkerBase:
l1tpf_calo::CombinedCaloLinker l1tpf_calo::FlatCaloLinker l1tpf_calo::SimpleCaloLinker

Public Member Functions

virtual void clear ()
 
void clearBase ()
 
template<typename Corrector >
void correct (const Corrector &corrector)
 
std::unique_ptr< l1t::PFClusterCollectionfetch () const
 
std::unique_ptr< l1t::PFClusterCollectionfetch (const edm::OrphanHandle< l1t::PFClusterCollection > &ecal, const edm::OrphanHandle< l1t::PFClusterCollection > &hcal) const
 
virtual void run ()=0
 
 SimpleCaloLinkerBase (const edm::ParameterSet &pset, const SingleCaloClusterer &ecal, const SingleCaloClusterer &hcal)
 
virtual ~SimpleCaloLinkerBase ()
 

Protected Attributes

IndexGrid clusterIndex_
 
std::vector< CombinedClusterclusters_
 
const SingleCaloClustererecal_
 
std::vector< double > etaBounds_
 
const Gridgrid_
 
const SingleCaloClustererhcal_
 
float hoeCut_
 
std::vector< unsigned int > maxClustersEtaPhi_
 
float minHadronEt_
 
float minHadronRawEt_
 
float minPhotonEt_
 
bool noEmInHGC_
 
std::vector< double > phiBounds_
 

Detailed Description

Definition at line 261 of file CaloClusterer.h.

Constructor & Destructor Documentation

◆ SimpleCaloLinkerBase()

l1tpf_calo::SimpleCaloLinkerBase::SimpleCaloLinkerBase ( const edm::ParameterSet pset,
const SingleCaloClusterer ecal,
const SingleCaloClusterer hcal 
)

Definition at line 453 of file CaloClusterer.cc.

References etaBounds_, Exception, grid_, maxClustersEtaPhi_, and phiBounds_.

456  : grid_(getGrid(pset.getParameter<std::string>("grid"))),
457  ecal_(ecal),
458  hcal_(hcal),
460  clusters_(),
461  etaBounds_(pset.getParameter<std::vector<double>>("etaBounds")),
462  phiBounds_(pset.getParameter<std::vector<double>>("phiBounds")),
463  maxClustersEtaPhi_(pset.getParameter<std::vector<unsigned int>>("maxClustersEtaPhi")),
464  hoeCut_(pset.getParameter<double>("hoeCut")),
465  minPhotonEt_(pset.getParameter<double>("minPhotonEt")),
466  minHadronRawEt_(pset.getParameter<double>("minHadronRawEt")),
467  minHadronEt_(pset.getParameter<double>("minHadronEt")),
468  noEmInHGC_(pset.getParameter<bool>("noEmInHGC")) {
469  if (grid_ != &ecal.raw().grid())
470  throw cms::Exception("LogicError", "Inconsistent grid between ecal and linker\n");
471  if (grid_ != &hcal.raw().grid())
472  throw cms::Exception("LogicError", "Inconsistent grid between hcal and linker\n");
473  if ((etaBounds_.size() - 1) * (phiBounds_.size() - 1) != maxClustersEtaPhi_.size()) {
474  throw cms::Exception("Configuration")
475  << "Size mismatch between eta/phi bounds and max clusters: " << (etaBounds_.size() - 1) << " x "
476  << (phiBounds_.size() - 1) << " != " << maxClustersEtaPhi_.size() << "\n";
477  }
478  if (!std::is_sorted(etaBounds_.begin(), etaBounds_.end())) {
479  throw cms::Exception("Configuration") << "etaBounds is not sorted\n";
480  }
481  if (!std::is_sorted(phiBounds_.begin(), phiBounds_.end())) {
482  throw cms::Exception("Configuration") << "phiBounds is not sorted\n";
483  }
484 }
std::vector< CombinedCluster > clusters_
const SingleCaloClusterer & hcal_
std::vector< unsigned int > maxClustersEtaPhi_
const Grid * getGrid(const std::string &type)
std::vector< double > phiBounds_
const SingleCaloClusterer & ecal_
std::vector< double > etaBounds_

◆ ~SimpleCaloLinkerBase()

l1tpf_calo::SimpleCaloLinkerBase::~SimpleCaloLinkerBase ( )
virtual

Definition at line 486 of file CaloClusterer.cc.

486 {}

Member Function Documentation

◆ clear()

virtual void l1tpf_calo::SimpleCaloLinkerBase::clear ( void  )
inlinevirtual

◆ clearBase()

void l1tpf_calo::SimpleCaloLinkerBase::clearBase ( )
inline

Definition at line 269 of file CaloClusterer.h.

References clusterIndex_, clusters_, and l1tpf_calo::GridData< T >::fill().

Referenced by clear().

269  {
270  clusters_.clear();
271  clusterIndex_.fill(-1);
272  }
std::vector< CombinedCluster > clusters_
void fill(const T &val)

◆ correct()

template<typename Corrector >
void l1tpf_calo::SimpleCaloLinkerBase::correct ( const Corrector &  corrector)
inline

Definition at line 276 of file CaloClusterer.h.

References DummyCfis::c, clusters_, and ZGammaplusJetsMonitor_cff::corrector.

Referenced by KalmanMuonCorrector.KalmanMuonCorrector::correct_all(), and JetReCalibrator.JetReCalibrator::correctAll().

276  {
277  for (CombinedCluster &c : clusters_) {
278  c.et = corrector(c);
279  }
280  }
std::vector< CombinedCluster > clusters_

◆ fetch() [1/2]

std::unique_ptr< l1t::PFClusterCollection > l1tpf_calo::SimpleCaloLinkerBase::fetch ( ) const

◆ fetch() [2/2]

std::unique_ptr< l1t::PFClusterCollection > l1tpf_calo::SimpleCaloLinkerBase::fetch ( const edm::OrphanHandle< l1t::PFClusterCollection > &  ecal,
const edm::OrphanHandle< l1t::PFClusterCollection > &  hcal 
) const

Definition at line 493 of file CaloClusterer.cc.

References funct::abs(), cms::cuda::assert(), l1tpf_calo::Cluster::constituents, l1tpf_calo::CombinedCluster::ecal_et, l1tpf_calo::CombinedCluster::ecal_eta, l1tpf_calo::CombinedCluster::ecal_phi, l1tpf_calo::Cluster::et, l1tpf_calo::Cluster::eta, l1tpf_calo::CombinedCluster::hcal_et, cuy::ii, dqmdumpme::indices, SiStripPI::max, l1tpf_calo::Cluster::phi, displacedMuons_cfi::photon, runTheMatrix::ret, and collectionMerger::selector.

495  {
496  bool setRefs = (ecal.isValid() && hcal.isValid());
497  auto ret = std::make_unique<l1t::PFClusterCollection>();
499  unsigned int index = 0;
500  for (const CombinedCluster &cluster : clusters_) {
501  index++;
502  if (cluster.et > 0) {
503  bool photon = (cluster.hcal_et < hoeCut_ * cluster.ecal_et);
504  if (photon && noEmInHGC_) {
505  if (std::abs(cluster.eta) > 1.5 && std::abs(cluster.eta) < 3.0) { // 1.5-3 = eta range of HGCal
506  continue;
507  }
508  }
509  selector.fill(cluster.et, cluster.eta, cluster.phi, index - 1);
510  }
511  }
512  std::vector<unsigned int> indices = selector.returnSorted();
513  for (unsigned int ii = 0; ii < indices.size(); ii++) {
514  unsigned int theIndex = indices[ii];
515  const CombinedCluster &cluster = clusters_[theIndex];
516  bool photon = (cluster.hcal_et < hoeCut_ * cluster.ecal_et);
517  if (cluster.et > (photon ? minPhotonEt_ : minHadronEt_)) {
518  ret->emplace_back(cluster.et,
519  photon ? cluster.ecal_eta : cluster.eta,
520  photon ? cluster.ecal_phi : cluster.phi,
521  cluster.ecal_et > 0 ? std::max(cluster.et - cluster.ecal_et, 0.f) / cluster.ecal_et : -1,
522  photon);
523  if (setRefs) {
524  for (const auto &pair : cluster.constituents) {
525  assert(pair.first != 0);
526  if (pair.first > 0) { // 1+hcal index
527  ret->back().addConstituent(edm::Ptr<l1t::PFCluster>(hcal, +pair.first - 1), pair.second);
528  } else { // -1-ecal index
529  ret->back().addConstituent(edm::Ptr<l1t::PFCluster>(ecal, -pair.first + 1), pair.second);
530  }
531  }
532  }
533  }
534  }
535  return ret;
536 }
std::vector< CombinedCluster > clusters_
ret
prodAgent to be discontinued
std::vector< unsigned int > maxClustersEtaPhi_
assert(be >=bs)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > phiBounds_
ii
Definition: cuy.py:589
std::vector< double > etaBounds_

◆ run()

virtual void l1tpf_calo::SimpleCaloLinkerBase::run ( )
pure virtual

Member Data Documentation

◆ clusterIndex_

IndexGrid l1tpf_calo::SimpleCaloLinkerBase::clusterIndex_
protected

Definition at line 289 of file CaloClusterer.h.

Referenced by clearBase().

◆ clusters_

std::vector<CombinedCluster> l1tpf_calo::SimpleCaloLinkerBase::clusters_
protected

Definition at line 290 of file CaloClusterer.h.

Referenced by clearBase(), and correct().

◆ ecal_

const SingleCaloClusterer& l1tpf_calo::SimpleCaloLinkerBase::ecal_
protected

Definition at line 288 of file CaloClusterer.h.

◆ etaBounds_

std::vector<double> l1tpf_calo::SimpleCaloLinkerBase::etaBounds_
protected

Definition at line 291 of file CaloClusterer.h.

Referenced by SimpleCaloLinkerBase().

◆ grid_

const Grid* l1tpf_calo::SimpleCaloLinkerBase::grid_
protected

Definition at line 287 of file CaloClusterer.h.

Referenced by SimpleCaloLinkerBase().

◆ hcal_

const SingleCaloClusterer & l1tpf_calo::SimpleCaloLinkerBase::hcal_
protected

Definition at line 288 of file CaloClusterer.h.

◆ hoeCut_

float l1tpf_calo::SimpleCaloLinkerBase::hoeCut_
protected

Definition at line 294 of file CaloClusterer.h.

◆ maxClustersEtaPhi_

std::vector<unsigned int> l1tpf_calo::SimpleCaloLinkerBase::maxClustersEtaPhi_
protected

Definition at line 293 of file CaloClusterer.h.

Referenced by SimpleCaloLinkerBase().

◆ minHadronEt_

float l1tpf_calo::SimpleCaloLinkerBase::minHadronEt_
protected

Definition at line 294 of file CaloClusterer.h.

◆ minHadronRawEt_

float l1tpf_calo::SimpleCaloLinkerBase::minHadronRawEt_
protected

Definition at line 294 of file CaloClusterer.h.

◆ minPhotonEt_

float l1tpf_calo::SimpleCaloLinkerBase::minPhotonEt_
protected

Definition at line 294 of file CaloClusterer.h.

◆ noEmInHGC_

bool l1tpf_calo::SimpleCaloLinkerBase::noEmInHGC_
protected

Definition at line 295 of file CaloClusterer.h.

◆ phiBounds_

std::vector<double> l1tpf_calo::SimpleCaloLinkerBase::phiBounds_
protected

Definition at line 292 of file CaloClusterer.h.

Referenced by SimpleCaloLinkerBase().