test
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 
8 
14 
15 namespace pat { namespace helper {
16 
17 // Base class for a test for overlaps
18 class OverlapTest {
19  public:
22  srcToken_(iC.consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("src"))),
23  name_(name),
24  requireNoOverlaps_(iConfig.getParameter<bool>("requireNoOverlaps")) {}
26  virtual ~OverlapTest() {}
28  virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) = 0;
31  virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const = 0;
33  virtual void done() {}
34  // -- basic getters ---
35 
36  const std::string & name() const { return name_; }
37  bool requireNoOverlaps() const { return requireNoOverlaps_; }
38  protected:
42 };
43 
44 class BasicOverlapTest : public OverlapTest {
45  public:
47  OverlapTest(name, iConfig, iC),
48  presel_(iConfig.getParameter<std::string>("preselection")),
49  deltaR_(iConfig.getParameter<double>("deltaR")),
50  checkRecoComponents_(iConfig.getParameter<bool>("checkRecoComponents")),
51  pairCut_(iConfig.getParameter<std::string>("pairCut")) {}
52  // implementation of mother methods
54  virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) ;
56  virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const ;
57  protected:
58  // ---- configurables ----
62  double deltaR_;
67  // ---- working variables ----
71  std::vector<bool> isPreselected_;
72 };
73 
75  public:
76  // constructor: nothing except initialize the base class
77  OverlapBySuperClusterSeed(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector && iC) : OverlapTest(name, iConfig, iC) {}
78  // every event: nothing except read the input list
79  virtual void readInput(const edm::Event & iEvent, const edm::EventSetup &iSetup) {
80  iEvent.getByToken(srcToken_, others_);
81  }
83  virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const ;
84  protected:
85 // edm::Handle<edm::View<reco::RecoCandidate> > others_;
87 };
88 
89 
90 
91 } } // namespaces
92 
93 #endif
OverlapBySuperClusterSeed(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: OverlapTest.h:77
virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const =0
edm::EDGetTokenT< reco::CandidateView > srcToken_
Definition: OverlapTest.h:39
virtual void done()
end of event method. does nothing
Definition: OverlapTest.h:33
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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
virtual void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Read input, apply preselection cut.
Definition: OverlapTest.cc:10
int iEvent
Definition: GenABIO.cc:230
PATStringCutObjectSelector presel_
A generic preselection cut that can work on any Candidate, but has access also to methods of PAT spec...
Definition: OverlapTest.h:60
edm::Handle< reco::CandidateView > candidates_
The collection to check overlaps against.
Definition: OverlapTest.h:69
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:71
virtual ~OverlapTest()
destructor, does nothing
Definition: OverlapTest.h:26
virtual void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup)
initializer for each event. to be implemented in child classes.
Definition: OverlapTest.h:79
BasicOverlapTest(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: OverlapTest.h:46
double deltaR_
Delta R for the match.
Definition: OverlapTest.h:62
const std::string & name() const
Definition: OverlapTest.h:36
bool checkRecoComponents_
Check the overlapping by RECO components.
Definition: OverlapTest.h:64
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:86
bool requireNoOverlaps() const
Definition: OverlapTest.h:37
StringCutObjectSelector< pat::DiObjectProxy > pairCut_
Cut on the pair of objects together.
Definition: OverlapTest.h:66
OverlapTest(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
constructor: reads &#39;src&#39; and &#39;requireNoOverlaps&#39; parameters
Definition: OverlapTest.h:21