#include <PhysicsTools/RecoUtils/interface/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] |
virtual CandCommonVertexFitterBase::~CandCommonVertexFitterBase | ( | ) | [inline, virtual] |
void CandCommonVertexFitterBase::fill | ( | std::vector< reco::TransientTrack > & | , | |
std::vector< reco::Candidate * > & | , | |||
std::vector< reco::RecoCandidate::TrackType > & | , | |||
reco::Candidate & | ||||
) | const [protected] |
Referenced by set().
virtual bool CandCommonVertexFitterBase::fit | ( | TransientVertex & | , | |
const std::vector< reco::TransientTrack > & | ||||
) | const [protected, pure virtual] |
void CandCommonVertexFitterBase::set | ( | reco::VertexCompositeCandidate & | c | ) | const |
Definition at line 9 of file CandCommonVertexFitter.cc.
References bField_, reco::Vertex::chi2(), chi2_, cov_, lat::endl(), reco::Particle::energy(), relval_parameters_module::energy, fill(), reco::Vertex::fill(), fit(), edm::errors::InvalidReference, reco::Particle::mass(), reco::Vertex::ndof(), ndof_, reco::TrackBase::p(), p, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), scale, reco::VertexCompositeCandidate::setChi2AndNdof(), reco::VertexCompositeCandidate::setCovariance(), reco::Particle::setP4(), reco::Particle::setVertex(), funct::sqrt(), track, tracks, and v.
00009 { 00010 if(bField_ == 0) 00011 throw edm::Exception(edm::errors::InvalidReference) 00012 << "B-Field was not set up CandCommonVertexFitter.\n" 00013 << "the following method must be called before fitting a candidate:\n" 00014 << " CandCommonVertexFitter:.set( const MagneticField * )" << endl; 00015 vector<TransientTrack> tracks; 00016 vector<Candidate *> daughters; 00017 vector<RecoCandidate::TrackType> trackTypes; 00018 fill(tracks, daughters, trackTypes, c); 00019 assert(tracks.size() == daughters.size()); 00020 TransientVertex vertex; 00021 if(fit(vertex, tracks)) { 00022 tracks = vertex.refittedTracks(); 00023 Candidate::Point vtx(vertex.position()); 00024 c.setVertex(vtx); 00025 vector<TransientTrack>::const_iterator trackIt = tracks.begin(), tracksEnd = tracks.end(); 00026 vector<Candidate *>::const_iterator daughterIt = daughters.begin(); 00027 vector<RecoCandidate::TrackType>::const_iterator trackTypeIt = trackTypes.begin(); 00028 Candidate::LorentzVector mp4(0, 0, 0, 0); 00029 for(; trackIt != tracksEnd; ++ trackIt, ++ daughterIt, ++trackTypeIt) { 00030 const Track & track = trackIt->track(); 00031 Candidate & daughter = * * daughterIt; 00032 double px = track.px(), py = track.py(), pz = track.pz(), p = track.p(); 00033 double energy; 00034 daughter.setVertex( vtx ); 00035 if(*trackTypeIt == RecoCandidate::recoTrackType) { 00036 double mass = daughter.mass(); 00037 energy = sqrt(p*p + mass*mass); 00038 } else { 00039 energy = daughter.energy(); 00040 double scale = energy / p; 00041 px *= scale; py *= scale; pz *= scale; 00042 } 00043 Candidate::LorentzVector dp4(px, py, pz, energy); 00044 daughter.setP4(dp4); 00045 mp4 += dp4; 00046 } 00047 c.setP4(mp4); 00048 Vertex v = vertex; 00049 c.setChi2AndNdof(chi2_ = v.chi2(), ndof_ = v.ndof()); 00050 v.fill(cov_); 00051 c.setCovariance(cov_); 00052 } else { 00053 c.setChi2AndNdof(chi2_ = -1, ndof_ = 0); 00054 c.setCovariance(cov_ = CovarianceMatrix(ROOT::Math::SMatrixIdentity())); 00055 } 00056 }
void CandCommonVertexFitterBase::set | ( | const MagneticField * | bField | ) | [inline] |
Definition at line 22 of file CandCommonVertexFitter.h.
References bField_.
Referenced by reco::modules::CandVertexFitterEventSetupInit< Fitter >::init().
00022 { bField_ = bField; }
const MagneticField* CandCommonVertexFitterBase::bField_ [protected] |
double CandCommonVertexFitterBase::chi2_ [mutable, protected] |
CovarianceMatrix CandCommonVertexFitterBase::cov_ [mutable, protected] |
covariance matrix (3x3)
Definition at line 38 of file CandCommonVertexFitter.h.
Referenced by set().
double CandCommonVertexFitterBase::ndof_ [mutable, protected] |
number of degrees of freedom
Definition at line 36 of file CandCommonVertexFitter.h.
Referenced by set().