CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/RecoVertex/KinematicFit/src/KinematicParticleFitter.cc

Go to the documentation of this file.
00001 #include "RecoVertex/KinematicFit/interface/KinematicParticleFitter.h"
00002 #include "RecoVertex/KinematicFit/interface/LagrangeParentParticleFitter.h"
00003 #include "RecoVertex/KinematicFit/interface/LagrangeChildUpdator.h"
00004 
00005 KinematicParticleFitter::KinematicParticleFitter()
00006 {
00007  parentFitter = new LagrangeParentParticleFitter();
00008  cUpdator = new LagrangeChildUpdator();
00009 }
00010 
00011 KinematicParticleFitter::KinematicParticleFitter(const ParentParticleFitter& fitter, const ChildUpdator& updator)
00012 {
00013  parentFitter = fitter.clone();
00014  cUpdator = updator.clone();
00015 }
00016   
00017 KinematicParticleFitter::~KinematicParticleFitter()
00018 {
00019  delete parentFitter;
00020  delete cUpdator;
00021 }
00022 
00023 std::vector<RefCountedKinematicTree> KinematicParticleFitter::fit(KinematicConstraint * cs , 
00024                                             std::vector<RefCountedKinematicTree> trees)const
00025 {
00026  std::vector<RefCountedKinematicTree> tr = parentFitter->fit(trees,cs);
00027  // In case of problem in fit:
00028  if (tr.empty()) return tr;
00029  tr = cUpdator->update(tr);
00030  return tr;
00031 } 
00032 
00033 RefCountedKinematicTree KinematicParticleFitter::fit(KinematicConstraint * cs , 
00034                                             RefCountedKinematicTree tree)const
00035 {
00036  std::vector<RefCountedKinematicTree> trees;
00037  trees.push_back(tree);
00038  std::vector<RefCountedKinematicTree> tr = parentFitter->fit(trees,cs);
00039  // In case of problem in fit:
00040  if (tr.empty()) return ReferenceCountingPointer<KinematicTree>(new KinematicTree());
00041  tr = cUpdator->update(tr);
00042  return tr.front();
00043 }