17 const static std::array<std::string,7> electron_vars = { {
"sumChargedHadronPt",
20 "sumChargedParticlePt",
21 "sumNeutralHadronEtHighThreshold",
22 "sumPhotonEtHighThreshold",
25 const static std::array<std::string,9> photon_vars = { {
"chargedHadronIso",
26 "chargedHadronIsoWrongVtx",
30 "sumChargedParticlePt",
31 "sumNeutralHadronEtHighThreshold",
32 "sumPhotonEtHighThreshold",
36 #include <unordered_map>
40 typedef std::tuple<edm::InputTag,edm::EDGetTokenT<edm::ValueMap<float> > >
tag_and_token;
41 typedef std::unordered_map<std::string,tag_and_token>
input_map;
59 void setConsumes(edm::ConsumesCollector&) override final;
76 "EGPfIsolationModifierFromValueMaps");
78 EGPfIsolationModifierFromValueMaps::
81 if( conf.exists(
"electron_config") ) {
85 if( electrons.
exists(varname) ) {
90 if( conf.exists(
"photon_config") ) {
94 if( photons.
exists(varname) ) {
100 ele_idx = pho_idx = 0;
122 for(
unsigned i = 0;
i < eles->size(); ++
i ) {
128 for(
const std::string& varname : electron_vars ) {
138 for(
unsigned i = 0;
i < phos->size(); ++
i ) {
155 template<
typename T,
typename U,
typename V>
156 inline void make_consumes(
T&
tag,U&
tok,V& sume) {
if( !(empty_tag == tag) ) tok = sume.template consumes<edm::ValueMap<float> >(
tag); }
163 for(
const std::string& varname : electron_vars ) {
166 auto& the_tuple =
inputs[varname];
167 make_consumes(std::get<0>(the_tuple),std::get<1>(the_tuple),sumes);
176 auto& the_tuple =
inputs[varname];
177 make_consumes(std::get<0>(the_tuple),std::get<1>(the_tuple),sumes);
181 template<
typename T,
typename U,
typename V>
183 auto itr = input_map.find(name);
184 if( itr == input_map.end() )
return;
185 const auto&
tok = std::get<1>(itr->second);
186 if( !
tok.isUninitialized() ) value = map.find(
tok.index())->
second->get(ptr.id(),ptr.key());
201 <<
"Original object pointer with key = " << ele.
originalObjectRef().
key() <<
" not found in cache!";
234 <<
"Original object pointer with key = " << pho.
originalObjectRef().
key() <<
" not found in cache!";
const PflowIsolationVariables & pfIsolationVariables() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void setPflowIsolationVariables(const PflowIsolationVariables &pfisol)
Set Particle Flow Isolation variables.
T getParameter(std::string const &) const
void modifyObject(pat::Electron &) const overridefinal
Analysis-level Photon class.
std::unordered_map< unsigned, edm::Ptr< reco::GsfElectron > > eles_by_oop
std::unordered_map< unsigned, edm::Ptr< reco::Photon > > phos_by_oop
std::unordered_map< unsigned, edm::Handle< edm::ValueMap< float > > > pho_vmaps
std::tuple< edm::InputTag, edm::EDGetTokenT< edm::ValueMap< float > > > tag_and_token
bool getByToken(EDGetToken token, Handle< PROD > &result) const
input_map electron_inputs
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::InputTag electron_src
void setConsumes(edm::ConsumesCollector &) overridefinal
void setPfIsolationVariables(const PflowIsolationVariables &iso)
U second(std::pair< T, U > const &p)
void setEvent(const edm::Event &) overridefinal
const std::string & name() const
edm::EDGetTokenT< edm::View< pat::Photon > > tok_photon_src
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
std::unordered_map< std::string, tag_and_token > input_map
Analysis-level electron class.
std::unordered_map< unsigned, edm::Handle< edm::ValueMap< float > > > ele_vmaps
edm::EDGetTokenT< edm::View< pat::Electron > > tok_electron_src
void setEventContent(const edm::EventSetup &) overridefinal
bool isUninitialized() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
EGPfIsolationModifierFromValueMaps(const edm::ParameterSet &conf)
const PflowIsolationVariables & getPflowIsolationVariables() const
Get Particle Flow Isolation variables block.