test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
adjustForPileup.cc
Go to the documentation of this file.
2 
3 namespace fftjetcms {
7  const bool subtractPileupAs4Vec)
8  {
9  const double pt = jet.Pt();
10  if (pt > 0.0)
11  {
12  const double pileupPt = pileup.Pt();
13  const double ptFactor = (pt - pileupPt)/pt;
14  if (ptFactor <= 0.0)
15  return math::XYZTLorentzVector();
16  else if (subtractPileupAs4Vec)
17  {
18  const math::XYZTLorentzVector subtracted(jet - pileup);
19  const double e = subtracted.E();
20  if (e <= 0.0)
21  return math::XYZTLorentzVector();
22  else
23  {
24  // Avoid negative jet masses
25  const double px = subtracted.Px();
26  const double py = subtracted.Py();
27  const double pz = subtracted.Pz();
28  if (e*e < px*px + py*py + pz*pz)
29  // It is not clear what is the best thing to do here.
30  // For now, revert to Pt scaling.
31  return jet*ptFactor;
32  else
33  return subtracted;
34  }
35  }
36  else
37  return jet*ptFactor;
38  }
39  else
40  return jet;
41  }
42 }
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)