ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DGele/PhysicsTools/RecoAlgos/src/SuperClusterToCandidate.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_SuperClusterToCandidate_h
2     #define RecoAlgos_SuperClusterToCandidate_h
3     #include "PhysicsTools/RecoAlgos/src/MassiveCandidateConverter.h"
4     #include "PhysicsTools/RecoAlgos/src/CandidateProducer.h"
5     #include "DataFormats/EgammaReco/interface/SuperCluster.h"
6     #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
7     #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
8     #include "DataFormats/Candidate/interface/CandidateFwd.h"
9    
10     namespace converter {
11     struct SuperClusterToCandidate : public MassiveCandidateConverter {
12     typedef reco::SuperCluster value_type;
13     typedef reco::SuperClusterCollection Components;
14     typedef reco::RecoEcalCandidate Candidate;
15     SuperClusterToCandidate(const edm::ParameterSet & cfg) :
16     MassiveCandidateConverter(cfg) {
17     }
18     void convert(reco::SuperClusterRef scRef, reco::RecoEcalCandidate & c) const {
19     const reco::SuperCluster & sc = * scRef;
20     math::XYZPoint v(0, 0, 0); // this should be taken from something else...
21     math::XYZVector p = sc.energy() * (sc.position() - v).unit();
22     double t = sqrt(massSqr_ + p.mag2());
23     c.setCharge(0);
24     c.setVertex(v);
25     c.setP4(reco::Candidate::LorentzVector(p.x(), p.y(), p.z(), t));
26     c.setSuperCluster(scRef);
27     c.setPdgId(particle_.pdgId());
28     }
29     };
30    
31     namespace helper {
32     template<>
33     struct CandConverter<reco::SuperCluster> {
34     typedef SuperClusterToCandidate type;
35     };
36     }
37     }
38    
39     #endif