00001 #ifndef PFCandIsolatorFromDeposits_H 00002 #define PFCandIsolatorFromDeposits_H 00003 00004 #include "FWCore/Framework/interface/EDProducer.h" 00005 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00006 00007 #include "DataFormats/TrackReco/interface/TrackFwd.h" 00008 #include "DataFormats/MuonReco/interface/MuonFwd.h" 00009 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" 00010 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h" 00011 #include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVeto.h" 00012 00013 #include "DataFormats/Candidate/interface/Candidate.h" 00014 #include "CommonTools/Utils/interface/StringObjectFunction.h" 00015 #include "DataFormats/Common/interface/OwnVector.h" 00016 00017 #include <string> 00018 00019 namespace edm { class Event; } 00020 namespace edm { class EventSetup; } 00021 00022 class PFCandIsolatorFromDeposits : public edm::EDProducer { 00023 00024 public: 00025 typedef edm::ValueMap<double> CandDoubleMap; 00026 00027 enum Mode { Sum, SumRelative, Sum2, Sum2Relative, Max, MaxRelative, Count, NearestDR }; 00028 PFCandIsolatorFromDeposits(const edm::ParameterSet&); 00029 00030 virtual ~PFCandIsolatorFromDeposits(); 00031 00032 virtual void produce(edm::Event&, const edm::EventSetup&); 00033 00034 private: 00035 class SingleDeposit { 00036 public: 00037 SingleDeposit(const edm::ParameterSet &) ; 00038 void cleanup() ; 00039 void open(const edm::Event &iEvent, const edm::EventSetup &iSetup) ; 00040 double compute(const reco::CandidateBaseRef &cand) ; 00041 const reco::IsoDepositMap & map() { return *hDeps_; } 00042 private: 00043 Mode mode_; 00044 edm::InputTag src_; 00045 double deltaR_; 00046 bool usesFunction_; 00047 double weight_; 00048 00049 StringObjectFunction<reco::Candidate> weightExpr_; 00050 reco::isodeposit::AbsVetos barrelVetos_; 00051 reco::isodeposit::AbsVetos endcapVetos_; 00052 reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice! 00053 bool skipDefaultVeto_; 00054 bool usePivotForBarrelEndcaps_; 00055 edm::Handle<reco::IsoDepositMap> hDeps_; // transient 00056 00057 bool isNumber(const std::string &str) const ; 00058 double toNumber(const std::string &str) const ; 00059 }; 00060 // datamembers 00061 std::vector<SingleDeposit> sources_; 00062 00063 00064 00065 }; 00066 #endif