ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DGele/PhysicsTools/RecoAlgos/src/TrackToCandidate.h
Revision: 1.1.1.1 (vendor branch)
Committed: Tue Oct 20 17:15:15 2009 UTC (15 years, 6 months ago) by dgele
Content type: text/plain
Branch: ANA
CVS Tags: start
Changes since 1.1: +0 -0 lines
Error occurred while calculating annotation data.
Log Message:
version CMSSW_2_2_10

File Contents

# Content
1 #ifndef RecoAlgos_TrackToCandidate_h
2 #define RecoAlgos_TrackToCandidate_h
3 #include "PhysicsTools/RecoAlgos/src/MassiveCandidateConverter.h"
4 #include "PhysicsTools/RecoAlgos/src/CandidateProducer.h"
5 #include "DataFormats/TrackReco/interface/Track.h"
6 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
7 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h"
8 #include "DataFormats/Candidate/interface/CandidateFwd.h"
9
10 namespace converter {
11
12 struct TrackToCandidate : public MassiveCandidateConverter {
13 typedef reco::Track value_type;
14 typedef reco::TrackCollection Components;
15 typedef reco::RecoChargedCandidate Candidate;
16 TrackToCandidate(const edm::ParameterSet & cfg) :
17 MassiveCandidateConverter(cfg) {
18 }
19 void convert(reco::TrackRef trkRef, reco::RecoChargedCandidate & c) const {
20 const reco::Track & trk = * trkRef;
21 c.setCharge(trk.charge());
22 c.setVertex(trk.vertex());
23 reco::Track::Vector p = trk.momentum();
24 double t = sqrt(massSqr_ + p.mag2());
25 c.setP4(reco::Candidate::LorentzVector(p.x(), p.y(), p.z(), t));
26 c.setTrack(trkRef);
27 c.setPdgId(particle_.pdgId());
28 }
29 };
30
31 namespace helper {
32 template<>
33 struct CandConverter<reco::Track> {
34 typedef TrackToCandidate type;
35 };
36 }
37
38 }
39
40 #endif