CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
PFClusterProducer Class Reference
Inheritance diagram for PFClusterProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &, 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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
 
std::unique_ptr< SeedFinderBase_seedFinder
 
bool cutsFromDB
 
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcdhcalCutsToken_
 
HcalPFCuts const * paramPF = nullptr
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 13 of file PFClusterProducer.cc.

Member Typedef Documentation

◆ ICSB

Definition at line 15 of file PFClusterProducer.cc.

◆ PFCBB

Definition at line 16 of file PFClusterProducer.cc.

◆ PosCalc

Definition at line 17 of file PFClusterProducer.cc.

◆ RHCB

Definition at line 14 of file PFClusterProducer.cc.

Constructor & Destructor Documentation

◆ PFClusterProducer()

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

Definition at line 60 of file PFClusterProducer.cc.

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedcleaners, _seedFinder, gpuPixelDoublets::cc, beamerCreator::create(), cutsFromDB, edm::ParameterSet::empty(), edm::ParameterSet::exists(), get, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getParameterSetVector(), hcalCutsToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

61  : _prodInitClusters(conf.getUntrackedParameter<bool>("prodInitialClusters", false)) {
62  _rechitsLabel = consumes<reco::PFRecHitCollection>(conf.getParameter<edm::InputTag>("recHitsSource"));
63  cutsFromDB = conf.getParameter<bool>("usePFThresholdsFromDB");
64  edm::ConsumesCollector cc = consumesCollector();
65 
66  if (cutsFromDB) {
67  hcalCutsToken_ = esConsumes<HcalPFCuts, HcalPFCutsRcd, edm::Transition::BeginRun>(edm::ESInputTag("", "withTopo"));
68  }
69 
70  //setup rechit cleaners
71  const edm::VParameterSet& cleanerConfs = conf.getParameterSetVector("recHitCleaners");
72  for (const auto& conf : cleanerConfs) {
73  const std::string& cleanerName = conf.getParameter<std::string>("algoName");
74  _cleaners.emplace_back(RecHitTopologicalCleanerFactory::get()->create(cleanerName, conf, cc));
75  }
76 
77  if (conf.exists("seedCleaners")) {
78  const edm::VParameterSet& seedcleanerConfs = conf.getParameterSetVector("seedCleaners");
79 
80  for (const auto& conf : seedcleanerConfs) {
81  const std::string& seedcleanerName = conf.getParameter<std::string>("algoName");
82  _seedcleaners.emplace_back(RecHitTopologicalCleanerFactory::get()->create(seedcleanerName, conf, cc));
83  }
84  }
85 
86  // setup seed finding
87  const edm::ParameterSet& sfConf = conf.getParameterSet("seedFinder");
88  const std::string& sfName = sfConf.getParameter<std::string>("algoName");
89  _seedFinder = SeedFinderFactory::get()->create(sfName, sfConf);
90  //setup topo cluster builder
91  const edm::ParameterSet& initConf = conf.getParameterSet("initialClusteringStep");
92  const std::string& initName = initConf.getParameter<std::string>("algoName");
93  _initialClustering = InitialClusteringStepFactory::get()->create(initName, initConf, cc);
94  //setup pf cluster builder if requested
95  const edm::ParameterSet& pfcConf = conf.getParameterSet("pfClusterBuilder");
96  if (!pfcConf.empty()) {
97  const std::string& pfcName = pfcConf.getParameter<std::string>("algoName");
98  _pfClusterBuilder = PFClusterBuilderFactory::get()->create(pfcName, pfcConf, cc);
99  }
100  //setup (possible) recalcuation of positions
101  const edm::ParameterSet& pConf = conf.getParameterSet("positionReCalc");
102  if (!pConf.empty()) {
103  const std::string& pName = pConf.getParameter<std::string>("algoName");
104  _positionReCalc = PFCPositionCalculatorFactory::get()->create(pName, pConf, cc);
105  }
106  // see if new need to apply corrections, setup if there.
107  const edm::ParameterSet& cConf = conf.getParameterSet("energyCorrector");
108  if (!cConf.empty()) {
109  const std::string& cName = cConf.getParameter<std::string>("algoName");
110  _energyCorrector = PFClusterEnergyCorrectorFactory::get()->create(cName, cConf);
111  }
112 
113  if (_prodInitClusters) {
114  produces<reco::PFClusterCollection>("initialClusters");
115  }
116  produces<reco::PFClusterCollection>();
117 }
std::unique_ptr< SeedFinderBase > _seedFinder
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
def create(alignables, pedeDump, additionalData, outputFile, config)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:35
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParameterSet const & getParameterSet(std::string const &) const
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
const bool _prodInitClusters
bool empty() const
Definition: ParameterSet.h:202
edm::EDGetTokenT< reco::PFRecHitCollection > _rechitsLabel
std::unique_ptr< InitialClusteringStepBase > _initialClustering
VParameterSet const & getParameterSetVector(std::string const &name) const
#define get
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > hcalCutsToken_

◆ ~PFClusterProducer()

PFClusterProducer::~PFClusterProducer ( )
overridedefault

Member Function Documentation

◆ beginRun()

void PFClusterProducer::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
override

Definition at line 119 of file PFClusterProducer.cc.

References _cleaners, _initialClustering, _pfClusterBuilder, _positionReCalc, _seedcleaners, cutsFromDB, edm::EventSetup::getData(), hcalCutsToken_, and paramPF.

119  {
120  if (cutsFromDB) {
122  }
123  _initialClustering->update(es);
124  if (_pfClusterBuilder)
125  _pfClusterBuilder->update(es);
126  if (_positionReCalc)
127  _positionReCalc->update(es);
128  for (const auto& cleaner : _cleaners)
129  cleaner->update(es);
130  for (const auto& cleaner : _seedcleaners)
131  cleaner->update(es);
132 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
std::unique_ptr< PFCPositionCalculatorBase > _positionReCalc
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _cleaners
std::unique_ptr< InitialClusteringStepBase > _initialClustering
HcalPFCuts const * paramPF
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > hcalCutsToken_

◆ produce()

void PFClusterProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
override

Definition at line 134 of file PFClusterProducer.cc.

References _cleaners, _energyCorrector, _initialClustering, _pfClusterBuilder, _positionReCalc, _prodInitClusters, _rechitsLabel, _seedcleaners, _seedFinder, MillePedeFileConverter_cfg::e, LOGVERB, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, eostools::move(), paramPF, and HI_PhotonSkim_cff::rechits.

134  {
135  _initialClustering->reset();
136  if (_pfClusterBuilder)
137  _pfClusterBuilder->reset();
138 
140  e.getByToken(_rechitsLabel, rechits);
141 
142  _initialClustering->updateEvent(e);
143 
144  std::vector<bool> mask(rechits->size(), true);
145  for (const auto& cleaner : _cleaners) {
146  cleaner->clean(rechits, mask);
147  }
148 
149  // no seeding on these hits
150  std::vector<bool> seedmask = mask;
151  for (const auto& cleaner : _seedcleaners) {
152  cleaner->clean(rechits, seedmask);
153  }
154 
155  std::vector<bool> seedable(rechits->size(), false);
156  _seedFinder->findSeeds(rechits, seedmask, seedable, paramPF);
157 
158  auto initialClusters = std::make_unique<reco::PFClusterCollection>();
159  _initialClustering->buildClusters(rechits, mask, seedable, *initialClusters, paramPF);
160  LOGVERB("PFClusterProducer::produce()") << *_initialClustering;
161 
162  auto pfClusters = std::make_unique<reco::PFClusterCollection>();
163  pfClusters = std::make_unique<reco::PFClusterCollection>();
164  if (_pfClusterBuilder) { // if we've defined a re-clustering step execute it
165  _pfClusterBuilder->buildClusters(*initialClusters, seedable, *pfClusters, paramPF);
166  LOGVERB("PFClusterProducer::produce()") << *_pfClusterBuilder;
167  } else {
168  pfClusters->insert(pfClusters->end(), initialClusters->begin(), initialClusters->end());
169  }
170 
171  if (_positionReCalc) {
172  _positionReCalc->calculateAndSetPositions(*pfClusters, paramPF);
173  }
174 
175  if (_energyCorrector) {
176  _energyCorrector->correctEnergies(*pfClusters);
177  }
178 
179  if (_prodInitClusters)
180  e.put(std::move(initialClusters), "initialClusters");
181  e.put(std::move(pfClusters));
182 }
std::unique_ptr< SeedFinderBase > _seedFinder
std::unique_ptr< PFClusterEnergyCorrectorBase > _energyCorrector
std::unique_ptr< PFClusterBuilderBase > _pfClusterBuilder
std::vector< std::unique_ptr< RecHitTopologicalCleanerBase > > _seedcleaners
#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
HcalPFCuts const * paramPF
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ _cleaners

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

Definition at line 36 of file PFClusterProducer.cc.

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

◆ _energyCorrector

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

Definition at line 42 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().

◆ _initialClustering

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

Definition at line 39 of file PFClusterProducer.cc.

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

◆ _pfClusterBuilder

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

Definition at line 40 of file PFClusterProducer.cc.

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

◆ _positionReCalc

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

Definition at line 41 of file PFClusterProducer.cc.

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

◆ _prodInitClusters

const bool PFClusterProducer::_prodInitClusters
private

Definition at line 34 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().

◆ _rechitsLabel

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

Definition at line 28 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().

◆ _seedcleaners

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

Definition at line 37 of file PFClusterProducer.cc.

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

◆ _seedFinder

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

Definition at line 38 of file PFClusterProducer.cc.

Referenced by PFClusterProducer(), and produce().

◆ cutsFromDB

bool PFClusterProducer::cutsFromDB
private

Definition at line 30 of file PFClusterProducer.cc.

Referenced by beginRun(), and PFClusterProducer().

◆ hcalCutsToken_

edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> PFClusterProducer::hcalCutsToken_
private

Definition at line 29 of file PFClusterProducer.cc.

Referenced by beginRun(), and PFClusterProducer().

◆ paramPF

HcalPFCuts const* PFClusterProducer::paramPF = nullptr
private

Definition at line 31 of file PFClusterProducer.cc.

Referenced by beginRun(), and produce().