CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PFClusterFromHGCalMultiCluster Class Reference

#include <PFClusterFromHGCalMultiCluster.h>

Inheritance diagram for PFClusterFromHGCalMultiCluster:
InitialClusteringStepBase

Public Member Functions

void buildClusters (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override
 
PFClusterFromHGCalMultiClusteroperator= (const PFClusterFromHGCalMultiCluster &)=delete
 
 PFClusterFromHGCalMultiCluster (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
 PFClusterFromHGCalMultiCluster (const PFClusterFromHGCalMultiCluster &)=delete
 
void updateEvent (const edm::Event &) final
 
 ~PFClusterFromHGCalMultiCluster () override
 
- Public Member Functions inherited from InitialClusteringStepBase
 InitialClusteringStepBase (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
 InitialClusteringStepBase (const ICSB &)=delete
 
std::ostream & operator<< (std::ostream &o)
 
ICSBoperator= (const ICSB &)=delete
 
void reset ()
 
virtual void update (const edm::EventSetup &)
 
virtual ~InitialClusteringStepBase ()=default
 

Private Attributes

edm::Handle< std::vector< reco::HGCalMultiCluster > > clusterH_
 
edm::EDGetTokenT< std::vector< reco::HGCalMultiCluster > > clusterToken_
 

Additional Inherited Members

- Protected Member Functions inherited from InitialClusteringStepBase
reco::PFRecHitRef makeRefhit (const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
 
- Protected Attributes inherited from InitialClusteringStepBase
const std::unordered_map< std::string, int > _layerMap
 
unsigned _nClustersFound
 
unsigned _nSeeds
 
std::unordered_map< int, std::pair< double, double > > _thresholds
 

Detailed Description

Definition at line 8 of file PFClusterFromHGCalMultiCluster.h.

Constructor & Destructor Documentation

PFClusterFromHGCalMultiCluster::PFClusterFromHGCalMultiCluster ( const edm::ParameterSet conf,
edm::ConsumesCollector sumes 
)
inline

Definition at line 10 of file PFClusterFromHGCalMultiCluster.h.

References clusterToken_, edm::ConsumesCollector::consumes(), and edm::ParameterSet::getParameter().

Referenced by ~PFClusterFromHGCalMultiCluster().

12  : InitialClusteringStepBase(conf, sumes) {
13  clusterToken_ = sumes.consumes<std::vector<reco::HGCalMultiCluster> >(
14  conf.getParameter<edm::InputTag>("clusterSrc"));
15  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
InitialClusteringStepBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
edm::EDGetTokenT< std::vector< reco::HGCalMultiCluster > > clusterToken_
PFClusterFromHGCalMultiCluster::~PFClusterFromHGCalMultiCluster ( )
inlineoverride
PFClusterFromHGCalMultiCluster::PFClusterFromHGCalMultiCluster ( const PFClusterFromHGCalMultiCluster )
delete

Member Function Documentation

void PFClusterFromHGCalMultiCluster::buildClusters ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
const std::vector< bool > &  seedable,
reco::PFClusterCollection output 
)
overridevirtual

Implements InitialClusteringStepBase.

Definition at line 12 of file PFClusterFromHGCalMultiCluster.cc.

References reco::PFCluster::addRecHitFraction(), GetRecoTauVFromDQM_MC_cff::cl, clusterH_, f, hfClusterShapes_cfi::hits, reco::CaloCluster::hitsAndFractions(), mps_fire::i, input, InitialClusteringStepBase::makeRefhit(), SurveyInfoScenario_cff::seed, reco::CaloCluster::setCorrectedEnergy(), reco::CaloCluster::setEnergy(), and reco::CaloCluster::setSeed().

Referenced by ~PFClusterFromHGCalMultiCluster().

15  {
16 
17  const auto& hgcalMultiClusters = *clusterH_;
18  auto const& hits = *input;
19 
20  // for quick indexing back to hit energy
21  std::unordered_map<uint32_t, size_t> detIdToIndex(hits.size());
22  for (uint32_t i = 0; i < hits.size(); ++i) {
23  detIdToIndex[hits[i].detId()] = i;
24  }
25 
26  for (const auto& mcl : hgcalMultiClusters) {
27  DetId seed;
28  double energy = 0.0, highest_energy = 0.0;
29  output.emplace_back();
30  reco::PFCluster& back = output.back();
31  for (const auto& cl : mcl) {
32  const auto& hitsAndFractions = cl->hitsAndFractions();
33  for (const auto& hAndF : hitsAndFractions) {
34  auto itr = detIdToIndex.find(hAndF.first);
35  if (itr == detIdToIndex.end()) {
36  continue; // hit wasn't saved in reco
37  }
38  auto ref = makeRefhit(input, itr->second);
39  assert(ref->detId() == hAndF.first.rawId());
40  const double hit_energy = hAndF.second * ref->energy();
41  energy += hit_energy;
42  back.addRecHitFraction(reco::PFRecHitFraction(ref, hAndF.second));
43  // TODO: the following logic to identify the seed of a cluster
44  // could be appropriate for the Run2 Ecal Calorimetric
45  // detector, but could be wrong for the HGCal one. This has to
46  // be reviewd.
47  if (hit_energy > highest_energy || highest_energy == 0.0) {
48  highest_energy = hit_energy;
49  seed = ref->detId();
50  }
51  } // end of hitsAndFractions
52  } // end of loop over clusters (2D/layer)
53  if (energy <= 1) {
54  output.pop_back();
55  continue;
56  }
57  if (!back.hitsAndFractions().empty()) {
58  back.setSeed(seed);
59  back.setEnergy(energy);
60  back.setCorrectedEnergy(energy);
61  } else {
62  back.setSeed(0);
63  back.setEnergy(0.f);
64  }
65  } // end of loop over hgcalMulticlusters (3D)
66 }
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
void setEnergy(double energy)
Definition: CaloCluster.h:111
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:195
static std::string const input
Definition: EdmProvDump.cc:44
void setSeed(const DetId &id)
Definition: CaloCluster.h:121
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:112
double f[11][100]
Definition: DetId.h:18
edm::Handle< std::vector< reco::HGCalMultiCluster > > clusterH_
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:99
PFClusterFromHGCalMultiCluster& PFClusterFromHGCalMultiCluster::operator= ( const PFClusterFromHGCalMultiCluster )
delete
void PFClusterFromHGCalMultiCluster::updateEvent ( const edm::Event ev)
finalvirtual

Reimplemented from InitialClusteringStepBase.

Definition at line 8 of file PFClusterFromHGCalMultiCluster.cc.

References clusterH_, clusterToken_, and edm::Event::getByToken().

Referenced by ~PFClusterFromHGCalMultiCluster().

8  {
10 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::Handle< std::vector< reco::HGCalMultiCluster > > clusterH_
edm::EDGetTokenT< std::vector< reco::HGCalMultiCluster > > clusterToken_

Member Data Documentation

edm::Handle<std::vector<reco::HGCalMultiCluster> > PFClusterFromHGCalMultiCluster::clusterH_
private

Definition at line 30 of file PFClusterFromHGCalMultiCluster.h.

Referenced by buildClusters(), and updateEvent().

edm::EDGetTokenT<std::vector<reco::HGCalMultiCluster> > PFClusterFromHGCalMultiCluster::clusterToken_
private

Definition at line 29 of file PFClusterFromHGCalMultiCluster.h.

Referenced by PFClusterFromHGCalMultiCluster(), and updateEvent().