CMS 3D CMS Logo

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 {
16  namespace helper {
17 
18  // Base class for a test for overlaps
19  class OverlapTest {
20  public:
23  : srcToken_(iC.consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("src"))),
24  name_(name),
25  requireNoOverlaps_(iConfig.getParameter<bool>("requireNoOverlaps")) {}
27  virtual ~OverlapTest() {}
29  virtual void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup) = 0;
32  virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const = 0;
34  virtual void done() {}
35  // -- basic getters ---
36 
37  const std::string &name() const { return name_; }
38  bool requireNoOverlaps() const { return requireNoOverlaps_; }
39 
40  protected:
44  };
45 
46  class BasicOverlapTest : public OverlapTest {
47  public:
49  : OverlapTest(name, iConfig, iC),
50  presel_(iConfig.getParameter<std::string>("preselection")),
51  deltaR_(iConfig.getParameter<double>("deltaR")),
52  checkRecoComponents_(iConfig.getParameter<bool>("checkRecoComponents")),
53  pairCut_(iConfig.getParameter<std::string>("pairCut")) {}
54  // implementation of mother methods
56  void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup) override;
58  bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const override;
59 
60  protected:
61  // ---- configurables ----
65  double deltaR_;
70  // ---- working variables ----
74  std::vector<bool> isPreselected_;
75  };
76 
78  public:
79  // constructor: nothing except initialize the base class
81  : OverlapTest(name, iConfig, iC) {}
82  // every event: nothing except read the input list
83  void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup) override {
84  iEvent.getByToken(srcToken_, others_);
85  }
87  bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const override;
88 
89  protected:
90  // edm::Handle<edm::View<reco::RecoCandidate> > others_;
92  };
93 
94  } // namespace helper
95 } // namespace pat
96 
97 #endif
OverlapBySuperClusterSeed(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: OverlapTest.h:80
bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const override
Check for overlaps.
Definition: OverlapTest.cc:20
Definition: helper.py:1
virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const =0
edm::EDGetTokenT< reco::CandidateView > srcToken_
Definition: OverlapTest.h:41
virtual void done()
end of event method. does nothing
Definition: OverlapTest.h:34
bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const override
Check for overlaps.
Definition: OverlapTest.cc:52
Definition: HeavyIon.h:7
bool requireNoOverlaps() const
Definition: OverlapTest.h:38
int iEvent
Definition: GenABIO.cc:224
PATStringCutObjectSelector presel_
A generic preselection cut that can work on any Candidate, but has access also to methods of PAT spec...
Definition: OverlapTest.h:63
edm::Handle< reco::CandidateView > candidates_
The collection to check overlaps against.
Definition: OverlapTest.h:72
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:74
void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Read input, apply preselection cut.
Definition: OverlapTest.cc:9
virtual ~OverlapTest()
destructor, does nothing
Definition: OverlapTest.h:27
BasicOverlapTest(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: OverlapTest.h:48
double deltaR_
Delta R for the match.
Definition: OverlapTest.h:65
bool checkRecoComponents_
Check the overlapping by RECO components.
Definition: OverlapTest.h:67
fixed size matrix
HLT enums.
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:91
StringCutObjectSelector< pat::DiObjectProxy > pairCut_
Cut on the pair of objects together.
Definition: OverlapTest.h:69
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:22
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23
const std::string & name() const
Definition: OverlapTest.h:37
void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
initializer for each event. to be implemented in child classes.
Definition: OverlapTest.h:83