CMS 3D CMS Logo

PFClusterFromHGCalMultiCluster.cc
Go to the documentation of this file.
3 
5 
7 
9 
11  const std::vector<bool>& rechitMask,
12  const std::vector<bool>& seedable,
14  const auto& hgcalMultiClusters = *clusterH_;
15  auto const& hits = *input;
16 
17  // for quick indexing back to hit energy
18  std::unordered_map<uint32_t, size_t> detIdToIndex(hits.size());
19  for (uint32_t i = 0; i < hits.size(); ++i) {
20  detIdToIndex[hits[i].detId()] = i;
21  }
22 
23  for (const auto& mcl : hgcalMultiClusters) {
24  DetId seed;
25  double energy = 0.0, highest_energy = 0.0;
26  output.emplace_back();
27  reco::PFCluster& back = output.back();
28  for (const auto& cl : mcl) {
29  const auto& hitsAndFractions = cl->hitsAndFractions();
30  for (const auto& hAndF : hitsAndFractions) {
31  auto itr = detIdToIndex.find(hAndF.first);
32  if (itr == detIdToIndex.end()) {
33  continue; // hit wasn't saved in reco
34  }
35  auto ref = makeRefhit(input, itr->second);
36  assert(ref->detId() == hAndF.first.rawId());
37  const double hit_energy = hAndF.second * ref->energy();
38  energy += hit_energy;
39  back.addRecHitFraction(reco::PFRecHitFraction(ref, hAndF.second));
40  // TODO: the following logic to identify the seed of a cluster
41  // could be appropriate for the Run2 Ecal Calorimetric
42  // detector, but could be wrong for the HGCal one. This has to
43  // be reviewd.
44  if (hit_energy > highest_energy || highest_energy == 0.0) {
45  highest_energy = hit_energy;
46  seed = ref->detId();
47  }
48  } // end of hitsAndFractions
49  } // end of loop over clusters (2D/layer)
50  if (energy <= 1) {
51  output.pop_back();
52  continue;
53  }
54  if (!back.hitsAndFractions().empty()) {
55  back.setSeed(seed);
56  back.setEnergy(energy);
58  } else {
59  back.setSeed(0);
60  back.setEnergy(0.f);
61  }
62  } // end of loop over hgcalMulticlusters (3D)
63 }
PFClusterFromHGCalMultiCluster::updateEvent
void updateEvent(const edm::Event &) final
Definition: PFClusterFromHGCalMultiCluster.cc:8
reco::PFClusterCollection
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
reco::CaloCluster::setSeed
void setSeed(const DetId &id)
Definition: CaloCluster.h:146
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
reco::PFRecHitFraction
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
Definition: PFRecHitFraction.h:18
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
reco::CaloCluster::setCorrectedEnergy
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
PFClusterFromHGCalMultiCluster.h
cms::cuda::assert
assert(be >=bs)
edm::Handle
Definition: AssociativeIterator.h:50
InitialClusteringStepBase::makeRefhit
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Definition: InitialClusteringStepBase.h:103
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
DetId
Definition: DetId.h:17
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
Event.h
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
PFClusterFromHGCalMultiCluster::buildClusters
void buildClusters(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &) override
Definition: PFClusterFromHGCalMultiCluster.cc:10
PFClusterFromHGCalMultiCluster::clusterToken_
edm::EDGetTokenT< std::vector< reco::HGCalMultiCluster > > clusterToken_
Definition: PFClusterFromHGCalMultiCluster.h:27
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
reco::PFCluster::addRecHitFraction
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:77
reco::CaloCluster::setEnergy
void setEnergy(double energy)
Definition: CaloCluster.h:136
HGCalDetId.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:46
PFClusterFromHGCalMultiCluster::clusterH_
edm::Handle< std::vector< reco::HGCalMultiCluster > > clusterH_
Definition: PFClusterFromHGCalMultiCluster.h:28
edm::Event
Definition: Event.h:73
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295