CMS 3D CMS Logo

VBuilders.h
Go to the documentation of this file.
1 //=========================================================================
2 // VBuilders.h
3 //
4 // Functors for building various quantities from grid points. They are
5 // intended for use with "KernelRecombinationAlg" or similar templated
6 // classes.
7 //
8 // I. Volobouev
9 // March 2010
10 //=========================================================================
11 
12 #ifndef RecoJets_FFTJetAlgorithms_VBuilders_h
13 #define RecoJets_FFTJetAlgorithms_VBuilders_h
14 
15 #include <cmath>
16 
18 
19 namespace fftjetcms {
20  struct PtEtaP4Builder {
21  inline math::XYZTLorentzVector operator()(const double pt, const double eta, const double phi) const {
22  const double px = pt * cos(phi);
23  const double py = pt * sin(phi);
24  const double pz = pt * sinh(eta);
25  const double e = sqrt(px * px + py * py + pz * pz);
26  return math::XYZTLorentzVector(px, py, pz, e);
27  }
28  };
29 
31  inline math::XYZTLorentzVector operator()(const double e, const double eta, const double phi) const {
32  // There is no mass associated with this energy... We will
33  // assume that the mass is 0 and proceed as if the energy
34  // is the momentum.
35  const double pt = e / cosh(eta);
36  return math::XYZTLorentzVector(pt * cos(phi), pt * sin(phi), pt * sinh(eta), e);
37  }
38  };
39 } // namespace fftjetcms
40 
41 #endif // RecoJets_FFTJetAlgorithms_VBuilders_h
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZTLorentzVector operator()(const double e, const double eta, const double phi) const
Definition: VBuilders.h:31
math::XYZTLorentzVector operator()(const double pt, const double eta, const double phi) const
Definition: VBuilders.h:21