Go to the documentation of this file.00001
00002
00003
00004 #ifndef PhysicsTools_PatAlgos_PATElectronProducer_h
00005 #define PhysicsTools_PatAlgos_PATElectronProducer_h
00006
00019 #include "FWCore/Framework/interface/EDProducer.h"
00020 #include "FWCore/Framework/interface/Event.h"
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022 #include "FWCore/Utilities/interface/InputTag.h"
00023 #include "DataFormats/Common/interface/View.h"
00024 #include "DataFormats/Common/interface/ValueMap.h"
00025 #include "DataFormats/Candidate/interface/CandAssociation.h"
00026
00027 #include "CommonTools/Utils/interface/PtComparator.h"
00028
00029 #include "PhysicsTools/PatAlgos/interface/MultiIsolator.h"
00030 #include "PhysicsTools/PatAlgos/interface/EfficiencyLoader.h"
00031 #include "PhysicsTools/PatAlgos/interface/KinResolutionsLoader.h"
00032
00033 #include "DataFormats/PatCandidates/interface/Electron.h"
00034
00035 #include "DataFormats/PatCandidates/interface/UserData.h"
00036 #include "PhysicsTools/PatAlgos/interface/PATUserDataHelper.h"
00037
00038 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
00039 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00040 #include "DataFormats/VertexReco/interface/Vertex.h"
00041
00042 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.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) override;
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 embedPflowSuperCluster_;
00074 bool embedSeedCluster_;
00075 bool embedBasicClusters_;
00076 bool embedPreshowerClusters_;
00077 bool embedPflowBasicClusters_;
00078 bool embedPflowPreshowerClusters_;
00079 bool embedTrack_;
00080 bool addGenMatch_;
00081 bool embedGenMatch_;
00082 bool embedRecHits_;
00083
00084 std::vector<edm::InputTag> genMatchSrc_;
00085
00087 bool useParticleFlow_;
00088 edm::InputTag pfElecSrc_;
00089 edm::InputTag pfCandidateMap_;
00090 bool embedPFCandidate_;
00091
00093 edm::InputTag reducedBarrelRecHitCollection_;
00094 edm::InputTag reducedEndcapRecHitCollection_;
00095
00097 bool embedHighLevelSelection_;
00098 edm::InputTag beamLineSrc_;
00099 bool usePV_;
00100 edm::InputTag pvSrc_;
00101
00102 typedef std::vector<edm::Handle<edm::Association<reco::GenParticleCollection> > > GenAssociations;
00103 typedef edm::RefToBase<reco::GsfElectron> ElectronBaseRef;
00104 typedef std::vector< edm::Handle< edm::ValueMap<IsoDeposit> > > IsoDepositMaps;
00105 typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
00106
00107
00109 void fillElectron( Electron& aElectron,
00110 const ElectronBaseRef& electronRef,
00111 const reco::CandidateBaseRef& baseRef,
00112 const GenAssociations& genMatches,
00113 const IsoDepositMaps& deposits,
00114 const bool pfId,
00115 const IsolationValueMaps& isolationValues,
00116 const IsolationValueMaps& isolationValuesNoPFId) const;
00117
00118 void fillElectron2( Electron& anElectron,
00119 const reco::CandidatePtr& candPtrForIsolation,
00120 const reco::CandidatePtr& candPtrForGenMatch,
00121 const reco::CandidatePtr& candPtrForLoader,
00122 const GenAssociations& genMatches,
00123 const IsoDepositMaps& deposits,
00124 const IsolationValueMaps& isolationValues ) const;
00125
00126
00127
00128 void embedHighLevel( pat::Electron & anElectron,
00129 reco::GsfTrackRef track,
00130 reco::TransientTrack & tt,
00131 reco::Vertex & primaryVertex,
00132 bool primaryVertexIsValid,
00133 reco::BeamSpot & beamspot,
00134 bool beamspotIsValid );
00135
00136 typedef std::pair<pat::IsolationKeys,edm::InputTag> IsolationLabel;
00137 typedef std::vector<IsolationLabel> IsolationLabels;
00138
00141 void readIsolationLabels( const edm::ParameterSet & iConfig,
00142 const char* psetName,
00143 IsolationLabels& labels);
00144
00145 bool addElecID_;
00146 typedef std::pair<std::string, edm::InputTag> NameTag;
00147 std::vector<NameTag> elecIDSrcs_;
00148
00149
00150 GreaterByPt<Electron> pTComparator_;
00151
00152 pat::helper::MultiIsolator isolator_;
00153 pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_;
00154 IsolationLabels isoDepositLabels_;
00155 IsolationLabels isolationValueLabels_;
00156 IsolationLabels isolationValueLabelsNoPFId_;
00157
00158 bool addEfficiencies_;
00159 pat::helper::EfficiencyLoader efficiencyLoader_;
00160
00161 bool addResolutions_;
00162 pat::helper::KinResolutionsLoader resolutionLoader_;
00163
00164 bool useUserData_;
00165 pat::PATUserDataHelper<pat::Electron> userDataHelper_;
00166
00167 const CaloTopology * ecalTopology_;
00168
00169 };
00170
00171
00172 }
00173
00174 #endif