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  _pfClusterBuilder.reset(nullptr);
19  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
20  if( !pfcConf.empty() ) {
21  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
22  PFCBB* pfcb = PFClusterBuilderFactory::get()->create(pfcName,pfcConf);
23  _pfClusterBuilder.reset(pfcb);
24  }
25  // see if new need to apply corrections, setup if there.
26  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
27  if( !cConf.empty() ) {
28  const std::string& cName = cConf.getParameter<std::string>("algoName");
30  PFClusterEnergyCorrectorFactory::get()->create(cName,cConf);
31  _energyCorrector.reset(eCorr);
32  }
33 
34  produces<reco::PFClusterCollection>();
35 }
36 
38  const edm::EventSetup& es) {
39  _pfClusterBuilder->update(es);
40 
41 }
42 
44  _pfClusterBuilder->reset();
45 
47  e.getByToken(_clustersLabel,inputClusters);
48 
49  std::vector<bool> seedable;
50 
51  auto pfClusters = std::make_unique<reco::PFClusterCollection>();
52  _pfClusterBuilder->buildClusters(*inputClusters, seedable, *pfClusters);
53  LOGVERB("PFMultiDepthClusterProducer::produce()") << *_pfClusterBuilder;
54 
55  if( _energyCorrector ) {
56  _energyCorrector->correctEnergies(*pfClusters);
57  }
58  e.put(std::move(pfClusters));
59 
60 }
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:218
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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:510
T get(const Candidate &c)
Definition: component.h:55