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_
 
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 298 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 538 of file CaloClusterer.cc.

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

◆ ~SimpleCaloLinker()

l1tpf_calo::SimpleCaloLinker::~SimpleCaloLinker ( )
override

Definition at line 543 of file CaloClusterer.cc.

543 {}

Member Function Documentation

◆ clear()

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

Reimplemented from l1tpf_calo::SimpleCaloLinkerBase.

Definition at line 545 of file CaloClusterer.cc.

545  {
546  clearBase();
547  ecalToHCal_.clear();
548 }

◆ run()

void l1tpf_calo::SimpleCaloLinker::run ( )
overridevirtual

Implements l1tpf_calo::SimpleCaloLinkerBase.

Definition at line 550 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, l1tpf_calo::CombinedCluster::ecal_eta, l1tpf_calo::CombinedCluster::ecal_phi, l1tnanotables_cff::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.

550  {
551  unsigned int i, ncells = grid_->size();
552 
553  const EtGrid &hraw = hcal_.raw();
554  const IndexGrid &ecals = ecal_.indexGrid();
555  const IndexGrid &hcals = hcal_.indexGrid();
556 
557  // for each ECal cluster, get the corresponding HCal cluster and the sum of the neighbour HCal clusters
558  ecalToHCal_.clear();
559  for (i = 0; i < ncells; ++i) {
560  if (ecals[i] >= 0) {
561  if (hcals[i] >= 0) {
562  ecalToHCal_[i].ptLocalMax = hcal_.cluster(i).et;
563  } else {
564  float tot = 0;
565  for (int ineigh = 0; ineigh < 8; ++ineigh) {
566  tot += hcal_.cluster(grid_->neighbour(i, ineigh)).et;
567  }
568  ecalToHCal_[i].ptOverNeighLocalMaxSum = tot ? ecal_.cluster(i).et / tot : 0;
569  }
570  }
571  }
572 
573  clusterIndex_.fill(-1);
574  clusters_.clear();
575  CombinedCluster cluster;
576  // promote HCal clusters to final clusters
577  for (i = 0; i < ncells; ++i) {
578  if (hcals[i] >= 0) {
579  const Cluster &hcal = hcal_.cluster(i);
580  cluster.clear();
581  cluster.constituents.emplace_back(+i + 1, 1);
582  if (ecalToHCal_[i].ptLocalMax > 0) {
583  // direct linking is easy
584  const Cluster &ecal = ecal_.cluster(i);
585  if (ecal.et + hcal.et > minHadronRawEt_) {
586  cluster.ecal_et = ecal.et;
587  cluster.hcal_et = hcal.et;
588  cluster.et = cluster.ecal_et + cluster.hcal_et;
589  float wecal = cluster.ecal_et / cluster.et, whcal = 1.0 - wecal;
590  cluster.eta = ecal.eta * wecal + hcal.eta * whcal;
591  cluster.phi = ecal.phi * wecal + hcal.phi * whcal;
592  cluster.ecal_eta = cluster.eta;
593  cluster.ecal_phi = cluster.phi;
594  // wrap around phi
595  cluster.phi = reco::reduceRange(cluster.phi);
596  cluster.constituents.emplace_back(-i - 1, 1);
597  }
598  } else {
599  // sidewas linking is more annonying
600  float myet = hcal.et;
601  float etot = 0;
602  float avg_eta = 0;
603  float avg_phi = 0;
604  for (int ineigh = 0; ineigh < 8; ++ineigh) {
605  int ineighcell = grid_->neighbour(i, ineigh);
606  if (ineighcell == -1)
607  continue; // skip dummy cells
608  float fracet = myet * ecalToHCal_.neigh(i, ineigh).ptOverNeighLocalMaxSum;
609  if (fracet == 0)
610  continue;
611  etot += fracet;
612  avg_eta += fracet * (grid_->eta(ineighcell) - grid_->eta(i));
613  avg_phi += fracet * deltaPhi(grid_->phi(ineighcell), grid_->phi(i));
614  cluster.constituents.emplace_back(-i - 1, fracet / ecal_.cluster(ineighcell).et);
615  }
616  if (myet + etot > minHadronRawEt_) {
617  cluster.hcal_et = hcal.et;
618  cluster.ecal_et = etot;
619  cluster.et = myet + etot;
620  cluster.eta = hcal.eta + avg_eta / cluster.et;
621  cluster.phi = hcal.phi + avg_phi / cluster.et;
622  cluster.ecal_eta = cluster.eta;
623  cluster.ecal_phi = cluster.phi;
624  // wrap around phi
625  cluster.phi = reco::reduceRange(cluster.phi);
626  }
627  }
628  if (cluster.et > 0) {
629  clusterIndex_[i] = clusters_.size();
630  clusters_.push_back(cluster);
631  }
632  }
633  }
634 
635  // promote Unlinked ECal clusters to final clusters
636  for (i = 0; i < ncells; ++i) {
637  if (ecals[i] >= 0 && ecalToHCal_[i].ptLocalMax == 0 && ecalToHCal_[i].ptOverNeighLocalMaxSum == 0) {
638  cluster.clear();
639  const Cluster &ecal = ecal_.cluster(i);
640  cluster.ecal_et = ecal.et;
641  cluster.hcal_et = hraw[i];
642  cluster.et = cluster.ecal_et + cluster.hcal_et;
643  cluster.eta = ecal.eta;
644  cluster.phi = ecal.phi;
645  cluster.constituents.emplace_back(-i - 1, 1);
646  clusterIndex_[i] = clusters_.size();
647  clusters_.push_back(cluster);
648  }
649  }
650 }
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 306 of file CaloClusterer.h.