CMS 3D CMS Logo

LeptonVertexSignificance.cc
Go to the documentation of this file.
15 
16 using namespace pat;
17 
18 // constructor
20  : vertexToken_(iC.consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVerticesFromCTFTracks"))) {
21  // instantiate the transient-track builder
23  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
25 }
26 
27 // destructor
29 
30 // calculate the TrackIsoPt for the lepton object
32  return this->calculate(*theElectron.gsfTrack(), iEvent);
33 }
34 
36  return this->calculate(*theMuon.track(), iEvent);
37 }
38 
39 // calculate the TrackIsoPt for the lepton's track
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 }
LeptonVertexSignificance.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Handle.h
FreeTrajectoryState.h
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
Electron
Definition: Electron.py:1
edm
HLT enums.
Definition: AlignableModifier.h:19
pat::LeptonVertexSignificance::vertexToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Definition: LeptonVertexSignificance.h:48
Muon.h
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
pat::LeptonVertexSignificance::~LeptonVertexSignificance
~LeptonVertexSignificance()
Definition: LeptonVertexSignificance.cc:28
pat::Electron::gsfTrack
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster
reco::Vertex::position
const Point & position() const
position
Definition: Vertex.h:114
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
TransientTrack.h
edm::Handle< reco::VertexCollection >
Muon
Definition: Muon.py:1
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TransientTrackRecord
Definition: TransientTrackRecord.h:11
reco::Track
Definition: Track.h:27
edm::ESHandle< TransientTrackBuilder >
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
TransientTrackBuilder.h
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
GsfTrack.h
pat::Muon::track
reco::TrackRef track() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon)
TransientTrackBuilder
Definition: TransientTrackBuilder.h:16
edm::EventSetup
Definition: EventSetup.h:57
pat
Definition: HeavyIon.h:7
TransientTrackRecord.h
get
#define get
pat::LeptonVertexSignificance::LeptonVertexSignificance
LeptonVertexSignificance()
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
EventSetup.h
Exception.h
Electron.h
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::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::Vertex
Definition: Vertex.h:35