1 #ifndef TtJetPartonMatch_h
2 #define TtJetPartonMatch_h
85 : partons_(cfg.getParameter<std::
vector<std::
string> >(
"partonsToIgnore")),
88 maxNJets_(cfg.getParameter<int>(
"maxNJets")),
89 maxNComb_(cfg.getParameter<int>(
"maxNComb")),
90 algorithm_(readAlgorithm(cfg.getParameter<std::
string>(
"algorithm"))),
91 useDeltaR_(cfg.getParameter<bool>(
"useDeltaR")),
92 useMaxDist_(cfg.getParameter<bool>(
"useMaxDist")),
93 maxDist_(cfg.getParameter<double>(
"maxDist")),
94 verbosity_(cfg.getParameter<int>(
"verbosity")) {
100 produces<std::vector<std::vector<int> > >();
101 produces<std::vector<double> >(
"SumPt");
102 produces<std::vector<double> >(
"SumDR");
103 produces<int>(
"NumberOfConsideredJets");
106 template <
typename C>
109 template <
typename C>
116 std::unique_ptr<std::vector<std::vector<int> > >
match(
new std::vector<std::vector<int> >);
117 std::unique_ptr<std::vector<double> > sumPt(
new std::vector<double>);
118 std::unique_ptr<std::vector<double> > sumDR(
new std::vector<double>);
119 std::unique_ptr<int> pJetsConsidered(
new int);
132 std::vector<const reco::Candidate*>
partons = partons_.vec(*genEvt);
135 std::vector<const reco::Candidate*>
jets;
136 for (
unsigned int ij = 0; ij < topJets->size(); ++ij) {
141 if (maxNJets_ != -1) {
142 if (maxNJets_ >= (
int)partons.size()) {
143 if ((
int)ij == maxNJets_)
146 if (ij == partons.size())
152 *pJetsConsidered = jets.size();
155 JetPartonMatching jetPartonMatch(partons, jets, algorithm_, useMaxDist_, useDeltaR_, maxDist_);
160 jetPartonMatch.
print();
163 if ((
int)ic >= maxNComb_ && maxNComb_ >= 0)
166 partons_.expand(matches);
167 match->push_back(matches);
174 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
177 template <
typename C>
179 if (str ==
"totalMinDist")
181 else if (str ==
"minSumDist")
183 else if (str ==
"ptOrderedMinDist")
185 else if (str ==
"unambiguousOnly")
188 throw cms::Exception(
"Configuration") <<
"Chosen algorithm is not supported: " << str <<
"\n";
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< TtGenEvent > genEvt_
TtGenEvent collection input.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void produce(edm::Event &, const edm::EventSetup &) override
write jet parton match objects into the event
~TtJetPartonMatch() override
default destructor
unsigned int getNumberOfAvailableCombinations()
Class derived from the TopGenEvent for ttbar events.
JetPartonMatching::algorithms readAlgorithm(const std::string &str)
convert string for algorithm into corresponding enumerator type
std::vector< int > getMatchesForPartons(const unsigned int comb=0)
bool useDeltaR_
switch to choose between deltaR/deltaTheta matching
JetPartonMatching::algorithms algorithm_
choice of algorithm
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
jet collection input
int verbosity_
verbosity level
double getSumDeltaR(const unsigned int comb=0)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
TtJetPartonMatch(const edm::ParameterSet &)
default conructor
genEvt_(cfg.getParameter< edm::InputTag >("genEvent"))
double getSumDeltaPt(const unsigned int comb=0)