CMS 3D CMS Logo

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>

List of all members.

Public Member Functions

float calculate (const Electron &anElectron, const edm::Event &iEvent)
float calculate (const Muon &aMuon, const edm::Event &iEvent)
 LeptonVertexSignificance (const edm::EventSetup &iSetup)
 LeptonVertexSignificance ()
 ~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< T >::product(), and theTrackBuilder_.

                                                                               {
  // instantiate the transient-track builder
  edm::ESHandle<TransientTrackBuilder> builder;
  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
  theTrackBuilder_ = new TransientTrackBuilder(*builder.product());
}
LeptonVertexSignificance::~LeptonVertexSignificance ( )

Definition at line 33 of file LeptonVertexSignificance.cc.

References theTrackBuilder_.

                                                    {
  delete 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().

                                                                                               {
  return this->calculate(*theElectron.gsfTrack(), 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().

                                                                                             {
  // FIXME: think more about how to handle events without vertices
  // lepton LR calculation should have nothing to do with event selection
  edm::Handle<reco::VertexCollection> vertexHandle;
  iEvent.getByLabel("offlinePrimaryVerticesFromCTFTracks", vertexHandle);
  if (vertexHandle.product()->size() == 0) return 0;
  reco::Vertex theVertex = vertexHandle.product()->front();
  // calculate the track-vertex association significance
  reco::TransientTrack theTrTrack = theTrackBuilder_->build(&theTrack);
  GlobalPoint theVertexPoint(theVertex.position().x(), theVertex.position().y(), theVertex.position().z());
  FreeTrajectoryState theLeptonNearVertex = theTrTrack.trajectoryStateClosestToPoint(theVertexPoint).theState();
  return fabs(theVertex.position().z() - theLeptonNearVertex.position().z())
    / sqrt(std::pow(theVertex.zError(), 2) + theLeptonNearVertex.cartesianError().position().czz());
}
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().

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

Member Data Documentation