CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoJets/FFTJetAlgorithms/interface/VBuilders.h

Go to the documentation of this file.
00001 //=========================================================================
00002 // VBuilders.h
00003 //
00004 // Functors for building various quantities from grid points. They are
00005 // intended for use with "KernelRecombinationAlg" or similar templated
00006 // classes.
00007 //
00008 // I. Volobouev
00009 // March 2010
00010 //=========================================================================
00011 
00012 #ifndef RecoJets_FFTJetAlgorithms_VBuilders_h
00013 #define RecoJets_FFTJetAlgorithms_VBuilders_h
00014 
00015 #include <cmath>
00016 
00017 #include "DataFormats/Math/interface/LorentzVector.h"
00018 
00019 namespace fftjetcms {
00020     struct PtEtaP4Builder
00021     {
00022         inline math::XYZTLorentzVector operator()(
00023             const double pt, const double eta, const double phi) const
00024             {
00025                 const double px = pt*cos(phi);
00026                 const double py = pt*sin(phi);
00027                 const double pz = pt*sinh(eta);
00028                 const double e = sqrt(px*px + py*py + pz*pz);
00029                 return math::XYZTLorentzVector(px, py, pz, e);
00030             }
00031     };
00032 
00033     struct EnergyEtaP4Builder
00034     {
00035         inline math::XYZTLorentzVector operator()(
00036             const double e, const double eta, const double phi) const
00037             {
00038                 // There is no mass associated with this energy... We will
00039                 // assume that the mass is 0 and proceed as if the energy
00040                 // is the momentum.
00041                 const double pt = e/cosh(eta);
00042                 return math::XYZTLorentzVector(
00043                     pt*cos(phi), pt*sin(phi), pt*sinh(eta), e);
00044             }
00045     };
00046 }
00047 
00048 #endif // RecoJets_FFTJetAlgorithms_VBuilders_h