Go to the documentation of this file.00001 #ifndef RecoParticleFlow_PFProducer_PFElectronTranslator_H
00002 #define RecoParticleFlow_PFProducer_PFElectronTranslator_H
00003 #include "FWCore/Framework/interface/EDProducer.h"
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementFwd.h"
00008 #include "DataFormats/Common/interface/ValueMap.h"
00009 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00010 #include "DataFormats/EgammaReco/interface/PreshowerClusterFwd.h"
00011 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00012 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00013 #include "DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h"
00014 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
00015 #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
00016 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
00017 #include <iostream>
00018 #include <string>
00019 #include <map>
00020
00021
00022
00023 class PFElectronTranslator : public edm::EDProducer
00024 {
00025 public:
00026 explicit PFElectronTranslator(const edm::ParameterSet&);
00027 ~PFElectronTranslator();
00028
00029 virtual void produce(edm::Event &, const edm::EventSetup&);
00030 virtual void beginRun(edm::Run & run,const edm::EventSetup & c);
00031
00032 typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
00033
00034
00035 private:
00036
00037 bool fetchCandidateCollection(edm::Handle<reco::PFCandidateCollection>& c,
00038 const edm::InputTag& tag,
00039 const edm::Event& iEvent) const;
00040
00041 void fetchGsfCollection(edm::Handle<reco::GsfTrackCollection>& c,
00042 const edm::InputTag& tag,
00043 const edm::Event& iEvent) const ;
00044
00045
00046
00047 void createBasicCluster(const reco::PFBlockElement & , reco::BasicClusterCollection & basicClusters,
00048 std::vector<const reco::PFCluster *> &,
00049 const reco::PFCandidate & coCandidate) const;
00050
00051 void createPreshowerCluster(const reco::PFBlockElement & PFBE,
00052 reco::PreshowerClusterCollection& preshowerClusters,
00053 unsigned plane) const;
00054
00055
00056 void createSuperClusters(const reco::PFCandidateCollection &,
00057 reco::SuperClusterCollection &superClusters) const;
00058
00059
00060 void createGsfElectronCores(reco::GsfElectronCoreCollection &) const;
00061
00062
00063 void createBasicClusterPtrs(const edm::OrphanHandle<reco::BasicClusterCollection> & basicClustersHandle );
00064
00065
00066 void createPreshowerClusterPtrs(const edm::OrphanHandle<reco::PreshowerClusterCollection> & preshowerClustersHandle );
00067
00068
00069 void createSuperClusterGsfMapRefs(const edm::OrphanHandle<reco::SuperClusterCollection> & superClustersHandle );
00070
00071
00072 void createGsfElectronCoreRefs(const edm::OrphanHandle<reco::GsfElectronCoreCollection> & gsfElectronCoreHandle);
00073
00074
00075 void createGsfElectrons(const reco::PFCandidateCollection &,
00076 const IsolationValueMaps& isolationValues,
00077 reco::GsfElectronCollection &);
00078
00079
00080 void fillMVAValueMap(edm::Event& iEvent, edm::ValueMap<float>::Filler & filler) ;
00081 void fillValueMap(edm::Event& iEvent, edm::ValueMap<float>::Filler & filler) const;
00082 void fillSCRefValueMap(edm::Event& iEvent,
00083 edm::ValueMap<reco::SuperClusterRef>::Filler & filler) const;
00084 void getAmbiguousGsfTracks(const reco::PFBlockElement & PFBE, std::vector<reco::GsfTrackRef>& ) const ;
00085
00086
00087 const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate & cand, const reco::PFBlockElement & pfbe) const;
00088 private:
00089 edm::InputTag inputTagPFCandidates_;
00090 edm::InputTag inputTagPFCandidateElectrons_;
00091 edm::InputTag inputTagGSFTracks_;
00092 std::vector<edm::InputTag> inputTagIsoVals_;
00093 std::string PFBasicClusterCollection_;
00094 std::string PFPreshowerClusterCollection_;
00095 std::string PFSuperClusterCollection_;
00096 std::string PFMVAValueMap_;
00097 std::string PFSCValueMap_;
00098 std::string GsfElectronCoreCollection_;
00099 std::string GsfElectronCollection_;
00100 double MVACut_;
00101
00102
00103
00104 std::vector<reco::GsfTrackRef> GsfTrackRef_;
00105
00106 std::vector<reco::CandidatePtr> CandidatePtr_;
00107
00108 std::vector<reco::TrackRef> kfTrackRef_;
00109
00110 std::vector<std::vector<reco::GsfTrackRef> > ambiguousGsfTracks_;
00111
00112 std::vector<reco::BasicClusterCollection> basicClusters_;
00113
00114 std::vector<std::vector<const reco::PFCluster *> > pfClusters_;
00115
00116 std::vector<reco::PreshowerClusterCollection> preshowerClusters_;
00117
00118 std::vector<reco::SuperClusterCollection> superClusters_;
00119
00120 std::vector<reco::CaloClusterPtrVector> basicClusterPtr_;
00121
00122 std::vector<reco::CaloClusterPtrVector> preshowerClusterPtr_;
00123
00124 std::vector<reco::GsfElectronCoreRef> gsfElectronCoreRefs_;
00125
00126 std::vector<int> gsfPFCandidateIndex_;
00127
00128 std::map<reco::GsfTrackRef,reco::SuperClusterRef> scMap_;
00129 std::map<reco::GsfTrackRef,float> gsfMvaMap_;
00130
00131 bool emptyIsOk_;
00132
00133 };
00134 #endif