CMS 3D CMS Logo

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

Calculates a lepton's vertex association significance. More...

#include "PhysicsTools/PatUtils/interface/LeptonVertexSignificance.h"

Public Member Functions

float calculate (const Electron &anElectron, const edm::Event &iEvent)
 
float calculate (const Muon &aMuon, const edm::Event &iEvent)
 
 LeptonVertexSignificance ()
 
 LeptonVertexSignificance (const edm::EventSetup &iSetup)
 
 ~LeptonVertexSignificance ()
 

Private Member Functions

float calculate (const reco::Track &track, const edm::Event &iEvent)
 

Private Attributes

TransientTrackBuildertheTrackBuilder_
 

Detailed Description

Calculates a lepton's vertex association significance.

LeptonVertexSignificance calculates the significance of the association of the lepton to a given vertex, as defined in CMS Note 2006/024

Author
Steven Lowette
Version
Id:
LeptonVertexSignificance.h,v 1.3 2008/03/05 14:51:03 fronga Exp

Definition at line 34 of file LeptonVertexSignificance.h.

Constructor & Destructor Documentation

pat::LeptonVertexSignificance::LeptonVertexSignificance ( )
LeptonVertexSignificance::LeptonVertexSignificance ( const edm::EventSetup iSetup)

Definition at line 25 of file LeptonVertexSignificance.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), and theTrackBuilder_.

25  {
26  // instantiate the transient-track builder
28  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
30 }
TransientTrackBuilder * theTrackBuilder_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
LeptonVertexSignificance::~LeptonVertexSignificance ( )

Definition at line 33 of file LeptonVertexSignificance.cc.

References theTrackBuilder_.

33  {
34  delete theTrackBuilder_;
35 }
TransientTrackBuilder * theTrackBuilder_

Member Function Documentation

float LeptonVertexSignificance::calculate ( const Electron anElectron,
const edm::Event iEvent 
)

Definition at line 38 of file LeptonVertexSignificance.cc.

References pat::Electron::gsfTrack(), and iEvent.

Referenced by calculate().

38  {
39  return this->calculate(*theElectron.gsfTrack(), iEvent);
40 }
int iEvent
Definition: GenABIO.cc:243
float calculate(const Electron &anElectron, const edm::Event &iEvent)
float LeptonVertexSignificance::calculate ( const Muon aMuon,
const edm::Event iEvent 
)

Definition at line 42 of file LeptonVertexSignificance.cc.

References calculate(), iEvent, and pat::Muon::track().

42  {
43  return this->calculate(*theMuon.track(), iEvent);
44 }
int iEvent
Definition: GenABIO.cc:243
float calculate(const Electron &anElectron, const edm::Event &iEvent)
float LeptonVertexSignificance::calculate ( const reco::Track track,
const edm::Event iEvent 
)
private

Definition at line 47 of file LeptonVertexSignificance.cc.

References TransientTrackBuilder::build(), edm::Event::getByLabel(), reco::Vertex::position(), funct::pow(), edm::Handle< T >::product(), mathSSE::sqrt(), TrajectoryStateClosestToPoint::theState(), theTrackBuilder_, reco::TransientTrack::trajectoryStateClosestToPoint(), and reco::Vertex::zError().

47  {
48  // FIXME: think more about how to handle events without vertices
49  // lepton LR calculation should have nothing to do with event selection
51  iEvent.getByLabel("offlinePrimaryVerticesFromCTFTracks", vertexHandle);
52  if (vertexHandle.product()->size() == 0) return 0;
53  reco::Vertex theVertex = vertexHandle.product()->front();
54  // calculate the track-vertex association significance
55  reco::TransientTrack theTrTrack = theTrackBuilder_->build(&theTrack);
56  GlobalPoint theVertexPoint(theVertex.position().x(), theVertex.position().y(), theVertex.position().z());
57  FreeTrajectoryState theLeptonNearVertex = theTrTrack.trajectoryStateClosestToPoint(theVertexPoint).theState();
58  return fabs(theVertex.position().z() - theLeptonNearVertex.position().z())
59  / sqrt(std::pow(theVertex.zError(), 2) + theLeptonNearVertex.cartesianError().position().czz());
60 }
double zError() const
error on z
Definition: Vertex.h:105
const FreeTrajectoryState & theState() const
reco::TransientTrack build(const reco::Track *p) const
const Point & position() const
position
Definition: Vertex.h:93
TransientTrackBuilder * theTrackBuilder_
T sqrt(T t)
Definition: SSEVec.h:46
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
T const * product() const
Definition: Handle.h:74
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

TransientTrackBuilder* pat::LeptonVertexSignificance::theTrackBuilder_
private