CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
pat::helper::BasicOverlapTest Class Reference

#include <OverlapTest.h>

Inheritance diagram for pat::helper::BasicOverlapTest:
pat::helper::OverlapTest

Public Member Functions

 BasicOverlapTest (const std::string &name, const edm::ParameterSet &iConfig)
 
virtual bool fillOverlapsForItem (const reco::Candidate &item, reco::CandidatePtrVector &overlapsToFill) const
 Check for overlaps. More...
 
virtual void readInput (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 Read input, apply preselection cut. More...
 
- Public Member Functions inherited from pat::helper::OverlapTest
virtual void done ()
 end of event method. does nothing More...
 
const std::string & name () const
 
 OverlapTest (const std::string &name, const edm::ParameterSet &iConfig)
 constructor: reads 'src' and 'requireNoOverlaps' parameters More...
 
bool requireNoOverlaps () const
 
virtual ~OverlapTest ()
 destructor, does nothing More...
 

Protected Attributes

edm::Handle< reco::CandidateViewcandidates_
 The collection to check overlaps against. More...
 
bool checkRecoComponents_
 Check the overlapping by RECO components. More...
 
double deltaR_
 Delta R for the match. More...
 
std::vector< bool > isPreselected_
 Flag saying if each element has passed the preselection or not. More...
 
StringCutObjectSelector
< pat::DiObjectProxy
pairCut_
 Cut on the pair of objects together. More...
 
PATStringCutObjectSelector presel_
 A generic preselection cut that can work on any Candidate, but has access also to methods of PAT specific objects. More...
 
- Protected Attributes inherited from pat::helper::OverlapTest
std::string name_
 
bool requireNoOverlaps_
 
edm::InputTag src_
 

Detailed Description

Definition at line 43 of file OverlapTest.h.

Constructor & Destructor Documentation

pat::helper::BasicOverlapTest::BasicOverlapTest ( const std::string &  name,
const edm::ParameterSet iConfig 
)
inline

Definition at line 45 of file OverlapTest.h.

45  :
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")) {}
T getParameter(std::string const &) const
OverlapTest(const std::string &name, const edm::ParameterSet &iConfig)
constructor: reads &#39;src&#39; and &#39;requireNoOverlaps&#39; parameters
Definition: OverlapTest.h:20
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
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
StringCutObjectSelector< pat::DiObjectProxy > pairCut_
Cut on the pair of objects together.
Definition: OverlapTest.h:65

Member Function Documentation

bool BasicOverlapTest::fillOverlapsForItem ( const reco::Candidate item,
reco::CandidatePtrVector overlapsToFill 
) const
virtual

Check for overlaps.

Implements pat::helper::OverlapTest.

Definition at line 23 of file OverlapTest.cc.

References candidates_, checkRecoComponents_, reco::deltaR(), deltaR_, customizeTrackingMonitorSeedNumber::idx, isPreselected_, analyzePatCOC_cfg::overlaps, pairCut_, edm::PtrVector< T >::push_back(), and python.multivaluedict::sort().

24 {
25  size_t idx = 0;
26  std::vector<std::pair<float,size_t> > matches;
27  for (reco::CandidateView::const_iterator it = candidates_->begin(); it != candidates_->end(); ++it, ++idx) {
28  if (!isPreselected_[idx]) continue;
29  double dr = reco::deltaR(item, *it);
30  if (dr < deltaR_) {
33  if (!overlaps(item, *it)) continue;
34  }
35  if (!pairCut_(pat::DiObjectProxy(item,*it))) continue;
36  matches.push_back(std::make_pair(dr, idx));
37  }
38  }
39  // see if we matched anything
40  if (matches.empty()) return false;
41 
42  // sort matches
43  std::sort(matches.begin(), matches.end());
44  // fill ptr vector
45  for (std::vector<std::pair<float,size_t> >::const_iterator it = matches.begin(); it != matches.end(); ++it) {
46  overlapsToFill.push_back(candidates_->ptrAt(it->second));
47  }
48  return true;
49 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:137
edm::Handle< reco::CandidateView > candidates_
The collection to check overlaps against.
Definition: OverlapTest.h:68
std::vector< bool > isPreselected_
Flag saying if each element has passed the preselection or not.
Definition: OverlapTest.h:70
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
double deltaR_
Delta R for the match.
Definition: OverlapTest.h:61
bool checkRecoComponents_
Check the overlapping by RECO components.
Definition: OverlapTest.h:63
StringCutObjectSelector< pat::DiObjectProxy > pairCut_
Cut on the pair of objects together.
Definition: OverlapTest.h:65
void BasicOverlapTest::readInput ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Read input, apply preselection cut.

Implements pat::helper::OverlapTest.

Definition at line 10 of file OverlapTest.cc.

References candidates_, edm::Event::getByLabel(), customizeTrackingMonitorSeedNumber::idx, isPreselected_, presel_, and pat::helper::OverlapTest::src_.

Referenced by parserPerfsuiteMetadata.parserPerfsuiteMetadata::readCmsScimarkTest().

11 {
12  iEvent.getByLabel(src_, candidates_);
13  isPreselected_.resize(candidates_->size());
14  size_t idx = 0;
15  for (reco::CandidateView::const_iterator it = candidates_->begin(); it != candidates_->end(); ++it, ++idx) {
16  isPreselected_[idx] = presel_(*it);
17  }
18  // Yes, I could use std::transform. But would people like it?
19  // http://www.sgi.com/tech/stl/transform.html
20 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
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
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:361
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...

Member Data Documentation

edm::Handle<reco::CandidateView> pat::helper::BasicOverlapTest::candidates_
protected

The collection to check overlaps against.

Definition at line 68 of file OverlapTest.h.

Referenced by fillOverlapsForItem(), and readInput().

bool pat::helper::BasicOverlapTest::checkRecoComponents_
protected

Check the overlapping by RECO components.

Definition at line 63 of file OverlapTest.h.

Referenced by fillOverlapsForItem().

double pat::helper::BasicOverlapTest::deltaR_
protected

Delta R for the match.

Definition at line 61 of file OverlapTest.h.

Referenced by fillOverlapsForItem().

std::vector<bool> pat::helper::BasicOverlapTest::isPreselected_
protected

Flag saying if each element has passed the preselection or not.

Definition at line 70 of file OverlapTest.h.

Referenced by fillOverlapsForItem(), and readInput().

StringCutObjectSelector<pat::DiObjectProxy> pat::helper::BasicOverlapTest::pairCut_
protected

Cut on the pair of objects together.

Definition at line 65 of file OverlapTest.h.

Referenced by fillOverlapsForItem().

PATStringCutObjectSelector pat::helper::BasicOverlapTest::presel_
protected

A generic preselection cut that can work on any Candidate, but has access also to methods of PAT specific objects.

Definition at line 59 of file OverlapTest.h.

Referenced by readInput().