3 #include "FWCore/Framework/interface/Event.h"
4 #include "FWCore/Framework/interface/EventSetup.h"
5 #include "FWCore/Framework/interface/MakerMacros.h"
6 #include "FWCore/ParameterSet/interface/ParameterSet.h"
7 #include "FWCore/Utilities/interface/InputTag.h"
8 #include "DataFormats/Common/interface/Handle.h"
9 #include "DataFormats/Common/interface/ValueMap.h"
11 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
12 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
13 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
14 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
15 #include "RecoEgamma/EgammaTools/interface/ConversionTools.h"
19 const edm::ParameterSet& config)
20 : input_((config.getParameter<
edm::InputTag>(
"input"))),
21 input_beamspot_((config.getParameter<
edm::InputTag>(
"beamspot"))),
22 input_conversions_((config.getParameter<
edm::InputTag>(
"conversions"))) {
23 consumes<edm::View<reco::GsfElectron>>(input_);
24 consumes<reco::BeamSpot>(input_beamspot_);
25 consumes<reco::ConversionCollection>(input_conversions_);
26 produces<edm::ValueMap<bool> >();
31 void ICElectronConversionCalculator::produce(edm::Event& event,
32 const edm::EventSetup& setup) {
33 std::auto_ptr<edm::ValueMap<bool> > product(
new edm::ValueMap<bool>());
36 edm::Handle<edm::View<reco::GsfElectron> > elecs_handle;
37 event.getByLabel(input_, elecs_handle);
39 edm::Handle<reco::BeamSpot> beamspot_handle;
40 event.getByLabel(input_beamspot_, beamspot_handle);
42 edm::Handle<reco::ConversionCollection> conversions_handle;
43 event.getByLabel(input_conversions_, conversions_handle);
68 if(elecs_handle->size()>0){
72 n=elecs_handle->
size();
74 std::vector<bool> values(n,
false);
76 for (
unsigned i = 0; i < n; ++i) {
77 reco::GsfElectron
const& src = elecs_handle->at(i);
78 values[i] = ConversionTools::hasMatchedConversion(
79 src, conversions_handle, beamspot_handle->position(),
83 edm::ValueMap<bool>::Filler filler(*product);
87 filler.insert(c_id_size, values.begin(), values.end());
94 void ICElectronConversionCalculator::beginJob() {}
96 void ICElectronConversionCalculator::endJob() {}
DEFINE_FWK_MODULE(ICElectronConversionCalculator)
Produces an edm::ValueMap for the electron conversion-rejection flag.
~ICElectronConversionCalculator()
edm::Handle< edm::View< T > > handle_
CollectionSize< T > * collsizepointer
ICElectronConversionCalculator(const edm::ParameterSet &)