26 #include "Math/GenVector/PxPyPzM4D.h"
27 #include "Math/GenVector/VectorUtil.h"
28 #include "Math/GenVector/Boost.h"
50 using namespace ROOT::Math::VectorUtil;
71 : m_jets(iConfig.getParameter<
edm::
InputTag>(
"jets")),
75 m_leptons(iConfig.getParameter<
edm::
InputTag>(
"leptons")),
81 m_leptonCands(iConfig.exists(
"leptonCands") ? iConfig.getParameter<
edm::
InputTag>(
"leptonCands")
85 m_leptonId(iConfig.exists(
"leptonId") ? iConfig.getParameter<
edm::
InputTag>(
"leptonId") :
edm::
InputTag()),
88 m_transientTrackBuilder(nullptr),
89 m_refineJetAxis(iConfig.getParameter<unsigned
int>(
"refineJetAxis")),
90 m_deltaRCut(iConfig.getParameter<double>(
"leptonDeltaRCut")),
91 m_chi2Cut(iConfig.getParameter<double>(
"leptonChi2Cut")),
93 produces<reco::SoftLeptonTagInfoCollection>();
110 std::vector<edm::RefToBase<reco::Jet> >
jets;
111 std::vector<reco::TrackRefVector>
tracks;
121 for (
unsigned int i = 0;
i <
size; ++
i) {
122 jets[
i] = (*h_jtas)[
i].first;
133 unsigned int size = h_jets->size();
136 for (
unsigned int i = 0;
i < h_jets->size();
i++)
137 jets[
i] = h_jets->refAt(
i);
144 <<
" of type among (\"reco::JetTracksAssociationCollection\", \"edm::View<reco::Jet>\") not found";
152 if (h_primaryVertex.
isValid() and not h_primaryVertex->empty())
153 vertex = h_primaryVertex->front();
176 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
180 id[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva_e_pi();
182 id[SoftLeptonProperties::Quality::btagElectronCands] =
194 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
198 id[SoftLeptonProperties::Quality::btagElectronCands] =
210 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
211 for (reco::PFCandidateCollection::const_iterator
electron = h_electrons->begin();
215 if (
electron->gsfTrackRef().isNonnull())
217 else if (
electron->trackRef().isNonnull())
221 (*id)[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva_e_pi();
223 (*id)[SoftLeptonProperties::Quality::btagElectronCands] =
238 if (
muon->globalTrack().isNonnull())
240 else if (
muon->innerTrack().isNonnull())
242 else if (
muon->outerTrack().isNonnull())
248 (*id)[SoftLeptonProperties::Quality::btagMuonCands] =
260 for (
unsigned int i = 0;
i < h_tracks->size();
i++) {
263 id[SoftLeptonProperties::Quality::btagLeptonCands] = (*h_leptonCands)[h_tracks->refAt(
i)];
270 <<
" of type among (\"edm::View<reco::GsfElectron>\", "
271 "\"edm::View<reco::Muon>\", \"edm::View<reco::Track>\") !found";
279 for (Leptons::iterator lepton =
leptons.begin(); lepton !=
leptons.end(); ++lepton)
280 lepton->second[
leptonId] = (*h_leptonId)[lepton->first];
284 auto outputCollection = std::make_unique<reco::SoftLeptonTagInfoCollection>();
285 for (
unsigned int i = 0;
i <
jets.size(); ++
i) {
287 outputCollection->push_back(
result);
300 for (Leptons::const_iterator lepton =
leptons.begin(); lepton !=
leptons.end(); ++lepton) {
321 properties.
ptRel = Perp(lepton_momentum, axis);
324 properties.
ratio = lepton_momentum.R() / axis.R();
325 properties.
ratioRel = lepton_momentum.Dot(axis) / axis.Mag2();
327 for (LeptonIds::const_iterator iter = lepton->second.begin(); iter != lepton->second.end(); ++iter)
328 properties.
setQuality(static_cast<SoftLeptonProperties::Quality::Generic>(iter->first), iter->second);
330 info.insert(lepton->first, properties);
345 double sum_eta_by_pT = 0.;
346 double sum_phi_by_pT = 0.;
357 eta_rel = (double)
track.eta() - axis.eta();
358 phi_rel = (double)
track.phi() - axis.phi();
359 while (phi_rel < -
M_PI)
361 while (phi_rel >
M_PI)
365 sum_phi_by_pT +=
perp * phi_rel;
366 sum_eta_by_pT +=
perp * eta_rel;
374 eta_rel = (double)
track.eta() - axis.eta();
375 phi_rel = (double)
track.phi() - axis.phi();
376 while (phi_rel < -
M_PI)
378 while (phi_rel >
M_PI)
382 sum_phi_by_pT -=
perp * phi_rel;
383 sum_eta_by_pT -=
perp * eta_rel;
388 math::RhoEtaPhiVector(axis.rho(), axis.eta() + sum_eta_by_pT / sum_pT, axis.phi() + sum_phi_by_pT / sum_pT);
396 sum +=
track.momentum();
402 sum -=
track.momentum();
422 static const double lepton_mass = 0.00;
423 static const double jet_mass = 5.279;
424 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > lepton(
425 vector.Dot(axis) / axis.r(), Perp(
vector, axis), 0., lepton_mass);
426 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> >
jet(axis.r(), 0., 0., jet_mass);
427 ROOT::Math::BoostX
boost(-
jet.Beta());
428 return boost(lepton).x();
434 desc.add<
unsigned int>(
"muonSelection", 1);
439 desc.add<
unsigned int>(
"refineJetAxis", 0);
441 desc.add<
double>(
"leptonDeltaRCut", 0.4);
442 desc.add<
double>(
"leptonChi2Cut", 9999.0);