CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

CandCommonVertexFitterBase Class Reference

#include <CandCommonVertexFitter.h>

Inheritance diagram for CandCommonVertexFitterBase:
CandCommonVertexFitter< Fitter >

List of all members.

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 MagneticFieldbField_
double chi2_
 chi-sqared
CovarianceMatrix cov_
 covariance matrix (3x3)
double ndof_
 number of degrees of freedom

Detailed Description

Definition at line 17 of file CandCommonVertexFitter.h.


Member Typedef Documentation

Definition at line 19 of file CandCommonVertexFitter.h.


Constructor & Destructor Documentation

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.

{ }

Member Function Documentation

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]
void CandCommonVertexFitterBase::set ( const MagneticField bField) [inline]
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, lumiContext::fill, reco::Vertex::fill(), edm::errors::InvalidReference, reco::Candidate::mass(), reco::Vertex::ndof(), reco::TrackBase::p(), AlCaHLTBitMon_ParallelJobs::p, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), reco::RecoCandidate::recoTrackType, pileupReCalc_HLTpaths::scale, reco::VertexCompositeCandidate::setChi2AndNdof(), reco::VertexCompositeCandidate::setCovariance(), reco::LeafCandidate::setP4(), reco::Candidate::setP4(), reco::LeafCandidate::setVertex(), reco::Candidate::setVertex(), mathSSE::sqrt(), testEve_cfg::tracks, and findQualityFiles::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())); 
  }
}

Member Data Documentation

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.

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.