Skip to content

Commit

Permalink
Merge pull request #11069 from wmtan/UseNamespace75X
Browse files Browse the repository at this point in the history
Use anonymous namespace to avoid duplicate symbols
  • Loading branch information
cmsbuild committed Sep 4, 2015
2 parents c506ce7 + 6a16ed7 commit 2908a4e
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 44 deletions.
40 changes: 23 additions & 17 deletions RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc
Expand Up @@ -181,11 +181,13 @@ EGExtraInfoModifierFromDB::EGExtraInfoModifierFromDB(const edm::ParameterSet& co
}
}

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()]);
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) {
Expand Down Expand Up @@ -307,16 +309,18 @@ void EGExtraInfoModifierFromDB::setEventContent(const edm::EventSetup& evs) {
}
}

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);
}
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);
}

template<typename T, typename U, typename V>
inline void make_int_consumes(T& tag,U& tok,V& sume) {
if(!(empty_tag == tag))
tok = sume.template consumes<edm::ValueMap<int> >(tag);
template<typename T, typename U, typename V>
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,9 +364,11 @@ void EGExtraInfoModifierFromDB::setConsumes(edm::ConsumesCollector& sumes) {
}
}

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());
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 {
Expand Down
Expand Up @@ -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<edm::ValueMap<float> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<float> > >& map) {
evt.getByToken(tok,map[tok.index()]);
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::
Expand Down Expand Up @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromFloatValueMaps::
setEventContent(const edm::EventSetup& evs) {
}

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); }
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,9 +159,11 @@ setConsumes(edm::ConsumesCollector& sumes) {
}
}

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());
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::
Expand Down
Expand Up @@ -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<edm::ValueMap<int> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<int> > >& map) {
evt.getByToken(tok,map[tok.index()]);
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::
Expand Down Expand Up @@ -135,8 +137,10 @@ void EGExtraInfoModifierFromIntValueMaps::
setEventContent(const edm::EventSetup& evs) {
}

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); }
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,9 +159,11 @@ setConsumes(edm::ConsumesCollector& sumes) {
}
}

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());
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::
Expand Down
24 changes: 15 additions & 9 deletions RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc
Expand Up @@ -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<edm::ValueMap<float> >& tok,
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<float> > >& map) {
if( !tok.isUninitialized() ) evt.getByToken(tok,map[tok.index()]);
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::
Expand Down Expand Up @@ -195,8 +197,10 @@ void EGFull5x5ShowerShapeModifierFromValueMaps::
setEventContent(const edm::EventSetup& evs) {
}

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); }
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,9 +233,11 @@ setConsumes(edm::ConsumesCollector& sumes) {
make_consumes(ph_conf.hcalDepth2OverEcalBc,ph_conf.tok_hcalDepth2OverEcalBc,sumes);
}

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());
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::
Expand Down

0 comments on commit 2908a4e

Please sign in to comment.