CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pf2pat::IPCutPFCandidateSelectorDefinition Class Reference

Selects PFCandidates basing on their compatibility with vertex. More...

#include "CommonTools/ParticleFlow/interface/IPCutPFCandidateSelectorDefinition.h"

Inheritance diagram for pf2pat::IPCutPFCandidateSelectorDefinition:
pf2pat::PFCandidateSelectorDefinition

Public Member Functions

 IPCutPFCandidateSelectorDefinition (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
void select (const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
 
- Public Member Functions inherited from pf2pat::PFCandidateSelectorDefinition
const_iterator begin () const
 
const_iterator end () const
 
 PFCandidateSelectorDefinition ()
 
const containerselected () const
 
size_t size () const
 

Private Attributes

double d0Cut_
 
double d0SigCut_
 
double dzCut_
 
double dzSigCut_
 
edm::EDGetTokenT< reco::VertexCollectionverticesToken_
 

Additional Inherited Members

- Public Types inherited from pf2pat::PFCandidateSelectorDefinition
typedef reco::PFCandidateCollection collection
 
typedef boost::transform_iterator< Pointer, container::const_iterator > const_iterator
 
typedef std::vector< reco::PFCandidatecontainer
 
typedef edm::Handle< collectionHandleToCollection
 
- Protected Attributes inherited from pf2pat::PFCandidateSelectorDefinition
container selected_
 

Detailed Description

Selects PFCandidates basing on their compatibility with vertex.

Author
Giovanni Petrucciani
Version
Id
IPCutPFCandidateSelectorDefinition.h,v 1.2 2011/04/06 12:12:38 rwolf Exp

Definition at line 22 of file IPCutPFCandidateSelectorDefinition.h.

Constructor & Destructor Documentation

pf2pat::IPCutPFCandidateSelectorDefinition::IPCutPFCandidateSelectorDefinition ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 24 of file IPCutPFCandidateSelectorDefinition.h.

24  :
26  d0Cut_( cfg.getParameter<double>("d0Cut") ),
27  dzCut_( cfg.getParameter<double>("dzCut") ),
28  d0SigCut_( cfg.getParameter<double>("d0SigCut") ),
29  dzSigCut_( cfg.getParameter<double>("dzSigCut") ) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< reco::VertexCollection > verticesToken_

Member Function Documentation

void pf2pat::IPCutPFCandidateSelectorDefinition::select ( const HandleToCollection hc,
const edm::Event e,
const edm::EventSetup s 
)
inline

Definition at line 31 of file IPCutPFCandidateSelectorDefinition.h.

References allConversions_cfi::d0, d0Cut_, d0SigCut_, reco::TrackBase::dxy(), reco::TrackBase::dxyError(), PVValHelper::dz, reco::TrackBase::dz(), dzCut_, reco::TrackBase::dzError(), dzSigCut_, edm::Event::getByToken(), crabWrapper::key, TagProbeFitTreeAnalyzer_cfi::passing, reco::Vertex::position(), pf2pat::PFCandidateSelectorDefinition::selected_, ecalDrivenElectronSeedsParameters_cff::vertices, verticesToken_, badGlobalMuonTaggersAOD_cff::vtx, reco::Vertex::xError(), reco::Vertex::yError(), and reco::Vertex::zError().

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

33  {
34  selected_.clear();
35 
37  e.getByToken(verticesToken_, vertices);
38  if (vertices->empty()) return;
39  const reco::Vertex &vtx = (*vertices)[0];
40 
41  unsigned key=0;
42  for( collection::const_iterator pfc = hc->begin();
43  pfc != hc->end(); ++pfc, ++key) {
44 
45  bool passing = true;
46  const reco::Track *tk = 0;
47  if (pfc->gsfTrackRef().isNonnull()) tk = pfc->gsfTrackRef().get();
48  else if (pfc->trackRef().isNonnull()) tk = pfc->trackRef().get();
49 
50  if (tk != 0) {
51  double d0 = fabs(tk->dxy(vtx.position()));
52  double dz = fabs(tk->dz(vtx.position()));
53  double d0e = hypot(tk->dxyError(), hypot(vtx.xError(), vtx.yError()));
54  double dze = hypot(tk->dzError(), vtx.zError());
55  if (d0Cut_ > 0 && d0 > d0Cut_) passing = false;
56  if (dzCut_ > 0 && dz > dzCut_) passing = false;
57  if (d0SigCut_ > 0 && d0e > 0 && d0/d0e > d0SigCut_) passing = false;
58  if (dzSigCut_ > 0 && dze > 0 && dz/dze > dzSigCut_) passing = false;
59  }
60 
61  if( passing ) {
62  selected_.push_back( reco::PFCandidate(*pfc) );
63  reco::PFCandidatePtr ptrToMother( hc, key );
64 
65  if ( pfc->numberOfSourceCandidatePtrs() > 0 ) {
66  selected_.back().setSourceCandidatePtr( edm::Ptr<reco::PFCandidate>( pfc->sourceCandidatePtr(0)
67  ) );
68  }
69  else {
70  selected_.back().setSourceCandidatePtr( ptrToMother );
71  }
72  }
73  }
74  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
double zError() const
error on z
Definition: Vertex.h:123
double dxyError() const
error on dxy
Definition: TrackBase.h:796
const Point & position() const
position
Definition: Vertex.h:109
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:609
double dzError() const
error on dz
Definition: TrackBase.h:814
double xError() const
error on x
Definition: Vertex.h:119
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
susybsm::HSCParticleCollection hc
Definition: classes.h:25
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:591
double yError() const
error on y
Definition: Vertex.h:121

Member Data Documentation

double pf2pat::IPCutPFCandidateSelectorDefinition::d0Cut_
private

Definition at line 78 of file IPCutPFCandidateSelectorDefinition.h.

Referenced by select().

double pf2pat::IPCutPFCandidateSelectorDefinition::d0SigCut_
private

Definition at line 80 of file IPCutPFCandidateSelectorDefinition.h.

Referenced by select().

double pf2pat::IPCutPFCandidateSelectorDefinition::dzCut_
private

Definition at line 79 of file IPCutPFCandidateSelectorDefinition.h.

Referenced by select().

double pf2pat::IPCutPFCandidateSelectorDefinition::dzSigCut_
private

Definition at line 81 of file IPCutPFCandidateSelectorDefinition.h.

Referenced by select().

edm::EDGetTokenT<reco::VertexCollection> pf2pat::IPCutPFCandidateSelectorDefinition::verticesToken_
private

Definition at line 77 of file IPCutPFCandidateSelectorDefinition.h.

Referenced by select().