File indexing completed on 2024-04-06 12:01:10
0001 #ifndef RecoAlgos_SuperClusterToCandidate_h
0002 #define RecoAlgos_SuperClusterToCandidate_h
0003 #include "CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h"
0004 #include "CommonTools/RecoAlgos/interface/CandidateProducer.h"
0005 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0006 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
0007 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
0008 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0009
0010 namespace converter {
0011 struct SuperClusterToCandidate : public MassiveCandidateConverter {
0012 typedef reco::SuperCluster value_type;
0013 typedef reco::SuperClusterCollection Components;
0014 typedef reco::RecoEcalCandidate Candidate;
0015 SuperClusterToCandidate(const edm::ParameterSet& cfg, edm::ConsumesCollector iC)
0016 : MassiveCandidateConverter(cfg, iC) {}
0017 void convert(reco::SuperClusterRef scRef, reco::RecoEcalCandidate& c) const {
0018 const reco::SuperCluster& sc = *scRef;
0019 math::XYZPoint v(0, 0, 0);
0020 math::XYZVector p = sc.energy() * (sc.position() - v).unit();
0021 double t = sqrt(massSqr_ + p.mag2());
0022 c.setCharge(0);
0023 c.setVertex(v);
0024 c.setP4(reco::Candidate::LorentzVector(p.x(), p.y(), p.z(), t));
0025 c.setSuperCluster(scRef);
0026 c.setPdgId(particle_.pdgId());
0027 }
0028 };
0029
0030 namespace helper {
0031 template <>
0032 struct CandConverter<reco::SuperCluster> {
0033 typedef SuperClusterToCandidate type;
0034 };
0035 }
0036 }
0037
0038 #endif