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_ = 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 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
LowPtGsfElectronFinalizer(const edm::ParameterSet &)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &)
const edm::EDPutTokenT< reco::GsfElectronCollection > putToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::unique_ptr< ModifyObjectValueBase > regression_
#define get
const edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1