CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/RecoJets/FFTJetAlgorithms/interface/jetConverters.h

Go to the documentation of this file.
00001 #ifndef RecoJets_FFTJetAlgorithms_jetConverters_h
00002 #define RecoJets_FFTJetAlgorithms_jetConverters_h
00003 
00004 #include "fftjet/RecombinedJet.hh"
00005 
00006 #include "DataFormats/JetReco/interface/FFTJet.h"
00007 #include "RecoJets/FFTJetAlgorithms/interface/fftjetTypedefs.h"
00008 
00009 namespace fftjetcms {
00010     // The function below makes a storable FFTJet
00011     template<class Real>
00012     reco::FFTJet<Real> jetToStorable(
00013         const fftjet::RecombinedJet<VectorLike>& jet);
00014 
00015     // The function below restores the original RecombinedJet object
00016     template<class Real>
00017     fftjet::RecombinedJet<VectorLike> jetFromStorable(
00018         const reco::FFTJet<Real>& jet);
00019 }
00020 
00022 //
00023 //  Implementation follows
00024 //
00026 
00027 namespace fftjetcms {
00028     template<class Real>
00029     reco::FFTJet<Real> jetToStorable(
00030         const fftjet::RecombinedJet<VectorLike>& jet)
00031     {
00032         typedef reco::PattRecoPeak<Real> StoredPeak;
00033 
00034         double hessian[3] = {0., 0., 0.};
00035         const fftjet::Peak& peak(jet.precluster());
00036         peak.hessian(hessian);
00037 
00038         return reco::FFTJet<Real>(StoredPeak(peak.eta(),
00039                                              peak.phi(),
00040                                              peak.magnitude(),
00041                                              hessian,
00042                                              peak.driftSpeed(),
00043                                              peak.magSpeed(),
00044                                              peak.lifetime(),
00045                                              peak.scale(),
00046                                              peak.nearestNeighborDistance(),
00047                                              peak.clusterRadius(),
00048                                              peak.clusterSeparation()),
00049                                   jet.vec(), jet.ncells(), jet.etSum(),
00050                                   jet.centroidEta(), jet.centroidPhi(),
00051                                   jet.etaWidth(), jet.phiWidth(),
00052                                   jet.etaPhiCorr(), jet.fuzziness(),
00053                                   jet.convergenceDistance(),
00054                                   jet.recoScale(), jet.recoScaleRatio(),
00055                                   jet.membershipFactor(),
00056                                   jet.code(), jet.status());
00057     }
00058 
00059 
00060     template<class Real>
00061     fftjet::RecombinedJet<VectorLike> jetFromStorable(
00062         const reco::FFTJet<Real>& jet)
00063     {
00064         typedef reco::PattRecoPeak<Real> StoredPeak;
00065         typedef fftjet::RecombinedJet<VectorLike> RecoFFTJet;
00066 
00067         double hessian[3] = {0., 0., 0.};
00068         const StoredPeak& p(jet.f_precluster());
00069         p.hessian(hessian);
00070         const double pileupPt = jet.f_pileup().Pt();
00071 
00072         return RecoFFTJet(fftjet::Peak(p.eta(), p.phi(), p.magnitude(),
00073                                        hessian, p.driftSpeed(),
00074                                        p.magSpeed(), p.lifetime(),
00075                                        p.scale(), p.nearestNeighborDistance(),
00076                                        jet.f_membershipFactor(),
00077                                        jet.f_recoScale(),
00078                                        jet.f_recoScaleRatio(),
00079                                        p.clusterRadius(),
00080                                        p.clusterSeparation(), jet.f_code(),
00081                                        jet.f_status()),
00082                           jet.f_vec(), jet.f_ncells(), jet.f_etSum(),
00083                           jet.f_centroidEta(), jet.f_centroidPhi(),
00084                           jet.f_etaWidth(), jet.f_phiWidth(),
00085                           jet.f_etaPhiCorr(), jet.f_fuzziness(),
00086                           pileupPt, 0.0, jet.f_convergenceDistance());
00087     }
00088 }
00089 
00090 #endif // RecoJets_FFTJetAlgorithms_jetConverters_h