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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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 15 of file PFClusterProducer.cc.

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

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 69 of file PFClusterProducer.cc.

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

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

◆ produce()

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

Definition at line 81 of file PFClusterProducer.cc.

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

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedcleaners, _seedFinder, MillePedeFileConverter_cfg::e, LOGVERB, eostools::move(), and TrackInfoProducer_cfi::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().

reco::PFClusterCollection
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
PFClusterProducer::_seedFinder
std::unique_ptr< SeedFinderBase > _seedFinder
Definition: PFClusterProducer.h:41
edm::VParameterSet
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
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
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:674
edm::ParameterSet
Definition: ParameterSet.h:36
TrackInfoProducer_cfi.rechits
rechits
Definition: TrackInfoProducer_cfi.py:9
PFClusterProducer::_rechitsLabel
edm::EDGetTokenT< reco::PFRecHitCollection > _rechitsLabel
Definition: PFClusterProducer.h:35
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
LOGVERB
#define LOGVERB(x)
Definition: PFClusterProducer.cc:9
edm::ParameterSet::getParameterSetVector
VParameterSet const & getParameterSetVector(std::string const &name) const
Definition: ParameterSet.cc:2153
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
edm::ParameterSet::empty
bool empty() const
Definition: ParameterSet.h:190
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
PFClusterProducer::_energyCorrector
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
Definition: PFClusterProducer.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37