test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
 PFClusterProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PFClusterProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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, eCorr(), edm::ParameterSet::empty(), reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getParameterSetVector(), NULL, 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  }
29  // setup seed finding
30  const edm::ParameterSet& sfConf =
31  conf.getParameterSet("seedFinder");
32  const std::string& sfName = sfConf.getParameter<std::string>("algoName");
33  SeedFinderBase* sfb = SeedFinderFactory::get()->create(sfName,sfConf);
34  _seedFinder.reset(sfb);
35  //setup topo cluster builder
36  const edm::ParameterSet& initConf =
37  conf.getParameterSet("initialClusteringStep");
38  const std::string& initName = initConf.getParameter<std::string>("algoName");
39  ICSB* initb = InitialClusteringStepFactory::get()->create(initName,initConf);
40  _initialClustering.reset(initb);
41  //setup pf cluster builder if requested
42  _pfClusterBuilder.reset(NULL);
43  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
44  if( !pfcConf.empty() ) {
45  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
46  PFCBB* pfcb = PFClusterBuilderFactory::get()->create(pfcName,pfcConf);
47  _pfClusterBuilder.reset(pfcb);
48  }
49  //setup (possible) recalcuation of positions
50  _positionReCalc.reset(NULL);
51  const edm::ParameterSet& pConf = conf.getParameterSet("positionReCalc");
52  if( !pConf.empty() ) {
53  const std::string& pName = pConf.getParameter<std::string>("algoName");
54  PosCalc* pcalc = PFCPositionCalculatorFactory::get()->create(pName,pConf);
55  _positionReCalc.reset(pcalc);
56  }
57  // see if new need to apply corrections, setup if there.
58  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
59  if( !cConf.empty() ) {
60  const std::string& cName = cConf.getParameter<std::string>("algoName");
62  PFClusterEnergyCorrectorFactory::get()->create(cName,cConf);
63  _energyCorrector.reset(eCorr);
64  }
65 
66 
67  if( _prodInitClusters ) {
68  produces<reco::PFClusterCollection>("initialClusters");
69  }
70  produces<reco::PFClusterCollection>();
71 }
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
#define NULL
Definition: scimark2.h:8
PFCPositionCalculatorBase PosCalc
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
PFClusterBuilderBase PFCBB
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
InitialClusteringStepBase ICSB
static float eCorr(int ieta, int iphi, double ampl, int runnum)
Ugly hack to apply energy corrections to some HB- cells.
T get(const Candidate &c)
Definition: component.h:55
PFClusterProducer::~PFClusterProducer ( )
inline

Definition at line 28 of file PFClusterProducer.h.

28 { }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 73 of file PFClusterProducer.cc.

References _initialClustering, _pfClusterBuilder, and _positionReCalc.

74  {
75  _initialClustering->update(es);
76  _pfClusterBuilder->update(es);
77  if( _positionReCalc ) _positionReCalc->update(es);
78 
79 }
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 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 81 of file PFClusterProducer.cc.

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedFinder, edm::Event::getByToken(), LOGVERB, edm::Event::put(), and HI_PhotonSkim_cff::rechits.

81  {
82  _initialClustering->reset();
83  _pfClusterBuilder->reset();
84 
86  e.getByToken(_rechitsLabel,rechits);
87 
88  std::vector<bool> mask(rechits->size(),true);
89  for( const auto& cleaner : _cleaners ) {
90  cleaner->clean(rechits, mask);
91  }
92 
93 
94 
95  std::vector<bool> seedable(rechits->size(),false);
96  _seedFinder->findSeeds(rechits,mask,seedable);
97 
98 
99 
100  std::auto_ptr<reco::PFClusterCollection> initialClusters;
101  initialClusters.reset(new reco::PFClusterCollection);
102  _initialClustering->buildClusters(rechits, mask, seedable, *initialClusters);
103  LOGVERB("PFClusterProducer::produce()") << *_initialClustering;
104 
105 
106 
107 
108  std::auto_ptr<reco::PFClusterCollection> pfClusters;
109  pfClusters.reset(new reco::PFClusterCollection);
110  if( _pfClusterBuilder ) { // if we've defined a re-clustering step execute it
111  _pfClusterBuilder->buildClusters(*initialClusters, seedable, *pfClusters);
112  LOGVERB("PFClusterProducer::produce()") << *_pfClusterBuilder;
113  } else {
114  pfClusters->insert(pfClusters->end(),
115  initialClusters->begin(),initialClusters->end());
116  }
117 
118 
119 
120 
121  if( _positionReCalc ) {
122  _positionReCalc->calculateAndSetPositions(*pfClusters);
123  }
124 
125  if( _energyCorrector ) {
126  _energyCorrector->correctEnergies(*pfClusters);
127  }
128 
129  if( _prodInitClusters ) e.put(initialClusters,"initialClusters");
130  e.put(pfClusters);
131 }
std::unique_ptr< SeedFinderBase > _seedFinder
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
#define LOGVERB(x)
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
const bool _prodInitClusters
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< reco::PFRecHitCollection > _rechitsLabel
std::unique_ptr< InitialClusteringStepBase > _initialClustering
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9

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