00001 #ifndef RecoAlgos_TrackToRefCandidate_h 00002 #define RecoAlgos_TrackToRefCandidate_h 00003 #include "CommonTools/RecoAlgos/src/MassiveCandidateConverter.h" 00004 #include "CommonTools/RecoAlgos/src/CandidateProducer.h" 00005 #include "DataFormats/TrackReco/interface/Track.h" 00006 #include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h" 00007 #include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidateFwd.h" 00008 #include "DataFormats/Candidate/interface/CandidateFwd.h" 00009 00010 namespace converter { 00011 00012 struct TrackToRefCandidate : public MassiveCandidateConverter { 00013 typedef reco::Track value_type; 00014 typedef reco::TrackCollection Components; 00015 typedef reco::RecoChargedRefCandidate Candidate; 00016 TrackToRefCandidate(const edm::ParameterSet & cfg) : 00017 MassiveCandidateConverter(cfg) { 00018 } 00019 void convert(reco::TrackRef trkRef, reco::RecoChargedRefCandidate & c) const { 00020 c = reco::RecoChargedRefCandidate( trkRef, sqrt(massSqr_) ); 00021 } 00022 }; 00023 00024 namespace helper { 00025 template<> 00026 struct CandConverter<reco::Track> { 00027 typedef TrackToRefCandidate type; 00028 }; 00029 } 00030 00031 } 00032 00033 #endif