CMS 3D CMS Logo

PFRecoTauEnergyAlgorithmPlugin.cc
Go to the documentation of this file.
1 /*
2  * =============================================================================
3  * Filename: RecoTauEnergyAlgorithmPlugin.cc
4  *
5  * Description: Determine best estimate for tau energy
6  * for tau candidates reconstructed in different decay modes
7  *
8  * Created: 04/09/2013 11:40:00
9  *
10  * Authors: Christian Veelken (LLR)
11  *
12  * =============================================================================
13  */
14 
16 
28 
31 
32 #include <vector>
33 #include <cmath>
34 
35 namespace reco { namespace tau {
36 
38 {
39  public:
40 
43  void operator()(reco::PFTau&) const override;
44  void beginEvent() override;
45  void endEvent() override;
46 
47  private:
48 
51  double dRaddPhoton_;
52  double minGammaEt_;
53 
55 };
56 
58  : RecoTauModifierPlugin(cfg, std::move(iC)),
59  dRaddNeutralHadron_(cfg.getParameter<double>("dRaddNeutralHadron")),
60  minNeutralHadronEt_(cfg.getParameter<double>("minNeutralHadronEt")),
61  dRaddPhoton_(cfg.getParameter<double>("dRaddPhoton")),
62  minGammaEt_(cfg.getParameter<double>("minGammaEt")),
63  verbosity_(cfg.getParameter<int>("verbosity"))
64 {}
65 
67 {}
68 
70 {}
71 
72 namespace
73 {
74  double getTrackPerr2(const reco::Track& track)
75  {
76  double trackPerr = track.p()*(track.ptError()/track.pt());
77  return trackPerr*trackPerr;
78  }
79 
80  void updateTauP4(reco::PFTau& tau, double sf, const reco::Candidate::LorentzVector& addP4)
81  {
82  // preserve tau candidate mass when adding extra neutral energy
83  double tauPx_modified = tau.px() + sf*addP4.px();
84  double tauPy_modified = tau.py() + sf*addP4.py();
85  double tauPz_modified = tau.pz() + sf*addP4.pz();
86  double tauMass = tau.mass();
87  double tauEn_modified = sqrt(tauPx_modified*tauPx_modified + tauPy_modified*tauPy_modified + tauPz_modified*tauPz_modified + tauMass*tauMass);
88  reco::Candidate::LorentzVector tauP4_modified(tauPx_modified, tauPy_modified, tauPz_modified, tauEn_modified);
89  tau.setP4(tauP4_modified);
90  }
91 
92  void killTau(reco::PFTau& tau)
93  {
94  reco::Candidate::LorentzVector tauP4_modified(0.,0.,0.,0.);
95  tau.setP4(tauP4_modified);
96  tau.setStatus(-1);
97  }
98 }
99 
100 template<class Base, class Der>
101 bool isPtrEqual(const edm::Ptr<Base>& b, const edm::Ptr<Der>& d) {
102  return edm::Ptr<Der>(b) == d;
103 }
104 
105 template<class Base>
107  return b == d;
108 }
109 
111 {
112  if ( verbosity_ ) {
113  std::cout << "<PFRecoTauEnergyAlgorithmPlugin::operator()>:" << std::endl;
114  std::cout << "tau: Pt = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << " (En = " << tau.energy() << ", decayMode = " << tau.decayMode() << ")" << std::endl;
115  }
116 
117  // Add high Pt PFNeutralHadrons and PFGammas that are not "used" by tau decay mode object
118  std::vector<reco::CandidatePtr> addNeutrals;
119  reco::Candidate::LorentzVector addNeutralsSumP4;
120  const auto& jetConstituents = tau.jetRef()->daughterPtrVector();
121  for (const auto& jetConstituent : jetConstituents) {
122 
123  int jetConstituentPdgId = std::abs(jetConstituent->pdgId());
124  if ( !((jetConstituentPdgId == 130 && jetConstituent->et() > minNeutralHadronEt_) ||
125  (jetConstituentPdgId == 22 && jetConstituent->et() > minGammaEt_ )) ) continue;
126 
127  bool isSignalCand = false;
128  const auto& signalCands = tau.signalCands();
129  for (const auto& signalCand : signalCands) {
130  if ( isPtrEqual(jetConstituent, signalCand) ) isSignalCand = true;
131  }
132  if ( isSignalCand ) continue;
133 
134  double dR = deltaR(jetConstituent->p4(), tau.p4());
135  double dRadd = -1.;
136  if ( jetConstituentPdgId == 130 ) dRadd = dRaddNeutralHadron_;
137  else if ( jetConstituentPdgId == 22 ) dRadd = dRaddPhoton_;
138  if ( dR < dRadd ) {
139  addNeutrals.push_back(jetConstituent);
140  addNeutralsSumP4 += jetConstituent->p4();
141  }
142  }
143  if ( verbosity_ ) {
144  std::cout << "addNeutralsSumP4: En = " << addNeutralsSumP4.energy() << std::endl;
145  }
146 
147  unsigned numNonPFCandTracks = 0;
148  double nonPFCandTracksSumP = 0.;
149  double nonPFCandTracksSumPerr2 = 0.;
150  const std::vector<PFRecoTauChargedHadron>& chargedHadrons = tau.signalTauChargedHadronCandidatesRestricted();
151  for ( std::vector<PFRecoTauChargedHadron>::const_iterator chargedHadron = chargedHadrons.begin();
152  chargedHadron != chargedHadrons.end(); ++chargedHadron ) {
154  ++numNonPFCandTracks;
155  const reco::Track* chargedHadronTrack = getTrackFromChargedHadron(*chargedHadron);
156  if ( chargedHadronTrack != nullptr ) {
157  nonPFCandTracksSumP += chargedHadronTrack->p();
158  nonPFCandTracksSumPerr2 += getTrackPerr2(*chargedHadronTrack);
159  }
160  }
161  }
162  if ( verbosity_ ) {
163  std::cout << "nonPFCandTracksSumP = " << nonPFCandTracksSumP << " +/- " << sqrt(nonPFCandTracksSumPerr2)
164  << " (numNonPFCandTracks = " << numNonPFCandTracks << ")" << std::endl;
165  }
166 
167  if ( numNonPFCandTracks == 0 ) {
168  // This is the easy case:
169  // All tau energy is taken from PFCandidates reconstructed by PFlow algorithm
170  // and there is no issue with double-counting of energy.
171  if ( verbosity_ ) {
172  std::cout << "easy case: all tracks are associated to PFCandidates --> leaving tau momentum untouched." << std::endl;
173  }
174  updateTauP4(tau, 1., addNeutralsSumP4);
175  return;
176  } else {
177  // This is the difficult case:
178  // The tau energy needs to be computed for an arbitrary mix of charged and neutral PFCandidates plus reco::Tracks.
179  // We need to make sure not to double-count energy deposited by reco::Track in ECAL and/or HCAL as neutral PFCandidates.
180 
181  // Check if we have enough energy in collection of PFNeutralHadrons and PFGammas that are not "used" by tau decay mode object
182  // to balance track momenta:
183  if ( nonPFCandTracksSumP < addNeutralsSumP4.energy() ) {
184  double scaleFactor = 1. - nonPFCandTracksSumP/addNeutralsSumP4.energy();
185  if ( !(scaleFactor >= 0. && scaleFactor <= 1.) ) {
186  edm::LogWarning("PFRecoTauEnergyAlgorithmPlugin::operator()")
187  << "Failed to compute tau energy --> killing tau candidate !!" << std::endl;
188  killTau(tau);
189  return;
190  }
191  if ( verbosity_ ) {
192  std::cout << "case (2): addNeutralsSumEn > nonPFCandTracksSumP --> adjusting tau momentum." << std::endl;
193  }
194  updateTauP4(tau, scaleFactor, addNeutralsSumP4);
195  return;
196  }
197 
198  // Determine which neutral PFCandidates are close to PFChargedHadrons
199  // and have been merged into ChargedHadrons
200  std::vector<reco::CandidatePtr> mergedNeutrals;
201  reco::Candidate::LorentzVector mergedNeutralsSumP4;
202  for ( std::vector<PFRecoTauChargedHadron>::const_iterator chargedHadron = chargedHadrons.begin();
203  chargedHadron != chargedHadrons.end(); ++chargedHadron ) {
205  const std::vector<reco::CandidatePtr>& neutralPFCands = chargedHadron->getNeutralPFCandidates();
206  for ( std::vector<reco::CandidatePtr>::const_iterator neutralPFCand = neutralPFCands.begin();
207  neutralPFCand != neutralPFCands.end(); ++neutralPFCand ) {
208  mergedNeutrals.push_back(*neutralPFCand);
209  mergedNeutralsSumP4 += (*neutralPFCand)->p4();
210  }
211  }
212  }
213  if ( verbosity_ ) {
214  std::cout << "mergedNeutralsSumP4: En = " << mergedNeutralsSumP4.energy() << std::endl;
215  }
216 
217  // Check if track momenta are balanced by sum of PFNeutralHadrons and PFGammas that are not "used" by tau decay mode object
218  // plus neutral PFCandidates close to PFChargedHadrons:
219  if ( nonPFCandTracksSumP < (addNeutralsSumP4.energy() + mergedNeutralsSumP4.energy()) ) {
220  double scaleFactor = ((addNeutralsSumP4.energy() + mergedNeutralsSumP4.energy()) - nonPFCandTracksSumP)/mergedNeutralsSumP4.energy();
221  if ( !(scaleFactor >= 0. && scaleFactor <= 1.) ) {
222  edm::LogWarning("PFRecoTauEnergyAlgorithmPlugin::operator()")
223  << "Failed to compute tau energy --> killing tau candidate !!" << std::endl;
224  killTau(tau);
225  return;
226  }
228  size_t numChargedHadrons = chargedHadrons.size();
229  for ( size_t iChargedHadron = 0; iChargedHadron < numChargedHadrons; ++iChargedHadron ) {
230  const PFRecoTauChargedHadron& chargedHadron = chargedHadrons[iChargedHadron];
231  if ( !chargedHadron.getNeutralPFCandidates().empty() ) {
232  PFRecoTauChargedHadron chargedHadron_modified = chargedHadron;
233  setChargedHadronP4(chargedHadron_modified, scaleFactor);
234  tau.signalTauChargedHadronCandidatesRestricted()[iChargedHadron] = chargedHadron_modified;
235  diffP4 += (chargedHadron.p4() - chargedHadron_modified.p4());
236  }
237  }
238  if ( verbosity_ ) {
239  std::cout << "case (3): (addNeutralsSumEn + mergedNeutralsSumEn) > nonPFCandTracksSumP --> adjusting tau momentum." << std::endl;
240  }
241  updateTauP4(tau, -1., diffP4);
242  return;
243  }
244 
245  // Determine energy sum of all PFNeutralHadrons interpreted as ChargedHadrons with missing track
246  unsigned numChargedHadronNeutrals = 0;
247  std::vector<reco::CandidatePtr> chargedHadronNeutrals;
248  reco::Candidate::LorentzVector chargedHadronNeutralsSumP4;
249  for ( std::vector<PFRecoTauChargedHadron>::const_iterator chargedHadron = chargedHadrons.begin();
250  chargedHadron != chargedHadrons.end(); ++chargedHadron ) {
252  ++numChargedHadronNeutrals;
253  chargedHadronNeutrals.push_back(chargedHadron->getChargedPFCandidate());
254  chargedHadronNeutralsSumP4 += chargedHadron->getChargedPFCandidate()->p4();
255  }
256  }
257  if ( verbosity_ ) {
258  std::cout << "chargedHadronNeutralsSumP4: En = " << chargedHadronNeutralsSumP4.energy()
259  << " (numChargedHadronNeutrals = " << numChargedHadronNeutrals << ")" << std::endl;
260  }
261 
262  // Check if sum of PFNeutralHadrons and PFGammas that are not "used" by tau decay mode object
263  // plus neutral PFCandidates close to PFChargedHadrons plus PFNeutralHadrons interpreted as ChargedHadrons with missing track balances track momenta
264  if ( nonPFCandTracksSumP < (addNeutralsSumP4.energy() + mergedNeutralsSumP4.energy() + chargedHadronNeutralsSumP4.energy()) ) {
265  double scaleFactor = ((addNeutralsSumP4.energy() + mergedNeutralsSumP4.energy() + chargedHadronNeutralsSumP4.energy()) - nonPFCandTracksSumP)/chargedHadronNeutralsSumP4.energy();
266  if ( !(scaleFactor >= 0. && scaleFactor <= 1.) ) {
267  edm::LogWarning("PFRecoTauEnergyAlgorithmPlugin::operator()")
268  << "Failed to compute tau energy --> killing tau candidate !!" << std::endl;
269  killTau(tau);
270  return;
271  }
273  size_t numChargedHadrons = chargedHadrons.size();
274  for ( size_t iChargedHadron = 0; iChargedHadron < numChargedHadrons; ++iChargedHadron ) {
275  const PFRecoTauChargedHadron& chargedHadron = chargedHadrons[iChargedHadron];
276  if ( chargedHadron.algoIs(PFRecoTauChargedHadron::kPFNeutralHadron) ) {
277  PFRecoTauChargedHadron chargedHadron_modified = chargedHadron;
278  chargedHadron_modified.neutralPFCandidates_.clear();
279  const CandidatePtr& chargedPFCand = chargedHadron.getChargedPFCandidate();
280  double chargedHadronPx_modified = scaleFactor*chargedPFCand->px();
281  double chargedHadronPy_modified = scaleFactor*chargedPFCand->py();
282  double chargedHadronPz_modified = scaleFactor*chargedPFCand->pz();
283  reco::Candidate::LorentzVector chargedHadronP4_modified = compChargedHadronP4fromPxPyPz(chargedHadronPx_modified, chargedHadronPy_modified, chargedHadronPz_modified);
284  chargedHadron_modified.setP4(chargedHadronP4_modified);
285  tau.signalTauChargedHadronCandidatesRestricted()[iChargedHadron] = chargedHadron_modified;
286  diffP4 += (chargedHadron.p4() - chargedHadron_modified.p4());
287  }
288  }
289  if ( verbosity_ ) {
290  std::cout << "case (4): (addNeutralsSumEn + mergedNeutralsSumEn + chargedHadronNeutralsSumEn) > nonPFCandTracksSumP --> adjusting momenta of tau and chargedHadrons." << std::endl;
291  }
292  updateTauP4(tau, -1., diffP4);
293  return;
294  } else {
295  double allTracksSumP = 0.;
296  double allTracksSumPerr2 = 0.;
297  const std::vector<PFRecoTauChargedHadron> chargedHadrons = tau.signalTauChargedHadronCandidatesRestricted();
298  for ( std::vector<PFRecoTauChargedHadron>::const_iterator chargedHadron = chargedHadrons.begin();
299  chargedHadron != chargedHadrons.end(); ++chargedHadron ) {
301  const reco::Track* chargedHadronTrack = getTrackFromChargedHadron(*chargedHadron);
302  if ( chargedHadronTrack != nullptr ) {
303  allTracksSumP += chargedHadronTrack->p();
304  allTracksSumPerr2 += getTrackPerr2(*chargedHadronTrack);
305  } else {
306  edm::LogInfo("PFRecoTauEnergyAlgorithmPlugin::operator()")
307  << "PFRecoTauChargedHadron has no associated reco::Track !!";
308  if ( verbosity_ ) {
309  chargedHadron->print();
310  }
311  }
312  }
313  }
314  if ( verbosity_ ) {
315  std::cout << "allTracksSumP = " << allTracksSumP << " +/- " << sqrt(allTracksSumPerr2) << std::endl;
316  }
317  double allNeutralsSumEn = 0.;
318  const auto& signalCands = tau.signalCands();
319  for (const auto& signalCand : signalCands) {
320  if ( verbosity_ ) {
321  std::cout << "Candidate #" << signalCand.id() << ":" << signalCand.key() << ":"
322  << " Pt = " << (signalCand)->pt() << ", eta = " << (signalCand)->eta() << ", phi = " << (signalCand)->phi() << std::endl;
323  }
324  const PFCandidate* pfCand = dynamic_cast<const PFCandidate*>(&*signalCand);
325  if (pfCand) {
326  if (verbosity_) {
327  std::cout << "calorimeter energy:"
328  << " ECAL = " << (pfCand)->ecalEnergy() << ","
329  << " HCAL = " << (pfCand)->hcalEnergy() << ","
330  << " HO = " << (pfCand)->hoEnergy() << std::endl;
331  }
332  // TauReco@MiniAOD: This info is not yet available in miniAOD.
333  if ( edm::isFinite(pfCand->ecalEnergy()) ) allNeutralsSumEn += pfCand->ecalEnergy();
334  if ( edm::isFinite(pfCand->hcalEnergy()) ) allNeutralsSumEn += pfCand->hcalEnergy();
335  if ( edm::isFinite(pfCand->hoEnergy()) ) allNeutralsSumEn += pfCand->hoEnergy();
336  }
337  }
338  allNeutralsSumEn += addNeutralsSumP4.energy();
339  if ( allNeutralsSumEn < 0. ) allNeutralsSumEn = 0.;
340  if ( verbosity_ ) {
341  std::cout << "allNeutralsSumEn = " << allNeutralsSumEn << std::endl;
342  }
343  if ( allNeutralsSumEn > allTracksSumP ) {
344  // Adjust momenta of neutral PFCandidates merged into ChargedHadrons
345  size_t numChargedHadrons = chargedHadrons.size();
346  for ( size_t iChargedHadron = 0; iChargedHadron < numChargedHadrons; ++iChargedHadron ) {
347  const PFRecoTauChargedHadron& chargedHadron = chargedHadrons[iChargedHadron];
349  PFRecoTauChargedHadron chargedHadron_modified = chargedHadron;
350  chargedHadron_modified.neutralPFCandidates_.clear();
351  chargedHadron_modified.setP4(chargedHadron.getChargedPFCandidate()->p4());
352  if ( verbosity_ ) {
353  std::cout << "chargedHadron #" << iChargedHadron << ": changing En = " << chargedHadron.energy() << " to " << chargedHadron_modified.energy() << std::endl;
354  }
355  tau.signalTauChargedHadronCandidatesRestricted()[iChargedHadron] = chargedHadron_modified;
356  } else if ( chargedHadron.algoIs(PFRecoTauChargedHadron::kTrack) ) {
357  PFRecoTauChargedHadron chargedHadron_modified = chargedHadron;
358  chargedHadron_modified.neutralPFCandidates_.clear();
359  reco::Candidate::LorentzVector chargedHadronP4_modified(0.,0.,0.,0.);
360  const reco::Track* chTrack = getTrackFromChargedHadron(chargedHadron);
361  if ( chTrack != nullptr ) {
362  double chargedHadronPx_modified = chTrack->px();
363  double chargedHadronPy_modified = chTrack->py();
364  double chargedHadronPz_modified = chTrack->pz();
365  chargedHadronP4_modified = compChargedHadronP4fromPxPyPz(chargedHadronPx_modified, chargedHadronPy_modified, chargedHadronPz_modified);
366  } else {
367  edm::LogWarning("PFRecoTauEnergyAlgorithmPlugin::operator()")
368  << "PFRecoTauChargedHadron has no associated reco::Track !!" << std::endl;
369  if ( verbosity_ ) {
370  chargedHadron.print();
371  }
372  }
373  chargedHadron_modified.setP4(chargedHadronP4_modified);
374  if ( verbosity_ ) {
375  std::cout << "chargedHadron #" << iChargedHadron << ": changing En = " << chargedHadron.energy() << " to " << chargedHadron_modified.energy() << std::endl;
376  }
377  tau.signalTauChargedHadronCandidatesRestricted()[iChargedHadron] = chargedHadron_modified;
378  }
379  }
380  double scaleFactor = allNeutralsSumEn/tau.energy();
381  if ( verbosity_ ) {
382  std::cout << "case (5): allNeutralsSumEn > allTracksSumP --> adjusting momenta of tau and chargedHadrons." << std::endl;
383  }
384  updateTauP4(tau, scaleFactor - 1., tau.p4());
385  return;
386  } else {
387  if ( numChargedHadronNeutrals == 0 && tau.signalPiZeroCandidates().empty() ) {
388  // Adjust momenta of ChargedHadrons build from reco::Tracks to match sum of energy deposits in ECAL + HCAL + HO
389  size_t numChargedHadrons = chargedHadrons.size();
390  for ( size_t iChargedHadron = 0; iChargedHadron < numChargedHadrons; ++iChargedHadron ) {
391  const PFRecoTauChargedHadron& chargedHadron = chargedHadrons[iChargedHadron];
393  PFRecoTauChargedHadron chargedHadron_modified = chargedHadron;
394  chargedHadron_modified.neutralPFCandidates_.clear();
395  reco::Candidate::LorentzVector chargedHadronP4_modified(0.,0.,0.,0.);
396  const reco::Track* chargedHadronTrack = getTrackFromChargedHadron(chargedHadron);
397  if ( chargedHadronTrack != nullptr ) {
398  double trackP = chargedHadronTrack->p();
399  double trackPerr2 = getTrackPerr2(*chargedHadronTrack);
400  if ( verbosity_ ) {
401  std::cout << "trackP = " << trackP << " +/- " << sqrt(trackPerr2) << std::endl;
402  }
403  // CV: adjust track momenta such that difference beeen (measuredTrackP - adjustedTrackP)/sigmaMeasuredTrackP is minimal
404  // (expression derived using Mathematica)
405  double trackP_modified =
406  (trackP*(allTracksSumPerr2 - trackPerr2)
407  + trackPerr2*(allNeutralsSumEn - (allTracksSumP - trackP)))/
408  allTracksSumPerr2;
409  // CV: trackP_modified may actually become negative in case sum of energy deposits in ECAL + HCAL + HO is small
410  // and one of the tracks has a significantly larger momentum uncertainty than the other tracks.
411  // In this case set track momentum to small positive value.
412  if ( trackP_modified < 1.e-1 ) trackP_modified = 1.e-1;
413  if ( verbosity_ ) {
414  std::cout << "trackP (modified) = " << trackP_modified << std::endl;
415  }
416  double scaleFactor = trackP_modified/trackP;
417  if ( !(scaleFactor >= 0. && scaleFactor <= 1.) ) {
418  edm::LogWarning("PFRecoTauEnergyAlgorithmPlugin::operator()")
419  << "Failed to compute tau energy --> killing tau candidate !!" << std::endl;
420  killTau(tau);
421  return;
422  }
423  double chargedHadronPx_modified = scaleFactor*chargedHadronTrack->px();
424  double chargedHadronPy_modified = scaleFactor*chargedHadronTrack->py();
425  double chargedHadronPz_modified = scaleFactor*chargedHadronTrack->pz();
426  chargedHadronP4_modified = compChargedHadronP4fromPxPyPz(chargedHadronPx_modified, chargedHadronPy_modified, chargedHadronPz_modified);
427  } else {
428  edm::LogInfo("PFRecoTauEnergyAlgorithmPlugin::operator()")
429  << "PFRecoTauChargedHadron has no associated reco::Track !!";
430  if ( verbosity_ ) {
431  chargedHadron.print();
432  }
433  }
434  chargedHadron_modified.setP4(chargedHadronP4_modified);
435  if ( verbosity_ ) {
436  std::cout << "chargedHadron #" << iChargedHadron << ": changing En = " << chargedHadron.energy() << " to " << chargedHadron_modified.energy() << std::endl;
437  }
438  tau.signalTauChargedHadronCandidatesRestricted()[iChargedHadron] = chargedHadron_modified;
439  }
440  }
441  double scaleFactor = allNeutralsSumEn/tau.energy();
442  if ( verbosity_ ) {
443  std::cout << "case (6): allNeutralsSumEn < allTracksSumP --> adjusting momenta of tau and chargedHadrons." << std::endl;
444  }
445  updateTauP4(tau, scaleFactor - 1., tau.p4());
446  return;
447  } else {
448  // Interpretation of PFNeutralHadrons as ChargedHadrons with missing track and/or reconstruction of extra PiZeros
449  // is not compatible with the fact that sum of reco::Track momenta exceeds sum of energy deposits in ECAL + HCAL + HO:
450  // kill tau candidate (by setting its four-vector to zero)
451  if ( verbosity_ ) {
452  std::cout << "case (7): allNeutralsSumEn < allTracksSumP not compatible with tau decay mode hypothesis --> killing tau candidate." << std::endl;
453  }
454  killTau(tau);
455  return;
456  }
457  }
458  }
459  }
460 
461  // CV: You should never come here.
462  if ( verbosity_ ) {
463  std::cout << "undefined case: you should never come here !!" << std::endl;
464  }
465  assert(0);
466 }
467 
469 {}
470 
471 }} // end namespace reco::tau
472 
474 
double p() const
momentum vector magnitude
Definition: TrackBase.h:648
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:222
double eta() const final
momentum pseudorapidity
double px() const final
x coordinate of momentum vector
double pt() const final
transverse momentum
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:660
constexpr bool isFinite(T x)
hadronicDecayMode decayMode() const
Definition: PFTau.cc:315
void print(std::ostream &stream=std::cout) const
double pz() const final
z coordinate of momentum vector
const std::vector< RecoTauPiZero > & signalPiZeroCandidates() const
Retrieve the association of signal region gamma candidates into candidate PiZeros.
Definition: PFTau.cc:230
T sqrt(T t)
Definition: SSEVec.h:18
double pt() const
track transverse momentum
Definition: TrackBase.h:654
const JetBaseRef & jetRef() const
Definition: PFTau.cc:58
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:808
double energy() const final
energy
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
std::vector< CandidatePtr > neutralPFCandidates_
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:672
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
bool isPtrEqual(const edm::Ptr< Base > &b, const edm::Ptr< Der > &d)
double hoEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:242
double b
Definition: hdecay.h:120
double py() const final
y coordinate of momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
const reco::Track * getTrackFromChargedHadron(const reco::PFRecoTauChargedHadron &chargedHadron)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
double hcalEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:232
PFRecoTauEnergyAlgorithmPlugin(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
bool algoIs(PFRecoTauChargedHadronAlgorithm algo) const
Check whether a given algo produced this charged hadron.
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< PFRecoTauChargedHadron > & signalTauChargedHadronCandidatesRestricted()
Definition: PFTau.cc:283
const std::vector< reco::CandidatePtr > & signalCands() const
Candidates in signal region.
Definition: PFTau.cc:78
void setStatus(int status) final
set status word
void setChargedHadronP4(reco::PFRecoTauChargedHadron &chargedHadron, double scaleFactor_neutralPFCands=1.0)
const CandidatePtr & getChargedPFCandidate() const
reference to "charged" PFCandidate (either charged PFCandidate or PFNeutralHadron) ...
double phi() const final
momentum azimuthal angle
void setP4(const LorentzVector &p4) final
set 4-momentum
def move(src, dest)
Definition: eostools.py:511
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:666
double mass() const final
mass
const std::vector< CandidatePtr > & getNeutralPFCandidates() const
references to additional neutral PFCandidates
reco::Candidate::LorentzVector compChargedHadronP4fromPxPyPz(double, double, double)