4 #include "FWCore/Framework/interface/Event.h" 
    5 #include "FWCore/Framework/interface/EventSetup.h" 
    6 #include "FWCore/Framework/interface/MakerMacros.h" 
    7 #include "FWCore/ParameterSet/interface/ParameterSet.h" 
    8 #include "FWCore/Utilities/interface/InputTag.h" 
    9 #include "DataFormats/Common/interface/Handle.h" 
   10 #include "DataFormats/Common/interface/View.h" 
   11 #include "DataFormats/Common/interface/ValueMap.h" 
   12 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" 
   13 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" 
   14 #include "DataFormats/VertexReco/interface/Vertex.h" 
   15 #include "DataFormats/VertexReco/interface/VertexFwd.h" 
   16 #include "DataFormats/BeamSpot/interface/BeamSpot.h" 
   24     : charged_all(pset.getParameter<
edm::InputTag>(
"chargedAll")),
 
   25       charged(pset.getParameter<
edm::InputTag>(
"charged")),
 
   26       neutral(pset.getParameter<
edm::InputTag>(
"neutral")),
 
   27       gamma(pset.getParameter<
edm::InputTag>(
"gamma")),
 
   28       pu(pset.getParameter<
edm::InputTag>(
"pu")) {
 
   29         collector.consumes<edm::ValueMap<double>>(charged_all);
 
   30         collector.consumes<edm::ValueMap<double>>(charged);
 
   31         collector.consumes<edm::ValueMap<double>>(neutral);
 
   32         collector.consumes<edm::ValueMap<double>>(
gamma);
 
   33         collector.consumes<edm::ValueMap<double>>(pu);
 
   36 ICElectronProducer::ClusterIsoTags::ClusterIsoTags(edm::ParameterSet 
const& pset, 
edm::ConsumesCollector && collector)
 
   37     : ecal(pset.getParameter<
edm::InputTag>(
"ecal")),
 
   38       hcal(pset.getParameter<
edm::InputTag>(
"hcal")) {
 
   39         collector.consumes<edm::ValueMap<double>>(ecal);
 
   40         collector.consumes<edm::ValueMap<double>>(hcal);
 
   44     : input_(config.getParameter<
edm::InputTag>(
"input")),
 
   45       branch_(config.getParameter<
std::string>(
"branch")),
 
   46       input_r9_(config.getParameter<
edm::InputTag>(
"inputR9")),
 
   47       do_r9_(config.getParameter<bool>(
"includeR9")),
 
   48       input_hcal_sum_(config.getParameter<
edm::InputTag>(
"inputHcalSum")),
 
   49       do_hcal_sum_(config.getParameter<bool>(
"includeHcalSum")),
 
   50       input_vertices_(config.getParameter<
edm::InputTag>(
"inputVertices")),
 
   51       do_vertex_ip_(config.getParameter<bool>(
"includeVertexIP")),
 
   52       input_beamspot_(config.getParameter<
edm::InputTag>(
"inputBeamspot")),
 
   53       do_beamspot_ip_(config.getParameter<bool>(
"includeBeamspotIP")),
 
   54       input_conversion_matches_(
 
   55           config.getParameter<
edm::InputTag>(
"inputConversionMatches")),
 
   56       do_conversion_matches_(
 
   57           config.getParameter<bool>(
"includeConversionMatches")),
 
   61       do_cluster_iso_(config.getParameter<bool>(
"includeClusterIso")),
 
   62       do_pf_iso_03_(config.getParameter<bool>(
"includePFIso03")),
 
   63       do_pf_iso_04_(config.getParameter<bool>(
"includePFIso04")) {
 
   64         consumes<edm::View<reco::GsfElectron>>(input_);
 
   65         consumes<edm::ValueMap<float>>(input_r9_);
 
   66         consumes<edm::ValueMap<float>>(input_hcal_sum_);
 
   67         consumes<edm::View<reco::Vertex>>(input_vertices_);
 
   68         consumes<reco::BeamSpot>(input_beamspot_);
 
   69         consumes<edm::ValueMap<bool>>(input_conversion_matches_);
 
   71      electrons_ = 
new std::vector<ic::Electron>();
 
   73   edm::ParameterSet pset_floats =
 
   74       config.getParameter<edm::ParameterSet>(
"includeFloats");
 
   75   std::vector<std::string> vec =
 
   76       pset_floats.getParameterNamesForType<edm::InputTag>();
 
   77   for (
unsigned i = 0; i < vec.size(); ++i) {
 
   78     input_vmaps_.push_back(std::make_pair(
 
   79         vec[i], pset_floats.getParameter<edm::InputTag>(vec[i])));
 
   80        consumes<edm::ValueMap<float>>(input_vmaps_[i].second);
 
   88   PrintOptional(1, do_conversion_matches_, 
"includeConversionMatches");
 
   95 void ICElectronProducer::produce(edm::Event& event,
 
   96                                  const edm::EventSetup& setup) {
 
   97      edm::Handle<edm::View<reco::GsfElectron> > elecs_handle;
 
   98   event.getByLabel(input_, elecs_handle);
 
  100   edm::Handle<edm::ValueMap<float> > r9_handle;
 
  101   if (do_r9_) 
event.getByLabel(input_r9_, r9_handle);
 
  103   edm::Handle<edm::ValueMap<float> > hcal_sum_handle;
 
  104   if (do_hcal_sum_) 
event.getByLabel(input_hcal_sum_, hcal_sum_handle);
 
  106   edm::Handle<edm::ValueMap<bool> > conversion_matches_handle;
 
  107   if (do_conversion_matches_)
 
  108     event.getByLabel(input_conversion_matches_, conversion_matches_handle);
 
  110   edm::Handle<edm::View<reco::Vertex> > vertices_handle;
 
  111   if (do_vertex_ip_) 
event.getByLabel(input_vertices_, vertices_handle);
 
  113   edm::Handle<reco::BeamSpot> beamspot_handle;
 
  114   if (do_beamspot_ip_) 
event.getByLabel(input_beamspot_, beamspot_handle);
 
  116   std::vector<edm::Handle<edm::ValueMap<float> > > float_handles(
 
  117       input_vmaps_.size());
 
  118   for (
unsigned i = 0; i < float_handles.size(); ++i) {
 
  119     event.getByLabel(input_vmaps_[i].second, float_handles[i]);
 
  122   edm::Handle<edm::ValueMap<double> > charged_all_03;
 
  123   edm::Handle<edm::ValueMap<double> > charged_03;
 
  124   edm::Handle<edm::ValueMap<double> > neutral_03;
 
  125   edm::Handle<edm::ValueMap<double> > gamma_03;
 
  126   edm::Handle<edm::ValueMap<double> > pu_03;
 
  127   edm::Handle<edm::ValueMap<double> > ecal_pf_cluster_iso;
 
  128   edm::Handle<edm::ValueMap<double> > hcal_pf_cluster_iso;
 
  130   if (do_cluster_iso_){
 
  131     event.getByLabel(cluster_iso_.ecal, ecal_pf_cluster_iso);
 
  132     event.getByLabel(cluster_iso_.hcal, hcal_pf_cluster_iso);
 
  135     event.getByLabel(pf_iso_03_.charged_all, charged_all_03);
 
  136     event.getByLabel(pf_iso_03_.charged, charged_03);
 
  137     event.getByLabel(pf_iso_03_.neutral, neutral_03);
 
  138     event.getByLabel(pf_iso_03_.gamma, gamma_03);
 
  139     event.getByLabel(pf_iso_03_.pu, pu_03);
 
  142   edm::Handle<edm::ValueMap<double> > charged_all_04;
 
  143   edm::Handle<edm::ValueMap<double> > charged_04;
 
  144   edm::Handle<edm::ValueMap<double> > neutral_04;
 
  145   edm::Handle<edm::ValueMap<double> > gamma_04;
 
  146   edm::Handle<edm::ValueMap<double> > pu_04;
 
  148     event.getByLabel(pf_iso_04_.charged_all, charged_all_04);
 
  149     event.getByLabel(pf_iso_04_.charged, charged_04);
 
  150     event.getByLabel(pf_iso_04_.neutral, neutral_04);
 
  151     event.getByLabel(pf_iso_04_.gamma, gamma_04);
 
  152     event.getByLabel(pf_iso_04_.pu, pu_04);
 
  157   electrons_->resize(elecs_handle->size(), 
ic::Electron());
 
  159   for (
unsigned i = 0; i < elecs_handle->size(); ++i) {
 
  160     reco::GsfElectron 
const& src = elecs_handle->at(i);
 
  161     edm::RefToBase<reco::GsfElectron> ref = elecs_handle->refAt(i);
 
  163     dest.
set_id(gsf_electron_hasher_(&src));
 
  175 #if CMSSW_MAJOR_VERSION >7 || (CMSSW_MAJOR_VERSION == 7 && CMSSW_MINOR_VERSION >= 1) 
  180     if (src.gsfTrack().isNonnull()) {
 
  181 #if CMSSW_MAJOR_VERSION > 7 || (CMSSW_MAJOR_VERSION == 7 && CMSSW_MINOR_VERSION >= 2) 
  183           src.gsfTrack()->hitPattern().numberOfHits(
 
  184               reco::HitPattern::MISSING_INNER_HITS));
 
  187           src.gsfTrack()->trackerExpectedHitsInner().numberOfHits());
 
  193     if (src.superCluster().isNonnull()) {
 
  195       dest.
set_sc_theta(src.superCluster()->position().theta());
 
  205       dest.
set_r9((*r9_handle)[ref]);
 
  210     if (do_conversion_matches_) {
 
  214     for (
unsigned v = 0; v < float_handles.size(); ++v) {
 
  215       dest.
SetIdIso(input_vmaps_[v].first,
 
  216                     (*(float_handles[v]))[ref]);
 
  219     if (do_cluster_iso_) {
 
  241       if (vertices_handle->size() > 0) {
 
  242         reco::Vertex 
const& vtx = vertices_handle->at(0);
 
  247     if (do_beamspot_ip_) {
 
  251     if (src.superCluster()->seed().isNonnull()) {
 
  258 void ICElectronProducer::beginJob() {
 
  262 void ICElectronProducer::endJob() {
 
void set_full5x5_sigma_IetaIeta(float const &full5x5_sigma_IetaIeta)
Weighted cluster RMS in the -direction, measured in units of crystals in a 5x5 block centred on the s...
 
void set_vz(double const &z)
The z-coordinate of the ref_point() 
 
void set_has_matched_conversion(bool const &has_matched_conversion)
True if electron is matched to a conversion vertex. 
 
void set_dphi_sc_tk_at_vtx(float const &dphi_sc_tk_at_vtx)
 between the supercluster and track, where the latter is evaluated from the vertex position ...
 
void set_dz_vertex(double const &dz_vertex)
Longitudinal impact parameter of the GSF track with the primary vertex. 
 
void set_hcal_pf_cluster_iso(float const &hcal_pf_cluster_iso)
HCAL PF cluster isolation. 
 
void set_hcal_sum(float const &hcal_sum)
Calorimeter tower isolation sum. 
 
void set_dr03_pfiso_pu(float const &dr03_pfiso_pu)
PF isolation, using charged pileup in a cone with . 
 
void set_dr04_pfiso_charged_all(float const &dr04_pfiso_charged_all)
PF isolation, using all charged particles in a cone with . 
 
void set_deta_sc_tk_at_vtx(float const &deta_sc_tk_at_vtx)
 between the supercluster and track, where the latter is evaluated from the vertex position ...
 
This class stores a subset of the reco::GsfElectron properties which are most commonly used in analys...
 
void SetIdIso(std::string const &name, float const &value)
Add a new entry, overwriting any existing one with the same name. 
 
void set_sc_theta(float const &sc_theta)
Supercluster . 
 
void set_dr03_pfiso_charged(float const &dr03_pfiso_charged)
PF isolation, using charged hadrons in a cone with . 
 
void set_phi(double const &phi)
Direct access to . 
 
void set_sc_energy(float const &sc_energy)
Supercluster energy. 
 
void set_dr03_pfiso_gamma(float const &dr03_pfiso_gamma)
PF isolation, using photons in a cone with . 
 
void set_id(std::size_t const &id)
Unique identifier. 
 
void set_dr04_pfiso_pu(float const &dr04_pfiso_pu)
PF isolation, using charged pileup in a cone with . 
 
void set_dr04_pfiso_charged(float const &dr04_pfiso_charged)
PF isolation, using charged hadrons in a cone with . 
 
DEFINE_FWK_MODULE(ICElectronProducer)
 
void set_charge(int const &charge)
Electric charge. 
 
void set_sc_eta(float const &sc_eta)
Supercluster . 
 
void set_ecal_pf_cluster_iso(float const &ecal_pf_cluster_iso)
ECAL PF cluster isolation. 
 
void set_f_brem(float const &f_brem)
Fraction of momentum lost as bremsstrahlung, as measured in the GSF fit. 
 
void set_sc_seed_eta(float const &sc_seed_eta)
Supercluster seed . 
 
void set_vx(double const &x)
The x-coordinate of the ref_point() 
 
void set_dr03_hcal_tower_sum_et(float const &dr03_hcal_tower_sum_et)
HCAL isolation in a cone with . 
 
void set_dr03_pfiso_charged_all(float const &dr03_pfiso_charged_all)
PF isolation, using all charged particles in a cone with . 
 
void set_dr04_pfiso_gamma(float const &dr04_pfiso_gamma)
PF isolation, using photons in a cone with . 
 
void set_conv_dist(float const &conv_dist)
Minimum distance between conversion tracks (if found) 
 
void set_dr03_tk_sum_pt(float const &dr03_tk_sum_pt)
Tracker isolation in a cone with . 
 
void set_dxy_beamspot(double const &dxy_beamspot)
Transverse impact parameter of the GSF track with the beamspot. 
 
void set_energy(double const &energy)
Direct access to the energy. 
 
void set_hadronic_over_em(float const &hadronic_over_em)
Ratio of HCAL to supercluster energy in the region of the electron hit. 
 
void set_gsf_tk_nhits(int const &gsf_tk_nhits)
Number of tracker layers between the vertex and the first detected hit the electron should have trave...
 
void set_sigma_IetaIeta(float const &sigma_IetaIeta)
Weighted cluster RMS in the -direction, measured in units of crystals in a 5x5 block centred on the s...
 
void set_r9(float const &r9)
The ratio of the energy in the 3x3 crystal array centred on the seed over the energy of the complete ...
 
ICElectronProducer(const edm::ParameterSet &)
 
void set_vy(double const &y)
The y-coordinate of the ref_point() 
 
edm::ConsumesCollector consumesCollector()
 
void set_pt(double const &pt)
Direct access to the . 
 
void set_eta(double const &eta)
Direct access to . 
 
void set_dr03_pfiso_neutral(float const &dr03_pfiso_neutral)
PF isolation, using neutral hadrons in a cone with . 
 
void set_conv_dcot(float const &conv_dcot)
 between conversion tracks at the conversion vertex 
 
void set_ecal_energy(float const &ecal_energy)
The corrected supercluster energy. 
 
void set_dr03_ecal_rechit_sum_et(float const &dr03_ecal_rechit_sum_et)
ECAL isolation in a cone with . 
 
void set_dr04_pfiso_neutral(float const &dr04_pfiso_neutral)
PF isolation, using neutral hadrons in a cone with . 
 
void set_dxy_vertex(double const &dxy_vertex)
Transverse impact parameter of the GSF track with the primary vertex. 
 
void set_sc_e_over_p(float const &sc_e_over_p)
Ratio of supercluster energy to track momentum, where the latter is evaluated at the PCA to the beams...