53 produces<edm::ValueMap<float>>(
"ptRatio");
54 produces<edm::ValueMap<float>>(
"ptRel");
55 produces<edm::ValueMap<float>>(
"jetNDauChargedMVASel");
56 produces<edm::ValueMap<reco::CandidatePtr>>(
"jetForLepJetVar");
98 unsigned int nJet =
srcJet->size();
99 unsigned int nLep =
srcLep->size();
101 std::vector<float>
ptRatio(nLep, -1);
102 std::vector<float>
ptRel(nLep, -1);
106 const auto&
pv = (*srcVtx)[0];
108 for (
unsigned int il = 0; il < nLep; il++) {
109 for (
unsigned int ij = 0; ij < nJet; ij++) {
110 auto lep =
srcLep->ptrAt(il);
113 auto res = calculatePtRatioRel(lep,
jet,
pv);
144 fillerjetForLepJetVar.
fill();
148 template <
typename T>
152 auto rawp4 =
jet->correctedP4(
"Uncorrected");
153 auto lepp4 = lep->
p4();
155 if ((rawp4 - lepp4).
R() < 1
e-4)
156 return std::tuple<float, float, float>(1.0, 0.0, 0.0);
158 auto l1corrFactor =
jet->jecFactor(
"L1FastJet") /
jet->jecFactor(
"Uncorrected");
160 auto jetp4 = (rawp4 - lepp4 * (1.0 / l1corrFactor)) * (
jet->pt() / rawp4.pt()) + lepp4;
161 auto ptratio = lepp4.pt() / jetp4.pt();
162 auto ptrel = lepp4.Vect().Cross((jetp4 - lepp4).Vect().Unit()).R();
164 unsigned int jndau = 0;
165 for (
const auto& _d :
jet->daughterPtrVector()) {
166 const auto d = dynamic_cast<const pat::PackedCandidate*>(_d.get());
167 if (
d->charge() == 0)
169 if (
d->fromPV() <= 1)
173 if (!(
d->hasTrackDetails()))
175 auto tk =
d->pseudoTrack();
176 if (tk.pt() > 1 && tk.hitPattern().numberOfValidHits() >= 8 && tk.hitPattern().numberOfValidPixelHits() >= 2 &&
177 tk.normalizedChi2() < 5 && fabs(tk.dxy(
vtx.position())) < 0.2 && fabs(tk.dz(
vtx.position())) < 17)
181 return std::tuple<float, float, float>(ptratio, ptrel,
float(jndau));
185 template <
typename T>
192 desc.add<
edm::InputTag>(
"srcVtx")->setComment(
"primary vertex input collection");