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
PATDiObjectProxy.h
reco::CandidateView
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23
electrons_cff.bool
bool
Definition: electrons_cff.py:393
pat::helper::OverlapTest
Definition: OverlapTest.h:19
pat::helper::OverlapTest::~OverlapTest
virtual ~OverlapTest()
destructor, does nothing
Definition: OverlapTest.h:27
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
pat::helper::BasicOverlapTest::checkRecoComponents_
bool checkRecoComponents_
Check the overlapping by RECO components.
Definition: OverlapTest.h:67
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
RecoCandidate.h
pat::helper::BasicOverlapTest::readInput
void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Read input, apply preselection cut.
Definition: OverlapTest.cc:9
pat::helper::BasicOverlapTest::BasicOverlapTest
BasicOverlapTest(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: OverlapTest.h:48
CandidateFwd.h
pat::helper::BasicOverlapTest::deltaR_
double deltaR_
Delta R for the match.
Definition: OverlapTest.h:65
pat::helper::OverlapBySuperClusterSeed::fillOverlapsForItem
bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const override
Check for overlaps.
Definition: OverlapTest.cc:52
edm::PtrVector< Candidate >
pat::helper::OverlapTest::OverlapTest
OverlapTest(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
constructor: reads 'src' and 'requireNoOverlaps' parameters
Definition: OverlapTest.h:22
pat::helper::OverlapTest::requireNoOverlaps_
bool requireNoOverlaps_
Definition: OverlapTest.h:43
pat::helper::OverlapBySuperClusterSeed::others_
edm::Handle< reco::CandidateView > others_
Definition: OverlapTest.h:91
pat::helper::OverlapTest::name_
std::string name_
Definition: OverlapTest.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::helper::OverlapTest::name
const std::string & name() const
Definition: OverlapTest.h:37
pat::helper::OverlapTest::fillOverlapsForItem
virtual bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const =0
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
pat::helper::BasicOverlapTest::fillOverlapsForItem
bool fillOverlapsForItem(const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const override
Check for overlaps.
Definition: OverlapTest.cc:20
helper
Definition: helper.py:1
pat::helper::BasicOverlapTest::candidates_
edm::Handle< reco::CandidateView > candidates_
The collection to check overlaps against.
Definition: OverlapTest.h:72
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::helper::BasicOverlapTest::isPreselected_
std::vector< bool > isPreselected_
Flag saying if each element has passed the preselection or not.
Definition: OverlapTest.h:74
StringParserTools.h
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::EventSetup
Definition: EventSetup.h:57
pat
Definition: HeavyIon.h:7
pat::helper::OverlapTest::srcToken_
edm::EDGetTokenT< reco::CandidateView > srcToken_
Definition: OverlapTest.h:41
pat::helper::OverlapTest::done
virtual void done()
end of event method. does nothing
Definition: OverlapTest.h:34
InputTag.h
reco::Candidate
Definition: Candidate.h:27
std
Definition: JetResolutionObject.h:76
pat::helper::OverlapBySuperClusterSeed
Definition: OverlapTest.h:77
pat::helper::BasicOverlapTest::presel_
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
StringCutObjectSelector< pat::DiObjectProxy >
pat::helper::OverlapTest::requireNoOverlaps
bool requireNoOverlaps() const
Definition: OverlapTest.h:38
ConsumesCollector.h
Candidate.h
ParameterSet.h
pat::helper::BasicOverlapTest
Definition: OverlapTest.h:46
edm::Event
Definition: Event.h:73
pat::helper::OverlapTest::readInput
virtual void readInput(const edm::Event &iEvent, const edm::EventSetup &iSetup)=0
initializer for each event. to be implemented in child classes.
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
pat::helper::OverlapBySuperClusterSeed::OverlapBySuperClusterSeed
OverlapBySuperClusterSeed(const std::string &name, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: OverlapTest.h:80
PATStringCutObjectSelector
Definition: StringParserTools.h:59
pat::helper::OverlapBySuperClusterSeed::readInput
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
pat::helper::BasicOverlapTest::pairCut_
StringCutObjectSelector< pat::DiObjectProxy > pairCut_
Cut on the pair of objects together.
Definition: OverlapTest.h:69