Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef PhysicsTools_PatAlgos_PATElectronProducer_h
00006 #define PhysicsTools_PatAlgos_PATElectronProducer_h
00007
00020 #include "FWCore/Framework/interface/EDProducer.h"
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00023 #include "FWCore/Utilities/interface/InputTag.h"
00024 #include "DataFormats/Common/interface/View.h"
00025 #include "DataFormats/Common/interface/ValueMap.h"
00026 #include "DataFormats/Candidate/interface/CandAssociation.h"
00027
00028 #include "CommonTools/Utils/interface/PtComparator.h"
00029
00030 #include "PhysicsTools/PatAlgos/interface/MultiIsolator.h"
00031 #include "PhysicsTools/PatAlgos/interface/EfficiencyLoader.h"
00032 #include "PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h"
00033
00034 #include "DataFormats/PatCandidates/interface/Electron.h"
00035
00036 #include "DataFormats/PatCandidates/interface/UserData.h"
00037 #include "PhysicsTools/PatAlgos/interface/PATUserDataHelper.h"
00038
00039 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
00040
00041 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00042 #include "DataFormats/VertexReco/interface/Vertex.h"
00043
00044 #include <string>
00045
00046
00047 namespace pat {
00048
00049
00050 class TrackerIsolationPt;
00051 class CaloIsolationEnergy;
00052 class LeptonLRCalc;
00053
00054
00055 class PATElectronProducer : public edm::EDProducer {
00056
00057 public:
00058
00059 explicit PATElectronProducer(const edm::ParameterSet & iConfig);
00060 ~PATElectronProducer();
00061
00062 virtual void produce(edm::Event & iEvent, const edm::EventSetup & iSetup);
00063
00064 static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
00065
00066 private:
00067
00068
00069 edm::InputTag electronSrc_;
00070 bool embedGsfElectronCore_;
00071 bool embedGsfTrack_;
00072 bool embedSuperCluster_;
00073 bool embedTrack_;
00074 bool addGenMatch_;
00075 bool embedGenMatch_;
00076 std::vector<edm::InputTag> genMatchSrc_;
00077
00079 bool useParticleFlow_;
00080 edm::InputTag pfElecSrc_;
00081 edm::InputTag pfCandidateMap_;
00082 bool embedPFCandidate_;
00083
00085 bool embedHighLevelSelection_;
00086 edm::InputTag beamLineSrc_;
00087 bool usePV_;
00088 edm::InputTag pvSrc_;
00089
00090 typedef std::vector<edm::Handle<edm::Association<reco::GenParticleCollection> > > GenAssociations;
00091 typedef edm::RefToBase<reco::GsfElectron> ElectronBaseRef;
00092 typedef std::vector< edm::Handle< edm::ValueMap<IsoDeposit> > > IsoDepositMaps;
00093 typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
00094
00095
00097 void fillElectron( Electron& aElectron,
00098 const ElectronBaseRef& electronRef,
00099 const reco::CandidateBaseRef& baseRef,
00100 const GenAssociations& genMatches,
00101 const IsoDepositMaps& deposits,
00102 const bool pfId,
00103 const IsolationValueMaps& isolationValues,
00104 const IsolationValueMaps& isolationValuesNoPFId) const;
00105
00106 void fillElectron2( Electron& anElectron,
00107 const reco::CandidatePtr& candPtrForIsolation,
00108 const reco::CandidatePtr& candPtrForGenMatch,
00109 const reco::CandidatePtr& candPtrForLoader,
00110 const GenAssociations& genMatches,
00111 const IsoDepositMaps& deposits,
00112 const IsolationValueMaps& isolationValues ) const;
00113
00114
00115
00116 void embedHighLevel( pat::Electron & anElectron,
00117 reco::GsfTrackRef track,
00118 reco::TransientTrack & tt,
00119 reco::Vertex & primaryVertex,
00120 bool primaryVertexIsValid,
00121 reco::BeamSpot & beamspot,
00122 bool beamspotIsValid );
00123
00124 typedef std::pair<pat::IsolationKeys,edm::InputTag> IsolationLabel;
00125 typedef std::vector<IsolationLabel> IsolationLabels;
00126
00129 void readIsolationLabels( const edm::ParameterSet & iConfig,
00130 const char* psetName,
00131 IsolationLabels& labels);
00132
00133 bool addElecID_;
00134 typedef std::pair<std::string, edm::InputTag> NameTag;
00135 std::vector<NameTag> elecIDSrcs_;
00136
00137
00138 GreaterByPt<Electron> pTComparator_;
00139
00140 pat::helper::MultiIsolator isolator_;
00141 pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_;
00142 IsolationLabels isoDepositLabels_;
00143 IsolationLabels isolationValueLabels_;
00144 IsolationLabels isolationValueLabelsNoPFId_;
00145
00146 bool addEfficiencies_;
00147 pat::helper::EfficiencyLoader efficiencyLoader_;
00148
00149 bool addResolutions_;
00150 pat::helper::KinResolutionsLoader resolutionLoader_;
00151
00152 bool useUserData_;
00153 pat::PATUserDataHelper<pat::Electron> userDataHelper_;
00154
00155
00156 };
00157
00158
00159 }
00160
00161 #endif