From 6a16ed79c1302f9e3d40061aa4dda26e6fb61c43 Mon Sep 17 00:00:00 2001 From: wmtan Date: Wed, 2 Sep 2015 06:14:50 +0200 Subject: [PATCH] Use anonymous namespace to avoid duplicate symbols --- .../plugins/EGExtraInfoModifierFromDB.cc | 40 +++++++++++-------- .../EGExtraInfoModifierFromFloatValueMaps.cc | 24 ++++++----- .../EGExtraInfoModifierFromIntValueMaps.cc | 24 ++++++----- .../plugins/EGFull5x5ShowerShapeModifier.cc | 24 ++++++----- 4 files changed, 68 insertions(+), 44 deletions(-) diff --git a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc index 480d62bc6c098..0f491942144ee 100644 --- a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc +++ b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc @@ -181,11 +181,13 @@ EGExtraInfoModifierFromDB::EGExtraInfoModifierFromDB(const edm::ParameterSet& co } } -template -inline void get_product(const edm::Event& evt, - const edm::EDGetTokenT >& tok, - std::unordered_map > >& map) { - evt.getByToken(tok,map[tok.index()]); +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) { @@ -307,16 +309,18 @@ void EGExtraInfoModifierFromDB::setEventContent(const edm::EventSetup& evs) { } } -template -inline void make_consumes(T& tag,U& tok,V& sume) { - if(!(empty_tag == tag)) - tok = sume.template consumes >(tag); -} +namespace { + template + inline void make_consumes(T& tag,U& tok,V& sume) { + if(!(empty_tag == tag)) + tok = sume.template consumes >(tag); + } -template -inline void make_int_consumes(T& tag,U& tok,V& sume) { - if(!(empty_tag == tag)) - tok = sume.template consumes >(tag); + template + 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,9 +364,11 @@ void EGExtraInfoModifierFromDB::setConsumes(edm::ConsumesCollector& sumes) { } } -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()); +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 { diff --git a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc index 497f524259a69..b0ae80fc7395f 100644 --- a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc +++ b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromFloatValueMaps.cc @@ -87,10 +87,12 @@ EGExtraInfoModifierFromFloatValueMaps(const edm::ParameterSet& conf) : ele_idx = pho_idx = 0; } -inline void get_product(const edm::Event& evt, - const edm::EDGetTokenT >& tok, - std::unordered_map > >& map) { - evt.getByToken(tok,map[tok.index()]); +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:: @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromFloatValueMaps:: setEventContent(const edm::EventSetup& evs) { } -template -inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes >(tag); } +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,9 +159,11 @@ setConsumes(edm::ConsumesCollector& sumes) { } } -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()); +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:: diff --git a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc index 33f0997162384..4c6ea1544d844 100644 --- a/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc +++ b/RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromIntValueMaps.cc @@ -87,10 +87,12 @@ EGExtraInfoModifierFromIntValueMaps(const edm::ParameterSet& conf) : ele_idx = pho_idx = 0; } -inline void get_product(const edm::Event& evt, - const edm::EDGetTokenT >& tok, - std::unordered_map > >& map) { - evt.getByToken(tok,map[tok.index()]); +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:: @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromIntValueMaps:: setEventContent(const edm::EventSetup& evs) { } -template -inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes >(tag); } +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,9 +159,11 @@ setConsumes(edm::ConsumesCollector& sumes) { } } -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()); +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:: diff --git a/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc b/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc index 9728a53977443..cb9283528211b 100644 --- a/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc +++ b/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc @@ -130,10 +130,12 @@ EGFull5x5ShowerShapeModifierFromValueMaps(const edm::ParameterSet& conf) : ele_idx = pho_idx = 0; } -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()]); +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:: @@ -195,8 +197,10 @@ void EGFull5x5ShowerShapeModifierFromValueMaps:: setEventContent(const edm::EventSetup& evs) { } -template -inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes >(tag); } +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,9 +233,11 @@ setConsumes(edm::ConsumesCollector& sumes) { make_consumes(ph_conf.hcalDepth2OverEcalBc,ph_conf.tok_hcalDepth2OverEcalBc,sumes); } -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()); +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::