CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
l1tpf_calo::SimpleCaloLinker Class Reference

#include <CaloClusterer.h>

Inheritance diagram for l1tpf_calo::SimpleCaloLinker:
l1tpf_calo::SimpleCaloLinkerBase

Public Member Functions

void clear () override
 
void run () override
 
 SimpleCaloLinker (const edm::ParameterSet &pset, const SingleCaloClusterer &ecal, const SingleCaloClusterer &hcal)
 
 ~SimpleCaloLinker () override
 
- Public Member Functions inherited from l1tpf_calo::SimpleCaloLinkerBase
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
 
 SimpleCaloLinkerBase (const edm::ParameterSet &pset, const SingleCaloClusterer &ecal, const SingleCaloClusterer &hcal)
 
virtual ~SimpleCaloLinkerBase ()
 

Protected Attributes

PreClusterGrid ecalToHCal_
 
- Protected Attributes inherited from l1tpf_calo::SimpleCaloLinkerBase
IndexGrid clusterIndex_
 
std::vector< CombinedClusterclusters_
 
const SingleCaloClustererecal_
 
const Gridgrid_
 
const SingleCaloClustererhcal_
 
float hoeCut_
 
float minHadronEt_
 
float minHadronRawEt_
 
float minPhotonEt_
 
bool noEmInHGC_
 

Detailed Description

Definition at line 269 of file CaloClusterer.h.

Constructor & Destructor Documentation

◆ SimpleCaloLinker()

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

Definition at line 471 of file CaloClusterer.cc.

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

◆ ~SimpleCaloLinker()

l1tpf_calo::SimpleCaloLinker::~SimpleCaloLinker ( )
override

Definition at line 476 of file CaloClusterer.cc.

476 {}

Member Function Documentation

◆ clear()

void l1tpf_calo::SimpleCaloLinker::clear ( void  )
overridevirtual

Reimplemented from l1tpf_calo::SimpleCaloLinkerBase.

Definition at line 478 of file CaloClusterer.cc.

478  {
479  clearBase();
480  ecalToHCal_.clear();
481 }

◆ run()

void l1tpf_calo::SimpleCaloLinker::run ( )
overridevirtual

Implements l1tpf_calo::SimpleCaloLinkerBase.

Definition at line 483 of file CaloClusterer.cc.

References l1tpf_calo::GridData< T >::clear(), l1tpf_calo::CombinedCluster::clear(), l1tpf_calo::Cluster::constituents, SiPixelRawToDigiRegional_cfi::deltaPhi, l1tpf_calo::CombinedCluster::ecal_et, EgHLTOffHistBins_cfi::et, l1tpf_calo::Cluster::et, l1tpf_calo::Cluster::eta, l1tpf_calo::CombinedCluster::hcal_et, mps_fire::i, l1tpf_calo::Cluster::phi, reco::reduceRange(), and compareTotals::tot.

483  {
484  unsigned int i, ncells = grid_->size();
485 
486  const EtGrid &hraw = hcal_.raw();
487  const IndexGrid &ecals = ecal_.indexGrid();
488  const IndexGrid &hcals = hcal_.indexGrid();
489 
490  // for each ECal cluster, get the corresponding HCal cluster and the sum of the neighbour HCal clusters
491  ecalToHCal_.clear();
492  for (i = 0; i < ncells; ++i) {
493  if (ecals[i] >= 0) {
494  if (hcals[i] >= 0) {
495  ecalToHCal_[i].ptLocalMax = hcal_.cluster(i).et;
496  } else {
497  float tot = 0;
498  for (int ineigh = 0; ineigh < 8; ++ineigh) {
499  tot += hcal_.cluster(grid_->neighbour(i, ineigh)).et;
500  }
501  ecalToHCal_[i].ptOverNeighLocalMaxSum = tot ? ecal_.cluster(i).et / tot : 0;
502  }
503  }
504  }
505 
506  clusterIndex_.fill(-1);
507  clusters_.clear();
508  CombinedCluster cluster;
509  // promote HCal clusters to final clusters
510  for (i = 0; i < ncells; ++i) {
511  if (hcals[i] >= 0) {
512  const Cluster &hcal = hcal_.cluster(i);
513  cluster.clear();
514  cluster.constituents.emplace_back(+i + 1, 1);
515  if (ecalToHCal_[i].ptLocalMax > 0) {
516  // direct linking is easy
517  const Cluster &ecal = ecal_.cluster(i);
518  if (ecal.et + hcal.et > minHadronRawEt_) {
519  cluster.ecal_et = ecal.et;
520  cluster.hcal_et = hcal.et;
521  cluster.et = cluster.ecal_et + cluster.hcal_et;
522  float wecal = cluster.ecal_et / cluster.et, whcal = 1.0 - wecal;
523  cluster.eta = ecal.eta * wecal + hcal.eta * whcal;
524  cluster.phi = ecal.phi * wecal + hcal.phi * whcal;
525  // wrap around phi
526  cluster.phi = reco::reduceRange(cluster.phi);
527  cluster.constituents.emplace_back(-i - 1, 1);
528  }
529  } else {
530  // sidewas linking is more annonying
531  float myet = hcal.et;
532  float etot = 0;
533  float avg_eta = 0;
534  float avg_phi = 0;
535  for (int ineigh = 0; ineigh < 8; ++ineigh) {
536  int ineighcell = grid_->neighbour(i, ineigh);
537  if (ineighcell == -1)
538  continue; // skip dummy cells
539  float fracet = myet * ecalToHCal_.neigh(i, ineigh).ptOverNeighLocalMaxSum;
540  if (fracet == 0)
541  continue;
542  etot += fracet;
543  avg_eta += fracet * (grid_->eta(ineighcell) - grid_->eta(i));
544  avg_phi += fracet * deltaPhi(grid_->phi(ineighcell), grid_->phi(i));
545  cluster.constituents.emplace_back(-i - 1, fracet / ecal_.cluster(ineighcell).et);
546  }
547  if (myet + etot > minHadronRawEt_) {
548  cluster.hcal_et = hcal.et;
549  cluster.ecal_et = etot;
550  cluster.et = myet + etot;
551  cluster.eta = hcal.eta + avg_eta / cluster.et;
552  cluster.phi = hcal.phi + avg_phi / cluster.et;
553  // wrap around phi
554  cluster.phi = reco::reduceRange(cluster.phi);
555  }
556  }
557  if (cluster.et > 0) {
558  clusterIndex_[i] = clusters_.size();
559  clusters_.push_back(cluster);
560  }
561  }
562  }
563 
564  // promote Unlinked ECal clusters to final clusters
565  for (i = 0; i < ncells; ++i) {
566  if (ecals[i] >= 0 && ecalToHCal_[i].ptLocalMax == 0 && ecalToHCal_[i].ptOverNeighLocalMaxSum == 0) {
567  cluster.clear();
568  const Cluster &ecal = ecal_.cluster(i);
569  cluster.ecal_et = ecal.et;
570  cluster.hcal_et = hraw[i];
571  cluster.et = cluster.ecal_et + cluster.hcal_et;
572  cluster.eta = ecal.eta;
573  cluster.phi = ecal.phi;
574  cluster.constituents.emplace_back(-i - 1, 1);
575  clusterIndex_[i] = clusters_.size();
576  clusters_.push_back(cluster);
577  }
578  }
579 }
std::vector< CombinedCluster > clusters_
GridData< float > EtGrid
float eta(int icell) const
Definition: CaloClusterer.h:28
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18
void fill(const T &val)
const SingleCaloClusterer & hcal_
const IndexGrid & indexGrid() const
int neighbour(int icell, unsigned int idx) const
Definition: CaloClusterer.h:27
float phi(int icell) const
Definition: CaloClusterer.h:29
const SingleCaloClusterer & ecal_
const T & neigh(int icell, unsigned int idx) const
const EtGrid & raw() const
GridData< int > IndexGrid
const Cluster & cluster(int i) const
unsigned int size() const
Definition: CaloClusterer.h:25

Member Data Documentation

◆ ecalToHCal_

PreClusterGrid l1tpf_calo::SimpleCaloLinker::ecalToHCal_
protected

Definition at line 277 of file CaloClusterer.h.