#include <PhysicsTools/PatUtils/interface/LeptonVertexSignificance.h>
Public Member Functions | |
float | calculate (const Muon &aMuon, const edm::Event &iEvent) |
float | calculate (const Electron &anElectron, 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 | |
TransientTrackBuilder * | theTrackBuilder_ |
LeptonVertexSignificance calculates the significance of the association of the lepton to a given vertex, as defined in CMS Note 2006/024
Definition at line 34 of file LeptonVertexSignificance.h.
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_.
00025 { 00026 // instantiate the transient-track builder 00027 edm::ESHandle<TransientTrackBuilder> builder; 00028 iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder); 00029 theTrackBuilder_ = new TransientTrackBuilder(*builder.product()); 00030 }
LeptonVertexSignificance::~LeptonVertexSignificance | ( | ) |
Definition at line 33 of file LeptonVertexSignificance.cc.
References theTrackBuilder_.
00033 { 00034 delete theTrackBuilder_; 00035 }
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(), funct::sqrt(), TrajectoryStateClosestToPoint::theState(), theTrackBuilder_, reco::TransientTrack::trajectoryStateClosestToPoint(), and reco::Vertex::zError().
00047 { 00048 // FIXME: think more about how to handle events without vertices 00049 // lepton LR calculation should have nothing to do with event selection 00050 edm::Handle<reco::VertexCollection> vertexHandle; 00051 iEvent.getByLabel("offlinePrimaryVerticesFromCTFTracks", vertexHandle); 00052 if (vertexHandle.product()->size() == 0) return 0; 00053 reco::Vertex theVertex = vertexHandle.product()->front(); 00054 // calculate the track-vertex association significance 00055 reco::TransientTrack theTrTrack = theTrackBuilder_->build(&theTrack); 00056 GlobalPoint theVertexPoint(theVertex.position().x(), theVertex.position().y(), theVertex.position().z()); 00057 FreeTrajectoryState theLeptonNearVertex = theTrTrack.trajectoryStateClosestToPoint(theVertexPoint).theState(); 00058 return fabs(theVertex.position().z() - theLeptonNearVertex.position().z()) 00059 / sqrt(pow(theVertex.zError(), 2) + theLeptonNearVertex.cartesianError().position().czz()); 00060 }
float LeptonVertexSignificance::calculate | ( | const Muon & | aMuon, | |
const edm::Event & | iEvent | |||
) |
Definition at line 42 of file LeptonVertexSignificance.cc.
References calculate(), and pat::Muon::track().
00042 { 00043 return this->calculate(*theMuon.track(), iEvent); 00044 }
float LeptonVertexSignificance::calculate | ( | const Electron & | anElectron, | |
const edm::Event & | iEvent | |||
) |
Definition at line 38 of file LeptonVertexSignificance.cc.
References pat::Electron::gsfTrack().
Referenced by calculate().
00038 { 00039 return this->calculate(*theElectron.gsfTrack(), iEvent); 00040 }
Definition at line 45 of file LeptonVertexSignificance.h.
Referenced by calculate(), LeptonVertexSignificance(), and ~LeptonVertexSignificance().