CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
PFClusterProducer Class Reference
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 12 of file PFClusterProducer.cc.

Member Typedef Documentation

◆ ICSB

Definition at line 14 of file PFClusterProducer.cc.

◆ PFCBB

Definition at line 15 of file PFClusterProducer.cc.

◆ PosCalc

Definition at line 16 of file PFClusterProducer.cc.

◆ RHCB

Definition at line 13 of file PFClusterProducer.cc.

Constructor & Destructor Documentation

◆ PFClusterProducer()

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

Definition at line 55 of file PFClusterProducer.cc.

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.

56  : _prodInitClusters(conf.getUntrackedParameter<bool>("prodInitialClusters", false)) {
57  _rechitsLabel = consumes<reco::PFRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsSource"));
58  edm::ConsumesCollector cc = consumesCollector();
59 
60  //setup rechit cleaners
61  const edm::VParameterSet& cleanerConfs = conf.getParameterSetVector("recHitCleaners");
62  for (const auto& conf : cleanerConfs) {
63  const std::string& cleanerName = conf.getParameter<std::string>("algoName");
64  _cleaners.emplace_back(RecHitTopologicalCleanerFactory::get()->create(cleanerName, conf, cc));
65  }
66 
67  if (conf.exists("seedCleaners")) {
68  const edm::VParameterSet& seedcleanerConfs = conf.getParameterSetVector("seedCleaners");
69 
70  for (const auto& conf : seedcleanerConfs) {
71  const std::string& seedcleanerName = conf.getParameter<std::string>("algoName");
72  _seedcleaners.emplace_back(RecHitTopologicalCleanerFactory::get()->create(seedcleanerName, conf, cc));
73  }
74  }
75 
76  // setup seed finding
77  const edm::ParameterSet& sfConf = conf.getParameterSet("seedFinder");
78  const std::string& sfName = sfConf.getParameter<std::string>("algoName");
79  _seedFinder = SeedFinderFactory::get()->create(sfName, sfConf);
80  //setup topo cluster builder
81  const edm::ParameterSet& initConf = conf.getParameterSet("initialClusteringStep");
82  const std::string& initName = initConf.getParameter<std::string>("algoName");
83  _initialClustering = InitialClusteringStepFactory::get()->create(initName, initConf, cc);
84  //setup pf cluster builder if requested
85  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
86  if (!pfcConf.empty()) {
87  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
88  _pfClusterBuilder = PFClusterBuilderFactory::get()->create(pfcName, pfcConf, cc);
89  }
90  //setup (possible) recalcuation of positions
91  const edm::ParameterSet& pConf = conf.getParameterSet("positionReCalc");
92  if (!pConf.empty()) {
93  const std::string& pName = pConf.getParameter<std::string>("algoName");
94  _positionReCalc = PFCPositionCalculatorFactory::get()->create(pName, pConf, cc);
95  }
96  // see if new need to apply corrections, setup if there.
97  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
98  if (!cConf.empty()) {
99  const std::string& cName = cConf.getParameter<std::string>("algoName");
100  _energyCorrector = PFClusterEnergyCorrectorFactory::get()->create(cName, cConf);
101  }
102 
103  if (_prodInitClusters) {
104  produces<reco::PFClusterCollection>("initialClusters");
105  }
106  produces<reco::PFClusterCollection>();
107 }
std::unique_ptr< SeedFinderBase > _seedFinder
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
def create(alignables, pedeDump, additionalData, outputFile, config)
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParameterSet const & getParameterSet(std::string const &) const
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
const bool _prodInitClusters
bool empty() const
Definition: ParameterSet.h:201
edm::EDGetTokenT< reco::PFRecHitCollection > _rechitsLabel
std::unique_ptr< InitialClusteringStepBase > _initialClustering
VParameterSet const & getParameterSetVector(std::string const &name) const
#define get

◆ ~PFClusterProducer()

PFClusterProducer::~PFClusterProducer ( )
overridedefault

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 109 of file PFClusterProducer.cc.

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

109  {
110  _initialClustering->update(es);
111  if (_pfClusterBuilder)
112  _pfClusterBuilder->update(es);
113  if (_positionReCalc)
114  _positionReCalc->update(es);
115  for (const auto& cleaner : _cleaners)
116  cleaner->update(es);
117  for (const auto& cleaner : _seedcleaners)
118  cleaner->update(es);
119 }
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
std::unique_ptr< InitialClusteringStepBase > _initialClustering

◆ produce()

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

Definition at line 121 of file PFClusterProducer.cc.

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

121  {
122  _initialClustering->reset();
123  if (_pfClusterBuilder)
124  _pfClusterBuilder->reset();
125 
127  e.getByToken(_rechitsLabel, rechits);
128 
129  _initialClustering->updateEvent(e);
130 
131  std::vector<bool> mask(rechits->size(), true);
132  for (const auto& cleaner : _cleaners) {
133  cleaner->clean(rechits, mask);
134  }
135 
136  // no seeding on these hits
137  std::vector<bool> seedmask = mask;
138  for (const auto& cleaner : _seedcleaners) {
139  cleaner->clean(rechits, seedmask);
140  }
141 
142  std::vector<bool> seedable(rechits->size(), false);
143  _seedFinder->findSeeds(rechits, seedmask, seedable);
144 
145  auto initialClusters = std::make_unique<reco::PFClusterCollection>();
146  _initialClustering->buildClusters(rechits, mask, seedable, *initialClusters);
147  LOGVERB("PFClusterProducer::produce()") << *_initialClustering;
148 
149  auto pfClusters = std::make_unique<reco::PFClusterCollection>();
150  pfClusters = std::make_unique<reco::PFClusterCollection>();
151  if (_pfClusterBuilder) { // if we've defined a re-clustering step execute it
152  _pfClusterBuilder->buildClusters(*initialClusters, seedable, *pfClusters);
153  LOGVERB("PFClusterProducer::produce()") << *_pfClusterBuilder;
154  } else {
155  pfClusters->insert(pfClusters->end(), initialClusters->begin(), initialClusters->end());
156  }
157 
158  if (_positionReCalc) {
159  _positionReCalc->calculateAndSetPositions(*pfClusters);
160  }
161 
162  if (_energyCorrector) {
163  _energyCorrector->correctEnergies(*pfClusters);
164  }
165 
166  if (_prodInitClusters)
167  e.put(std::move(initialClusters), "initialClusters");
168  e.put(std::move(pfClusters));
169 }
std::unique_ptr< SeedFinderBase > _seedFinder
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
#define LOGVERB(x)
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
const bool _prodInitClusters
edm::EDGetTokenT< reco::PFRecHitCollection > _rechitsLabel
std::unique_ptr< InitialClusteringStepBase > _initialClustering
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ _cleaners

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

Definition at line 31 of file PFClusterProducer.cc.

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

◆ _energyCorrector

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

Definition at line 37 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().

◆ _initialClustering

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

Definition at line 34 of file PFClusterProducer.cc.

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

◆ _pfClusterBuilder

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

Definition at line 35 of file PFClusterProducer.cc.

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

◆ _positionReCalc

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

Definition at line 36 of file PFClusterProducer.cc.

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

◆ _prodInitClusters

const bool PFClusterProducer::_prodInitClusters
private

Definition at line 29 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().

◆ _rechitsLabel

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

Definition at line 27 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().

◆ _seedcleaners

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

Definition at line 32 of file PFClusterProducer.cc.

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

◆ _seedFinder

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

Definition at line 33 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().