CMS 3D CMS Logo

ElectronIDExternalProducer.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_ElectronIdentification_ElectronIDExternalProducer_h
2 #define RecoEgamma_ElectronIdentification_ElectronIDExternalProducer_h
3 
4 #include <memory>
11 
14 
16 
17 template <class algo>
19 public:
21  : srcToken_(consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("src"))),
22  select_(iConfig, consumesCollector()) {
23  produces<edm::ValueMap<float>>();
24  }
25 
27 
28  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
29 
30 private:
33 };
34 
35 template <typename algo>
37  // read input collection
39  iEvent.getByToken(srcToken_, electrons);
40 
41  // initialize common selector
42  select_.newEvent(iEvent, iSetup);
43 
44  // prepare room for output
45  std::vector<float> values;
46  values.reserve(electrons->size());
47  for (reco::GsfElectronCollection::const_iterator eleIt = electrons->begin(); eleIt != electrons->end(); ++eleIt) {
48  values.push_back(float(select_((*eleIt), iEvent, iSetup)));
49  }
50 
51  // fill in the ValueMap
52  auto out = std::make_unique<edm::ValueMap<float>>();
54  filler.insert(electrons, values.begin(), values.end());
55  filler.fill();
56  // and put it into the event
57  iEvent.put(std::move(out));
58 }
59 #endif
edm::EDGetTokenT< reco::GsfElectronCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
ElectronIDExternalProducer::select_
algo select_
Definition: ElectronIDExternalProducer.h:32
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
ElectronIDExternalProducer::srcToken_
edm::EDGetTokenT< reco::GsfElectronCollection > srcToken_
Definition: ElectronIDExternalProducer.h:31
EDProducer.h
ElectronIDExternalProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: ElectronIDExternalProducer.h:36
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition: GsfElectronFwd.h:14
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle< reco::GsfElectronCollection >
cmsdt::algo
algo
Definition: constants.h:165
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
GsfElectron.h
ElectronIDExternalProducer::ElectronIDExternalProducer
ElectronIDExternalProducer(const edm::ParameterSet &iConfig)
Definition: ElectronIDExternalProducer.h:20
ElectronIDExternalProducer::~ElectronIDExternalProducer
~ElectronIDExternalProducer() override
Definition: ElectronIDExternalProducer.h:26
GsfElectronFwd.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
InputTag.h
ValueMap.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
EventSetup.h
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ConsumesCollector.h
edm::helper::Filler
Definition: ValueMap.h:22
ParameterSet.h
edm::Event
Definition: Event.h:73
ElectronIDExternalProducer
Definition: ElectronIDExternalProducer.h:18