File indexing completed on 2024-04-06 12:25:21
0001 #ifndef RecoJets_FFTJetAlgorithms_jetConverters_h
0002 #define RecoJets_FFTJetAlgorithms_jetConverters_h
0003
0004 #include "fftjet/RecombinedJet.hh"
0005
0006 #include "DataFormats/JetReco/interface/FFTJet.h"
0007 #include "RecoJets/FFTJetAlgorithms/interface/fftjetTypedefs.h"
0008
0009 namespace fftjetcms {
0010
0011 template <class Real>
0012 reco::FFTJet<Real> jetToStorable(const fftjet::RecombinedJet<VectorLike>& jet);
0013
0014
0015 template <class Real>
0016 fftjet::RecombinedJet<VectorLike> jetFromStorable(const reco::FFTJet<Real>& jet);
0017 }
0018
0019
0020
0021
0022
0023
0024
0025 namespace fftjetcms {
0026 template <class Real>
0027 reco::FFTJet<Real> jetToStorable(const fftjet::RecombinedJet<VectorLike>& jet) {
0028 typedef reco::PattRecoPeak<Real> StoredPeak;
0029
0030 double hessian[3] = {0., 0., 0.};
0031 const fftjet::Peak& peak(jet.precluster());
0032 peak.hessian(hessian);
0033
0034 return reco::FFTJet<Real>(StoredPeak(peak.eta(),
0035 peak.phi(),
0036 peak.magnitude(),
0037 hessian,
0038 peak.driftSpeed(),
0039 peak.magSpeed(),
0040 peak.lifetime(),
0041 peak.scale(),
0042 peak.nearestNeighborDistance(),
0043 peak.clusterRadius(),
0044 peak.clusterSeparation(),
0045 peak.splitTime(),
0046 peak.mergeTime()),
0047 jet.vec(),
0048 jet.ncells(),
0049 jet.etSum(),
0050 jet.centroidEta(),
0051 jet.centroidPhi(),
0052 jet.etaWidth(),
0053 jet.phiWidth(),
0054 jet.etaPhiCorr(),
0055 jet.fuzziness(),
0056 jet.convergenceDistance(),
0057 jet.recoScale(),
0058 jet.recoScaleRatio(),
0059 jet.membershipFactor(),
0060 jet.code(),
0061 jet.status());
0062 }
0063
0064 template <class Real>
0065 fftjet::RecombinedJet<VectorLike> jetFromStorable(const reco::FFTJet<Real>& jet) {
0066 typedef reco::PattRecoPeak<Real> StoredPeak;
0067 typedef fftjet::RecombinedJet<VectorLike> RecoFFTJet;
0068
0069 double hessian[3] = {0., 0., 0.};
0070 const StoredPeak& p(jet.f_precluster());
0071 p.hessian(hessian);
0072 const double pileupPt = jet.f_pileup().Pt();
0073
0074 fftjet::Peak peak(p.eta(),
0075 p.phi(),
0076 p.magnitude(),
0077 hessian,
0078 p.driftSpeed(),
0079 p.magSpeed(),
0080 p.lifetime(),
0081 p.scale(),
0082 p.nearestNeighborDistance(),
0083 jet.f_membershipFactor(),
0084 jet.f_recoScale(),
0085 jet.f_recoScaleRatio(),
0086 p.clusterRadius(),
0087 p.clusterSeparation(),
0088 jet.f_code(),
0089 jet.f_status());
0090 peak.setSplitTime(p.splitTime());
0091 peak.setMergeTime(p.mergeTime());
0092
0093 return RecoFFTJet(peak,
0094 jet.f_vec(),
0095 jet.f_ncells(),
0096 jet.f_etSum(),
0097 jet.f_centroidEta(),
0098 jet.f_centroidPhi(),
0099 jet.f_etaWidth(),
0100 jet.f_phiWidth(),
0101 jet.f_etaPhiCorr(),
0102 jet.f_fuzziness(),
0103 pileupPt,
0104 0.0,
0105 jet.f_convergenceDistance());
0106 }
0107 }
0108
0109 #endif