# Project CMSSW displayed by LXR

File indexing completed on 2024-04-06 12:25:22

```0001 //=========================================================================
0002 // VBuilders.h
0003 //
0004 // Functors for building various quantities from grid points. They are
0005 // intended for use with "KernelRecombinationAlg" or similar templated
0006 // classes.
0007 //
0008 // I. Volobouev
0009 // March 2010
0010 //=========================================================================
0011
0012 #ifndef RecoJets_FFTJetAlgorithms_VBuilders_h
0013 #define RecoJets_FFTJetAlgorithms_VBuilders_h
0014
0015 #include <cmath>
0016
0017 #include "DataFormats/Math/interface/LorentzVector.h"
0018
0019 namespace fftjetcms {
0020   struct PtEtaP4Builder {
0021     inline math::XYZTLorentzVector operator()(const double pt, const double eta, const double phi) const {
0022       const double px = pt * cos(phi);
0023       const double py = pt * sin(phi);
0024       const double pz = pt * sinh(eta);
0025       const double e = sqrt(px * px + py * py + pz * pz);
0026       return math::XYZTLorentzVector(px, py, pz, e);
0027     }
0028   };
0029
0030   struct EnergyEtaP4Builder {
0031     inline math::XYZTLorentzVector operator()(const double e, const double eta, const double phi) const {
0032       // There is no mass associated with this energy... We will
0033       // assume that the mass is 0 and proceed as if the energy
0034       // is the momentum.
0035       const double pt = e / cosh(eta);
0036       return math::XYZTLorentzVector(pt * cos(phi), pt * sin(phi), pt * sinh(eta), e);
0037     }
0038   };
0039 }  // namespace fftjetcms
0040
0041 #endif  // RecoJets_FFTJetAlgorithms_VBuilders_h```