CMS 3D CMS Logo

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

Public Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 SCEnergyCorrectorProducer (const edm::ParameterSet &iConfig)
 
- 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

SCEnergyCorrectorSemiParm energyCorrector_
 
const edm::EDGetTokenT< reco::SuperClusterCollectioninputSCToken_
 
const bool writeFeatures_
 

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 18 of file SCEnergyCorrectorProducer.cc.

Constructor & Destructor Documentation

◆ SCEnergyCorrectorProducer()

SCEnergyCorrectorProducer::SCEnergyCorrectorProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 33 of file SCEnergyCorrectorProducer.cc.

References writeFeatures_.

34  : energyCorrector_(iConfig.getParameterSet("correctorCfg"), consumesCollector()),
35  inputSCToken_(consumes<reco::SuperClusterCollection>(iConfig.getParameter<edm::InputTag>("inputSCs"))),
36  writeFeatures_(iConfig.getParameter<bool>("writeFeatures")) {
37  produces<reco::SuperClusterCollection>();
38  if (writeFeatures_) {
39  produces<edm::ValueMap<std::vector<float>>>("features");
40  }
41 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet const & getParameterSet(std::string const &) const
SCEnergyCorrectorSemiParm energyCorrector_
const edm::EDGetTokenT< reco::SuperClusterCollection > inputSCToken_

Member Function Documentation

◆ beginLuminosityBlock()

void SCEnergyCorrectorProducer::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
override

Definition at line 43 of file SCEnergyCorrectorProducer.cc.

References energyCorrector_, and SCEnergyCorrectorSemiParm::setEventSetup().

43  {
45 }
SCEnergyCorrectorSemiParm energyCorrector_
void setEventSetup(const edm::EventSetup &es)

◆ fillDescriptions()

void SCEnergyCorrectorProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 72 of file SCEnergyCorrectorProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and SCEnergyCorrectorSemiParm::makePSetDescription().

72  {
75  desc.add<bool>("writeFeatures", false);
76  desc.add<edm::InputTag>("inputSCs", edm::InputTag("particleFlowSuperClusterECAL"));
77  descriptions.add("scEnergyCorrectorProducer", desc);
78 }
static edm::ParameterSetDescription makePSetDescription()
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void SCEnergyCorrectorProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 47 of file SCEnergyCorrectorProducer.cc.

References energyCorrector_, trigObjTnPSource_cfi::filler, SCEnergyCorrectorSemiParm::getRegData(), iEvent, SCEnergyCorrectorDRNProducer_cfi::inputSCs, inputSCToken_, SCEnergyCorrectorSemiParm::modifyObject(), eostools::move(), SCEnergyCorrectorSemiParm::setEvent(), and writeFeatures_.

47  {
49 
50  auto inputSCs = iEvent.get(inputSCToken_);
51  auto corrSCs = std::make_unique<reco::SuperClusterCollection>();
52  std::vector<std::vector<float>> scFeatures;
53  for (const auto& inputSC : inputSCs) {
54  corrSCs->push_back(inputSC);
55  energyCorrector_.modifyObject(corrSCs->back());
56  if (writeFeatures_) {
57  scFeatures.emplace_back(energyCorrector_.getRegData(corrSCs->back()));
58  }
59  }
60 
61  auto scHandle = iEvent.put(std::move(corrSCs));
62 
63  if (writeFeatures_) {
64  auto valMap = std::make_unique<edm::ValueMap<std::vector<float>>>();
65  edm::ValueMap<std::vector<float>>::Filler filler(*valMap);
66  filler.insert(scHandle, scFeatures.begin(), scFeatures.end());
67  filler.fill();
68  iEvent.put(std::move(valMap), "features");
69  }
70 }
int iEvent
Definition: GenABIO.cc:224
SCEnergyCorrectorSemiParm energyCorrector_
const edm::EDGetTokenT< reco::SuperClusterCollection > inputSCToken_
void modifyObject(reco::SuperCluster &sc) const
void setEvent(const edm::Event &e)
std::vector< float > getRegData(const reco::SuperCluster &sc) const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ energyCorrector_

SCEnergyCorrectorSemiParm SCEnergyCorrectorProducer::energyCorrector_
private

Definition at line 28 of file SCEnergyCorrectorProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ inputSCToken_

const edm::EDGetTokenT<reco::SuperClusterCollection> SCEnergyCorrectorProducer::inputSCToken_
private

Definition at line 29 of file SCEnergyCorrectorProducer.cc.

Referenced by produce().

◆ writeFeatures_

const bool SCEnergyCorrectorProducer::writeFeatures_
private

Definition at line 30 of file SCEnergyCorrectorProducer.cc.

Referenced by produce(), and SCEnergyCorrectorProducer().