Skip to content

Commit

Permalink
Merge pull request #11265 from wmtan/UseNamespace74x
Browse files Browse the repository at this point in the history
Use anonymous namespace to avoid duplicate symbols
  • Loading branch information
cmsbuild committed Sep 17, 2015
2 parents 43c11a4 + 88640e0 commit 9808d9f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,14 @@ EGExtraInfoModifierFromDB::EGExtraInfoModifierFromDB(const edm::ParameterSet& co
}
}

namespace {
template<typename T>
inline void get_product(const edm::Event& evt,
const edm::EDGetTokenT<edm::ValueMap<T> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<T> > >& map) {
evt.getByToken(tok,map[tok.index()]);
}
}

void EGExtraInfoModifierFromDB::setEvent(const edm::Event& evt) {
eles_by_oop.clear();
Expand Down Expand Up @@ -307,6 +309,7 @@ void EGExtraInfoModifierFromDB::setEventContent(const edm::EventSetup& evs) {
}
}

namespace {
template<typename T, typename U, typename V>
inline void make_consumes(T& tag,U& tok,V& sume) {
if(!(empty_tag == tag))
Expand All @@ -318,6 +321,7 @@ inline void make_int_consumes(T& tag,U& tok,V& sume) {
if(!(empty_tag == tag))
tok = sume.template consumes<edm::ValueMap<int> >(tag);
}
}

void EGExtraInfoModifierFromDB::setConsumes(edm::ConsumesCollector& sumes) {

Expand Down Expand Up @@ -360,10 +364,12 @@ void EGExtraInfoModifierFromDB::setConsumes(edm::ConsumesCollector& sumes) {
}
}

namespace {
template<typename T, typename U, typename V, typename Z>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<edm::ValueMap<float> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<float> > >& map) {
evt.getByToken(tok,map[tok.index()]);
}
}

void EGExtraInfoModifierFromFloatValueMaps::
setEvent(const edm::Event& evt) {
Expand Down Expand Up @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromFloatValueMaps::
setEventContent(const edm::EventSetup& evs) {
}

namespace {
template<typename T, typename U, typename V>
inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes<edm::ValueMap<float> >(tag); }
}

void EGExtraInfoModifierFromFloatValueMaps::
setConsumes(edm::ConsumesCollector& sumes) {
Expand All @@ -155,10 +159,12 @@ setConsumes(edm::ConsumesCollector& sumes) {
}
}

namespace {
template<typename T, typename U, typename V>
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<edm::ValueMap<int> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<int> > >& map) {
evt.getByToken(tok,map[tok.index()]);
}
}

void EGExtraInfoModifierFromIntValueMaps::
setEvent(const edm::Event& evt) {
Expand Down Expand Up @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromIntValueMaps::
setEventContent(const edm::EventSetup& evs) {
}

namespace {
template<typename T, typename U, typename V>
inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes<edm::ValueMap<int> >(tag); }
}

void EGExtraInfoModifierFromIntValueMaps::
setConsumes(edm::ConsumesCollector& sumes) {
Expand All @@ -155,10 +159,12 @@ setConsumes(edm::ConsumesCollector& sumes) {
}
}

namespace {
template<typename T, typename U, typename V>
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<edm::ValueMap<float> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<float> > >& map) {
if( !tok.isUninitialized() ) evt.getByToken(tok,map[tok.index()]);
}
}

void EGFull5x5ShowerShapeModifierFromValueMaps::
setEvent(const edm::Event& evt) {
Expand Down Expand Up @@ -195,8 +197,10 @@ void EGFull5x5ShowerShapeModifierFromValueMaps::
setEventContent(const edm::EventSetup& evs) {
}

namespace {
template<typename T, typename U, typename V>
inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes<edm::ValueMap<float> >(tag); }
}

void EGFull5x5ShowerShapeModifierFromValueMaps::
setConsumes(edm::ConsumesCollector& sumes) {
Expand Down Expand Up @@ -229,10 +233,12 @@ setConsumes(edm::ConsumesCollector& sumes) {
make_consumes(ph_conf.hcalDepth2OverEcalBc,ph_conf.tok_hcalDepth2OverEcalBc,sumes);
}

namespace {
template<typename T, typename U, typename V>
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 {
Expand Down
6 changes: 6 additions & 0 deletions RecoEgamma/EgammaTools/plugins/EGPfIsolationModifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<edm::ValueMap<float> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<float> > >& map) {
if( !tok.isUninitialized() ) evt.getByToken(tok,map[tok.index()]);
}
}

void EGPfIsolationModifierFromValueMaps::
setEvent(const edm::Event& evt) {
Expand Down Expand Up @@ -152,8 +154,10 @@ void EGPfIsolationModifierFromValueMaps::
setEventContent(const edm::EventSetup& evs) {
}

namespace {
template<typename T, typename U, typename V>
inline void make_consumes(T& tag,U& tok,V& sume) { if( !(empty_tag == tag) ) tok = sume.template consumes<edm::ValueMap<float> >(tag); }
}

void EGPfIsolationModifierFromValueMaps::
setConsumes(edm::ConsumesCollector& sumes) {
Expand All @@ -178,13 +182,15 @@ setConsumes(edm::ConsumesCollector& sumes) {
}
}

namespace {
template<typename T, typename U, typename V>
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);
if( itr == input_map.end() ) return;
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 {
Expand Down

0 comments on commit 9808d9f

Please sign in to comment.