40 maxNJets_(
cfg.getParameter<
int>(
"maxNJets")),
41 wMass_(
cfg.getParameter<double>(
"wMass")),
42 useBTagging_(
cfg.getParameter<
bool>(
"useBTagging")),
43 bTagAlgorithm_(
cfg.getParameter<
std::
string>(
"bTagAlgorithm")),
44 minBDiscBJets_(
cfg.getParameter<double>(
"minBDiscBJets")),
45 maxBDiscLightJets_(
cfg.getParameter<double>(
"maxBDiscLightJets")),
46 neutrinoSolutionType_(
cfg.getParameter<
int>(
"neutrinoSolutionType")) {
49 <<
"It has to be larger than 4 or can be set to -1 to take all jets.";
51 produces<std::vector<std::vector<int>>>();
52 produces<int>(
"NumberOfConsideredJets");
56 auto pOut = std::make_unique<std::vector<std::vector<int>>>();
57 auto pJetsConsidered = std::make_unique<int>(0);
59 std::vector<int>
match;
60 for (
unsigned int i = 0;
i < 4; ++
i)
74 pOut->push_back(
match);
76 *pJetsConsidered =
jets.size();
77 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
85 evt.
put(
std::move(pJetsConsidered),
"NumberOfConsideredJets");
87 std::vector<bool> isBJet;
88 std::vector<bool> isLJet;
104 std::vector<int> closestToWMassIndices;
105 closestToWMassIndices.push_back(-1);
106 closestToWMassIndices.push_back(-1);
110 for (
unsigned jdx = (
idx + 1); jdx <
maxNJets; ++jdx) {
112 (!isLJet[jdx] || (cntBJets <= 2 && isBJet[jdx]) || (cntBJets == 3 && isBJet[
idx] && isBJet[jdx])))
115 if (wDist < 0. || wDist > fabs(sum.mass() -
wMass_)) {
116 wDist = fabs(sum.mass() -
wMass_);
117 closestToWMassIndices.clear();
118 closestToWMassIndices.push_back(
idx);
119 closestToWMassIndices.push_back(jdx);
127 double neutrino_pz = 0.;
131 if (dynamic_cast<const reco::Muon*>(&(
leps.front())))
133 else if (dynamic_cast<const reco::GsfElectron*>(&(
leps.front())))
137 <<
"Type of lepton given together with MET for solving neutrino kinematics is neither muon nor electron.\n";
144 mets.begin()->py() *
mets.begin()->py() + neutrino_pz * neutrino_pz));
152 double deltaTop = -1.;
157 jets[closestToWMassIndices[0]].p4() +
jets[closestToWMassIndices[1]].p4();
163 if ((
int)
idx != closestToWMassIndices[0] && (
int)
idx != closestToWMassIndices[1]) {
166 for (
unsigned jdx = 0; jdx <
maxNJets; ++jdx) {
170 if ((
int)jdx != closestToWMassIndices[0] && (
int)jdx != closestToWMassIndices[1] && jdx !=
idx) {
172 if (deltaTop < 0. || deltaTop > fabs(hadTop.mass() - lepTop.mass())) {
173 deltaTop = fabs(hadTop.mass() - lepTop.mass());
188 pOut->push_back(
match);
edm::EDGetTokenT< std::vector< pat::Jet > > jetsToken_
void SetLepton(const pat::Particle &lepton, bool isMuon=true)
Set lepton.
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
void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &setup) const override
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void SetMET(const pat::MET &MET)
Set MET.
double Calculate(int type=1)
member functions
int neutrinoSolutionType_
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::View< reco::RecoCandidate > > lepsToken_
double maxBDiscLightJets_
TtSemiLepJetCombWMassDeltaTopMass(const edm::ParameterSet &)
std::string bTagAlgorithm_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
edm::EDGetTokenT< std::vector< pat::MET > > metsToken_
math::XYZTLorentzVector LorentzVector
Lorentz vector.