#include <string>
#include <vector>
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/View.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "DataFormats/EgammaCandidates/interface/Photon.h"
#include "DataFormats/PatCandidates/interface/Photon.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "RecoEgamma/EgammaTools/interface/ConversionTools.h"
: charged_all(pset.getParameter<
edm::InputTag>(
"chargedAll")),
charged(pset.getParameter<
edm::InputTag>(
"charged")),
neutral(pset.getParameter<
edm::InputTag>(
"neutral")),
gamma(pset.getParameter<
edm::InputTag>(
"gamma")),
pu(pset.getParameter<
edm::InputTag>(
"pu")) {
collector.consumes<edm::ValueMap<double>>(charged_all);
collector.consumes<edm::ValueMap<double>>(charged);
collector.consumes<edm::ValueMap<double>>(neutral);
collector.consumes<edm::ValueMap<double>>(
gamma);
collector.consumes<edm::ValueMap<double>>(pu);
}
: input_(config.getParameter<
edm::InputTag>(
"input")),
branch_(config.getParameter<
std::string>(
"branch")),
input_electron_veto_(
config.getParameter<
edm::InputTag>(
"inputElectronVeto")),
do_electron_veto_(config.getParameter<bool>("includeElectronVeto")),
do_had_tow_over_em_(config.getParameter<bool>("includeHadTowOverEm")),
do_pf_iso_03_(config.getParameter<bool>("includePFIso03")),
do_pf_iso_04_(config.getParameter<bool>("includePFIso04")),
do_iso_from_pat_(config.getParameter<bool>("includeIsoFromPat")) {
consumes<edm::View<reco::Photon>>(input_);
consumes<edm::View<pat::Photon>>(input_);
consumes<edm::ValueMap<bool>>(input_electron_veto_);
photons_ = new std::vector<ic::Photon>();
}
delete photons_;
}
void ICPhotonProducer::produce(edm::Event& event,
const edm::EventSetup& setup) {
edm::Handle<edm::View<reco::Photon> > photons_handle;
event.getByLabel(input_, photons_handle);
edm::Handle<edm::View<pat::Photon> > pat_photons_handle;
if(do_iso_from_pat_)event.getByLabel(input_, pat_photons_handle);
edm::Handle<edm::ValueMap<bool> > electron_veto_handle;
if (do_electron_veto_)
event.getByLabel(input_electron_veto_, electron_veto_handle);
edm::Handle<edm::ValueMap<double> > charged_all_03;
edm::Handle<edm::ValueMap<double> > charged_03;
edm::Handle<edm::ValueMap<double> > neutral_03;
edm::Handle<edm::ValueMap<double> > gamma_03;
edm::Handle<edm::ValueMap<double> > pu_03;
if (do_pf_iso_03_&&!do_iso_from_pat_) {
event.getByLabel(pf_iso_03_.charged_all, charged_all_03);
event.getByLabel(pf_iso_03_.charged, charged_03);
event.getByLabel(pf_iso_03_.neutral, neutral_03);
event.getByLabel(pf_iso_03_.gamma, gamma_03);
event.getByLabel(pf_iso_03_.pu, pu_03);
}
edm::Handle<edm::ValueMap<double> > charged_all_04;
edm::Handle<edm::ValueMap<double> > charged_04;
edm::Handle<edm::ValueMap<double> > neutral_04;
edm::Handle<edm::ValueMap<double> > gamma_04;
edm::Handle<edm::ValueMap<double> > pu_04;
if (do_pf_iso_04_&&!do_iso_from_pat_) {
event.getByLabel(pf_iso_04_.charged_all, charged_all_04);
event.getByLabel(pf_iso_04_.charged, charged_04);
event.getByLabel(pf_iso_04_.neutral, neutral_04);
event.getByLabel(pf_iso_04_.gamma, gamma_04);
event.getByLabel(pf_iso_04_.pu, pu_04);
}
photons_->clear();
photons_->resize(photons_handle->size(),
ic::Photon());
for (unsigned i = 0; i < photons_handle->size(); ++i) {
reco::Photon const& src = photons_handle->at(i);
edm::RefToBase<reco::Photon> ref = photons_handle->refAt(i);
dest.
set_id(photon_hasher_(&src));
if (do_electron_veto_) {
}
if (do_had_tow_over_em_) {
}
if (do_pf_iso_03_&&!do_iso_from_pat_) {
}
if (do_pf_iso_04_&&!do_iso_from_pat_) {
}
if(do_pf_iso_03_&&do_iso_from_pat_&&do_pf_iso_04_){
throw cms::Exception("FillingTwoIsosFromOnePatIso") << "You are trying to fill both the 03 and 04 photon isolation from the single pat isolation values!!";
}
if(do_pf_iso_03_&&do_iso_from_pat_) {
pat::Photon const& patsrc = pat_photons_handle->at(i);
#if CMSSW_MAJOR_VERSION >= 7 && CMSSW_MINOR_VERSION >= 0
#if CMSSW_MAJOR_VERSION > 7 || (CMSSW_MAJOR_VERSION == 7 && CMSSW_MINOR_VERSION >= 6)
#else
#endif
#endif
}
if(do_pf_iso_04_&&do_iso_from_pat_) {
pat::Photon const& patsrc = pat_photons_handle->at(i);
#if CMSSW_MAJOR_VERSION >= 7 && CMSSW_MINOR_VERSION >= 0
#if CMSSW_MAJOR_VERSION > 7 || (CMSSW_MAJOR_VERSION == 7 && CMSSW_MINOR_VERSION >= 6)
#else
#endif
#endif
}
}
}
void ICPhotonProducer::beginJob() {
}
void ICPhotonProducer::endJob() {}