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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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::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 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, beamerCreator::create(), 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  _cleaners.emplace_back(RecHitTopologicalCleanerFactory::get()->create(cleanerName,conf));
26  }
27  edm::ConsumesCollector sumes = consumesCollector();
28 
29  // setup seed finding
30  const edm::ParameterSet& sfConf =
31  conf.getParameterSet("seedFinder");
32  const std::string& sfName = sfConf.getParameter<std::string>("algoName");
33  _seedFinder = std::unique_ptr<SeedFinderBase>{SeedFinderFactory::get()->create(sfName,sfConf)};
34  //setup topo cluster builder
35  const edm::ParameterSet& initConf =
36  conf.getParameterSet("initialClusteringStep");
37  const std::string& initName = initConf.getParameter<std::string>("algoName");
38  _initialClustering = std::unique_ptr<ICSB>{InitialClusteringStepFactory::get()->create(initName,initConf,sumes)};
39  //setup pf cluster builder if requested
40  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
41  if( !pfcConf.empty() ) {
42  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
43  _pfClusterBuilder = std::unique_ptr<PFCBB>{PFClusterBuilderFactory::get()->create(pfcName,pfcConf)};
44  }
45  //setup (possible) recalcuation of positions
46  const edm::ParameterSet& pConf = conf.getParameterSet("positionReCalc");
47  if( !pConf.empty() ) {
48  const std::string& pName = pConf.getParameter<std::string>("algoName");
49  _positionReCalc = std::unique_ptr<PosCalc>{PFCPositionCalculatorFactory::get()->create(pName,pConf)};
50  }
51  // see if new need to apply corrections, setup if there.
52  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
53  if( !cConf.empty() ) {
54  const std::string& cName = cConf.getParameter<std::string>("algoName");
55  _energyCorrector = std::unique_ptr<PFClusterEnergyCorrectorBase>{PFClusterEnergyCorrectorFactory::get()->create(cName,cConf)};
56  }
57 
58 
59  if( _prodInitClusters ) {
60  produces<reco::PFClusterCollection>("initialClusters");
61  }
62  produces<reco::PFClusterCollection>();
63 }
std::unique_ptr< SeedFinderBase > _seedFinder
T getParameter(std::string const &) const
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
bool empty() const
Definition: ParameterSet.h:191
T getUntrackedParameter(std::string const &, T const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
def create(alignables, pedeDump, additionalData, outputFile, config)
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
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
ParameterSet const & getParameterSet(std::string const &) const
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 65 of file PFClusterProducer.cc.

References _initialClustering, _pfClusterBuilder, and _positionReCalc.

66  {
67  _initialClustering->update(es);
68  if( _pfClusterBuilder ) _pfClusterBuilder->update(es);
69  if( _positionReCalc ) _positionReCalc->update(es);
70 
71 }
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 73 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.

73  {
74  _initialClustering->reset();
75  if( _pfClusterBuilder ) _pfClusterBuilder->reset();
76 
78  e.getByToken(_rechitsLabel,rechits);
79 
80  _initialClustering->updateEvent(e);
81 
82  std::vector<bool> mask(rechits->size(),true);
83  for( const auto& cleaner : _cleaners ) {
84  cleaner->clean(rechits, mask);
85  }
86 
87 
88 
89  std::vector<bool> seedable(rechits->size(),false);
90  _seedFinder->findSeeds(rechits,mask,seedable);
91 
92 
93 
94  auto initialClusters = std::make_unique<reco::PFClusterCollection>();
95  _initialClustering->buildClusters(rechits, mask, seedable, *initialClusters);
96  LOGVERB("PFClusterProducer::produce()") << *_initialClustering;
97 
98 
99 
100 
101  auto pfClusters = std::make_unique<reco::PFClusterCollection>();
102  pfClusters.reset(new reco::PFClusterCollection);
103  if( _pfClusterBuilder ) { // if we've defined a re-clustering step execute it
104  _pfClusterBuilder->buildClusters(*initialClusters, seedable, *pfClusters);
105  LOGVERB("PFClusterProducer::produce()") << *_pfClusterBuilder;
106  } else {
107  pfClusters->insert(pfClusters->end(),
108  initialClusters->begin(),initialClusters->end());
109  }
110 
111 
112 
113 
114  if( _positionReCalc ) {
115  _positionReCalc->calculateAndSetPositions(*pfClusters);
116  }
117 
118  if( _energyCorrector ) {
119  _energyCorrector->correctEnergies(*pfClusters);
120  }
121 
122  if( _prodInitClusters ) e.put(std::move(initialClusters),"initialClusters");
123  e.put(std::move(pfClusters));
124 }
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:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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:511

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().