CMS 3D CMS Logo

adjustForPileup.cc
Go to the documentation of this file.
2 
3 namespace fftjetcms {
6  const bool subtractPileupAs4Vec) {
7  const double pt = jet.Pt();
8  if (pt > 0.0) {
9  const double pileupPt = pileup.Pt();
10  const double ptFactor = (pt - pileupPt) / pt;
11  if (ptFactor <= 0.0)
12  return math::XYZTLorentzVector();
13  else if (subtractPileupAs4Vec) {
14  const math::XYZTLorentzVector subtracted(jet - pileup);
15  const double e = subtracted.E();
16  if (e <= 0.0)
17  return math::XYZTLorentzVector();
18  else {
19  // Avoid negative jet masses
20  const double px = subtracted.Px();
21  const double py = subtracted.Py();
22  const double pz = subtracted.Pz();
23  if (e * e < px * px + py * py + pz * pz)
24  // It is not clear what is the best thing to do here.
25  // For now, revert to Pt scaling.
26  return jet * ptFactor;
27  else
28  return subtracted;
29  }
30  } else
31  return jet * ptFactor;
32  } else
33  return jet;
34  }
35 } // namespace fftjetcms
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
math::XYZTLorentzVector adjustForPileup(const math::XYZTLorentzVector &jet, const math::XYZTLorentzVector &pileup, bool subtractPileupAs4Vec)