CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OverlapTest.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatAlgos_interface_OverlapTest_h
2 #define PhysicsTools_PatAlgos_interface_OverlapTest_h
3 
7 
13 
14 namespace pat { namespace helper {
15 
16 // Base class for a test for overlaps
17 class OverlapTest {
18  public:
20  OverlapTest(const std::string &name, const edm::ParameterSet &iConfig) :
21  src_(iConfig.getParameter<edm::InputTag>("src")),
22  name_(name),
23  requireNoOverlaps_(iConfig.getParameter<bool>("requireNoOverlaps")) {}
25  virtual ~OverlapTest() {}
27  virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) = 0;
30  virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const = 0;
32  virtual void done() {}
33  // -- basic getters ---
34 
35  const std::string & name() const { return name_; }
36  bool requireNoOverlaps() const { return requireNoOverlaps_; }
37  protected:
39  std::string name_;
41 };
42 
43 class BasicOverlapTest : public OverlapTest {
44  public:
45  BasicOverlapTest(const std::string &name, const edm::ParameterSet &iConfig) :
46  OverlapTest(name, iConfig),
47  presel_(iConfig.getParameter<std::string>("preselection")),
48  deltaR_(iConfig.getParameter<double>("deltaR")),
49  checkRecoComponents_(iConfig.getParameter<bool>("checkRecoComponents")),
50  pairCut_(iConfig.getParameter<std::string>("pairCut")) {}
51  // implementation of mother methods
53  virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) ;
55  virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const ;
56  protected:
57  // ---- configurables ----
61  double deltaR_;
66  // ---- working variables ----
70  std::vector<bool> isPreselected_;
71 };
72 
74  public:
75  // constructor: nothing except initialize the base class
76  OverlapBySuperClusterSeed(const std::string &name, const edm::ParameterSet &iConfig) : OverlapTest(name, iConfig) {}
77  // every event: nothing except read the input list
78  virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) {
79  iEvent.getByLabel(src_, others_);
80  }
82  virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const ;
83  protected:
85 };
86 
87 
88 
89 } } // namespaces
90 
91 #endif
OverlapTest(const std::string &name, const edm::ParameterSet &iConfig)
constructor: reads &#39;src&#39; and &#39;requireNoOverlaps&#39; parameters
Definition: OverlapTest.h:20
virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const =0
virtual void done()
end of event method. does nothing
Definition: OverlapTest.h:32
virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const
Check for overlaps.
Definition: OverlapTest.cc:23
virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const
Check for overlaps.
Definition: OverlapTest.cc:52
edm::Handle< edm::View< reco::RecoCandidate > > others_
Definition: OverlapTest.h:84
virtual void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Read input, apply preselection cut.
Definition: OverlapTest.cc:10
BasicOverlapTest(const std::string &name, const edm::ParameterSet &iConfig)
Definition: OverlapTest.h:45
OverlapBySuperClusterSeed(const std::string &name, const edm::ParameterSet &iConfig)
Definition: OverlapTest.h:76
int iEvent
Definition: GenABIO.cc:243
PATStringCutObjectSelector presel_
A generic preselection cut that can work on any Candidate, but has access also to methods of PAT spec...
Definition: OverlapTest.h:59
edm::Handle< reco::CandidateView > candidates_
The collection to check overlaps against.
Definition: OverlapTest.h:68
virtual void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup)=0
initializer for each event. to be implemented in child classes.
std::vector< bool > isPreselected_
Flag saying if each element has passed the preselection or not.
Definition: OverlapTest.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual ~OverlapTest()
destructor, does nothing
Definition: OverlapTest.h:25
virtual void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup)
initializer for each event. to be implemented in child classes.
Definition: OverlapTest.h:78
double deltaR_
Delta R for the match.
Definition: OverlapTest.h:61
const std::string & name() const
Definition: OverlapTest.h:35
bool checkRecoComponents_
Check the overlapping by RECO components.
Definition: OverlapTest.h:63
bool requireNoOverlaps() const
Definition: OverlapTest.h:36
StringCutObjectSelector< pat::DiObjectProxy > pairCut_
Cut on the pair of objects together.
Definition: OverlapTest.h:65