32 maxNJets_(
cfg.getParameter<
int>(
"maxNJets")),
33 wMass_(
cfg.getParameter<double>(
"wMass")),
34 useBTagging_(
cfg.getParameter<
bool>(
"useBTagging")),
35 bTagAlgorithm_(
cfg.getParameter<
std::
string>(
"bTagAlgorithm")),
36 minBDiscBJets_(
cfg.getParameter<double>(
"minBDiscBJets")),
37 maxBDiscLightJets_(
cfg.getParameter<double>(
"maxBDiscLightJets")) {
40 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
42 produces<std::vector<std::vector<int>>>();
43 produces<int>(
"NumberOfConsideredJets");
47 auto pOut = std::make_unique<std::vector<std::vector<int>>>();
48 auto pJetsConsidered = std::make_unique<int>(0);
50 std::vector<int>
match;
51 for (
unsigned int i = 0;
i < 4; ++
i)
61 if (
leps.empty() ||
jets.size() < 4) {
62 pOut->push_back(
match);
64 *pJetsConsidered =
jets.size();
65 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
73 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
75 std::vector<bool> isBJet;
76 std::vector<bool> isLJet;
92 std::vector<int> maxPtIndices;
93 maxPtIndices.push_back(-1);
94 maxPtIndices.push_back(-1);
95 maxPtIndices.push_back(-1);
99 for (
unsigned jdx = (
idx + 1); jdx <
maxNJets; ++jdx) {
100 if (jdx ==
idx || (
useBTagging_ && (!isLJet[jdx] || (cntBJets <= 2 && isBJet[jdx]) ||
101 (cntBJets == 3 && isBJet[
idx] && isBJet[jdx]))))
103 for (
unsigned kdx = 0; kdx <
maxNJets; ++kdx) {
109 maxPtIndices.clear();
110 maxPtIndices.push_back(
idx);
111 maxPtIndices.push_back(jdx);
112 maxPtIndices.push_back(kdx);
123 std::vector<int> closestToWMassIndices;
124 closestToWMassIndices.push_back(-1);
125 closestToWMassIndices.push_back(-1);
127 for (
unsigned idx = 0;
idx < maxPtIndices.size(); ++
idx) {
128 for (
unsigned jdx = 0; jdx < maxPtIndices.size(); ++jdx) {
129 if (jdx ==
idx || maxPtIndices[
idx] > maxPtIndices[jdx] ||
131 (!isLJet[maxPtIndices[
idx]] || !isLJet[maxPtIndices[jdx]] ||
132 (cntBJets <= 2 && isBJet[maxPtIndices[
idx]]) || (cntBJets <= 2 && isBJet[maxPtIndices[jdx]]) ||
133 (cntBJets == 3 && isBJet[maxPtIndices[
idx]] && isBJet[maxPtIndices[jdx]]))))
136 if (wDist < 0. || wDist > fabs(sum.mass() -
wMass_)) {
137 wDist = fabs(sum.mass() -
wMass_);
138 closestToWMassIndices.clear();
139 closestToWMassIndices.push_back(maxPtIndices[
idx]);
140 closestToWMassIndices.push_back(maxPtIndices[jdx]);
146 for (
unsigned idx = 0;
idx < maxPtIndices.size(); ++
idx) {
148 if (
std::find(closestToWMassIndices.begin(), closestToWMassIndices.end(), maxPtIndices[
idx]) ==
149 closestToWMassIndices.end()) {
150 hadB = maxPtIndices[
idx];
166 if (
std::find(maxPtIndices.begin(), maxPtIndices.end(),
idx) == maxPtIndices.end()) {
180 pOut->push_back(
match);
bool isValid(const int &idx, const std::vector< pat::Jet > &jets) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool get(ProductID const &oid, Handle< PROD > &result) const
std::string bTagAlgorithm_
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
double maxBDiscLightJets_
TtSemiLepJetCombMaxSumPtWMass(const edm::ParameterSet &)
void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &setup) const override
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
math::XYZTLorentzVector LorentzVector
Lorentz vector.