CMS 3D CMS Logo

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, edm::ConsumesCollector &&iC)
 
 ~LeptonVertexSignificance ()
 

Private Member Functions

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

Private Attributes

TransientTrackBuildertheTrackBuilder_
 
edm::EDGetTokenT< reco::VertexCollectionvertexToken_
 

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

Definition at line 36 of file LeptonVertexSignificance.h.

Constructor & Destructor Documentation

◆ LeptonVertexSignificance() [1/2]

pat::LeptonVertexSignificance::LeptonVertexSignificance ( )

◆ LeptonVertexSignificance() [2/2]

LeptonVertexSignificance::LeptonVertexSignificance ( const edm::EventSetup iSetup,
edm::ConsumesCollector &&  iC 
)

Definition at line 19 of file LeptonVertexSignificance.cc.

20  : vertexToken_(iC.consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVerticesFromCTFTracks"))) {
21  // instantiate the transient-track builder
23  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
25 }

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

◆ ~LeptonVertexSignificance()

LeptonVertexSignificance::~LeptonVertexSignificance ( )

Definition at line 28 of file LeptonVertexSignificance.cc.

28 { delete theTrackBuilder_; }

References theTrackBuilder_.

Member Function Documentation

◆ calculate() [1/3]

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

Definition at line 31 of file LeptonVertexSignificance.cc.

31  {
32  return this->calculate(*theElectron.gsfTrack(), iEvent);
33 }

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

Referenced by calculate().

◆ calculate() [2/3]

float LeptonVertexSignificance::calculate ( const Muon aMuon,
const edm::Event iEvent 
)

Definition at line 35 of file LeptonVertexSignificance.cc.

35  {
36  return this->calculate(*theMuon.track(), iEvent);
37 }

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

◆ calculate() [3/3]

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

Definition at line 40 of file LeptonVertexSignificance.cc.

40  {
41  // FIXME: think more about how to handle events without vertices
42  // lepton LR calculation should have nothing to do with event selection
44  iEvent.getByToken(vertexToken_, vertexHandle);
45  if (vertexHandle.product()->empty())
46  return 0;
47  reco::Vertex theVertex = vertexHandle.product()->front();
48  // calculate the track-vertex association significance
49  reco::TransientTrack theTrTrack = theTrackBuilder_->build(&theTrack);
50  GlobalPoint theVertexPoint(theVertex.position().x(), theVertex.position().y(), theVertex.position().z());
51  FreeTrajectoryState theLeptonNearVertex = theTrTrack.trajectoryStateClosestToPoint(theVertexPoint).theState();
52  return fabs(theVertex.position().z() - theLeptonNearVertex.position().z()) /
53  sqrt(std::pow(theVertex.zError(), 2) + theLeptonNearVertex.cartesianError().position().czz());
54 }

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

Member Data Documentation

◆ theTrackBuilder_

TransientTrackBuilder* pat::LeptonVertexSignificance::theTrackBuilder_
private

◆ vertexToken_

edm::EDGetTokenT<reco::VertexCollection> pat::LeptonVertexSignificance::vertexToken_
private

Definition at line 48 of file LeptonVertexSignificance.h.

Referenced by calculate().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::Handle::product
T const * product() const
Definition: Handle.h:70
pat::LeptonVertexSignificance::vertexToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Definition: LeptonVertexSignificance.h:48
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
reco::Vertex::position
const Point & position() const
position
Definition: Vertex.h:114
edm::Handle< reco::VertexCollection >
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TransientTrackRecord
Definition: TransientTrackRecord.h:11
edm::ESHandle< TransientTrackBuilder >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
Point3DBase< float, GlobalTag >
pat::LeptonVertexSignificance::theTrackBuilder_
TransientTrackBuilder * theTrackBuilder_
Definition: LeptonVertexSignificance.h:47
reco::Vertex::zError
double zError() const
error on z
Definition: Vertex.h:128
reco::TransientTrack::trajectoryStateClosestToPoint
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
Definition: TransientTrack.h:90
iEvent
int iEvent
Definition: GenABIO.cc:224
TransientTrackBuilder
Definition: TransientTrackBuilder.h:16
get
#define get
pat::LeptonVertexSignificance::calculate
float calculate(const Electron &anElectron, const edm::Event &iEvent)
Definition: LeptonVertexSignificance.cc:31
reco::TransientTrack
Definition: TransientTrack.h:19
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
TrajectoryStateClosestToPoint::theState
const FreeTrajectoryState & theState() const
Definition: TrajectoryStateClosestToPoint.h:96
edm::InputTag
Definition: InputTag.h:15
reco::Vertex
Definition: Vertex.h:35