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.

◆ ~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.

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 }

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, and reco::reduceRange().

Member Data Documentation

◆ ecalToHCal_

PreClusterGrid l1tpf_calo::SimpleCaloLinker::ecalToHCal_
protected

Definition at line 277 of file CaloClusterer.h.

l1tpf_calo::GridData::clear
void clear()
Definition: CaloClusterer.h:139
mps_fire.i
i
Definition: mps_fire.py:428
l1tpf_calo::SimpleCaloLinkerBase::clusterIndex_
IndexGrid clusterIndex_
Definition: CaloClusterer.h:263
l1tpf_calo::SingleCaloClusterer::indexGrid
const IndexGrid & indexGrid() const
Definition: CaloClusterer.h:194
l1tpf_calo::GridData::fill
void fill(const T &val)
Definition: CaloClusterer.h:135
hcal
Definition: ConfigurationDatabase.cc:13
l1tpf_calo::SimpleCaloLinker::ecalToHCal_
PreClusterGrid ecalToHCal_
Definition: CaloClusterer.h:277
l1tpf_calo::SimpleCaloLinkerBase::hcal_
const SingleCaloClusterer & hcal_
Definition: CaloClusterer.h:262
ecal
Definition: ElectronicsMappingGPU.h:13
l1tpf_calo::SimpleCaloLinkerBase::SimpleCaloLinkerBase
SimpleCaloLinkerBase(const edm::ParameterSet &pset, const SingleCaloClusterer &ecal, const SingleCaloClusterer &hcal)
Definition: CaloClusterer.cc:410
l1tpf_calo::Cluster::clear
void clear()
Definition: CaloClusterer.h:164
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
l1tpf_calo::Grid::phi
float phi(int icell) const
Definition: CaloClusterer.h:29
l1tpf_calo::SingleCaloClusterer::raw
const EtGrid & raw() const
Definition: CaloClusterer.h:193
l1tpf_calo::SimpleCaloLinkerBase::clearBase
void clearBase()
Definition: CaloClusterer.h:243
l1tpf_calo::PreCluster::ptOverNeighLocalMaxSum
float ptOverNeighLocalMaxSum
Definition: CaloClusterer.h:155
l1tpf_calo::GridData::neigh
const T & neigh(int icell, unsigned int idx) const
Definition: CaloClusterer.h:116
l1tpf_calo::Grid::size
unsigned int size() const
Definition: CaloClusterer.h:25
l1tpf_calo::Grid::neighbour
int neighbour(int icell, unsigned int idx) const
Definition: CaloClusterer.h:27
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
l1tpf_calo::SimpleCaloLinkerBase::ecal_
const SingleCaloClusterer & ecal_
Definition: CaloClusterer.h:262
l1tpf_calo::SimpleCaloLinkerBase::minHadronRawEt_
float minHadronRawEt_
Definition: CaloClusterer.h:265
l1tpf_calo::Cluster::et
float et
Definition: CaloClusterer.h:162
l1tpf_calo::SimpleCaloLinkerBase::grid_
const Grid * grid_
Definition: CaloClusterer.h:261
l1tpf_calo::IndexGrid
GridData< int > IndexGrid
Definition: CaloClusterer.h:150
l1tpf_calo::EtGrid
GridData< float > EtGrid
Definition: CaloClusterer.h:149
l1tpf_calo::SingleCaloClusterer::cluster
const Cluster & cluster(int i) const
Definition: CaloClusterer.h:196
l1tpf_calo::Grid::eta
float eta(int icell) const
Definition: CaloClusterer.h:28
l1tpf_calo::SimpleCaloLinkerBase::clusters_
std::vector< CombinedCluster > clusters_
Definition: CaloClusterer.h:264
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
reco::reduceRange
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18