1 #ifndef TtJetPartonMatch_h
2 #define TtJetPartonMatch_h
83 : partons_(cfg.getParameter<std::
vector<std::
string>>(
"partonsToIgnore")),
86 maxNJets_(cfg.getParameter<int>(
"maxNJets")),
87 maxNComb_(cfg.getParameter<int>(
"maxNComb")),
88 algorithm_(readAlgorithm(cfg.getParameter<std::
string>(
"algorithm"))),
89 useDeltaR_(cfg.getParameter<bool>(
"useDeltaR")),
90 useMaxDist_(cfg.getParameter<bool>(
"useMaxDist")),
91 maxDist_(cfg.getParameter<double>(
"maxDist")),
92 verbosity_(cfg.getParameter<int>(
"verbosity")) {
98 produces<std::vector<std::vector<int>>>();
99 produces<std::vector<double>>(
"SumPt");
100 produces<std::vector<double>>(
"SumDR");
101 produces<int>(
"NumberOfConsideredJets");
104 template <
typename C>
111 auto match = std::make_unique<std::vector<std::vector<int>>>();
112 auto sumPt = std::make_unique<std::vector<double>>();
113 auto sumDR = std::make_unique<std::vector<double>>();
114 std::unique_ptr<int> pJetsConsidered(
new int);
125 std::vector<const reco::Candidate*>
partons = partons_.vec(genEvt);
128 std::vector<const reco::Candidate*>
jets;
129 for (
unsigned int ij = 0; ij < topJets.
size(); ++ij) {
134 if (maxNJets_ != -1) {
135 if (maxNJets_ >= (
int)partons.size()) {
136 if ((
int)ij == maxNJets_)
139 if (ij == partons.size())
143 jets.push_back(&topJets[ij]);
145 *pJetsConsidered = jets.size();
148 JetPartonMatching jetPartonMatch(partons, jets, algorithm_, useMaxDist_, useDeltaR_, maxDist_);
153 jetPartonMatch.
print();
156 if ((
int)ic >= maxNComb_ && maxNComb_ >= 0)
159 partons_.expand(matches);
160 match->push_back(matches);
167 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
170 template <
typename C>
172 if (str ==
"totalMinDist")
174 else if (str ==
"minSumDist")
176 else if (str ==
"ptOrderedMinDist")
178 else if (str ==
"unambiguousOnly")
181 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.
unsigned int getNumberOfAvailableCombinations()
Class derived from the TopGenEvent for ttbar events.
std::vector< int > getMatchesForPartons(const unsigned int comb=0)
JetPartonMatching::algorithms readAlgorithm(const std::string &str) const
convert string for algorithm into corresponding enumerator type
bool useDeltaR_
switch to choose between deltaR/deltaTheta matching
bool get(ProductID const &oid, Handle< PROD > &result) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
write jet parton match objects into the event
JetPartonMatching::algorithms algorithm_
choice of algorithm
genEvt_(cfg.getParameter< edm::InputTag >("genEvent"))
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
double getSumDeltaPt(const unsigned int comb=0)