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.

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 }

References writeFeatures_.

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 43 of file SCEnergyCorrectorProducer.cc.

43  {
45 }

References energyCorrector_, and SCEnergyCorrectorSemiParm::setEventSetup().

◆ fillDescriptions()

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

Definition at line 72 of file SCEnergyCorrectorProducer.cc.

72  {
75  desc.add<bool>("writeFeatures", false);
76  desc.add<edm::InputTag>("inputSCs", edm::InputTag("particleFlowSuperClusterECAL"));
77  descriptions.add("scEnergyCorrectorProducer", desc);
78 }

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

◆ produce()

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

Definition at line 47 of file SCEnergyCorrectorProducer.cc.

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 }

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

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

SCEnergyCorrectorSemiParm::setEventSetup
void setEventSetup(const edm::EventSetup &es)
Definition: SCEnergyCorrectorSemiParm.cc:96
SCEnergyCorrectorSemiParm::getRegData
std::vector< float > getRegData(const reco::SuperCluster &sc) const
Definition: SCEnergyCorrectorSemiParm.cc:165
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
SCEnergyCorrectorProducer::inputSCToken_
const edm::EDGetTokenT< reco::SuperClusterCollection > inputSCToken_
Definition: SCEnergyCorrectorProducer.cc:29
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SCEnergyCorrectorProducer::writeFeatures_
const bool writeFeatures_
Definition: SCEnergyCorrectorProducer.cc:30
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
SCEnergyCorrectorSemiParm::makePSetDescription
static edm::ParameterSetDescription makePSetDescription()
Definition: SCEnergyCorrectorSemiParm.cc:90
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ValueMap
Definition: ValueMap.h:107
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SCEnergyCorrectorSemiParm::modifyObject
void modifyObject(reco::SuperCluster &sc) const
Definition: SCEnergyCorrectorSemiParm.cc:154
edm::InputTag
Definition: InputTag.h:15
SCEnergyCorrectorProducer::energyCorrector_
SCEnergyCorrectorSemiParm energyCorrector_
Definition: SCEnergyCorrectorProducer.cc:28
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
SCEnergyCorrectorSemiParm::setEvent
void setEvent(const edm::Event &e)
Definition: SCEnergyCorrectorSemiParm.cc:108