CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
GenericSimClusterMapper Class Reference
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 &, const HcalPFCuts *) override
 
 GenericSimClusterMapper (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
 GenericSimClusterMapper (const B2DGT &)=delete
 
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 &cc)
 
 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 11 of file GenericSimClusterMapper.cc.

Member Typedef Documentation

◆ B2DGT

Definition at line 12 of file GenericSimClusterMapper.cc.

Constructor & Destructor Documentation

◆ GenericSimClusterMapper() [1/2]

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

Definition at line 15 of file GenericSimClusterMapper.cc.

References _simClusterToken, gpuPixelDoublets::cc, and edm::ParameterSet::getParameter().

16  : InitialClusteringStepBase(conf, cc) {
17  _simClusterToken = cc.consumes<SimClusterCollection>(conf.getParameter<edm::InputTag>("simClusterSrc"));
18  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
InitialClusteringStepBase(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
edm::EDGetTokenT< SimClusterCollection > _simClusterToken
std::vector< SimCluster > SimClusterCollection

◆ ~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,
const HcalPFCuts hcalCuts 
)
overridevirtual

Implements InitialClusteringStepBase.

Definition at line 52 of file GenericSimClusterMapper.cc.

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

56  {
57  const SimClusterCollection& simClusters = *_simClusterH;
58  auto const& hits = *input;
59 
60  // for quick indexing back to hit energy
61  std::unordered_map<uint32_t, size_t> detIdToIndex(hits.size());
62  for (uint32_t i = 0; i < hits.size(); ++i) {
63  detIdToIndex[hits[i].detId()] = i;
64  auto ref = makeRefhit(input, i);
65  }
66 
67  for (const auto& sc : simClusters) {
68  output.emplace_back();
69  reco::PFCluster& back = output.back();
71  double energy = 0.0, highest_energy = 0.0;
72  auto hitsAndFractions = sc.hits_and_fractions();
73  for (const auto& hAndF : hitsAndFractions) {
74  auto itr = detIdToIndex.find(hAndF.first);
75  if (itr == detIdToIndex.end())
76  continue; // hit wasn't saved in reco
77  auto ref = makeRefhit(input, itr->second);
78  const double hit_energy = hAndF.second * ref->energy();
79  energy += hit_energy;
80  back.addRecHitFraction(reco::PFRecHitFraction(ref, hAndF.second));
81  if (hit_energy > highest_energy || highest_energy == 0.0) {
82  highest_energy = hit_energy;
83  seed = ref;
84  }
85  }
86  if (!back.hitsAndFractions().empty()) {
87  back.setSeed(seed->detId());
88  back.setEnergy(energy);
90  } else {
91  back.setSeed(-1);
92  back.setEnergy(0.f);
93  }
94  }
95 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
void setEnergy(double energy)
Definition: CaloCluster.h:136
static std::string const input
Definition: EdmProvDump.cc:50
void setSeed(const DetId &id)
Definition: CaloCluster.h:146
edm::Handle< SimClusterCollection > _simClusterH
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
double f[11][100]
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:33
Definition: output.py:1
std::vector< SimCluster > SimClusterCollection

◆ operator=()

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

◆ updateEvent()

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

Reimplemented from InitialClusteringStepBase.

Definition at line 50 of file GenericSimClusterMapper.cc.

References _simClusterH, _simClusterToken, and makeMEIFBenchmarkPlots::ev.

50 { ev.getByToken(_simClusterToken, _simClusterH); }
edm::Handle< SimClusterCollection > _simClusterH
edm::EDGetTokenT< SimClusterCollection > _simClusterToken

Member Data Documentation

◆ _simClusterH

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

Definition at line 33 of file GenericSimClusterMapper.cc.

Referenced by buildClusters(), and updateEvent().

◆ _simClusterToken

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

Definition at line 32 of file GenericSimClusterMapper.cc.

Referenced by GenericSimClusterMapper(), and updateEvent().