#include <CandCommonVertexFitter.h>
Public Types | |
typedef reco::Vertex::CovarianceMatrix | CovarianceMatrix |
Public Member Functions | |
CandCommonVertexFitterBase (const edm::ParameterSet &) | |
void | set (reco::VertexCompositeCandidate &) const |
void | set (const MagneticField *bField) |
virtual | ~CandCommonVertexFitterBase () |
Protected Member Functions | |
void | fill (std::vector< reco::TransientTrack > &, std::vector< reco::Candidate * > &, std::vector< reco::RecoCandidate::TrackType > &, reco::Candidate &) const |
virtual bool | fit (TransientVertex &, const std::vector< reco::TransientTrack > &) const =0 |
Protected Attributes | |
const MagneticField * | bField_ |
double | chi2_ |
chi-sqared | |
CovarianceMatrix | cov_ |
covariance matrix (3x3) | |
double | ndof_ |
number of degrees of freedom |
Definition at line 17 of file CandCommonVertexFitter.h.
Definition at line 19 of file CandCommonVertexFitter.h.
CandCommonVertexFitterBase::CandCommonVertexFitterBase | ( | const edm::ParameterSet & | ) | [inline] |
Definition at line 20 of file CandCommonVertexFitter.h.
: bField_(0) { }
virtual CandCommonVertexFitterBase::~CandCommonVertexFitterBase | ( | ) | [inline, virtual] |
Definition at line 21 of file CandCommonVertexFitter.h.
{ }
void CandCommonVertexFitterBase::fill | ( | std::vector< reco::TransientTrack > & | , |
std::vector< reco::Candidate * > & | , | ||
std::vector< reco::RecoCandidate::TrackType > & | , | ||
reco::Candidate & | |||
) | const [protected] |
virtual bool CandCommonVertexFitterBase::fit | ( | TransientVertex & | , |
const std::vector< reco::TransientTrack > & | |||
) | const [protected, pure virtual] |
Implemented in CandCommonVertexFitter< Fitter >.
void CandCommonVertexFitterBase::set | ( | const MagneticField * | bField | ) | [inline] |
Definition at line 22 of file CandCommonVertexFitter.h.
References ecalTB2006H4_GenSimDigiReco_cfg::bField, and bField_.
Referenced by reco::modules::CandVertexFitterEventSetupInit< Fitter >::init().
void CandCommonVertexFitterBase::set | ( | reco::VertexCompositeCandidate & | c | ) | const |
Definition at line 9 of file CandCommonVertexFitter.cc.
References reco::Vertex::chi2(), reco::Candidate::energy(), relval_parameters_module::energy, Exception, reco::Vertex::fill(), edm::errors::InvalidReference, reco::Candidate::mass(), reco::Vertex::ndof(), reco::TrackBase::p(), L1TEmulatorMonitor_cff::p, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), reco::RecoCandidate::recoTrackType, TransientVertex::refittedTracks(), reco::VertexCompositeCandidate::setChi2AndNdof(), reco::VertexCompositeCandidate::setCovariance(), reco::LeafCandidate::setP4(), reco::Candidate::setP4(), reco::LeafCandidate::setVertex(), reco::Candidate::setVertex(), mathSSE::sqrt(), ExpressReco_HICollisions_FallBack::track, testEve_cfg::tracks, and v.
{ if(bField_ == 0) throw edm::Exception(edm::errors::InvalidReference) << "B-Field was not set up CandCommonVertexFitter.\n" << "the following method must be called before fitting a candidate:\n" << " CandCommonVertexFitter:.set( const MagneticField * )" << endl; vector<TransientTrack> tracks; vector<Candidate *> daughters; vector<RecoCandidate::TrackType> trackTypes; fill(tracks, daughters, trackTypes, c); assert(tracks.size() == daughters.size()); TransientVertex vertex; if(fit(vertex, tracks)) { tracks = vertex.refittedTracks(); Candidate::Point vtx(vertex.position()); c.setVertex(vtx); vector<TransientTrack>::const_iterator trackIt = tracks.begin(), tracksEnd = tracks.end(); vector<Candidate *>::const_iterator daughterIt = daughters.begin(); vector<RecoCandidate::TrackType>::const_iterator trackTypeIt = trackTypes.begin(); Candidate::LorentzVector mp4(0, 0, 0, 0); for(; trackIt != tracksEnd; ++ trackIt, ++ daughterIt, ++trackTypeIt) { const Track & track = trackIt->track(); Candidate & daughter = * * daughterIt; double px = track.px(), py = track.py(), pz = track.pz(), p = track.p(); double energy; daughter.setVertex( vtx ); if(*trackTypeIt == RecoCandidate::recoTrackType) { double mass = daughter.mass(); energy = sqrt(p*p + mass*mass); } else { energy = daughter.energy(); double scale = energy / p; px *= scale; py *= scale; pz *= scale; } Candidate::LorentzVector dp4(px, py, pz, energy); daughter.setP4(dp4); mp4 += dp4; } c.setP4(mp4); Vertex v = vertex; c.setChi2AndNdof(chi2_ = v.chi2(), ndof_ = v.ndof()); v.fill(cov_); c.setCovariance(cov_); } else { c.setChi2AndNdof(chi2_ = -1, ndof_ = 0); c.setCovariance(cov_ = CovarianceMatrix(ROOT::Math::SMatrixIdentity())); } }
const MagneticField* CandCommonVertexFitterBase::bField_ [protected] |
Definition at line 26 of file CandCommonVertexFitter.h.
Referenced by set().
double CandCommonVertexFitterBase::chi2_ [mutable, protected] |
chi-sqared
Definition at line 34 of file CandCommonVertexFitter.h.
CovarianceMatrix CandCommonVertexFitterBase::cov_ [mutable, protected] |
covariance matrix (3x3)
Definition at line 38 of file CandCommonVertexFitter.h.
double CandCommonVertexFitterBase::ndof_ [mutable, protected] |
number of degrees of freedom
Definition at line 36 of file CandCommonVertexFitter.h.