CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/PhysicsTools/PatAlgos/plugins/PATElectronProducer.h

Go to the documentation of this file.
00001 //
00002 // $Id: PATElectronProducer.h,v 1.30 2012/10/02 22:19:13 beaudett 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 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00041 #include "DataFormats/VertexReco/interface/Vertex.h"
00042 
00043 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00044 
00045 #include <string>
00046 
00047 
00048 namespace pat {
00049 
00050 
00051   class TrackerIsolationPt;
00052   class CaloIsolationEnergy;
00053   class LeptonLRCalc;
00054 
00055 
00056   class PATElectronProducer : public edm::EDProducer {
00057 
00058     public:
00059 
00060       explicit PATElectronProducer(const edm::ParameterSet & iConfig);
00061       ~PATElectronProducer();
00062 
00063       virtual void produce(edm::Event & iEvent, const edm::EventSetup & iSetup);
00064 
00065       static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
00066 
00067     private:
00068 
00069       // configurables
00070       edm::InputTag electronSrc_;
00071       bool          embedGsfElectronCore_;
00072       bool          embedGsfTrack_;
00073       bool          embedSuperCluster_;
00074       bool          embedSeedCluster_;
00075       bool          embedTrack_;
00076       bool          addGenMatch_;
00077       bool          embedGenMatch_;
00078       bool          embedRecHits_;
00079       
00080       std::vector<edm::InputTag> genMatchSrc_;
00081 
00083       bool          useParticleFlow_;
00084       edm::InputTag pfElecSrc_;
00085       edm::InputTag pfCandidateMap_;
00086       bool          embedPFCandidate_;
00087 
00089       edm::InputTag reducedBarrelRecHitCollection_;
00090       edm::InputTag reducedEndcapRecHitCollection_;
00091  
00093       bool          embedHighLevelSelection_;
00094       edm::InputTag beamLineSrc_;
00095       bool          usePV_;
00096       edm::InputTag pvSrc_;
00097 
00098       typedef std::vector<edm::Handle<edm::Association<reco::GenParticleCollection> > > GenAssociations;
00099       typedef edm::RefToBase<reco::GsfElectron> ElectronBaseRef;
00100       typedef std::vector< edm::Handle< edm::ValueMap<IsoDeposit> > > IsoDepositMaps;
00101       typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
00102 
00103 
00105       void fillElectron( Electron& aElectron,
00106                          const ElectronBaseRef& electronRef,
00107                          const reco::CandidateBaseRef& baseRef,
00108                          const GenAssociations& genMatches,
00109                          const IsoDepositMaps& deposits,
00110                          const bool pfId,
00111                          const IsolationValueMaps& isolationValues,
00112                          const IsolationValueMaps& isolationValuesNoPFId) const;
00113 
00114       void fillElectron2( Electron& anElectron,
00115                           const reco::CandidatePtr& candPtrForIsolation,
00116                           const reco::CandidatePtr& candPtrForGenMatch,
00117                           const reco::CandidatePtr& candPtrForLoader,
00118                           const GenAssociations& genMatches,
00119                           const IsoDepositMaps& deposits,
00120                           const IsolationValueMaps& isolationValues ) const;
00121 
00122     // embed various impact parameters with errors
00123     // embed high level selection
00124     void embedHighLevel( pat::Electron & anElectron,
00125                          reco::GsfTrackRef track,
00126                          reco::TransientTrack & tt,
00127                          reco::Vertex & primaryVertex,
00128                          bool primaryVertexIsValid,
00129                          reco::BeamSpot & beamspot,
00130                          bool beamspotIsValid );
00131 
00132       typedef std::pair<pat::IsolationKeys,edm::InputTag> IsolationLabel;
00133       typedef std::vector<IsolationLabel> IsolationLabels;
00134 
00137       void readIsolationLabels( const edm::ParameterSet & iConfig,
00138                                 const char* psetName,
00139                                 IsolationLabels& labels);
00140 
00141       bool          addElecID_;
00142       typedef std::pair<std::string, edm::InputTag> NameTag;
00143       std::vector<NameTag> elecIDSrcs_;
00144 
00145       // tools
00146       GreaterByPt<Electron>       pTComparator_;
00147 
00148       pat::helper::MultiIsolator isolator_;
00149       pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_; // better here than recreate at each event
00150       IsolationLabels isoDepositLabels_;
00151       IsolationLabels isolationValueLabels_;
00152       IsolationLabels isolationValueLabelsNoPFId_;
00153 
00154       bool addEfficiencies_;
00155       pat::helper::EfficiencyLoader efficiencyLoader_;
00156 
00157       bool addResolutions_;
00158       pat::helper::KinResolutionsLoader resolutionLoader_;
00159 
00160       bool useUserData_;
00161       pat::PATUserDataHelper<pat::Electron>      userDataHelper_;
00162 
00163       const CaloTopology * ecalTopology_;
00164 
00165   };
00166 
00167 
00168 }
00169 
00170 #endif