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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 21 of file PFClusterProducer.h.

Member Typedef Documentation

Definition at line 23 of file PFClusterProducer.h.

Definition at line 24 of file PFClusterProducer.h.

Definition at line 25 of file PFClusterProducer.h.

Definition at line 22 of file PFClusterProducer.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file PFClusterProducer.cc.

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedFinder, edm::EDConsumerBase::consumesCollector(), electrons_cff::eCorr, edm::ParameterSet::empty(), reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getParameterSetVector(), and AlCaHLTBitMon_QueryRunRegistry::string.

15  :
16  _prodInitClusters(conf.getUntrackedParameter<bool>("prodInitialClusters",false))
17 {
18  _rechitsLabel = consumes<reco::PFRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsSource"));
19  //setup rechit cleaners
20  const edm::VParameterSet& cleanerConfs =
21  conf.getParameterSetVector("recHitCleaners");
22  for( const auto& conf : cleanerConfs ) {
23  const std::string& cleanerName =
24  conf.getParameter<std::string>("algoName");
25  RHCB* cleaner =
26  RecHitTopologicalCleanerFactory::get()->create(cleanerName,conf);
27  _cleaners.push_back(std::unique_ptr<RHCB>(cleaner));
28  }
30 
31  // setup seed finding
32  const edm::ParameterSet& sfConf =
33  conf.getParameterSet("seedFinder");
34  const std::string& sfName = sfConf.getParameter<std::string>("algoName");
35  SeedFinderBase* sfb = SeedFinderFactory::get()->create(sfName,sfConf);
36  _seedFinder.reset(sfb);
37  //setup topo cluster builder
38  const edm::ParameterSet& initConf =
39  conf.getParameterSet("initialClusteringStep");
40  const std::string& initName = initConf.getParameter<std::string>("algoName");
41  ICSB* initb = InitialClusteringStepFactory::get()->create(initName,initConf,sumes);
42  _initialClustering.reset(initb);
43  //setup pf cluster builder if requested
44  _pfClusterBuilder.reset(nullptr);
45  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
46  if( !pfcConf.empty() ) {
47  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
48  PFCBB* pfcb = PFClusterBuilderFactory::get()->create(pfcName,pfcConf);
49  _pfClusterBuilder.reset(pfcb);
50  }
51  //setup (possible) recalcuation of positions
52  _positionReCalc.reset(nullptr);
53  const edm::ParameterSet& pConf = conf.getParameterSet("positionReCalc");
54  if( !pConf.empty() ) {
55  const std::string& pName = pConf.getParameter<std::string>("algoName");
56  PosCalc* pcalc = PFCPositionCalculatorFactory::get()->create(pName,pConf);
57  _positionReCalc.reset(pcalc);
58  }
59  // see if new need to apply corrections, setup if there.
60  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
61  if( !cConf.empty() ) {
62  const std::string& cName = cConf.getParameter<std::string>("algoName");
64  PFClusterEnergyCorrectorFactory::get()->create(cName,cConf);
65  _energyCorrector.reset(eCorr);
66  }
67 
68 
69  if( _prodInitClusters ) {
70  produces<reco::PFClusterCollection>("initialClusters");
71  }
72  produces<reco::PFClusterCollection>();
73 }
std::unique_ptr< SeedFinderBase > _seedFinder
T getParameter(std::string const &) const
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
bool empty() const
Definition: ParameterSet.h:218
T getUntrackedParameter(std::string const &, T const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
RecHitTopologicalCleanerBase RHCB
PFCPositionCalculatorBase PosCalc
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
PFClusterBuilderBase PFCBB
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
const bool _prodInitClusters
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< reco::PFRecHitCollection > _rechitsLabel
std::unique_ptr< InitialClusteringStepBase > _initialClustering
ParameterSet const & getParameterSet(std::string const &) const
InitialClusteringStepBase ICSB
T get(const Candidate &c)
Definition: component.h:55
PFClusterProducer::~PFClusterProducer ( )
overridedefault

Member Function Documentation

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

Definition at line 75 of file PFClusterProducer.cc.

References _initialClustering, _pfClusterBuilder, and _positionReCalc.

76  {
77  _initialClustering->update(es);
78  if( _pfClusterBuilder ) _pfClusterBuilder->update(es);
79  if( _positionReCalc ) _positionReCalc->update(es);
80 
81 }
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
std::unique_ptr< InitialClusteringStepBase > _initialClustering
void PFClusterProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
override

Definition at line 83 of file PFClusterProducer.cc.

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedFinder, edm::Event::getByToken(), LOGVERB, RecoTauDiscriminantConfiguration::mask, eostools::move(), edm::Event::put(), and TrackInfoProducer_cfi::rechits.

83  {
84  _initialClustering->reset();
85  if( _pfClusterBuilder ) _pfClusterBuilder->reset();
86 
88  e.getByToken(_rechitsLabel,rechits);
89 
90  _initialClustering->updateEvent(e);
91 
92  std::vector<bool> mask(rechits->size(),true);
93  for( const auto& cleaner : _cleaners ) {
94  cleaner->clean(rechits, mask);
95  }
96 
97 
98 
99  std::vector<bool> seedable(rechits->size(),false);
100  _seedFinder->findSeeds(rechits,mask,seedable);
101 
102 
103 
104  auto initialClusters = std::make_unique<reco::PFClusterCollection>();
105  _initialClustering->buildClusters(rechits, mask, seedable, *initialClusters);
106  LOGVERB("PFClusterProducer::produce()") << *_initialClustering;
107 
108 
109 
110 
111  auto pfClusters = std::make_unique<reco::PFClusterCollection>();
112  pfClusters.reset(new 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(),
118  initialClusters->begin(),initialClusters->end());
119  }
120 
121 
122 
123 
124  if( _positionReCalc ) {
125  _positionReCalc->calculateAndSetPositions(*pfClusters);
126  }
127 
128  if( _energyCorrector ) {
129  _energyCorrector->correctEnergies(*pfClusters);
130  }
131 
132  if( _prodInitClusters ) e.put(std::move(initialClusters),"initialClusters");
133  e.put(std::move(pfClusters));
134 }
std::unique_ptr< SeedFinderBase > _seedFinder
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
#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
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 40 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

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

Definition at line 45 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

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

Definition at line 42 of file PFClusterProducer.h.

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

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

Definition at line 43 of file PFClusterProducer.h.

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

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

Definition at line 44 of file PFClusterProducer.h.

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

const bool PFClusterProducer::_prodInitClusters
private

Definition at line 38 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

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

Definition at line 36 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().

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

Definition at line 41 of file PFClusterProducer.h.

Referenced by PFClusterProducer(), and produce().