CMS 3D CMS Logo

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

#include <PFClusterProducer.h>

Inheritance diagram for PFClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
 PFClusterProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFClusterProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Types

typedef InitialClusteringStepBase ICSB
 
typedef PFClusterBuilderBase PFCBB
 
typedef PFCPositionCalculatorBase PosCalc
 
typedef RecHitTopologicalCleanerBase RHCB
 

Private Attributes

std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
 
std::unique_ptr< PFClusterEnergyCorrectorBase_energyCorrector
 
std::unique_ptr< InitialClusteringStepBase_initialClustering
 
std::unique_ptr< PFClusterBuilderBase_pfClusterBuilder
 
std::unique_ptr< PFCPositionCalculatorBase_positionReCalc
 
const bool _prodInitClusters
 
edm::EDGetTokenT< reco::PFRecHitCollection_rechitsLabel
 
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
 
std::unique_ptr< SeedFinderBase_seedFinder
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 20 of file PFClusterProducer.h.

Member Typedef Documentation

◆ ICSB

Definition at line 22 of file PFClusterProducer.h.

◆ PFCBB

Definition at line 23 of file PFClusterProducer.h.

◆ PosCalc

Definition at line 24 of file PFClusterProducer.h.

◆ RHCB

Definition at line 21 of file PFClusterProducer.h.

Constructor & Destructor Documentation

◆ PFClusterProducer()

PFClusterProducer::PFClusterProducer ( const edm::ParameterSet conf)

Definition at line 17 of file PFClusterProducer.cc.

18  : _prodInitClusters(conf.getUntrackedParameter<bool>("prodInitialClusters", false)) {
19  _rechitsLabel = consumes<reco::PFRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsSource"));
20  //setup rechit cleaners
21  const edm::VParameterSet& cleanerConfs = conf.getParameterSetVector("recHitCleaners");
22  for (const auto& conf : cleanerConfs) {
23  const std::string& cleanerName = conf.getParameter<std::string>("algoName");
24  _cleaners.emplace_back(RecHitTopologicalCleanerFactory::get()->create(cleanerName, conf));
25  }
26 
27  if (conf.exists("seedCleaners")) {
28  const edm::VParameterSet& seedcleanerConfs = conf.getParameterSetVector("seedCleaners");
29 
30  for (const auto& conf : seedcleanerConfs) {
31  const std::string& seedcleanerName = conf.getParameter<std::string>("algoName");
32  _seedcleaners.emplace_back(RecHitTopologicalCleanerFactory::get()->create(seedcleanerName, conf));
33  }
34  }
35 
36  edm::ConsumesCollector sumes = consumesCollector();
37 
38  // setup seed finding
39  const edm::ParameterSet& sfConf = conf.getParameterSet("seedFinder");
40  const std::string& sfName = sfConf.getParameter<std::string>("algoName");
41  _seedFinder = SeedFinderFactory::get()->create(sfName, sfConf);
42  //setup topo cluster builder
43  const edm::ParameterSet& initConf = conf.getParameterSet("initialClusteringStep");
44  const std::string& initName = initConf.getParameter<std::string>("algoName");
45  _initialClustering = InitialClusteringStepFactory::get()->create(initName, initConf, sumes);
46  //setup pf cluster builder if requested
47  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
48  if (!pfcConf.empty()) {
49  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
50  _pfClusterBuilder = PFClusterBuilderFactory::get()->create(pfcName, pfcConf);
51  }
52  //setup (possible) recalcuation of positions
53  const edm::ParameterSet& pConf = conf.getParameterSet("positionReCalc");
54  if (!pConf.empty()) {
55  const std::string& pName = pConf.getParameter<std::string>("algoName");
56  _positionReCalc = PFCPositionCalculatorFactory::get()->create(pName, pConf);
57  }
58  // see if new need to apply corrections, setup if there.
59  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
60  if (!cConf.empty()) {
61  const std::string& cName = cConf.getParameter<std::string>("algoName");
63  }
64 
65  if (_prodInitClusters) {
66  produces<reco::PFClusterCollection>("initialClusters");
67  }
68  produces<reco::PFClusterCollection>();
69 }

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedcleaners, _seedFinder, beamerCreator::create(), edm::ParameterSet::empty(), edm::ParameterSet::exists(), get, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getParameterSetVector(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~PFClusterProducer()

PFClusterProducer::~PFClusterProducer ( )
overridedefault

Member Function Documentation

◆ beginLuminosityBlock()

void PFClusterProducer::beginLuminosityBlock ( const edm::LuminosityBlock lumi,
const edm::EventSetup es 
)
override

Definition at line 71 of file PFClusterProducer.cc.

71  {
72  _initialClustering->update(es);
74  _pfClusterBuilder->update(es);
75  if (_positionReCalc)
76  _positionReCalc->update(es);
77  for (const auto& cleaner : _cleaners)
78  cleaner->update(es);
79  for (const auto& cleaner : _seedcleaners)
80  cleaner->update(es);
81 }

References _cleaners, _initialClustering, _pfClusterBuilder, _positionReCalc, and _seedcleaners.

◆ produce()

void PFClusterProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
override

Definition at line 83 of file PFClusterProducer.cc.

83  {
84  _initialClustering->reset();
86  _pfClusterBuilder->reset();
87 
89  e.getByToken(_rechitsLabel, rechits);
90 
91  _initialClustering->updateEvent(e);
92 
93  std::vector<bool> mask(rechits->size(), true);
94  for (const auto& cleaner : _cleaners) {
95  cleaner->clean(rechits, mask);
96  }
97 
98  // no seeding on these hits
99  std::vector<bool> seedmask = mask;
100  for (const auto& cleaner : _seedcleaners) {
101  cleaner->clean(rechits, seedmask);
102  }
103 
104  std::vector<bool> seedable(rechits->size(), false);
105  _seedFinder->findSeeds(rechits, seedmask, seedable);
106 
107  auto initialClusters = std::make_unique<reco::PFClusterCollection>();
108  _initialClustering->buildClusters(rechits, mask, seedable, *initialClusters);
109  LOGVERB("PFClusterProducer::produce()") << *_initialClustering;
110 
111  auto pfClusters = std::make_unique<reco::PFClusterCollection>();
112  pfClusters = std::make_unique<reco::PFClusterCollection>();
113  if (_pfClusterBuilder) { // if we've defined a re-clustering step execute it
114  _pfClusterBuilder->buildClusters(*initialClusters, seedable, *pfClusters);
115  LOGVERB("PFClusterProducer::produce()") << *_pfClusterBuilder;
116  } else {
117  pfClusters->insert(pfClusters->end(), initialClusters->begin(), initialClusters->end());
118  }
119 
120  if (_positionReCalc) {
121  _positionReCalc->calculateAndSetPositions(*pfClusters);
122  }
123 
124  if (_energyCorrector) {
125  _energyCorrector->correctEnergies(*pfClusters);
126  }
127 
128  if (_prodInitClusters)
129  e.put(std::move(initialClusters), "initialClusters");
130  e.put(std::move(pfClusters));
131 }

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedcleaners, _seedFinder, MillePedeFileConverter_cfg::e, LOGVERB, eostools::move(), and HI_PhotonSkim_cff::rechits.

Member Data Documentation

◆ _cleaners

std::vector<std::unique_ptr<RecHitTopologicalCleanerBase> > PFClusterProducer::_cleaners
private

Definition at line 39 of file PFClusterProducer.h.

Referenced by beginLuminosityBlock(), PFClusterProducer(), and produce().

◆ _energyCorrector

std::unique_ptr<PFClusterEnergyCorrectorBase> PFClusterProducer::_energyCorrector
private

Definition at line 45 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

◆ _initialClustering

std::unique_ptr<InitialClusteringStepBase> PFClusterProducer::_initialClustering
private

Definition at line 42 of file PFClusterProducer.h.

Referenced by beginLuminosityBlock(), PFClusterProducer(), and produce().

◆ _pfClusterBuilder

std::unique_ptr<PFClusterBuilderBase> PFClusterProducer::_pfClusterBuilder
private

Definition at line 43 of file PFClusterProducer.h.

Referenced by beginLuminosityBlock(), PFClusterProducer(), and produce().

◆ _positionReCalc

std::unique_ptr<PFCPositionCalculatorBase> PFClusterProducer::_positionReCalc
private

Definition at line 44 of file PFClusterProducer.h.

Referenced by beginLuminosityBlock(), PFClusterProducer(), and produce().

◆ _prodInitClusters

const bool PFClusterProducer::_prodInitClusters
private

Definition at line 37 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

◆ _rechitsLabel

edm::EDGetTokenT<reco::PFRecHitCollection> PFClusterProducer::_rechitsLabel
private

Definition at line 35 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

◆ _seedcleaners

std::vector<std::unique_ptr<RecHitTopologicalCleanerBase> > PFClusterProducer::_seedcleaners
private

Definition at line 40 of file PFClusterProducer.h.

Referenced by beginLuminosityBlock(), PFClusterProducer(), and produce().

◆ _seedFinder

std::unique_ptr<SeedFinderBase> PFClusterProducer::_seedFinder
private

Definition at line 41 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

PFClusterProducer::_seedFinder
std::unique_ptr< SeedFinderBase > _seedFinder
Definition: PFClusterProducer.h:41
edm::VParameterSet
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
PFClusterProducer::_pfClusterBuilder
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
Definition: PFClusterProducer.h:43
PFClusterProducer::_positionReCalc
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
Definition: PFClusterProducer.h:44
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
edm::Handle
Definition: AssociativeIterator.h:50
PFClusterProducer::_prodInitClusters
const bool _prodInitClusters
Definition: PFClusterProducer.h:37
PFClusterProducer::_seedcleaners
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
Definition: PFClusterProducer.h:40
PFClusterProducer::_initialClustering
std::unique_ptr< InitialClusteringStepBase > _initialClustering
Definition: PFClusterProducer.h:42
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
PFClusterProducer::_cleaners
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
Definition: PFClusterProducer.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
edm::ParameterSet
Definition: ParameterSet.h:47
PFClusterProducer::_rechitsLabel
edm::EDGetTokenT< reco::PFRecHitCollection > _rechitsLabel
Definition: PFClusterProducer.h:35
get
#define get
eostools.move
def move(src, dest)
Definition: eostools.py:511
LOGVERB
#define LOGVERB(x)
Definition: PFClusterProducer.cc:11
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ParameterSet::getParameterSetVector
VParameterSet const & getParameterSetVector(std::string const &name) const
Definition: ParameterSet.cc:2160
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
edm::ParameterSet::empty
bool empty() const
Definition: ParameterSet.h:201
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
PFClusterProducer::_energyCorrector
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
Definition: PFClusterProducer.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37