ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DGele/PhysicsTools/RecoAlgos/src/StandAloneMuonTrackToCandidate.h
Revision: 1.1
Committed: Tue Oct 20 17:15:15 2009 UTC (15 years, 6 months ago) by dgele
Content type: text/plain
Branch: MAIN
Branch point for: ANA
Log Message:
Initial revision

File Contents

# User Rev Content
1 dgele 1.1 #ifndef RecoAlgos_StandAloneMuonTrackToCandidate_h
2     #define RecoAlgos_StandAloneMuonTrackToCandidate_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/RecoStandAloneMuonCandidate.h"
7     #include "DataFormats/RecoCandidate/interface/RecoStandAloneMuonCandidateFwd.h"
8     #include "DataFormats/Candidate/interface/CandidateFwd.h"
9    
10     namespace converter {
11    
12     struct StandAloneMuonTrackToCandidate : public MassiveCandidateConverter {
13     typedef reco::Track value_type;
14     typedef reco::TrackCollection Components;
15     typedef reco::RecoStandAloneMuonCandidate Candidate;
16     StandAloneMuonTrackToCandidate(const edm::ParameterSet & cfg) :
17     MassiveCandidateConverter(cfg) {
18     }
19     void convert(reco::TrackRef trkRef, reco::RecoStandAloneMuonCandidate & 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 StandAloneMuonTrackToCandidate type;
35     };
36     }
37    
38     }
39    
40     #endif