CMS 3D CMS Logo

PileupJetIdAlgo.cc
Go to the documentation of this file.
2 
10 
11 #include "TMatrixDSym.h"
12 #include "TMatrixDSymEigen.h"
13 
14 #include <utility>
15 
16 // ------------------------------------------------------------------------------------------
18 
19 // ------------------------------------------------------------------------------------------
20 
22  : cutBased_(ps.getParameter<bool>("cutBased")),
23  etaBinnedWeights_(false),
24  runMvas_(runMvas),
25  nEtaBins_(0),
26  label_(ps.getParameter<std::string>("label")),
27  mvacut_{},
28  rmsCut_{},
29  betaStarCut_{} {
30  std::vector<edm::FileInPath> tmvaEtaWeights;
31  std::vector<std::string> tmvaSpectators;
32  int version;
33 
34  if (!cutBased_) {
35  etaBinnedWeights_ = ps.getParameter<bool>("etaBinnedWeights");
36  if (etaBinnedWeights_) {
37  const std::vector<edm::ParameterSet>& trainings = ps.getParameter<std::vector<edm::ParameterSet> >("trainings");
38  nEtaBins_ = ps.getParameter<int>("nEtaBins");
39  for (int v = 0; v < nEtaBins_; v++) {
40  tmvaEtaWeights.push_back(trainings.at(v).getParameter<edm::FileInPath>("tmvaWeights"));
41  jEtaMin_.push_back(trainings.at(v).getParameter<double>("jEtaMin"));
42  jEtaMax_.push_back(trainings.at(v).getParameter<double>("jEtaMax"));
43  }
44  for (int v = 0; v < nEtaBins_; v++) {
45  tmvaEtaVariables_.push_back(trainings.at(v).getParameter<std::vector<std::string> >("tmvaVariables"));
46  }
47  } else {
48  tmvaVariables_ = ps.getParameter<std::vector<std::string> >("tmvaVariables");
49  }
50  tmvaMethod_ = ps.getParameter<std::string>("tmvaMethod");
51  tmvaSpectators = ps.getParameter<std::vector<std::string> >("tmvaSpectators");
52  version = ps.getParameter<int>("version");
53  } else {
54  version = USER;
55  }
56 
57  edm::ParameterSet jetConfig = ps.getParameter<edm::ParameterSet>("JetIdParams");
58  for (int i0 = 0; i0 < 3; i0++) {
59  std::string lCutType = "Tight";
61  lCutType = "Medium";
63  lCutType = "Loose";
64  int nCut = 1;
65  if (cutBased_)
66  nCut++;
67  for (int i1 = 0; i1 < nCut; i1++) {
68  std::string lFullCutType = lCutType;
69  if (cutBased_ && i1 == 0)
70  lFullCutType = "BetaStar" + lCutType;
71  if (cutBased_ && i1 == 1)
72  lFullCutType = "RMS" + lCutType;
73  std::vector<double> pt010 = jetConfig.getParameter<std::vector<double> >(("Pt010_" + lFullCutType).c_str());
74  std::vector<double> pt1020 = jetConfig.getParameter<std::vector<double> >(("Pt1020_" + lFullCutType).c_str());
75  std::vector<double> pt2030 = jetConfig.getParameter<std::vector<double> >(("Pt2030_" + lFullCutType).c_str());
76  std::vector<double> pt3050 = jetConfig.getParameter<std::vector<double> >(("Pt3050_" + lFullCutType).c_str());
77  if (!cutBased_) {
78  for (int i2 = 0; i2 < 4; i2++)
79  mvacut_[i0][0][i2] = pt010[i2];
80  for (int i2 = 0; i2 < 4; i2++)
81  mvacut_[i0][1][i2] = pt1020[i2];
82  for (int i2 = 0; i2 < 4; i2++)
83  mvacut_[i0][2][i2] = pt2030[i2];
84  for (int i2 = 0; i2 < 4; i2++)
85  mvacut_[i0][3][i2] = pt3050[i2];
86  }
87  if (cutBased_ && i1 == 0) {
88  for (int i2 = 0; i2 < 4; i2++)
89  betaStarCut_[i0][0][i2] = pt010[i2];
90  for (int i2 = 0; i2 < 4; i2++)
91  betaStarCut_[i0][1][i2] = pt1020[i2];
92  for (int i2 = 0; i2 < 4; i2++)
93  betaStarCut_[i0][2][i2] = pt2030[i2];
94  for (int i2 = 0; i2 < 4; i2++)
95  betaStarCut_[i0][3][i2] = pt3050[i2];
96  }
97  if (cutBased_ && i1 == 1) {
98  for (int i2 = 0; i2 < 4; i2++)
99  rmsCut_[i0][0][i2] = pt010[i2];
100  for (int i2 = 0; i2 < 4; i2++)
101  rmsCut_[i0][1][i2] = pt1020[i2];
102  for (int i2 = 0; i2 < 4; i2++)
103  rmsCut_[i0][2][i2] = pt2030[i2];
104  for (int i2 = 0; i2 < 4; i2++)
105  rmsCut_[i0][3][i2] = pt3050[i2];
106  }
107  }
108  }
109 
110  if (!cutBased_) {
111  assert(tmvaMethod_.empty() || ((!tmvaVariables_.empty() || (!tmvaEtaVariables_.empty())) && version == USER));
112  }
113 
114  if ((!cutBased_) && (runMvas_)) {
115  if (etaBinnedWeights_) {
116  for (int v = 0; v < nEtaBins_; v++) {
117  etaReader_.push_back(createGBRForest(tmvaEtaWeights.at(v)));
118  }
119  } else {
120  reader_ = createGBRForest(ps.getParameter<std::string>("tmvaWeights"));
121  }
122  }
123 }
124 
126 
127 // ------------------------------------------------------------------------------------------
129 
130 // ------------------------------------------------------------------------------------------
131 void assign(const std::vector<float>& vec, float& a, float& b, float& c, float& d) {
132  size_t sz = vec.size();
133  a = (sz > 0 ? vec[0] : 0.);
134  b = (sz > 1 ? vec[1] : 0.);
135  c = (sz > 2 ? vec[2] : 0.);
136  d = (sz > 3 ? vec[3] : 0.);
137 }
138 // ------------------------------------------------------------------------------------------
139 void setPtEtaPhi(const reco::Candidate& p, float& pt, float& eta, float& phi) {
140  pt = p.pt();
141  eta = p.eta();
142  phi = p.phi();
143 }
144 
145 // ------------------------------------------------------------------------------------------
147 
148 // ------------------------------------------------------------------------------------------
149 
150 float PileupJetIdAlgo::getMVAval(const std::vector<std::string>& varList,
151  const std::unique_ptr<const GBRForest>& reader) {
152  std::vector<float> vars;
153  for (std::vector<std::string>::const_iterator it = varList.begin(); it != varList.end(); ++it) {
154  std::pair<float*, float> var = variables_.at(*it);
155  vars.push_back(*var.first);
156  }
157  return reader->GetClassifier(vars.data());
158 }
159 
161  if (cache_->cutBased()) {
164  } else {
165  if (std::abs(internalId_.jetEta_) >= 5.0) {
166  internalId_.mva_ = -2.;
167  } else {
168  if (cache_->etaBinnedWeights()) {
169  if (std::abs(internalId_.jetEta_) > cache_->jEtaMax().at(cache_->nEtaBins() - 1)) {
170  internalId_.mva_ = -2.;
171  } else {
172  for (int v = 0; v < cache_->nEtaBins(); v++) {
173  if (std::abs(internalId_.jetEta_) >= cache_->jEtaMin().at(v) &&
176  break;
177  }
178  }
179  }
180  } else {
182  }
183  }
185  }
186 }
187 
188 // ------------------------------------------------------------------------------------------
189 std::pair<int, int> PileupJetIdAlgo::getJetIdKey(float jetPt, float jetEta) {
190  int ptId = 0;
191  if (jetPt >= 10 && jetPt < 20)
192  ptId = 1;
193  if (jetPt >= 20 && jetPt < 30)
194  ptId = 2;
195  if (jetPt >= 30)
196  ptId = 3;
197 
198  int etaId = 0;
199  if (std::abs(jetEta) >= 2.5 && std::abs(jetEta) < 2.75)
200  etaId = 1;
201  if (std::abs(jetEta) >= 2.75 && std::abs(jetEta) < 3.0)
202  etaId = 2;
203  if (std::abs(jetEta) >= 3.0 && std::abs(jetEta) < 5.0)
204  etaId = 3;
205 
206  return std::pair<int, int>(ptId, etaId);
207 }
208 // ------------------------------------------------------------------------------------------
209 int PileupJetIdAlgo::computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta) {
210  std::pair<int, int> jetIdKey = getJetIdKey(jetPt, jetEta);
211  float betaStarModified = betaStarClassic / log(nvtx - 0.64);
212  int idFlag(0);
213  if (betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kTight][jetIdKey.first][jetIdKey.second] &&
214  dR2Mean < cache_->rmsCut()[PileupJetIdentifier::kTight][jetIdKey.first][jetIdKey.second])
215  idFlag += 1 << PileupJetIdentifier::kTight;
216 
217  if (betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kMedium][jetIdKey.first][jetIdKey.second] &&
218  dR2Mean < cache_->rmsCut()[PileupJetIdentifier::kMedium][jetIdKey.first][jetIdKey.second])
219  idFlag += 1 << PileupJetIdentifier::kMedium;
220 
221  if (betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kLoose][jetIdKey.first][jetIdKey.second] &&
222  dR2Mean < cache_->rmsCut()[PileupJetIdentifier::kLoose][jetIdKey.first][jetIdKey.second])
223  idFlag += 1 << PileupJetIdentifier::kLoose;
224  return idFlag;
225 }
226 // ------------------------------------------------------------------------------------------
227 int PileupJetIdAlgo::computeIDflag(float mva, float jetPt, float jetEta) {
228  std::pair<int, int> jetIdKey = getJetIdKey(jetPt, jetEta);
229  return computeIDflag(mva, jetIdKey.first, jetIdKey.second);
230 }
231 
232 // ------------------------------------------------------------------------------------------
233 int PileupJetIdAlgo::computeIDflag(float mva, int ptId, int etaId) {
234  int idFlag(0);
235  if (mva > cache_->mvacut()[PileupJetIdentifier::kTight][ptId][etaId])
236  idFlag += 1 << PileupJetIdentifier::kTight;
237  if (mva > cache_->mvacut()[PileupJetIdentifier::kMedium][ptId][etaId])
238  idFlag += 1 << PileupJetIdentifier::kMedium;
239  if (mva > cache_->mvacut()[PileupJetIdentifier::kLoose][ptId][etaId])
240  idFlag += 1 << PileupJetIdentifier::kLoose;
241  return idFlag;
242 }
243 
244 // ------------------------------------------------------------------------------------------
246  runMva();
248 }
249 
250 // ------------------------------------------------------------------------------------------
252  float jec,
253  const reco::Vertex* vtx,
254  const reco::VertexCollection& allvtx,
255  double rho,
256  bool usePuppi) {
257  // initialize all variables to 0
258  resetVariables();
259 
260  // loop over constituents, accumulate sums and find leading candidates
261  const pat::Jet* patjet = dynamic_cast<const pat::Jet*>(jet);
262  const reco::PFJet* pfjet = dynamic_cast<const reco::PFJet*>(jet);
263  assert(patjet != nullptr || pfjet != nullptr);
264  if (patjet != nullptr && jec == 0.) { // if this is a pat jet and no jec has been passed take the jec from the object
265  jec = patjet->pt() / patjet->correctedJet(0).pt();
266  }
267  if (jec <= 0.) {
268  jec = 1.;
269  }
270 
271  const reco::Candidate *lLead = nullptr, *lSecond = nullptr, *lLeadNeut = nullptr, *lLeadEm = nullptr,
272  *lLeadCh = nullptr, *lTrail = nullptr;
273  std::vector<float> frac, fracCh, fracEm, fracNeut;
274  float cones[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7};
275  size_t ncones = sizeof(cones) / sizeof(float);
276  float* coneFracs[] = {&internalId_.frac01_,
283  float* coneEmFracs[] = {&internalId_.emFrac01_,
290  float* coneNeutFracs[] = {&internalId_.neutFrac01_,
297  float* coneChFracs[] = {&internalId_.chFrac01_,
304  TMatrixDSym covMatrix(2);
305  covMatrix = 0.;
306  float jetPt = jet->pt() / jec; // use uncorrected pt for shape variables
307  float sumPt = 0., sumPt2 = 0., sumTkPt = 0., sumPtCh = 0, sumPtNe = 0;
308  float multNeut = 0.0;
309  setPtEtaPhi(
310  *jet, internalId_.jetPt_, internalId_.jetEta_, internalId_.jetPhi_); // use corrected pt for jet kinematics
311  internalId_.jetM_ = jet->mass();
312  internalId_.nvtx_ = allvtx.size();
313  internalId_.rho_ = rho;
314 
315  float dRmin(1000);
316 
317  for (unsigned i = 0; i < jet->numberOfSourceCandidatePtrs(); ++i) {
318  reco::CandidatePtr pfJetConstituent = jet->sourceCandidatePtr(i);
319 
320  const reco::Candidate* icand = pfJetConstituent.get();
321  const pat::PackedCandidate* lPack = dynamic_cast<const pat::PackedCandidate*>(icand);
322  const reco::PFCandidate* lPF = dynamic_cast<const reco::PFCandidate*>(icand);
323  bool isPacked = true;
324  if (lPack == nullptr) {
325  isPacked = false;
326  }
327  float candPuppiWeight = 1.0;
328  if (usePuppi && isPacked)
329  candPuppiWeight = lPack->puppiWeight();
330  float candPt = (icand->pt()) * candPuppiWeight;
331  float candPtFrac = candPt / jetPt;
332  float candDr = reco::deltaR(*icand, *jet);
333  float candDeta = icand->eta() - jet->eta();
334  float candDphi = reco::deltaPhi(*icand, *jet);
335  float candPtDr = candPt * candDr;
336  size_t icone = std::lower_bound(&cones[0], &cones[ncones], candDr) - &cones[0];
337 
338  if (candDr < dRmin)
339  dRmin = candDr;
340 
341  // // all particles
342  if (lLead == nullptr || candPt > lLead->pt()) {
343  lSecond = lLead;
344  lLead = icand;
345  } else if ((lSecond == nullptr || candPt > lSecond->pt()) && (candPt < lLead->pt())) {
346  lSecond = icand;
347  }
348 
349  // // average shapes
350  internalId_.dRMean_ += candPtDr;
351  internalId_.dR2Mean_ += candPtDr * candPtDr;
352  covMatrix(0, 0) += candPt * candPt * candDeta * candDeta;
353  covMatrix(0, 1) += candPt * candPt * candDeta * candDphi;
354  covMatrix(1, 1) += candPt * candPt * candDphi * candDphi;
355  internalId_.ptD_ += candPt * candPt;
356  sumPt += candPt;
357  sumPt2 += candPt * candPt;
358 
359  // single most energetic candiates and jet shape profiles
360  frac.push_back(candPtFrac);
361 
362  if (icone < ncones) {
363  *coneFracs[icone] += candPt;
364  }
365 
366  // neutrals
367  if (abs(icand->pdgId()) == 130) {
368  if (lLeadNeut == nullptr || candPt > lLeadNeut->pt()) {
369  lLeadNeut = icand;
370  }
371  internalId_.dRMeanNeut_ += candPtDr;
372  fracNeut.push_back(candPtFrac);
373  if (icone < ncones) {
374  *coneNeutFracs[icone] += candPt;
375  }
376  internalId_.ptDNe_ += candPt * candPt;
377  sumPtNe += candPt;
378  multNeut += candPuppiWeight;
379  }
380  // EM candidated
381  if (icand->pdgId() == 22) {
382  if (lLeadEm == nullptr || candPt > lLeadEm->pt()) {
383  lLeadEm = icand;
384  }
385  internalId_.dRMeanEm_ += candPtDr;
386  fracEm.push_back(candPtFrac);
387  if (icone < ncones) {
388  *coneEmFracs[icone] += candPt;
389  }
390  internalId_.ptDNe_ += candPt * candPt;
391  sumPtNe += candPt;
392  multNeut += candPuppiWeight;
393  }
394  if ((abs(icand->pdgId()) == 1) || (abs(icand->pdgId()) == 2))
395  multNeut += candPuppiWeight;
396 
397  // Charged particles
398  if (icand->charge() != 0) {
399  if (lLeadCh == nullptr || candPt > lLeadCh->pt()) {
400  lLeadCh = icand;
401 
402  const reco::Track* pfTrk = icand->bestTrack();
403  if (lPF && std::abs(icand->pdgId()) == 13 && pfTrk == nullptr) {
404  reco::MuonRef lmuRef = lPF->muonRef();
405  if (lmuRef.isNonnull()) {
406  const reco::Muon& lmu = *lmuRef.get();
407  pfTrk = lmu.bestTrack();
408  edm::LogWarning("BadMuon")
409  << "Found a PFCandidate muon without a trackRef: falling back to Muon::bestTrack ";
410  }
411  }
412  if (pfTrk == nullptr) { //protection against empty pointers for the miniAOD case
413  //To handle the electron case
414  if (isPacked) {
415  internalId_.d0_ = std::abs(lPack->dxy(vtx->position()));
416  internalId_.dZ_ = std::abs(lPack->dz(vtx->position()));
417  } else if (lPF != nullptr) {
418  pfTrk = (lPF->trackRef().get() == nullptr) ? lPF->gsfTrackRef().get() : lPF->trackRef().get();
419  internalId_.d0_ = std::abs(pfTrk->dxy(vtx->position()));
420  internalId_.dZ_ = std::abs(pfTrk->dz(vtx->position()));
421  }
422  } else {
423  internalId_.d0_ = std::abs(pfTrk->dxy(vtx->position()));
424  internalId_.dZ_ = std::abs(pfTrk->dz(vtx->position()));
425  }
426  }
427  internalId_.dRMeanCh_ += candPtDr;
428  internalId_.ptDCh_ += candPt * candPt;
429  fracCh.push_back(candPtFrac);
430  if (icone < ncones) {
431  *coneChFracs[icone] += candPt;
432  }
433  sumPtCh += candPt;
434  }
435  // // beta and betastar
436  if (icand->charge() != 0) {
437  if (!isPacked) {
438  if (lPF->trackRef().isNonnull()) {
439  float tkpt = candPt;
440  sumTkPt += tkpt;
441  // 'classic' beta definition based on track-vertex association
442  bool inVtx0 = vtx->trackWeight(lPF->trackRef()) > 0;
443 
444  bool inAnyOther = false;
445  // alternative beta definition based on track-vertex distance of closest approach
446  double dZ0 = std::abs(lPF->trackRef()->dz(vtx->position()));
447  double dZ = dZ0;
448  for (reco::VertexCollection::const_iterator vi = allvtx.begin(); vi != allvtx.end(); ++vi) {
449  const reco::Vertex& iv = *vi;
450  if (iv.isFake() || iv.ndof() < 4) {
451  continue;
452  }
453  // the primary vertex may have been copied by the user: check identity by position
454  bool isVtx0 = (iv.position() - vtx->position()).r() < 0.02;
455  // 'classic' beta definition: check if the track is associated with
456  // any vertex other than the primary one
457  if (!isVtx0 && !inAnyOther) {
458  inAnyOther = vtx->trackWeight(lPF->trackRef()) <= 0;
459  }
460  // alternative beta: find closest vertex to the track
461  dZ = std::min(dZ, std::abs(lPF->trackRef()->dz(iv.position())));
462  }
463  // classic beta/betaStar
464  if (inVtx0 && !inAnyOther) {
465  internalId_.betaClassic_ += tkpt;
466  } else if (!inVtx0 && inAnyOther) {
468  }
469  // alternative beta/betaStar
470  if (dZ0 < 0.2) {
471  internalId_.beta_ += tkpt;
472  } else if (dZ < 0.2) {
473  internalId_.betaStar_ += tkpt;
474  }
475  }
476  } else {
477  float tkpt = candPt;
478  sumTkPt += tkpt;
479  bool inVtx0 = false;
480  bool inVtxOther = false;
481  double dZ0 = 9999.;
482  double dZ_tmp = 9999.;
483  for (unsigned vtx_i = 0; vtx_i < allvtx.size(); vtx_i++) {
484  auto iv = allvtx[vtx_i];
485 
486  if (iv.isFake())
487  continue;
488 
489  // Match to vertex in case of copy as above
490  bool isVtx0 = (iv.position() - vtx->position()).r() < 0.02;
491 
492  if (isVtx0) {
493  if (lPack->fromPV(vtx_i) == pat::PackedCandidate::PVUsedInFit)
494  inVtx0 = true;
495  if (lPack->fromPV(vtx_i) == 0)
496  inVtxOther = true;
497  dZ0 = lPack->dz(iv.position());
498  }
499 
500  if (fabs(lPack->dz(iv.position())) < fabs(dZ_tmp)) {
501  dZ_tmp = lPack->dz(iv.position());
502  }
503  }
504  if (inVtx0) {
505  internalId_.betaClassic_ += tkpt;
506  } else if (inVtxOther) {
508  }
509  if (fabs(dZ0) < 0.2) {
510  internalId_.beta_ += tkpt;
511  } else if (fabs(dZ_tmp) < 0.2) {
512  internalId_.betaStar_ += tkpt;
513  }
514  }
515  }
516 
517  // trailing candidate
518  if (lTrail == nullptr || candPt < lTrail->pt()) {
519  lTrail = icand;
520  }
521  }
522 
523  // // Finalize all variables
524  assert(!(lLead == nullptr));
525 
526  if (lSecond == nullptr) {
527  lSecond = lTrail;
528  }
529  if (lLeadNeut == nullptr) {
530  lLeadNeut = lTrail;
531  }
532  if (lLeadEm == nullptr) {
533  lLeadEm = lTrail;
534  }
535  if (lLeadCh == nullptr) {
536  lLeadCh = lTrail;
537  }
538 
539  if (patjet != nullptr) { // to enable running on MiniAOD slimmedJets
542  internalId_.chgEMfrac_ = patjet->chargedEmEnergy() / jet->energy();
543  internalId_.neuEMfrac_ = patjet->neutralEmEnergy() / jet->energy();
544  internalId_.chgHadrfrac_ = patjet->chargedHadronEnergy() / jet->energy();
545  internalId_.neuHadrfrac_ = patjet->neutralHadronEnergy() / jet->energy();
546  if (usePuppi)
547  internalId_.nNeutrals_ = multNeut;
548  } else {
551  internalId_.chgEMfrac_ = pfjet->chargedEmEnergy() / jet->energy();
552  internalId_.neuEMfrac_ = pfjet->neutralEmEnergy() / jet->energy();
553  internalId_.chgHadrfrac_ = pfjet->chargedHadronEnergy() / jet->energy();
554  internalId_.neuHadrfrac_ = pfjet->neutralHadronEnergy() / jet->energy();
555  }
556  internalId_.nParticles_ = jet->nConstituents();
557 
559  float sumW2(0.0);
560  float sum_deta(0.0), sum_dphi(0.0);
561  float ave_deta(0.0), ave_dphi(0.0);
562  for (size_t j = 0; j < jet->numberOfDaughters(); j++) {
563  const auto& part = jet->daughterPtr(j);
564  if (!(part.isAvailable() && part.isNonnull())) {
565  continue;
566  }
567 
568  float partPuppiWeight = 1.0;
569  if (usePuppi) {
570  const pat::PackedCandidate* partpack = dynamic_cast<const pat::PackedCandidate*>(part.get());
571  if (partpack != nullptr)
572  partPuppiWeight = partpack->puppiWeight();
573  }
574 
575  float weight = (part->pt()) * partPuppiWeight;
576  float weight2 = weight * weight;
577  sumW2 += weight2;
578  float deta = part->eta() - jet->eta();
579  float dphi = reco::deltaPhi(*part, *jet);
580  sum_deta += deta * weight2;
581  sum_dphi += dphi * weight2;
582  if (sumW2 > 0) {
583  ave_deta = sum_deta / sumW2;
584  ave_dphi = sum_dphi / sumW2;
585  }
586  }
587 
588  float ddetaR_sum(0.0), ddphiR_sum(0.0), pull_tmp(0.0);
589  for (size_t i = 0; i < jet->numberOfDaughters(); i++) {
590  const auto& part = jet->daughterPtr(i);
591  if (!(part.isAvailable() && part.isNonnull())) {
592  continue;
593  }
594 
595  float partPuppiWeight = 1.0;
596  if (usePuppi) {
597  const pat::PackedCandidate* partpack = dynamic_cast<const pat::PackedCandidate*>(part.get());
598  if (partpack != nullptr)
599  partPuppiWeight = partpack->puppiWeight();
600  }
601 
602  float weight = partPuppiWeight * (part->pt()) * partPuppiWeight * (part->pt());
603  float deta = part->eta() - jet->eta();
604  float dphi = reco::deltaPhi(*part, *jet);
605  float ddeta, ddphi, ddR;
606  ddeta = deta - ave_deta;
607  ddphi = dphi - ave_dphi;
608  ddR = sqrt(ddeta * ddeta + ddphi * ddphi);
609  ddetaR_sum += ddR * ddeta * weight;
610  ddphiR_sum += ddR * ddphi * weight;
611  }
612  if (sumW2 > 0) {
613  float ddetaR_ave = ddetaR_sum / sumW2;
614  float ddphiR_ave = ddphiR_sum / sumW2;
615  pull_tmp = sqrt(ddetaR_ave * ddetaR_ave + ddphiR_ave * ddphiR_ave);
616  }
617  internalId_.pull_ = pull_tmp;
619 
625 
626  std::sort(frac.begin(), frac.end(), std::greater<float>());
627  std::sort(fracCh.begin(), fracCh.end(), std::greater<float>());
628  std::sort(fracEm.begin(), fracEm.end(), std::greater<float>());
629  std::sort(fracNeut.begin(), fracNeut.end(), std::greater<float>());
631  assign(
633  assign(
635  assign(fracNeut,
640 
641  covMatrix(0, 0) /= sumPt2;
642  covMatrix(0, 1) /= sumPt2;
643  covMatrix(1, 1) /= sumPt2;
644  covMatrix(1, 0) = covMatrix(0, 1);
645  internalId_.etaW_ = sqrt(covMatrix(0, 0));
646  internalId_.phiW_ = sqrt(covMatrix(1, 1));
648  TVectorD eigVals(2);
649  eigVals = TMatrixDSymEigen(covMatrix).GetEigenValues();
650  internalId_.majW_ = sqrt(std::abs(eigVals(0)));
651  internalId_.minW_ = sqrt(std::abs(eigVals(1)));
654  }
655 
657  if (lSecond == nullptr) {
658  internalId_.dRLead2nd_ = reco::deltaR(*jet, *lSecond);
659  }
664  internalId_.dR2Mean_ /= sumPt2;
665 
666  for (size_t ic = 0; ic < ncones; ++ic) {
667  *coneFracs[ic] /= jetPt;
668  *coneEmFracs[ic] /= jetPt;
669  *coneNeutFracs[ic] /= jetPt;
670  *coneChFracs[ic] /= jetPt;
671  }
672  //http://jets.physics.harvard.edu/qvg/
673  double ptMean = sumPt / internalId_.nParticles_;
674  double ptRMS = 0;
675  for (unsigned int i0 = 0; i0 < frac.size(); i0++) {
676  ptRMS += (frac[i0] - ptMean) * (frac[i0] - ptMean);
677  }
678  ptRMS /= internalId_.nParticles_;
679  ptRMS = sqrt(ptRMS);
680 
681  internalId_.ptMean_ = ptMean;
682  internalId_.ptRMS_ = ptRMS / jetPt;
688  internalId_.sumChPt_ = sumPtCh;
689  internalId_.sumNePt_ = sumPtNe;
690 
691  internalId_.jetR_ = lLead->pt() / sumPt;
692  internalId_.jetRchg_ = lLeadCh->pt() / sumPt;
693  internalId_.dRMatch_ = dRmin;
694 
695  if (sumTkPt != 0.) {
696  internalId_.beta_ /= sumTkPt;
697  internalId_.betaStar_ /= sumTkPt;
698  internalId_.betaClassic_ /= sumTkPt;
699  internalId_.betaStarClassic_ /= sumTkPt;
700  } else {
703  }
704 
705  if (cache_->runMvas()) {
706  runMva();
707  }
708 
710 }
711 
712 // ------------------------------------------------------------------------------------------
714  std::stringstream out;
715  for (variables_list_t::const_iterator it = variables_.begin(); it != variables_.end(); ++it) {
716  out << std::setw(15) << it->first << std::setw(3) << "=" << std::setw(5) << *it->second.first << " ("
717  << std::setw(5) << it->second.second << ")" << std::endl;
718  }
719  return out.str();
720 }
721 
722 // ------------------------------------------------------------------------------------------
724  internalId_.idFlag_ = 0;
725  for (variables_list_t::iterator it = variables_.begin(); it != variables_.end(); ++it) {
726  *it->second.first = it->second.second;
727  }
728 }
729 
730 // ------------------------------------------------------------------------------------------
731 #define INIT_VARIABLE(NAME, TMVANAME, VAL) \
732  internalId_.NAME##_ = VAL; \
733  variables_[#NAME] = std::make_pair(&internalId_.NAME##_, VAL);
734 
735 // ------------------------------------------------------------------------------------------
737  internalId_.idFlag_ = 0;
738  INIT_VARIABLE(mva, "", -100.);
739  //INIT_VARIABLE(jetPt , "jspt_1", 0.);
740  //INIT_VARIABLE(jetEta , "jseta_1", large_val);
741  INIT_VARIABLE(jetPt, "", 0.);
743  INIT_VARIABLE(jetPhi, "jsphi_1", large_val);
744  INIT_VARIABLE(jetM, "jm_1", 0.);
745 
746  INIT_VARIABLE(nCharged, "", 0.);
747  INIT_VARIABLE(nNeutrals, "", 0.);
748 
749  INIT_VARIABLE(chgEMfrac, "", 0.);
750  INIT_VARIABLE(neuEMfrac, "", 0.);
751  INIT_VARIABLE(chgHadrfrac, "", 0.);
752  INIT_VARIABLE(neuHadrfrac, "", 0.);
753 
754  INIT_VARIABLE(d0, "jd0_1", -1000.);
755  INIT_VARIABLE(dZ, "jdZ_1", -1000.);
756  //INIT_VARIABLE(nParticles , "npart_1" , 0.);
757  INIT_VARIABLE(nParticles, "", 0.);
758 
759  INIT_VARIABLE(leadPt, "lpt_1", 0.);
760  INIT_VARIABLE(leadEta, "leta_1", large_val);
761  INIT_VARIABLE(leadPhi, "lphi_1", large_val);
762  INIT_VARIABLE(secondPt, "spt_1", 0.);
763  INIT_VARIABLE(secondEta, "seta_1", large_val);
764  INIT_VARIABLE(secondPhi, "sphi_1", large_val);
765  INIT_VARIABLE(leadNeutPt, "lnept_1", 0.);
766  INIT_VARIABLE(leadNeutEta, "lneeta_1", large_val);
767  INIT_VARIABLE(leadNeutPhi, "lnephi_1", large_val);
768  INIT_VARIABLE(leadEmPt, "lempt_1", 0.);
769  INIT_VARIABLE(leadEmEta, "lemeta_1", large_val);
770  INIT_VARIABLE(leadEmPhi, "lemphi_1", large_val);
771  INIT_VARIABLE(leadChPt, "lchpt_1", 0.);
772  INIT_VARIABLE(leadChEta, "lcheta_1", large_val);
773  INIT_VARIABLE(leadChPhi, "lchphi_1", large_val);
774  INIT_VARIABLE(leadFrac, "lLfr_1", 0.);
775 
776  INIT_VARIABLE(dRLeadCent, "drlc_1", 0.);
777  INIT_VARIABLE(dRLead2nd, "drls_1", 0.);
778  INIT_VARIABLE(dRMean, "drm_1", 0.);
779  INIT_VARIABLE(dRMean, "", 0.);
780  INIT_VARIABLE(pull, "", 0.);
781  INIT_VARIABLE(dRMeanNeut, "drmne_1", 0.);
782  INIT_VARIABLE(dRMeanEm, "drem_1", 0.);
783  INIT_VARIABLE(dRMeanCh, "drch_1", 0.);
784  INIT_VARIABLE(dR2Mean, "", 0.);
785 
786  INIT_VARIABLE(ptD, "", 0.);
787  INIT_VARIABLE(ptMean, "", 0.);
788  INIT_VARIABLE(ptRMS, "", 0.);
789  INIT_VARIABLE(pt2A, "", 0.);
790  INIT_VARIABLE(ptDCh, "", 0.);
791  INIT_VARIABLE(ptDNe, "", 0.);
792  INIT_VARIABLE(sumPt, "", 0.);
793  INIT_VARIABLE(sumChPt, "", 0.);
794  INIT_VARIABLE(sumNePt, "", 0.);
795 
796  INIT_VARIABLE(secondFrac, "", 0.);
797  INIT_VARIABLE(thirdFrac, "", 0.);
798  INIT_VARIABLE(fourthFrac, "", 0.);
799 
800  INIT_VARIABLE(leadChFrac, "", 0.);
801  INIT_VARIABLE(secondChFrac, "", 0.);
802  INIT_VARIABLE(thirdChFrac, "", 0.);
803  INIT_VARIABLE(fourthChFrac, "", 0.);
804 
805  INIT_VARIABLE(leadNeutFrac, "", 0.);
806  INIT_VARIABLE(secondNeutFrac, "", 0.);
807  INIT_VARIABLE(thirdNeutFrac, "", 0.);
808  INIT_VARIABLE(fourthNeutFrac, "", 0.);
809 
810  INIT_VARIABLE(leadEmFrac, "", 0.);
811  INIT_VARIABLE(secondEmFrac, "", 0.);
812  INIT_VARIABLE(thirdEmFrac, "", 0.);
813  INIT_VARIABLE(fourthEmFrac, "", 0.);
814 
815  INIT_VARIABLE(jetW, "", 1.);
816  INIT_VARIABLE(etaW, "", 1.);
817  INIT_VARIABLE(phiW, "", 1.);
818 
819  INIT_VARIABLE(majW, "", 1.);
820  INIT_VARIABLE(minW, "", 1.);
821 
822  INIT_VARIABLE(frac01, "", 0.);
823  INIT_VARIABLE(frac02, "", 0.);
824  INIT_VARIABLE(frac03, "", 0.);
825  INIT_VARIABLE(frac04, "", 0.);
826  INIT_VARIABLE(frac05, "", 0.);
827  INIT_VARIABLE(frac06, "", 0.);
828  INIT_VARIABLE(frac07, "", 0.);
829 
830  INIT_VARIABLE(chFrac01, "", 0.);
831  INIT_VARIABLE(chFrac02, "", 0.);
832  INIT_VARIABLE(chFrac03, "", 0.);
833  INIT_VARIABLE(chFrac04, "", 0.);
834  INIT_VARIABLE(chFrac05, "", 0.);
835  INIT_VARIABLE(chFrac06, "", 0.);
836  INIT_VARIABLE(chFrac07, "", 0.);
837 
838  INIT_VARIABLE(neutFrac01, "", 0.);
839  INIT_VARIABLE(neutFrac02, "", 0.);
840  INIT_VARIABLE(neutFrac03, "", 0.);
841  INIT_VARIABLE(neutFrac04, "", 0.);
842  INIT_VARIABLE(neutFrac05, "", 0.);
843  INIT_VARIABLE(neutFrac06, "", 0.);
844  INIT_VARIABLE(neutFrac07, "", 0.);
845 
846  INIT_VARIABLE(emFrac01, "", 0.);
847  INIT_VARIABLE(emFrac02, "", 0.);
848  INIT_VARIABLE(emFrac03, "", 0.);
849  INIT_VARIABLE(emFrac04, "", 0.);
850  INIT_VARIABLE(emFrac05, "", 0.);
851  INIT_VARIABLE(emFrac06, "", 0.);
852  INIT_VARIABLE(emFrac07, "", 0.);
853 
854  INIT_VARIABLE(beta, "", 0.);
855  INIT_VARIABLE(betaStar, "", 0.);
856  INIT_VARIABLE(betaClassic, "", 0.);
857  INIT_VARIABLE(betaStarClassic, "", 0.);
858 
859  INIT_VARIABLE(nvtx, "", 0.);
860  INIT_VARIABLE(rho, "", 0.);
861  INIT_VARIABLE(nTrueInt, "", 0.);
862 
863  INIT_VARIABLE(jetR, "", 0.);
864  INIT_VARIABLE(jetRchg, "", 0.);
865  INIT_VARIABLE(dRMatch, "", 0.);
866 }
867 
868 #undef INIT_VARIABLE
PileupJetIdentifier::chFrac03_
float chFrac03_
Definition: PileupJetIdentifier.h:165
StoredPileupJetIdentifier::dR2Mean_
float dR2Mean_
Definition: PileupJetIdentifier.h:40
reco::PFCandidate::trackRef
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:408
reco::btau::jetPt
Definition: TaggingVariable.h:32
PileupJetIdAlgo::resetVariables
void resetVariables()
Definition: PileupJetIdAlgo.cc:723
StoredPileupJetIdentifier::frac05_
float frac05_
Definition: PileupJetIdentifier.h:53
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
PileupJetIdentifier::jetW_
float jetW_
Definition: PileupJetIdentifier.h:156
PileupJetIdentifier::dRMeanEm_
float dRMeanEm_
Definition: PileupJetIdentifier.h:124
PileupJetIdentifier::thirdNeutFrac_
float thirdNeutFrac_
Definition: PileupJetIdentifier.h:148
PileupJetIdentifier::leadNeutPt_
float leadNeutPt_
Definition: PileupJetIdentifier.h:111
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
PileupJetIdentifier::secondEta_
float secondEta_
Definition: PileupJetIdentifier.h:109
PileupJetIdentifier::d0_
float d0_
Definition: PileupJetIdentifier.h:104
PileupJetIdAlgo::USER
Definition: PileupJetIdAlgo.h:24
PileupJetIdAlgo::initVariables
void initVariables()
Definition: PileupJetIdAlgo.cc:736
funct::false
false
Definition: Factorize.h:34
PileupJetIdentifier::sumChPt_
float sumChPt_
Definition: PileupJetIdentifier.h:133
PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas
bool runMvas() const
Definition: PileupJetIdAlgo.h:64
jets_cff.ptD
ptD
Definition: jets_cff.py:139
StoredPileupJetIdentifier::jetR_
float jetR_
Definition: PileupJetIdentifier.h:64
PileupJetIdentifier::chFrac04_
float chFrac04_
Definition: PileupJetIdentifier.h:166
PileupJetIdentifier::idFlag_
int idFlag_
Definition: PileupJetIdentifier.h:91
PFCandidate.h
PileupJetIdAlgo.h
BeamSpotFakeParameters_cfi.betaStar
betaStar
Definition: BeamSpotFakeParameters_cfi.py:19
PileupJetIdAlgo::dumpVariables
std::string dumpVariables() const
Definition: PileupJetIdAlgo.cc:713
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
min
T min(T a, T b)
Definition: MathUtil.h:58
PileupJetIdentifier::emFrac02_
float emFrac02_
Definition: PileupJetIdentifier.h:180
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
PileupJetIdentifier::kTight
Definition: PileupJetIdentifier.h:87
reco::Candidate::eta
virtual double eta() const =0
momentum pseudorapidity
PileupJetIdentifier::leadPhi_
float leadPhi_
Definition: PileupJetIdentifier.h:107
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
mps_merge.weight
weight
Definition: mps_merge.py:88
PileupJetIdentifier::ptDNe_
float ptDNe_
Definition: PileupJetIdentifier.h:131
GBRForestTools.h
PileupJetIdentifier::pt2A_
float pt2A_
Definition: PileupJetIdentifier.h:129
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PileupJetIDParams_cfi.trainings
trainings
Definition: PileupJetIDParams_cfi.py:12
cropTnPTrees.frac
frac
Definition: cropTnPTrees.py:18
PileupJetIdentifier::emFrac01_
float emFrac01_
Definition: PileupJetIdentifier.h:179
assign
void assign(const std::vector< float > &vec, float &a, float &b, float &c, float &d)
Definition: PileupJetIdAlgo.cc:131
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
hltPUIdAlgo_cff.tmvaSpectators
tmvaSpectators
Definition: hltPUIdAlgo_cff.py:52
HLT_2018_cff.nCharged
nCharged
Definition: HLT_2018_cff.py:31800
ZElectronSkim_cff.rho
rho
Definition: ZElectronSkim_cff.py:38
PFJet.h
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
PileupJetIdentifier::leadEmPt_
float leadEmPt_
Definition: PileupJetIdentifier.h:114
METSignificanceParams_cfi.dRMatch
dRMatch
Definition: METSignificanceParams_cfi.py:9
PileupJetIdentifier::mva_
float mva_
Definition: PileupJetIdentifier.h:94
StoredPileupJetIdentifier::rho_
float rho_
Definition: PileupJetIdentifier.h:63
PileupJetIdentifier::fourthEmFrac_
float fourthEmFrac_
Definition: PileupJetIdentifier.h:154
PileupJetIdentifier::sumPt_
float sumPt_
Definition: PileupJetIdentifier.h:132
PileupJetIdentifier::ptDCh_
float ptDCh_
Definition: PileupJetIdentifier.h:130
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
StoredPileupJetIdentifier::dRMatch_
float dRMatch_
Definition: PileupJetIdentifier.h:66
reco::Candidate::pt
virtual double pt() const =0
transverse momentum
cms::cuda::assert
assert(be >=bs)
PileupJetIdentifier::jetM_
float jetM_
Definition: PileupJetIdentifier.h:97
PileupJetIdentifier::thirdFrac_
float thirdFrac_
Definition: PileupJetIdentifier.h:138
Jet.h
LHEJetFilter_cfi.jetR
jetR
Definition: LHEJetFilter_cfi.py:5
reco::Vertex::position
const Point & position() const
position
Definition: Vertex.h:114
createGBRForest
std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightsFile)
Definition: GBRForestTools.cc:244
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMax
std::vector< double > const & jEtaMax() const
Definition: PileupJetIdAlgo.h:67
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
PileupJetIdAlgo::AlgoGBRForestsAndConstants::AlgoGBRForestsAndConstants
AlgoGBRForestsAndConstants(edm::ParameterSet const &, bool runMvas)
Definition: PileupJetIdAlgo.cc:21
StoredPileupJetIdentifier::dRMean_
float dRMean_
Definition: PileupJetIdentifier.h:44
findQualityFiles.v
v
Definition: findQualityFiles.py:179
beam_dqm_sourceclient-live_cfg.mva
mva
Definition: beam_dqm_sourceclient-live_cfg.py:119
PileupJetIdentifier::chFrac07_
float chFrac07_
Definition: PileupJetIdentifier.h:169
PileupJetIdentifier::chgHadrfrac_
float chgHadrfrac_
Definition: PileupJetIdentifier.h:101
StoredPileupJetIdentifier::dZ_
float dZ_
Definition: PileupJetIdentifier.h:37
PileupJetIdentifier::fourthChFrac_
float fourthChFrac_
Definition: PileupJetIdentifier.h:144
StoredPileupJetIdentifier::minW_
float minW_
Definition: PileupJetIdentifier.h:47
PileupJetIdentifier::neuHadrfrac_
float neuHadrfrac_
Definition: PileupJetIdentifier.h:102
PileupJetIdentifier::leadChEta_
float leadChEta_
Definition: PileupJetIdentifier.h:118
PileupJetIdentifier::thirdEmFrac_
float thirdEmFrac_
Definition: PileupJetIdentifier.h:153
large_val
const float large_val
Definition: PileupJetIdAlgo.cc:17
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaVariables
std::vector< std::string > const & tmvaVariables() const
Definition: PileupJetIdAlgo.h:70
reco::Muon
Definition: Muon.h:27
edm::Ref< MuonCollection >
FileInPath.h
TtFullHadEvtBuilder_cfi.sumPt
sumPt
Definition: TtFullHadEvtBuilder_cfi.py:38
pat::PackedCandidate::PVUsedInFit
Definition: PackedCandidate.h:703
StoredPileupJetIdentifier::jetPt_
float jetPt_
Definition: PileupJetIdentifier.h:32
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
deltaR.h
reco::PFJet::chargedHadronEnergy
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: PFJet.h:95
PileupJetIdAlgo::getJetIdKey
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
Definition: PileupJetIdAlgo.cc:189
PileupJetIdentifier::chFrac05_
float chFrac05_
Definition: PileupJetIdentifier.h:167
PileupJetIdAlgo::set
void set(const PileupJetIdentifier &)
Definition: PileupJetIdAlgo.cc:146
edm::FileInPath
Definition: FileInPath.h:64
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
reco::PFCandidate::muonRef
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:421
part
part
Definition: HCALResponse.h:20
PileupJetIdentifier::emFrac05_
float emFrac05_
Definition: PileupJetIdentifier.h:183
PileupJetIdentifier::neutFrac04_
float neutFrac04_
Definition: PileupJetIdentifier.h:174
reco::Vertex::isFake
bool isFake() const
Definition: Vertex.h:76
PileupJetIdAlgo::cache_
AlgoGBRForestsAndConstants const * cache_
Definition: PileupJetIdAlgo.h:106
pat::Jet::chargedHadronEnergy
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: Jet.h:696
PileupJetIdentifier::emFrac06_
float emFrac06_
Definition: PileupJetIdentifier.h:184
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
vars
vars
Definition: DeepTauId.cc:163
DQM.reader
reader
Definition: DQM.py:105
reco::Candidate::charge
virtual int charge() const =0
electric charge
PVValHelper::eta
Definition: PVValidationHelpers.h:69
StoredPileupJetIdentifier::jetEta_
float jetEta_
Definition: PileupJetIdentifier.h:31
PileupJetIdentifier::leadNeutPhi_
float leadNeutPhi_
Definition: PileupJetIdentifier.h:113
reco::PFJet::chargedMultiplicity
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:152
PileupJetIdentifier::emFrac03_
float emFrac03_
Definition: PileupJetIdentifier.h:181
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
PileupJetIdentifier::phiW_
float phiW_
Definition: PileupJetIdentifier.h:158
PileupJetIdentifier::fourthFrac_
float fourthFrac_
Definition: PileupJetIdentifier.h:139
pat::Jet::neutralEmEnergy
float neutralEmEnergy() const
neutralEmEnergy
Definition: Jet.h:726
pat::PackedCandidate::dz
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
Definition: PackedCandidate.h:745
reco::Track
Definition: Track.h:27
PileupJetIdAlgo::computeCutIDflag
int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
Definition: PileupJetIdAlgo.cc:209
reco::PFJet::chargedEmEnergy
float chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:139
PileupJetIdentifier::fourthNeutFrac_
float fourthNeutFrac_
Definition: PileupJetIdentifier.h:149
PileupJetIdentifier::leadChFrac_
float leadChFrac_
Definition: PileupJetIdentifier.h:141
PileupJetIdentifier::dRMeanNeut_
float dRMeanNeut_
Definition: PileupJetIdentifier.h:123
StoredPileupJetIdentifier::frac02_
float frac02_
Definition: PileupJetIdentifier.h:50
reco::TrackBase::dz
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:602
PileupJetIdAlgo::computeIdVariables
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, bool usePuppi)
Definition: PileupJetIdAlgo.cc:251
PileupJetIdAlgo::computeIDflag
int computeIDflag(float mva, float jetPt, float jetEta)
Definition: PileupJetIdAlgo.cc:227
PileupJetIdentifier::secondEmFrac_
float secondEmFrac_
Definition: PileupJetIdentifier.h:152
b
double b
Definition: hdecay.h:118
pat::Jet::chargedMultiplicity
int chargedMultiplicity() const
chargedMultiplicity
Definition: Jet.h:746
StoredPileupJetIdentifier::pull_
float pull_
Definition: PileupJetIdentifier.h:70
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
utilities.cache
def cache(function)
Definition: utilities.py:3
PileupJetIdentifier::dRLead2nd_
float dRLead2nd_
Definition: PileupJetIdentifier.h:122
pat::PackedCandidate::fromPV
const PVAssoc fromPV(size_t ipv=0) const
Definition: PackedCandidate.h:704
StoredPileupJetIdentifier::nParticles_
float nParticles_
Definition: PileupJetIdentifier.h:38
DDAxes::rho
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
PileupJetIdentifier::secondNeutFrac_
float secondNeutFrac_
Definition: PileupJetIdentifier.h:147
PileupJetIdentifier::neutFrac03_
float neutFrac03_
Definition: PileupJetIdentifier.h:173
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
pat::Jet::neutralHadronEnergy
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: Jet.h:706
edm::LogWarning
Definition: MessageLogger.h:141
PileupJetIdentifier::secondChFrac_
float secondChFrac_
Definition: PileupJetIdentifier.h:142
reco::btau::jetPhi
Definition: TaggingVariable.h:36
PileupJetIdentifier::secondPt_
float secondPt_
Definition: PileupJetIdentifier.h:108
StoredPileupJetIdentifier::nvtx_
float nvtx_
Definition: PileupJetIdentifier.h:69
pat::Jet::chargedEmEnergy
float chargedEmEnergy() const
chargedEmEnergy
Definition: Jet.h:716
PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMin
std::vector< double > const & jEtaMin() const
Definition: PileupJetIdAlgo.h:66
reco::btau::jetEta
Definition: TaggingVariable.h:34
StoredPileupJetIdentifier::betaStar_
float betaStar_
Definition: PileupJetIdentifier.h:58
StoredPileupJetIdentifier::frac04_
float frac04_
Definition: PileupJetIdentifier.h:52
edm::ParameterSet
Definition: ParameterSet.h:36
PileupJetIdentifier::etaW_
float etaW_
Definition: PileupJetIdentifier.h:157
reco::PFCandidate::gsfTrackRef
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:440
a
double a
Definition: hdecay.h:119
pat::PackedCandidate::puppiWeight
float puppiWeight() const
Definition: PackedCandidate.cc:380
PVValHelper::phi
Definition: PVValidationHelpers.h:68
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PileupJetIdentifier::thirdChFrac_
float thirdChFrac_
Definition: PileupJetIdentifier.h:143
pat::PackedCandidate
Definition: PackedCandidate.h:22
PileupJetIdAlgo::internalId_
PileupJetIdentifier internalId_
Definition: PileupJetIdAlgo.h:104
StoredPileupJetIdentifier::nNeutrals_
float nNeutrals_
Definition: PileupJetIdentifier.h:35
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
PileupJetIdentifier::leadEta_
float leadEta_
Definition: PileupJetIdentifier.h:106
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaBinnedWeights
bool etaBinnedWeights() const
Definition: PileupJetIdAlgo.h:63
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaReader
std::vector< std::unique_ptr< const GBRForest > > const & etaReader() const
Definition: PileupJetIdAlgo.h:61
PileupJetIdAlgo::computeMva
PileupJetIdentifier computeMva()
Definition: PileupJetIdAlgo.cc:245
PileupJetIdentifier::neutFrac02_
float neutFrac02_
Definition: PileupJetIdentifier.h:172
pat::Jet::neutralMultiplicity
int neutralMultiplicity() const
neutralMultiplicity
Definition: Jet.h:466
PileupJetIdentifier::leadFrac_
float leadFrac_
Definition: PileupJetIdentifier.h:136
PileupJetIdAlgo::runMva
void runMva()
Definition: PileupJetIdAlgo.cc:160
PileupJetIdentifier::neuEMfrac_
float neuEMfrac_
Definition: PileupJetIdentifier.h:100
PileupJetIdentifier::neutFrac06_
float neutFrac06_
Definition: PileupJetIdentifier.h:176
PileupJetIdentifier::leadNeutFrac_
float leadNeutFrac_
Definition: PileupJetIdentifier.h:146
PileupJetIdentifier
Definition: PileupJetIdentifier.h:74
PileupJetIdentifier::leadEmFrac_
float leadEmFrac_
Definition: PileupJetIdentifier.h:151
PileupJetIdAlgo::AlgoGBRForestsAndConstants::nEtaBins
int nEtaBins() const
Definition: PileupJetIdAlgo.h:65
StoredPileupJetIdentifier::frac03_
float frac03_
Definition: PileupJetIdentifier.h:51
PileupJetIdAlgo::AlgoGBRForestsAndConstants
Definition: PileupJetIdAlgo.h:56
PileupJetIdentifier::chgEMfrac_
float chgEMfrac_
Definition: PileupJetIdentifier.h:99
PileupJetIdAlgo::PileupJetIdAlgo
PileupJetIdAlgo(AlgoGBRForestsAndConstants const *cache)
Definition: PileupJetIdAlgo.cc:125
PileupJetIdentifier::secondFrac_
float secondFrac_
Definition: PileupJetIdentifier.h:137
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
PileupJetIdentifier::chFrac06_
float chFrac06_
Definition: PileupJetIdentifier.h:168
PileupJetIdentifier::dRMeanCh_
float dRMeanCh_
Definition: PileupJetIdentifier.h:125
PileupJetIdentifier::jetPhi_
float jetPhi_
Definition: PileupJetIdentifier.h:96
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
PileupJetIdAlgo::AlgoGBRForestsAndConstants::cutBased
bool cutBased() const
Definition: PileupJetIdAlgo.h:62
StoredPileupJetIdentifier::frac06_
float frac06_
Definition: PileupJetIdentifier.h:54
reco::Muon::bestTrack
const Track * bestTrack() const override
Definition: Muon.h:58
edm::Ptr< Candidate >
reco::Candidate
Definition: Candidate.h:27
alignCSCRings.r
r
Definition: alignCSCRings.py:93
PileupJetIdentifier::dRLeadCent_
float dRLeadCent_
Definition: PileupJetIdentifier.h:121
PileupJetIdentifier::leadEmEta_
float leadEmEta_
Definition: PileupJetIdentifier.h:115
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
PileupJetIdentifier::sumNePt_
float sumNePt_
Definition: PileupJetIdentifier.h:134
pat::PackedCandidate::dxy
virtual float dxy() const
dxy with respect to the PV ref
Definition: PackedCandidate.h:740
std
Definition: JetResolutionObject.h:76
StoredPileupJetIdentifier::jetRchg_
float jetRchg_
Definition: PileupJetIdentifier.h:65
StoredPileupJetIdentifier::betaClassic_
float betaClassic_
Definition: PileupJetIdentifier.h:59
PileupJetIdentifier::kLoose
Definition: PileupJetIdentifier.h:87
reco::Candidate::bestTrack
virtual const Track * bestTrack() const
Definition: Candidate.h:268
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
reco::PFJet::neutralHadronEnergy
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: PFJet.h:99
hltMVAJetPuId_cff.runMvas
runMvas
Definition: hltMVAJetPuId_cff.py:6
metsig::jet
Definition: SignAlgoResolutions.h:47
PileupJetIdentifier::chFrac01_
float chFrac01_
Definition: PileupJetIdentifier.h:163
reco::PFJet::neutralMultiplicity
int neutralMultiplicity() const
neutralMultiplicity
Definition: PFJet.h:154
PileupJetIdentifier::neutFrac01_
float neutFrac01_
Definition: PileupJetIdentifier.h:171
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
PileupJetIdentifier::secondPhi_
float secondPhi_
Definition: PileupJetIdentifier.h:110
PileupJetIdentifier::emFrac04_
float emFrac04_
Definition: PileupJetIdentifier.h:182
reco::PFJet::neutralEmEnergy
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:147
PileupJetIdentifier::chFrac02_
float chFrac02_
Definition: PileupJetIdentifier.h:164
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaEtaVariables
std::vector< std::vector< std::string > > const & tmvaEtaVariables() const
Definition: PileupJetIdAlgo.h:71
StoredPileupJetIdentifier::beta_
float beta_
Definition: PileupJetIdentifier.h:57
pat::Jet::correctedJet
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
reco::deltaR
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
PileupJetIdentifier::ptRMS_
float ptRMS_
Definition: PileupJetIdentifier.h:128
PileupJetIdentifier::leadPt_
float leadPt_
Definition: PileupJetIdentifier.h:105
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
StoredPileupJetIdentifier::frac07_
float frac07_
Definition: PileupJetIdentifier.h:55
PileupJetIdAlgo::getMVAval
float getMVAval(const std::vector< std::string > &, const std::unique_ptr< const GBRForest > &)
Definition: PileupJetIdAlgo.cc:150
jetMETDQMOfflineSource_cff.jec
jec
Definition: jetMETDQMOfflineSource_cff.py:27
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ztail.d
d
Definition: ztail.py:151
INIT_VARIABLE
#define INIT_VARIABLE(NAME, TMVANAME, VAL)
Definition: PileupJetIdAlgo.cc:731
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
StoredPileupJetIdentifier::betaStarClassic_
float betaStarClassic_
Definition: PileupJetIdentifier.h:60
PileupJetIdAlgo::variables_
variables_list_t variables_
Definition: PileupJetIdAlgo.h:105
PileupJetIdAlgo::~PileupJetIdAlgo
~PileupJetIdAlgo()
Definition: PileupJetIdAlgo.cc:128
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PileupJetIdentifier::emFrac07_
float emFrac07_
Definition: PileupJetIdentifier.h:185
PileupJetIdentifier::neutFrac05_
float neutFrac05_
Definition: PileupJetIdentifier.h:175
PileupJetIdentifier::leadNeutEta_
float leadNeutEta_
Definition: PileupJetIdentifier.h:112
PileupJetIdentifier::leadChPt_
float leadChPt_
Definition: PileupJetIdentifier.h:117
PileupJetIdentifier::leadEmPhi_
float leadEmPhi_
Definition: PileupJetIdentifier.h:116
PileupJetIdentifier::kMedium
Definition: PileupJetIdentifier.h:87
StoredPileupJetIdentifier::majW_
float majW_
Definition: PileupJetIdentifier.h:46
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:85
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
setPtEtaPhi
void setPtEtaPhi(const reco::Candidate &p, float &pt, float &eta, float &phi)
Definition: PileupJetIdAlgo.cc:139
reco::TrackBase::dxy
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:593
reco::Vertex::ndof
double ndof() const
Definition: Vertex.h:110
PileupJetIdentifier::neutFrac07_
float neutFrac07_
Definition: PileupJetIdentifier.h:177
PileupJetID_cfi.usePuppi
usePuppi
Definition: PileupJetID_cfi.py:32
PileupJetIdAlgo::AlgoGBRForestsAndConstants::mvacut
array_t const & mvacut() const
Definition: PileupJetIdAlgo.h:74
PileupJetIdentifier::ptMean_
float ptMean_
Definition: PileupJetIdentifier.h:127
StoredPileupJetIdentifier::frac01_
float frac01_
Definition: PileupJetIdentifier.h:49
PileupJetIdAlgo::AlgoGBRForestsAndConstants::reader
std::unique_ptr< const GBRForest > const & reader() const
Definition: PileupJetIdAlgo.h:60
weight
Definition: weight.py:1
reco::Vertex
Definition: Vertex.h:35
StoredPileupJetIdentifier::nCharged_
float nCharged_
Definition: PileupJetIdentifier.h:34
PileupJetIdentifier::leadChPhi_
float leadChPhi_
Definition: PileupJetIdentifier.h:119
StoredPileupJetIdentifier::ptD_
float ptD_
Definition: PileupJetIdentifier.h:62