Skip to content

Commit

Permalink
remove auto in function decl
Browse files Browse the repository at this point in the history
  • Loading branch information
arizzi committed Sep 25, 2017
1 parent 6faa025 commit 1eabc06
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
6 changes: 4 additions & 2 deletions PhysicsTools/NanoAOD/interface/MatchingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include <vector>
#include "CommonTools/Utils/interface/StringCutObjectSelector.h"
*/
bool matchByCommonSourceCandidatePtr(const auto & c1, const auto & c2) {
template <class C1, class C2>
bool matchByCommonSourceCandidatePtr(const C1 & c1, const C2 & c2) {
for(unsigned int i1 = 0 ; i1 < c1.numberOfSourceCandidatePtrs();i1++){
auto c1s=c1.sourceCandidatePtr(i1);
for(unsigned int i2 = 0 ; i2 < c2.numberOfSourceCandidatePtrs();i2++) {
Expand All @@ -15,7 +16,8 @@ bool matchByCommonSourceCandidatePtr(const auto & c1, const auto & c2) {
return false;
}

bool matchByCommonParentSuperClusterRef(const auto & c1, const auto & c2) {
template <class C1, class C2>
bool matchByCommonParentSuperClusterRef(const C1 & c1, const C2 & c2) {
auto c1s = c1.parentSuperCluster();
auto c2s = c2.parentSuperCluster();
return (c1s == c2s);
Expand Down
5 changes: 3 additions & 2 deletions PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include "TLorentzVector.h"
#include "DataFormats/Common/interface/View.h"
#include "DataFormats/Candidate/interface/VertexCompositePtrCandidate.h"

#include "PhysicsTools/NanoAOD/interface/MatchingUtils.h"

Expand Down Expand Up @@ -64,7 +65,7 @@ class LeptonJetVarProducer : public edm::global::EDProducer<> {
private:
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;

std::tuple<float,float,float> calculatePtRatioRel(auto &lep, auto &jet, auto &vtx) const;
std::tuple<float,float,float> calculatePtRatioRel(edm::Ptr<reco::Candidate> lep, edm::Ptr<pat::Jet> jet, const reco::Vertex &vtx) const;

// ----------member data ---------------------------

Expand Down Expand Up @@ -153,7 +154,7 @@ LeptonJetVarProducer<T>::produce(edm::StreamID streamID, edm::Event& iEvent, con

template <typename T>
std::tuple<float,float,float>
LeptonJetVarProducer<T>::calculatePtRatioRel(auto &lep, auto &jet, auto &vtx) const {
LeptonJetVarProducer<T>::calculatePtRatioRel(edm::Ptr<reco::Candidate> lep, edm::Ptr<pat::Jet> jet, const reco::Vertex &vtx) const {

auto rawp4_ = jet->correctedP4("Uncorrected");
auto rawp4 = TLorentzVector(rawp4_.pt(),rawp4_.eta(),rawp4_.phi(),rawp4_.energy());
Expand Down
20 changes: 12 additions & 8 deletions PhysicsTools/NanoAOD/plugins/PATObjectCrossLinker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ class PATObjectCrossLinker : public edm::stream::EDProducer<> {
void produce(edm::Event&, const edm::EventSetup&) override;
void endStream() override;

void matchOneToMany(const auto & refProdOne, auto & itemsOne, const std::string & nameOne,
const auto & refProdMany, auto& itemsMany, const std::string & nameMany);
template < class C1, class C2,class C3, class C4>
void matchOneToMany(const C1 & refProdOne, C2 & itemsOne, const std::string & nameOne,
const C3 & refProdMany, C4& itemsMany, const std::string & nameMany);

void matchElectronToPhoton(const auto & refProdOne, auto & itemsOne, const std::string & nameOne,
const auto & refProdMany, auto& itemsMany, const std::string & nameMany);
template < class C1, class C2,class C3,class C4>
void matchElectronToPhoton(const C1 & refProdOne, C2 & itemsOne, const std::string & nameOne,
const C3 & refProdMany, C4& itemsMany, const std::string & nameMany);

//virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
//virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
Expand Down Expand Up @@ -112,8 +114,9 @@ PATObjectCrossLinker::~PATObjectCrossLinker()
// ------------ method called to produce the data ------------

///
void PATObjectCrossLinker::matchOneToMany(const auto & refProdOne, auto & itemsOne, const std::string & nameOne,
const auto & refProdMany, auto& itemsMany, const std::string & nameMany)
template < class C1, class C2,class C3,class C4>
void PATObjectCrossLinker::matchOneToMany(const C1 & refProdOne, C2 & itemsOne, const std::string & nameOne,
const C3 & refProdMany, C4& itemsMany, const std::string & nameMany)
{
size_t ji=0;
for(auto & j: itemsOne) {
Expand All @@ -131,8 +134,9 @@ void PATObjectCrossLinker::matchOneToMany(const auto & refProdOne, auto & itemsO
}
}

void PATObjectCrossLinker::matchElectronToPhoton(const auto & refProdOne, auto & itemsOne, const std::string & nameOne,
const auto & refProdMany, auto& itemsMany, const std::string & nameMany)
template < class C1, class C2,class C3,class C4>
void PATObjectCrossLinker::matchElectronToPhoton(const C1 & refProdOne, C2 & itemsOne, const std::string & nameOne,
const C3 & refProdMany, C4& itemsMany, const std::string & nameMany)
{
size_t ji=0;
for(auto & j: itemsOne) {
Expand Down

0 comments on commit 1eabc06

Please sign in to comment.