CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PFRecoTauClusterVariables.cc
Go to the documentation of this file.
2 
3 namespace {
4  struct PFTau_traits {
5  typedef reco::PFTau Tau_t;
6  typedef const std::vector<reco::CandidatePtr>& Ret_t;
7  };
8  struct PATTau_traits {
9  typedef pat::Tau Tau_t;
10  typedef reco::CandidatePtrVector Ret_t;
11  };
12 
13  template <typename T>
14  typename T::Ret_t getGammas_T(const typename T::Tau_t& tau, bool signal) {
15  return typename T::Ret_t();
16  }
18  template <>
19  const std::vector<reco::CandidatePtr>& getGammas_T<PFTau_traits>(const reco::PFTau& tau, bool signal) {
20  if (signal) {
21  return tau.signalGammaCands();
22  }
23  return tau.isolationGammaCands();
24  }
25 
26  template <>
27  reco::CandidatePtrVector getGammas_T<PATTau_traits>(const pat::Tau& tau, bool signal) {
28  if (signal) {
29  return tau.signalGammaCands();
30  }
31  return tau.isolationGammaCands();
32  }
33 
35  bool isInside(float photon_pt, float deta, float dphi) {
36  constexpr double stripEtaAssociationDistance_0p95_p0 = 0.197077;
37  constexpr double stripEtaAssociationDistance_0p95_p1 = 0.658701;
38  constexpr double stripPhiAssociationDistance_0p95_p0 = 0.352476;
39  constexpr double stripPhiAssociationDistance_0p95_p1 = 0.707716;
40  if (photon_pt == 0) {
41  return false;
42  }
43  if ((dphi < 0.3 && dphi < std::max(0.05,
44  stripPhiAssociationDistance_0p95_p0 *
45  std::pow(photon_pt, -stripPhiAssociationDistance_0p95_p1))) &&
46  (deta < 0.15 && deta < std::max(0.05,
47  stripEtaAssociationDistance_0p95_p0 *
48  std::pow(photon_pt, -stripEtaAssociationDistance_0p95_p1)))) {
49  return true;
50  }
51  return false;
52  }
53 } // namespace
54 
55 namespace reco {
56  namespace tau {
58  float lead_track_chi2(const reco::PFTau& tau) {
59  float LeadingTracknormalizedChi2 = 0;
60  const reco::CandidatePtr& leadingCharged = tau.leadChargedHadrCand();
61  if (leadingCharged.isNonnull()) {
62  const reco::PFCandidate* pfcand = dynamic_cast<const reco::PFCandidate*>(leadingCharged.get());
63  if (pfcand != nullptr) {
64  reco::TrackRef tref = pfcand->trackRef();
65  if (tref.isNonnull()) {
66  LeadingTracknormalizedChi2 = tref->normalizedChi2();
67  }
68  } else {
69  const pat::PackedCandidate* patcand = dynamic_cast<const pat::PackedCandidate*>(leadingCharged.get());
70  if (patcand != nullptr && patcand->hasTrackDetails()) {
71  LeadingTracknormalizedChi2 = patcand->pseudoTrack().normalizedChi2();
72  }
73  }
74  }
75  return LeadingTracknormalizedChi2;
76  }
78  float eratio(const reco::PFTau& tau) {
79  float ecal_en_in_signal_pf_cands = 0;
80  float hcal_en_in_signal_pf_cands = 0;
81  for (const auto& signal_cand : tau.signalCands()) {
82  const reco::PFCandidate* signal_pfcand = dynamic_cast<const reco::PFCandidate*>(signal_cand.get());
83  if (signal_pfcand != nullptr) {
84  ecal_en_in_signal_pf_cands += signal_pfcand->ecalEnergy();
85  hcal_en_in_signal_pf_cands += signal_pfcand->hcalEnergy();
86  } else {
87  // TauReco@MiniAOD: individual ECAL and HCAL energies recovered from fractions
88  const pat::PackedCandidate* signal_pcand = dynamic_cast<const pat::PackedCandidate*>(signal_cand.get());
89  assert(signal_pcand); // Taus are built either from reco::PFCandidates or pat::PackedCandidates
90  float calo_en = signal_pcand->caloFraction() * signal_pcand->energy();
91  ecal_en_in_signal_pf_cands += calo_en * (1. - signal_pcand->hcalFraction());
92  hcal_en_in_signal_pf_cands += calo_en * signal_pcand->hcalFraction();
93  }
94  }
95  float total = ecal_en_in_signal_pf_cands + hcal_en_in_signal_pf_cands;
96  if (total == 0.) {
97  return -1.;
98  }
99  return ecal_en_in_signal_pf_cands / total;
100  }
101  float eratio(const pat::Tau& tau) {
102  float ecal_en_in_signal_cands = tau.ecalEnergy();
103  float hcal_en_in_signal_cands = tau.hcalEnergy();
104  float total = ecal_en_in_signal_cands + hcal_en_in_signal_cands;
105  if (total == 0.) {
106  return -1.;
107  }
108  return ecal_en_in_signal_cands / total;
109  }
112  template <typename T>
113  float pt_weighted_dx_T(const typename T::Tau_t& tau, int mode, int var, int decaymode) {
114  float sum_pt = 0.;
115  float sum_dx_pt = 0.;
116  float signalrad = std::max(0.05, std::min(0.1, 3. / std::max(1., tau.pt())));
117  int is3prong = (decaymode == 10);
118  const auto& cands = getGammas_T<T>(tau, mode < 2);
119  for (const auto& cand : cands) {
120  // only look at electrons/photons with pT > 0.5
121  if (cand->pt() < 0.5) {
122  continue;
123  }
124  float dr = reco::deltaR(cand->eta(), cand->phi(), tau.eta(), tau.phi());
125  float deta = std::abs(cand->eta() - tau.eta());
126  float dphi = std::abs(reco::deltaPhi(cand->phi(), tau.phi()));
127  float pt = cand->pt();
128  bool flag = isInside(pt, deta, dphi);
129  if (is3prong == 0) {
130  if (mode == 2 || (mode == 0 && dr < signalrad) || (mode == 1 && dr > signalrad)) {
131  sum_pt += pt;
132  if (var == 0)
133  sum_dx_pt += pt * dr;
134  else if (var == 1)
135  sum_dx_pt += pt * deta;
136  else if (var == 2)
137  sum_dx_pt += pt * dphi;
138  }
139  } else if (is3prong == 1) {
140  if ((mode == 2 && flag == false) || (mode == 1 && flag == true) || mode == 0) {
141  sum_pt += pt;
142  if (var == 0)
143  sum_dx_pt += pt * dr;
144  else if (var == 1)
145  sum_dx_pt += pt * deta;
146  else if (var == 2)
147  sum_dx_pt += pt * dphi;
148  }
149  }
150  }
151  if (sum_pt > 0.) {
152  return sum_dx_pt / sum_pt;
153  }
154  return 0.;
155  }
156  float pt_weighted_dx(const reco::PFTau& tau, int mode, int var, int decaymode) {
157  return pt_weighted_dx_T<PFTau_traits>(tau, mode, var, decaymode);
158  }
159  float pt_weighted_dx(const pat::Tau& tau, int mode, int var, int decaymode) {
160  return pt_weighted_dx_T<PATTau_traits>(tau, mode, var, decaymode);
161  }
163  unsigned int n_photons_total(const reco::PFTau& tau) {
164  unsigned int n_photons = 0;
165  for (auto& cand : tau.signalGammaCands()) {
166  if (cand->pt() > 0.5)
167  ++n_photons;
168  }
169  for (auto& cand : tau.isolationGammaCands()) {
170  if (cand->pt() > 0.5)
171  ++n_photons;
172  }
173  return n_photons;
174  }
175  unsigned int n_photons_total(const pat::Tau& tau) {
176  unsigned int n_photons = 0;
177  for (auto& cand : tau.signalGammaCands()) {
178  if (cand->pt() > 0.5)
179  ++n_photons;
180  }
181  for (auto& cand : tau.isolationGammaCands()) {
182  if (cand->pt() > 0.5)
183  ++n_photons;
184  }
185  return n_photons;
186  }
187 
188  bool fillIsoMVARun2Inputs(float* mvaInput,
189  const pat::Tau& tau,
190  int mvaOpt,
191  const std::string& nameCharged,
192  const std::string& nameNeutral,
193  const std::string& namePu,
194  const std::string& nameOutside,
195  const std::string& nameFootprint) {
196  int tauDecayMode = tau.decayMode();
197  const float mTau = 1.77682;
198 
199  if (((mvaOpt == kOldDMwoLT || mvaOpt == kOldDMwLT || mvaOpt == kDBoldDMwLT || mvaOpt == kPWoldDMwLT ||
200  mvaOpt == kDBoldDMwLTwGJ) &&
201  (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10)) ||
202  ((mvaOpt == kDBnewDMwLTwGJPhase2 || mvaOpt == kNewDMwoLT || mvaOpt == kNewDMwLT || mvaOpt == kDBnewDMwLT ||
203  mvaOpt == kPWnewDMwLT || mvaOpt == kDBnewDMwLTwGJ) &&
204  (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 ||
205  tauDecayMode == 10 || tauDecayMode == 11))) {
206  float chargedIsoPtSum = tau.tauID(nameCharged);
207  float neutralIsoPtSum = tau.tauID(nameNeutral);
208  float puCorrPtSum = tau.tauID(namePu);
209  float photonPtSumOutsideSignalCone = tau.tauID(nameOutside);
210  float footprintCorrection = tau.tauID(nameFootprint);
211 
212  float decayDistX = tau.flightLength().x();
213  float decayDistY = tau.flightLength().y();
214  float decayDistZ = tau.flightLength().z();
215  float decayDistMag = std::sqrt(decayDistX * decayDistX + decayDistY * decayDistY + decayDistZ * decayDistZ);
216 
217  // --- The following 5 variables differ slightly between AOD & MiniAOD
218  // because they are recomputed using packedCandidates saved in the tau
219  float nPhoton = reco::tau::n_photons_total(tau);
220  float ptWeightedDetaStrip = reco::tau::pt_weighted_deta_strip(tau, tauDecayMode);
221  float ptWeightedDphiStrip = reco::tau::pt_weighted_dphi_strip(tau, tauDecayMode);
222  float ptWeightedDrSignal = reco::tau::pt_weighted_dr_signal(tau, tauDecayMode);
223  float ptWeightedDrIsolation = reco::tau::pt_weighted_dr_iso(tau, tauDecayMode);
224  // ---
225  float leadingTrackChi2 = tau.leadingTrackNormChi2();
226  float eRatio = reco::tau::eratio(tau);
227 
228  // Difference between measured and maximally allowed Gottfried-Jackson angle
229  float gjAngleDiff = -999;
230  if (tauDecayMode == 10) {
231  double mAOne = tau.p4().M();
232  double pAOneMag = tau.p();
233  double argumentThetaGJmax = (std::pow(mTau, 2) - std::pow(mAOne, 2)) / (2 * mTau * pAOneMag);
234  double argumentThetaGJmeasured =
235  (tau.p4().px() * decayDistX + tau.p4().py() * decayDistY + tau.p4().pz() * decayDistZ) /
236  (pAOneMag * decayDistMag);
237  if (std::abs(argumentThetaGJmax) <= 1. && std::abs(argumentThetaGJmeasured) <= 1.) {
238  double thetaGJmax = std::asin(argumentThetaGJmax);
239  double thetaGJmeasured = std::acos(argumentThetaGJmeasured);
240  gjAngleDiff = thetaGJmeasured - thetaGJmax;
241  }
242  }
243 
244  if (mvaOpt == kDBnewDMwLTwGJPhase2) {
245  mvaInput[0] = tau.pt();
246  mvaInput[1] = std::abs(tau.eta());
247  mvaInput[2] = chargedIsoPtSum; //tauID("chargedIsoPtSum");
248  mvaInput[3] = neutralIsoPtSum; //tauID("neutralIsoPtSum");
249  mvaInput[4] = puCorrPtSum; //tauID("puCorrPtSum");
250  mvaInput[5] = photonPtSumOutsideSignalCone; //tauID("photonPtSumOutsideSignalCone");
251  mvaInput[6] = tauDecayMode; //tau.decayMode();
252  mvaInput[7] = tau.signalGammaCands().size();
253  mvaInput[8] = tau.isolationGammaCands().size();
254 
255  float sigCands_pt = 0.;
256  float sigCands_dr, sigCands_deta, sigCands_dphi;
257  sigCands_dr = sigCands_deta = sigCands_dphi = 0.;
258  for (const auto& j : tau.signalGammaCands()) {
259  const float dr = reco::deltaR(tau, *j);
260  const float deta = std::abs(tau.eta() - j->eta());
261  const float dphi = std::abs(reco::deltaPhi(tau.phi(), j->phi()));
262  const float pt_ = j->pt();
263  sigCands_dr += dr * pt_;
264  sigCands_deta += deta * pt_;
265  sigCands_dphi += dphi * pt_;
266  sigCands_pt += pt_;
267  }
268  if (sigCands_pt > 0.) {
269  sigCands_dr = sigCands_dr / sigCands_pt;
270  sigCands_deta = sigCands_deta / sigCands_pt;
271  sigCands_dphi = sigCands_dphi / sigCands_pt;
272  } else {
273  sigCands_dr = sigCands_deta = sigCands_dphi = -0.1;
274  }
275  float isoCands_pt = 0.;
276  float isoCands_dr, isoCands_deta, isoCands_dphi;
277  isoCands_dr = isoCands_deta = isoCands_dphi = 0.;
278  for (const auto& j : tau.isolationGammaCands()) {
279  const float dr = reco::deltaR(tau, *j);
280  const float deta = std::abs(tau.eta() - j->eta());
281  const float dphi = std::abs(reco::deltaPhi(tau.phi(), j->phi()));
282  const float pt_ = j->pt();
283  isoCands_dr += dr * pt_;
284  isoCands_deta += deta * pt_;
285  isoCands_dphi += dphi * pt_;
286  isoCands_pt += pt_;
287  }
288  if (isoCands_pt > 0.) {
289  isoCands_dr = isoCands_dr / isoCands_pt;
290  isoCands_deta = isoCands_deta / isoCands_pt;
291  isoCands_dphi = isoCands_dphi / isoCands_pt;
292  } else {
293  isoCands_dr = isoCands_deta = isoCands_dphi = -0.1;
294  }
295  mvaInput[9] = isoCands_deta;
296  mvaInput[10] = isoCands_dphi;
297  mvaInput[11] = isoCands_dr;
298  mvaInput[12] = sigCands_deta;
299  mvaInput[13] = sigCands_dphi;
300  mvaInput[14] = sigCands_dr;
301 
302  float e = tau.hcalEnergy() + tau.ecalEnergy();
303  e > 0. ? e = tau.ecalEnergy() / e : e = -1.;
304  mvaInput[15] = e;
305  mvaInput[16] = tau.dxy() >= 0. ? +1 : -1;
306  mvaInput[17] = sqrt(std::abs(tau.dxy()));
307  mvaInput[18] = std::abs(tau.dxy_Sig());
308  mvaInput[19] = tau.ip3d() >= 0. ? +1 : -1;
309  mvaInput[20] = sqrt(std::abs(tau.ip3d()));
310  mvaInput[21] = std::abs(tau.ip3d_Sig());
311  mvaInput[22] = (tau.hasSecondaryVertex()) ? 1. : 0.;
312  mvaInput[23] = decayDistMag; //sqrt(tau.flightLength().Mag2());
313  mvaInput[24] = tau.flightLengthSig();
314  mvaInput[25] = leadingTrackChi2; //tau.leadingTrackNormChi2();
315 
316  float thetaGJmax, thetaGJ;
317  if (decayDistMag > 0. && tau.hasSecondaryVertex()) {
318  const float mAOne = tau.p4().M();
319  const float pAOneMag = tau.p();
320  thetaGJmax = (mTau * mTau - mAOne * mAOne) / (2. * mTau * pAOneMag);
321  thetaGJmax = asin(thetaGJmax);
322  thetaGJ = (tau.px() * tau.flightLength().x() + tau.py() * tau.flightLength().y() +
323  tau.pz() * tau.flightLength().z()) /
324  (pAOneMag * decayDistMag);
325  thetaGJ = acos(thetaGJ);
326  if (std::isnan(thetaGJ))
327  thetaGJ = -16.;
328  if (std::isnan(thetaGJmax))
329  thetaGJmax = -11.;
330  } else {
331  thetaGJ = -15.;
332  thetaGJmax = -10.;
333  }
334  mvaInput[26] = thetaGJ - thetaGJmax;
335 
336  mvaInput[27] = 0;
337  mvaInput[28] = 10.;
338  mvaInput[29] = 10.;
339  if (tau.leadChargedHadrCand().isNonnull()) {
340  if (tau.leadChargedHadrCand()->bestTrack()) {
341  const float trackdxy = tau.leadChargedHadrCand()->bestTrack()->dxy();
342  const float trackdxy_err = tau.leadChargedHadrCand()->bestTrack()->dxyError();
343  mvaInput[27] = trackdxy >= 0. ? +1 : -1;
344  mvaInput[28] = sqrt(std::abs(trackdxy));
345  mvaInput[29] = std::abs(trackdxy / trackdxy_err);
346  }
347  }
348  }
349  if (mvaOpt == kOldDMwoLT || mvaOpt == kNewDMwoLT) {
350  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
351  mvaInput[1] = std::abs((float)tau.eta());
352  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
353  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
354  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
355  mvaInput[5] = tauDecayMode;
356  } else if (mvaOpt == kOldDMwLT || mvaOpt == kNewDMwLT) {
357  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
358  mvaInput[1] = std::abs((float)tau.eta());
359  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
360  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
361  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
362  mvaInput[5] = tauDecayMode;
363  mvaInput[6] = std::copysign(+1.f, tau.dxy());
364  mvaInput[7] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
365  mvaInput[8] = std::min(10.f, std::abs(tau.dxy_Sig()));
366  mvaInput[9] = (tau.hasSecondaryVertex()) ? 1. : 0.;
367  mvaInput[10] = std::sqrt(decayDistMag);
368  mvaInput[11] = std::min(10.f, tau.flightLengthSig());
369  } else if (mvaOpt == kDBoldDMwLT || mvaOpt == kDBnewDMwLT) {
370  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
371  mvaInput[1] = std::abs((float)tau.eta());
372  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
373  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
374  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
375  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
376  mvaInput[6] = tauDecayMode;
377  mvaInput[7] = std::min(30.f, nPhoton);
378  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
379  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
380  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
381  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
382  mvaInput[12] = std::min(100.f, leadingTrackChi2);
383  mvaInput[13] = std::min(1.f, eRatio);
384  mvaInput[14] = std::copysign(+1.f, tau.dxy());
385  mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
386  mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
387  mvaInput[17] = std::copysign(+1.f, tau.ip3d());
388  mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
389  mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
390  mvaInput[20] = (tau.hasSecondaryVertex()) ? 1. : 0.;
391  mvaInput[21] = std::sqrt(decayDistMag);
392  mvaInput[22] = std::min(10.f, tau.flightLengthSig());
393  } else if (mvaOpt == kPWoldDMwLT || mvaOpt == kPWnewDMwLT) {
394  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
395  mvaInput[1] = std::abs((float)tau.eta());
396  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
397  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
398  mvaInput[4] = std::log(std::max(1.e-2f, footprintCorrection));
399  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
400  mvaInput[6] = tauDecayMode;
401  mvaInput[7] = std::min(30.f, nPhoton);
402  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
403  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
404  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
405  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
406  mvaInput[12] = std::min(100.f, leadingTrackChi2);
407  mvaInput[13] = std::min(1.f, eRatio);
408  mvaInput[14] = std::copysign(+1.f, tau.dxy());
409  mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
410  mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
411  mvaInput[17] = std::copysign(+1.f, tau.ip3d());
412  mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
413  mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
414  mvaInput[20] = (tau.hasSecondaryVertex()) ? 1. : 0.;
415  mvaInput[21] = std::sqrt(decayDistMag);
416  mvaInput[22] = std::min(10.f, tau.flightLengthSig());
417  } else if (mvaOpt == kDBoldDMwLTwGJ || mvaOpt == kDBnewDMwLTwGJ) {
418  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
419  mvaInput[1] = std::abs((float)tau.eta());
420  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
421  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
422  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
423  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
424  mvaInput[6] = tauDecayMode;
425  mvaInput[7] = std::min(30.f, nPhoton);
426  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
427  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
428  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
429  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
430  mvaInput[12] = std::min(1.f, eRatio);
431  mvaInput[13] = std::copysign(+1.f, tau.dxy());
432  mvaInput[14] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
433  mvaInput[15] = std::min(10.f, std::abs(tau.dxy_Sig()));
434  mvaInput[16] = std::copysign(+1.f, tau.ip3d());
435  mvaInput[17] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
436  mvaInput[18] = std::min(10.f, std::abs(tau.ip3d_Sig()));
437  mvaInput[19] = (tau.hasSecondaryVertex()) ? 1. : 0.;
438  mvaInput[20] = std::sqrt(decayDistMag);
439  mvaInput[21] = std::min(10.f, tau.flightLengthSig());
440  mvaInput[22] = std::max(-1.f, gjAngleDiff);
441  }
442 
443  return true;
444  }
445  return false;
446  }
447 
448  } // namespace tau
449 } // namespace reco
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:221
unsigned int n_photons_total(const reco::PFTau &tau)
return total number of pf photon candidates with pT&gt;500 MeV, which are associated to signal ...
static std::vector< std::string > checklist log
double pz() const final
z coordinate of momentum vector
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:75
double pt() const final
transverse momentum
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1)
float pt_weighted_dr_signal(const reco::PFTau &tau, int dm)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:593
float hcalFraction() const
float dxy() const
Definition: Tau.h:277
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
bool fillIsoMVARun2Inputs(float *mvaInput, const pat::Tau &tau, int mvaOpt, const std::string &nameCharged, const std::string &nameNeutral, const std::string &namePu, const std::string &nameOutside, const std::string &nameFootprint)
const std::vector< reco::CandidatePtr > & signalGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
float ip3d_Sig() const
float tauID(const std::string &name) const
float hcalEnergy() const
return sum of hcal energies from signal candidates
Definition: Tau.h:299
assert(be >=bs)
float ecalEnergy() const
Definition: Tau.h:297
reco::CandidatePtrVector signalGammaCands() const
const std::vector< reco::CandidatePtr > & isolationGammaCands() const
Gamma candidates in isolation region.
Definition: PFTau.cc:99
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:430
double px() const final
x coordinate of momentum vector
double p() const final
magnitude of momentum vector
float ip3d() const
Definition: Tau.h:290
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:63
float pt_weighted_deta_strip(const reco::PFTau &tau, int dm)
T sqrt(T t)
Definition: SSEVec.h:19
const pat::tau::TauPFEssential::Vector & flightLength() const
Definition: Tau.h:284
list var
if using global norm cols_to_minmax = [&#39;t_delta&#39;, &#39;t_hmaxNearP&#39;,&#39;t_emaxNearP&#39;, &#39;t_hAnnular&#39;, &#39;t_eAnnular&#39;,&#39;t_pt&#39;,&#39;t_nVtx&#39;,&#39;t_ieta&#39;,&#39;t_eHcal10&#39;, &#39;t_eHcal30&#39;,&#39;t_rhoh&#39;,&#39;t_eHcal&#39;] df[cols_to_minmax] = df[cols_to_minmax].apply(lambda x: (x - x.min()) / (x.max() - x.min()) if (x.max() - x.min() &gt; 0) else 1.0/200.0)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float pt_weighted_dr_iso(const reco::PFTau &tau, int dm)
virtual const reco::Track & pseudoTrack() const
bool hasSecondaryVertex() const
Definition: Tau.h:283
T min(T a, T b)
Definition: MathUtil.h:58
const reco::CandidatePtr leadChargedHadrCand() const
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
double py() const final
y coordinate of momentum vector
Analysis-level tau class.
Definition: Tau.h:53
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
float pt_weighted_dphi_strip(const reco::PFTau &tau, int dm)
int decayMode() const
reconstructed tau decay mode (specific to PFTau)
Definition: Tau.h:328
float eratio(const reco::PFTau &tau)
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
float flightLengthSig() const
Definition: Tau.h:285
float dxy_Sig() const
float leadingTrackNormChi2() const
return normalized chi2 of leading track
Definition: Tau.h:301
double energy() const override
energy
float pt_weighted_dx_T(const typename T::Tau_t &tau, int mode, int var, int decaymode)
double hcalEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:233
reco::CandidatePtrVector isolationGammaCands() const
float lead_track_chi2(const reco::PFTau &tau)
return chi2 of the leading track ==&gt; deprecated? &lt;==
const std::vector< reco::CandidatePtr > & signalCands() const
Candidates in signal region.
Definition: PFTau.cc:74
double phi() const final
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
double eta() const final
momentum pseudorapidity