CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Types | Private Attributes
GenericSimClusterMapper Class Reference

#include <GenericSimClusterMapper.h>

Inheritance diagram for GenericSimClusterMapper:
InitialClusteringStepBase

Public Member Functions

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

Private Types

typedef GenericSimClusterMapper B2DGT
 

Private Attributes

edm::Handle< SimClusterCollection_simClusterH
 
edm::EDGetTokenT< SimClusterCollection_simClusterToken
 

Additional Inherited Members

- Protected Types inherited from InitialClusteringStepBase
typedef std::tuple< std::vector< int >, std::vector< double >, std::vector< double > > I3tuple
 
- 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, I3tuple_thresholds
 

Detailed Description

Definition at line 9 of file GenericSimClusterMapper.h.

Member Typedef Documentation

◆ B2DGT

Definition at line 10 of file GenericSimClusterMapper.h.

Constructor & Destructor Documentation

◆ GenericSimClusterMapper() [1/2]

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

◆ ~GenericSimClusterMapper()

GenericSimClusterMapper::~GenericSimClusterMapper ( )
overridedefault

◆ GenericSimClusterMapper() [2/2]

GenericSimClusterMapper::GenericSimClusterMapper ( const B2DGT )
delete

Member Function Documentation

◆ buildClusters()

void GenericSimClusterMapper::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 23 of file GenericSimClusterMapper.cc.

26  {
27  const SimClusterCollection& simClusters = *_simClusterH;
28  auto const& hits = *input;
29 
30  // for quick indexing back to hit energy
31  std::unordered_map<uint32_t, size_t> detIdToIndex(hits.size());
32  for (uint32_t i = 0; i < hits.size(); ++i) {
33  detIdToIndex[hits[i].detId()] = i;
34  auto ref = makeRefhit(input, i);
35  }
36 
37  for (const auto& sc : simClusters) {
38  output.emplace_back();
39  reco::PFCluster& back = output.back();
41  double energy = 0.0, highest_energy = 0.0;
42  auto hitsAndFractions = sc.hits_and_fractions();
43  for (const auto& hAndF : hitsAndFractions) {
44  auto itr = detIdToIndex.find(hAndF.first);
45  if (itr == detIdToIndex.end())
46  continue; // hit wasn't saved in reco
47  auto ref = makeRefhit(input, itr->second);
48  const double hit_energy = hAndF.second * ref->energy();
49  energy += hit_energy;
50  back.addRecHitFraction(reco::PFRecHitFraction(ref, hAndF.second));
51  if (hit_energy > highest_energy || highest_energy == 0.0) {
52  highest_energy = hit_energy;
53  seed = ref;
54  }
55  }
56  if (!back.hitsAndFractions().empty()) {
57  back.setSeed(seed->detId());
58  back.setEnergy(energy);
60  } else {
61  back.setSeed(-1);
62  back.setEnergy(0.f);
63  }
64  }
65 }

References _simClusterH, reco::PFCluster::addRecHitFraction(), HCALHighEnergyHPDFilter_cfi::energy, f, hfClusterShapes_cfi::hits, reco::CaloCluster::hitsAndFractions(), mps_fire::i, input, InitialClusteringStepBase::makeRefhit(), convertSQLitetoXML_cfg::output, fileCollector::seed, reco::CaloCluster::setCorrectedEnergy(), reco::CaloCluster::setEnergy(), and reco::CaloCluster::setSeed().

◆ operator=()

B2DGT& GenericSimClusterMapper::operator= ( const B2DGT )
delete

◆ updateEvent()

void GenericSimClusterMapper::updateEvent ( const edm::Event ev)
finalvirtual

Reimplemented from InitialClusteringStepBase.

Definition at line 21 of file GenericSimClusterMapper.cc.

21 { ev.getByToken(_simClusterToken, _simClusterH); }

References _simClusterH, _simClusterToken, and ev.

Member Data Documentation

◆ _simClusterH

edm::Handle<SimClusterCollection> GenericSimClusterMapper::_simClusterH
private

Definition at line 30 of file GenericSimClusterMapper.h.

Referenced by buildClusters(), and updateEvent().

◆ _simClusterToken

edm::EDGetTokenT<SimClusterCollection> GenericSimClusterMapper::_simClusterToken
private

Definition at line 29 of file GenericSimClusterMapper.h.

Referenced by GenericSimClusterMapper(), and updateEvent().

reco::CaloCluster::setSeed
void setSeed(const DetId &id)
Definition: CaloCluster.h:146
SimClusterCollection
std::vector< SimCluster > SimClusterCollection
Definition: SimClusterFwd.h:8
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
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:72
reco::CaloCluster::setCorrectedEnergy
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
InitialClusteringStepBase::InitialClusteringStepBase
InitialClusteringStepBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Definition: InitialClusteringStepBase.h:28
edm::Ref
Definition: AssociativeIterator.h:58
InitialClusteringStepBase::makeRefhit
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Definition: InitialClusteringStepBase.h:103
fileCollector.seed
seed
Definition: fileCollector.py:127
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
GenericSimClusterMapper::_simClusterH
edm::Handle< SimClusterCollection > _simClusterH
Definition: GenericSimClusterMapper.h:30
GenericSimClusterMapper::_simClusterToken
edm::EDGetTokenT< SimClusterCollection > _simClusterToken
Definition: GenericSimClusterMapper.h:29
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
reco::PFCluster::addRecHitFraction
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:33
reco::CaloCluster::setEnergy
void setEnergy(double energy)
Definition: CaloCluster.h:136
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::InputTag
Definition: InputTag.h:15