36 kSegmentCompatibility,
42 bool subtractMuon =
true) {
46 float dot = muP4.Vect().Dot(jp4.Vect());
47 float ptrel = muP4.P2() -
dot *
dot / jp4.P2();
48 ptrel = ptrel > 0 ?
sqrt(ptrel) : 0.0;
65 var[kSegmentCompatibility] =
muon.segmentCompatibility();
66 var[kMiniRelIsoCharged] =
muon.miniPFIsolation().chargedHadronIso() /
muon.pt();
67 var[kMiniRelIsoNeutral] = miniIsoValue -
var[kMiniRelIsoCharged];
72 double dz = fabs(
muon.muonBestTrack()->dz(
vertex.position()));
73 var[kSip] = edB3D > 0 ? fabs(dB3D / edB3D) : 0.0;
74 var[kLog_abs_dxyBS] = dB2D > 0 ?
log(dB2D) : 0;
79 double jecL1L2L3Res = 1.;
83 double chIso =
muon.pfIsolationR04().sumChargedHadronPt;
84 double nIso =
muon.pfIsolationR04().sumNeutralHadronEt;
85 double phoIso =
muon.pfIsolationR04().sumPhotonEt;
86 double puIso =
muon.pfIsolationR04().sumPUPt;
87 double dbCorrectedIsolation = chIso +
std::max(nIso + phoIso - .5 * puIso, 0.);
88 double dbCorrectedRelIso = dbCorrectedIsolation /
muon.pt();
90 var[kJetPtRatio] = 1. / (1 + dbCorrectedRelIso);
92 var[kJetBTagCSV] = -999;
93 var[kJetNDauCharged] = -1;
95 for (
const auto& tagI :
bTags) {
105 if (correctorL1 && correctorL1L2L3Res) {
106 jecL1L2L3Res = correctorL1L2L3Res->
correction(*(tagI.first));
107 jecL1 = correctorL1->
correction(*(tagI.first));
111 var[kJetBTagCSV] = tagI.second;
112 var[kJetNDauCharged] = 0;
113 for (
auto jet : tagI.first->getJetConstituentsQuick()) {
116 throw cms::Exception(
"ConfigurationError") <<
"Cannot get jet constituents";
117 if (
pfcand->charge() == 0)
119 auto bestTrackPtr =
pfcand->bestTrack();
124 if (bestTrackPtr->pt() < 1.)
126 if (bestTrackPtr->hitPattern().numberOfValidHits() < 8)
128 if (bestTrackPtr->hitPattern().numberOfValidPixelHits() < 2)
130 if (bestTrackPtr->normalizedChi2() >= 5)
133 if (std::fabs(bestTrackPtr->dxy(
vertex.position())) > 0.2)
135 if (std::fabs(bestTrackPtr->dz(
vertex.position())) > 17)
137 var[kJetNDauCharged]++;
141 if ((jetP4 - muP4).Rho() < 0.0001) {
143 var[kJetPtRatio] = 1;
145 jetP4 -= muP4 / jecL1;
146 jetP4 *= jecL1L2L3Res;
149 var[kJetPtRatio] = muP4.pt() / jetP4.pt();
150 var[kJetPtRel] =
ptRel(muP4, jetP4);
155 if (
var[kJetPtRatio] > 1.5)
156 var[kJetPtRatio] = 1.5;
157 if (
var[kJetBTagCSV] < 0)
158 var[kJetBTagCSV] = 0;
159 jetPtRatio =
var[kJetPtRatio];
160 jetPtRel =
var[kJetPtRel];