CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/PhysicsTools/PatAlgos/plugins/PATElectronProducer.h

Go to the documentation of this file.
00001 //
00002 // $Id: PATElectronProducer.h,v 1.25.2.1 2011/07/05 16:25:28 bellan Exp $
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       // configurables
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 linkToPFSource_;  //SAK
00081       edm::InputTag pfElecSrc_;
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 IsolationValueMaps& isolationValues) const;
00103 
00104       void fillElectron2( Electron& anElectron,
00105                           const reco::CandidatePtr& candPtrForIsolation,
00106                           const reco::CandidatePtr& candPtrForGenMatch,
00107                           const reco::CandidatePtr& candPtrForLoader,
00108                           const GenAssociations& genMatches,
00109                           const IsoDepositMaps& deposits,
00110                           const IsolationValueMaps& isolationValues ) const;
00111 
00112     // embed various impact parameters with errors
00113     // embed high level selection
00114     void embedHighLevel( pat::Electron & anElectron,
00115                          reco::GsfTrackRef track,
00116                          reco::TransientTrack & tt,
00117                          reco::Vertex & primaryVertex,
00118                          bool primaryVertexIsValid,
00119                          reco::BeamSpot & beamspot,
00120                          bool beamspotIsValid );
00121 
00122       typedef std::pair<pat::IsolationKeys,edm::InputTag> IsolationLabel;
00123       typedef std::vector<IsolationLabel> IsolationLabels;
00124 
00127       void readIsolationLabels( const edm::ParameterSet & iConfig,
00128                                 const char* psetName,
00129                                 IsolationLabels& labels);
00130 
00131       bool          addElecID_;
00132       typedef std::pair<std::string, edm::InputTag> NameTag;
00133       std::vector<NameTag> elecIDSrcs_;
00134 
00135       // tools
00136       GreaterByPt<Electron>       pTComparator_;
00137 
00138       pat::helper::MultiIsolator isolator_;
00139       pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_; // better here than recreate at each event
00140       IsolationLabels isoDepositLabels_;
00141       IsolationLabels isolationValueLabels_;
00142 
00143       bool addEfficiencies_;
00144       pat::helper::EfficiencyLoader efficiencyLoader_;
00145 
00146       bool addResolutions_;
00147       pat::helper::KinResolutionsLoader resolutionLoader_;
00148 
00149       bool useUserData_;
00150       pat::PATUserDataHelper<pat::Electron>      userDataHelper_;
00151 
00152 
00153   };
00154 
00155 
00156 }
00157 
00158 #endif