10 #include "Math/VectorUtil.h"
19 bool isValid(
const int idx,
const std::vector<pat::Jet>&
jets)
const {
return (0 <= idx && idx < (
int)jets.size()); };
33 : jetsToken_(consumes<std::
vector<pat::
Jet>>(cfg.getParameter<edm::
InputTag>(
"jets"))),
34 lepsToken_(consumes<edm::
View<
reco::RecoCandidate>>(cfg.getParameter<edm::
InputTag>(
"leps"))),
35 maxNJets_(cfg.getParameter<int>(
"maxNJets")),
36 useDeltaR_(cfg.getParameter<bool>(
"useDeltaR")),
37 useBTagging_(cfg.getParameter<bool>(
"useBTagging")),
38 bTagAlgorithm_(cfg.getParameter<std::
string>(
"bTagAlgorithm")),
39 minBDiscBJets_(cfg.getParameter<double>(
"minBDiscBJets")),
40 maxBDiscLightJets_(cfg.getParameter<double>(
"maxBDiscLightJets")) {
43 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
45 produces<std::vector<std::vector<int>>>();
46 produces<int>(
"NumberOfConsideredJets");
50 auto pOut = std::make_unique<std::vector<std::vector<int>>>();
51 auto pJetsConsidered = std::make_unique<int>(0);
53 std::vector<int>
match;
54 for (
unsigned int i = 0;
i < 4; ++
i)
64 if (leps.empty() ||
jets.size() < 4) {
65 pOut->push_back(match);
67 *pJetsConsidered =
jets.size();
68 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
74 maxNJets =
jets.size();
75 *pJetsConsidered = maxNJets;
76 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
78 std::vector<bool> isBJet;
79 std::vector<bool> isLJet;
82 for (
unsigned int idx = 0; idx < maxNJets; ++idx) {
97 for (
unsigned int idx = 0; idx < maxNJets; ++idx) {
98 if (
useBTagging_ && (!isLJet[idx] || (cntBJets <= 2 && isBJet[idx])))
100 for (
unsigned int jdx = (idx + 1); jdx < maxNJets; ++jdx) {
102 (!isLJet[jdx] || (cntBJets <= 2 && isBJet[jdx]) || (cntBJets == 3 && isBJet[idx] && isBJet[jdx])))
105 if (minDist < 0. || dist < minDist) {
115 wHad =
jets[lightQ].p4() +
jets[lightQBar].p4();
124 for (
unsigned int idx = 0; idx < maxNJets; ++idx) {
128 if ((
int)idx != lightQ && (
int)idx != lightQBar) {
130 if (minDist < 0. || dist < minDist) {
144 for (
unsigned int idx = 0; idx < maxNJets; ++idx) {
148 if ((
int)idx != lightQ && (
int)idx != lightQBar && (
int)idx != hadB) {
150 if (minDist < 0. || dist < minDist) {
162 pOut->push_back(match);
171 return fabs(v1.theta() - v2.theta());
bool isValid(const int idx, const std::vector< pat::Jet > &jets) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double maxBDiscLightJets_
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TtSemiLepJetCombGeom(const edm::ParameterSet &)
void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &setup) const override
bool get(ProductID const &oid, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
std::string bTagAlgorithm_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
double distance(const math::XYZTLorentzVector &, const math::XYZTLorentzVector &) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.