CMS 3D CMS Logo

PFMultiDepthClusterProducer.cc
Go to the documentation of this file.
2 
3 #ifdef PFLOW_DEBUG
4 #define LOGVERB(x) edm::LogVerbatim(x)
5 #define LOGWARN(x) edm::LogWarning(x)
6 #define LOGERR(x) edm::LogError(x)
7 #define LOGDRESSED(x) edm::LogInfo(x)
8 #else
9 #define LOGVERB(x) LogTrace(x)
10 #define LOGWARN(x) edm::LogWarning(x)
11 #define LOGERR(x) edm::LogError(x)
12 #define LOGDRESSED(x) LogDebug(x)
13 #endif
14 
16 {
17  _clustersLabel = consumes<reco::PFClusterCollection>(conf.getParameter<edm::InputTag>("clustersSource"));
18  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
19  if( !pfcConf.empty() ) {
20  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
21  _pfClusterBuilder = std::unique_ptr<PFCBB>{PFClusterBuilderFactory::get()->create(pfcName,pfcConf)};
22  }
23  // see if new need to apply corrections, setup if there.
24  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
25  if( !cConf.empty() ) {
26  const std::string& cName = cConf.getParameter<std::string>("algoName");
27  _energyCorrector = std::unique_ptr<PFClusterEnergyCorrectorBase>{PFClusterEnergyCorrectorFactory::get()->create(cName,cConf)};
28  }
29 
30  produces<reco::PFClusterCollection>();
31 }
32 
34  const edm::EventSetup& es) {
35  _pfClusterBuilder->update(es);
36 
37 }
38 
40  _pfClusterBuilder->reset();
41 
43  e.getByToken(_clustersLabel,inputClusters);
44 
45  std::vector<bool> seedable;
46 
47  auto pfClusters = std::make_unique<reco::PFClusterCollection>();
48  _pfClusterBuilder->buildClusters(*inputClusters, seedable, *pfClusters);
49  LOGVERB("PFMultiDepthClusterProducer::produce()") << *_pfClusterBuilder;
50 
51  if( _energyCorrector ) {
52  _energyCorrector->correctEnergies(*pfClusters);
53  }
54  e.put(std::move(pfClusters));
55 
56 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:191
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
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
void produce(edm::Event &, const edm::EventSetup &) override
PFMultiDepthClusterProducer(const edm::ParameterSet &)
ParameterSet const & getParameterSet(std::string const &) const
edm::EDGetTokenT< reco::PFClusterCollection > _clustersLabel
#define LOGVERB(x)
def move(src, dest)
Definition: eostools.py:511
T get(const Candidate &c)
Definition: component.h:55