CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/PhysicsTools/PatAlgos/interface/OverlapTest.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_PatAlgos_interface_OverlapTest_h
00002 #define PhysicsTools_PatAlgos_interface_OverlapTest_h
00003 
00004 #include "FWCore/Framework/interface/Event.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "FWCore/Utilities/interface/InputTag.h"
00007 
00008 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00009 #include "DataFormats/Candidate/interface/Candidate.h"
00010 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00011 #include "PhysicsTools/PatUtils/interface/StringParserTools.h"
00012 #include "PhysicsTools/PatUtils/interface/PATDiObjectProxy.h"
00013 
00014 namespace pat { namespace helper {
00015 
00016 // Base class for a test for overlaps
00017 class OverlapTest {
00018     public:
00020         OverlapTest(const std::string &name, const edm::ParameterSet &iConfig) :
00021             src_(iConfig.getParameter<edm::InputTag>("src")),
00022             name_(name),
00023             requireNoOverlaps_(iConfig.getParameter<bool>("requireNoOverlaps")) {}
00025         virtual ~OverlapTest() {}
00027         virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) = 0;
00030         virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const = 0;
00032         virtual void done() {}
00033         // -- basic getters ---
00034        
00035         const std::string & name() const { return name_; }
00036         bool requireNoOverlaps() const { return requireNoOverlaps_; } 
00037     protected:
00038         edm::InputTag src_;
00039         std::string   name_;
00040         bool          requireNoOverlaps_;
00041 };
00042 
00043 class BasicOverlapTest : public OverlapTest {
00044     public:
00045         BasicOverlapTest(const std::string &name, const edm::ParameterSet &iConfig) :
00046             OverlapTest(name, iConfig),
00047             presel_(iConfig.getParameter<std::string>("preselection")),
00048             deltaR_(iConfig.getParameter<double>("deltaR")),
00049             checkRecoComponents_(iConfig.getParameter<bool>("checkRecoComponents")),
00050             pairCut_(iConfig.getParameter<std::string>("pairCut")) {}
00051         // implementation of mother methods
00053         virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) ;
00055         virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const ;
00056     protected:
00057         // ---- configurables ----
00059         PATStringCutObjectSelector presel_;
00061         double deltaR_;
00063         bool checkRecoComponents_;
00065         StringCutObjectSelector<pat::DiObjectProxy> pairCut_;
00066         // ---- working variables ----
00068         edm::Handle<reco::CandidateView> candidates_;
00070         std::vector<bool> isPreselected_;
00071 };
00072 
00073 class OverlapBySuperClusterSeed : public OverlapTest {
00074     public:
00075         // constructor: nothing except initialize the base class
00076         OverlapBySuperClusterSeed(const std::string &name, const edm::ParameterSet &iConfig) : OverlapTest(name, iConfig) {}
00077         // every event: nothing except read the input list
00078         virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) { 
00079             iEvent.getByLabel(src_, others_); 
00080         }
00082         virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const ;
00083     protected:
00084         edm::Handle<edm::View<reco::RecoCandidate> > others_;
00085 };
00086 
00087 
00088 
00089 } } // namespaces
00090 
00091 #endif