CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h

Go to the documentation of this file.
00001 #ifndef MuonIsolationProducers_CandIsolatorFromDeposits_H
00002 #define MuonIsolationProducers_CandIsolatorFromDeposits_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 CandIsolatorFromDeposits : 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   CandIsolatorFromDeposits(const edm::ParameterSet&);
00029 
00030   virtual ~CandIsolatorFromDeposits();
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         StringObjectFunction<reco::Candidate> weightExpr_;
00049         reco::isodeposit::AbsVetos vetos_;
00050         reco::isodeposit::EventDependentAbsVetos evdepVetos_; // note: these are a subset of the above. Don't delete twice!
00051         bool   skipDefaultVeto_; 
00052         edm::Handle<reco::IsoDepositMap> hDeps_; // transient
00053   };
00054   // datamembers
00055   std::vector<SingleDeposit> sources_;
00056 
00057 };
00058 #endif