144 unsigned int nJet = srcJet->size();
148 std::vector<float> leptonPtRatio(nJet, 0);
149 std::vector<float> leptonPtRelInv(nJet, 0);
150 std::vector<float> leptonPtRel_v0(nJet, 0);
151 std::vector<float> leptonPtRatio_v0(nJet, 0);
152 std::vector<float> leptonPtRelInv_v0(nJet, 0);
153 std::vector<int> leptonPdgId(nJet, 0);
154 std::vector<float> leptonPt(nJet, 0);
156 std::vector<float> leadTrackPt(nJet, 0);
157 std::vector<float> vtxPt(nJet, 0);
158 std::vector<float> vtxMass(nJet, 0);
159 std::vector<float> vtx3dL(nJet, 0);
160 std::vector<float> vtx3deL(nJet, 0);
161 std::vector<int> vtxNtrk(nJet, 0);
162 std::vector<float> ptD(nJet, 0);
163 std::vector<float> genPtwNu(nJet, 0);
165 const auto&
pv = (*srcVtx)[0];
166 for (
unsigned int ij = 0; ij < nJet; ij++) {
167 auto jet = srcJet->ptrAt(ij);
169 if (
jet->genJet() !=
nullptr) {
170 auto genp4 =
jet->genJet()->p4();
171 auto gep4wNu = genp4;
172 for (
const auto&
gp : *srcGP) {
173 if ((
abs(
gp.pdgId()) == 12 ||
abs(
gp.pdgId()) == 14 ||
abs(
gp.pdgId()) == 16) &&
gp.status() == 1) {
176 gep4wNu = gep4wNu +
gp.p4();
182 genPtwNu[ij] = gep4wNu.pt();
189 for (
const auto&
d :
jet->daughterPtrVector()) {
190 sumWeight += (
d->pt()) * (
d->pt());
195 leadTrackPt[ij] =
ptMax;
196 ptD[ij] = (sumWeight > 0 ?
sqrt(sumWeight) / sumPt : 0);
202 for (
const auto&
d :
jet->daughterPtrVector()) {
203 if (
abs(
d->pdgId()) == 11 ||
abs(
d->pdgId()) == 13) {
204 if (
d->pt() < maxLepPt)
207 leptonPtRatio[ij] = std::get<0>(res);
209 leptonPtRelInv[ij] = std::get<2>(res);
211 leptonPtRatio_v0[ij] = std::get<0>(res2);
212 leptonPtRel_v0[ij] = std::get<1>(res2);
213 leptonPtRelInv_v0[ij] = std::get<2>(res2);
214 leptonPdgId[ij] =
d->pdgId();
216 leptonPt[ij] =
d->pt();
223 float maxFoundSignificance = 0;
231 for (
const auto& sv : *srcSV) {
232 GlobalVector flightDir(sv.vertex().x() -
pv.x(), sv.vertex().y() -
pv.y(), sv.vertex().z() -
pv.z());
240 vtxMass[ij] = sv.p4().M();
241 vtx3dL[ij] = dl.
value();
242 vtx3deL[ij] = dl.
error();
243 vtxNtrk[ij] = sv.numberOfSourceCandidatePtrs();
251 fillerRel.insert(srcJet, leptonPtRel.begin(), leptonPtRel.end());
257 fillerRatio.insert(srcJet, leptonPtRatio.begin(), leptonPtRatio.end());
263 fillerRelInv.insert(srcJet, leptonPtRelInv.begin(), leptonPtRelInv.end());
265 iEvent.
put(
std::move(leptonPtRelInvV),
"leptonPtRelInv");
269 fillerRel_v0.insert(srcJet, leptonPtRel_v0.begin(), leptonPtRel_v0.end());
271 iEvent.
put(
std::move(leptonPtRelV_v0),
"leptonPtRelv0");
275 fillerRatio_v0.insert(srcJet, leptonPtRatio_v0.begin(), leptonPtRatio_v0.end());
276 fillerRatio_v0.fill();
277 iEvent.
put(
std::move(leptonPtRatioV_v0),
"leptonPtRatiov0");
281 fillerRelInv_v0.insert(srcJet, leptonPtRelInv_v0.begin(), leptonPtRelInv_v0.end());
282 fillerRelInv_v0.fill();
283 iEvent.
put(
std::move(leptonPtRelInvV_v0),
"leptonPtRelInvv0");
287 fillerLpt.insert(srcJet, leptonPt.begin(), leptonPt.end());
299 fillerId.insert(srcJet, leptonPdgId.begin(), leptonPdgId.end());
305 fillerLT.insert(srcJet, leadTrackPt.begin(), leadTrackPt.end());
311 fillerVtxPt.insert(srcJet, vtxPt.begin(), vtxPt.end());
317 fillerVtxMass.insert(srcJet, vtxMass.begin(), vtxMass.end());
318 fillerVtxMass.fill();
323 fillerVtx3dL.insert(srcJet, vtx3dL.begin(), vtx3dL.end());
329 fillerVtx3deL.insert(srcJet, vtx3deL.begin(), vtx3deL.end());
330 fillerVtx3deL.fill();
335 fillerVtxNT.insert(srcJet, vtxNtrk.begin(), vtxNtrk.end());
341 fillerPtD.insert(srcJet, ptD.begin(), ptD.end());
347 fillergenpt.insert(srcJet, genPtwNu.begin(), genPtwNu.end());
reco::Vertex::Point convertPos(const GlobalPoint &p)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > srcSV_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< reco::GenParticle > > srcGP_
std::tuple< float, float, float > calculatePtRatioRel(edm::Ptr< reco::Candidate > lep, edm::Ptr< pat::Jet > jet) const
reco::Vertex::Error convertError(const GlobalError &ge)
edm::EDGetTokenT< edm::View< pat::Jet > > srcJet_
Abs< T >::type abs(const T &t)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
double significance() const
edm::EDGetTokenT< std::vector< reco::Vertex > > srcVtx_
std::tuple< float, float, float > calculatePtRatioRelSimple(edm::Ptr< reco::Candidate > lep, edm::Ptr< pat::Jet > jet) const