Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use anonymous namespaces to avoid duplicate symbols #11066

Merged
merged 1 commit into from
Sep 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions RecoEgamma/EgammaTools/plugins/EGExtraInfoModifierFromDB.cc
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
30 changes: 18 additions & 12 deletions RecoEgamma/EgammaTools/plugins/EGPfIsolationModifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ EGPfIsolationModifierFromValueMaps(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 EGPfIsolationModifierFromValueMaps::
Expand Down Expand Up @@ -152,8 +154,10 @@ void EGPfIsolationModifierFromValueMaps::
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 EGPfIsolationModifierFromValueMaps::
setConsumes(edm::ConsumesCollector& sumes) {
Expand All @@ -178,12 +182,14 @@ setConsumes(edm::ConsumesCollector& sumes) {
}
}

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