From 88640e0188e3a16e07cb8f064ed7172592ff9bd4 Mon Sep 17 00:00:00 2001 From: wmtan Date: Tue, 15 Sep 2015 23:26:37 +0200 Subject: [PATCH] Use anonymous namespace to avoid duplicate symbols --- RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc | 6 ++++++ .../plugins/EGExtraInfoModifierFromFloatValueMaps.cc | 6 ++++++ .../plugins/EGExtraInfoModifierFromIntValueMaps.cc | 6 ++++++ .../EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc | 6 ++++++ RecoEgamma/EgammaTools/plugins/EGPfIsolationModifier.cc | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc index 480d62bc6c098..db374dab99afa 100644 --- a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc +++ b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc @@ -181,12 +181,14 @@ EGExtraInfoModifierFromDB::EGExtraInfoModifierFromDB(const edm::ParameterSet& co } } +namespace { template inline void get_product(const edm::Event& evt, const edm::EDGetTokenT >& tok, std::unordered_map > >& map) { evt.getByToken(tok,map[tok.index()]); } +} void EGExtraInfoModifierFromDB::setEvent(const edm::Event& evt) { eles_by_oop.clear(); @@ -307,6 +309,7 @@ void EGExtraInfoModifierFromDB::setEventContent(const edm::EventSetup& evs) { } } +namespace { template inline void make_consumes(T& tag,U& tok,V& sume) { if(!(empty_tag == tag)) @@ -318,6 +321,7 @@ inline void make_int_consumes(T& tag,U& tok,V& sume) { if(!(empty_tag == tag)) tok = sume.template consumes >(tag); } +} void EGExtraInfoModifierFromDB::setConsumes(edm::ConsumesCollector& sumes) { @@ -360,10 +364,12 @@ void EGExtraInfoModifierFromDB::setConsumes(edm::ConsumesCollector& sumes) { } } +namespace { template inline void assignValue(const T& ptr, const U& tok, const V& map, Z& value) { if( !tok.isUninitialized() ) value = map.find(tok.index())->second->get(ptr.id(),ptr.key()); } +} void EGExtraInfoModifierFromDB::modifyObject(pat::Electron& ele) const { // we encounter two cases here, either we are running AOD -> MINIAOD diff --git a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc index 497f524259a69..5bd801b7082ce 100644 --- a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc +++ b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc @@ -87,11 +87,13 @@ EGExtraInfoModifierFromFloatValueMaps(const edm::ParameterSet& conf) : ele_idx = pho_idx = 0; } +namespace { inline void get_product(const edm::Event& evt, const edm::EDGetTokenT >& tok, std::unordered_map > >& map) { evt.getByToken(tok,map[tok.index()]); } +} void EGExtraInfoModifierFromFloatValueMaps:: setEvent(const edm::Event& evt) { @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromFloatValueMaps:: setEventContent(const edm::EventSetup& evs) { } +namespace { template inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes >(tag); } +} void EGExtraInfoModifierFromFloatValueMaps:: setConsumes(edm::ConsumesCollector& sumes) { @@ -155,10 +159,12 @@ setConsumes(edm::ConsumesCollector& sumes) { } } +namespace { template inline void assignValue(const T& ptr, const U& tok, const V& map, float& value) { if( !tok.isUninitialized() ) value = map.find(tok.index())->second->get(ptr.id(),ptr.key()); } +} void EGExtraInfoModifierFromFloatValueMaps:: modifyObject(pat::Electron& ele) const { diff --git a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc index 33f0997162384..7cf8c4b11e09f 100644 --- a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc +++ b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc @@ -87,11 +87,13 @@ EGExtraInfoModifierFromIntValueMaps(const edm::ParameterSet& conf) : ele_idx = pho_idx = 0; } +namespace { inline void get_product(const edm::Event& evt, const edm::EDGetTokenT >& tok, std::unordered_map > >& map) { evt.getByToken(tok,map[tok.index()]); } +} void EGExtraInfoModifierFromIntValueMaps:: setEvent(const edm::Event& evt) { @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromIntValueMaps:: setEventContent(const edm::EventSetup& evs) { } +namespace { template inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes >(tag); } +} void EGExtraInfoModifierFromIntValueMaps:: setConsumes(edm::ConsumesCollector& sumes) { @@ -155,10 +159,12 @@ setConsumes(edm::ConsumesCollector& sumes) { } } +namespace { template inline void assignValue(const T& ptr, const U& tok, const V& map, int& value) { if( !tok.isUninitialized() ) value = map.find(tok.index())->second->get(ptr.id(),ptr.key()); } +} void EGExtraInfoModifierFromIntValueMaps:: modifyObject(pat::Electron& ele) const { diff --git a/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc b/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc index 9728a53977443..ea21e79700079 100644 --- a/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc +++ b/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc @@ -130,11 +130,13 @@ EGFull5x5ShowerShapeModifierFromValueMaps(const edm::ParameterSet& conf) : ele_idx = pho_idx = 0; } +namespace { inline void get_product(const edm::Event& evt, const edm::EDGetTokenT >& tok, std::unordered_map > >& map) { if( !tok.isUninitialized() ) evt.getByToken(tok,map[tok.index()]); } +} void EGFull5x5ShowerShapeModifierFromValueMaps:: setEvent(const edm::Event& evt) { @@ -195,8 +197,10 @@ void EGFull5x5ShowerShapeModifierFromValueMaps:: setEventContent(const edm::EventSetup& evs) { } +namespace { template inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes >(tag); } +} void EGFull5x5ShowerShapeModifierFromValueMaps:: setConsumes(edm::ConsumesCollector& sumes) { @@ -229,10 +233,12 @@ setConsumes(edm::ConsumesCollector& sumes) { make_consumes(ph_conf.hcalDepth2OverEcalBc,ph_conf.tok_hcalDepth2OverEcalBc,sumes); } +namespace { template inline void assignValue(const T& ptr, const U& tok, const V& map, float& value) { if( !tok.isUninitialized() ) value = map.find(tok.index())->second->get(ptr.id(),ptr.key()); } +} void EGFull5x5ShowerShapeModifierFromValueMaps:: modifyObject(pat::Electron& ele) const { diff --git a/RecoEgamma/EgammaTools/plugins/EGPfIsolationModifier.cc b/RecoEgamma/EgammaTools/plugins/EGPfIsolationModifier.cc index 48b9c1b005c3d..cf072ea2c9cfd 100644 --- a/RecoEgamma/EgammaTools/plugins/EGPfIsolationModifier.cc +++ b/RecoEgamma/EgammaTools/plugins/EGPfIsolationModifier.cc @@ -100,11 +100,13 @@ EGPfIsolationModifierFromValueMaps(const edm::ParameterSet& conf) : ele_idx = pho_idx = 0; } +namespace { inline void get_product(const edm::Event& evt, const edm::EDGetTokenT >& tok, std::unordered_map > >& map) { if( !tok.isUninitialized() ) evt.getByToken(tok,map[tok.index()]); } +} void EGPfIsolationModifierFromValueMaps:: setEvent(const edm::Event& evt) { @@ -152,8 +154,10 @@ void EGPfIsolationModifierFromValueMaps:: setEventContent(const edm::EventSetup& evs) { } +namespace { template inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes >(tag); } +} void EGPfIsolationModifierFromValueMaps:: setConsumes(edm::ConsumesCollector& sumes) { @@ -178,6 +182,7 @@ setConsumes(edm::ConsumesCollector& sumes) { } } +namespace { template inline void assignValue(const T& ptr, const U& input_map, const std::string& name, const V& map, float& value) { auto itr = input_map.find(name); @@ -185,6 +190,7 @@ inline void assignValue(const T& ptr, const U& input_map, const std::string& nam const auto& tok = std::get<1>(itr->second); if( !tok.isUninitialized() ) value = map.find(tok.index())->second->get(ptr.id(),ptr.key()); } +} void EGPfIsolationModifierFromValueMaps:: modifyObject(pat::Electron& ele) const {