CMS 3D CMS Logo

LowPtGsfElectronFinalizer.cc
Go to the documentation of this file.
10 
12 public:
14 
15  void produce(edm::Event&, const edm::EventSetup&) override;
16 
18 
19 private:
21  std::unique_ptr<ModifyObjectValueBase> regression_;
22 
24 };
25 
26 using edm::InputTag;
28 
30  : previousGsfElectrons_{consumes<GsfElectronCollection>(cfg.getParameter<InputTag>("previousGsfElectronsTag"))},
31  putToken_{produces<GsfElectronCollection>()} {
32  auto const& iconf = cfg.getParameterSet("regressionConfig");
33  auto const& mname = iconf.getParameter<std::string>("modifierName");
34  auto cc = consumesCollector();
35  regression_.reset(ModifyObjectValueFactory::get()->create(mname, iconf, cc));
36 }
37 
39  // Setup regression for event
40  regression_->setEvent(event);
41  regression_->setEventContent(setup);
42 
43  // Create new modified electron collection
44  reco::GsfElectronCollection outputElectrons;
45  for (auto const& electron : event.get(previousGsfElectrons_)) {
46  outputElectrons.emplace_back(electron);
47  auto& newElectron = outputElectrons.back();
48  regression_->modifyObject(newElectron);
49  }
50 
51  // Emplace modified electrons to event
52  event.emplace(putToken_, std::move(outputElectrons));
53 }
54 
57  desc.add<edm::InputTag>("previousGsfElectronsTag", {});
59  psd.setUnknown();
60  desc.add<edm::ParameterSetDescription>("regressionConfig", psd);
61  descriptions.addWithDefaultLabel(desc);
62 }
63 
T getParameter(std::string const &) const
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
def create(alignables, pedeDump, additionalData, outputFile, config)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
LowPtGsfElectronFinalizer(const edm::ParameterSet &)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void produce(edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static void fillDescriptions(edm::ConfigurationDescriptions &)
const edm::EDPutTokenT< reco::GsfElectronCollection > putToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:326
std::unique_ptr< ModifyObjectValueBase > regression_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons_
def move(src, dest)
Definition: eostools.py:511
T get(const Candidate &c)
Definition: component.h:55
Definition: event.py:1