Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:14

0001 #include "RecoVertex/KinematicFit/interface/KinematicParticleFitter.h"
0002 #include "RecoVertex/KinematicFit/interface/LagrangeParentParticleFitter.h"
0003 #include "RecoVertex/KinematicFit/interface/LagrangeChildUpdator.h"
0004 
0005 KinematicParticleFitter::KinematicParticleFitter() {
0006   parentFitter = new LagrangeParentParticleFitter();
0007   cUpdator = new LagrangeChildUpdator();
0008 }
0009 
0010 KinematicParticleFitter::KinematicParticleFitter(const ParentParticleFitter& fitter, const ChildUpdator& updator) {
0011   parentFitter = fitter.clone();
0012   cUpdator = updator.clone();
0013 }
0014 
0015 KinematicParticleFitter::~KinematicParticleFitter() {
0016   delete parentFitter;
0017   delete cUpdator;
0018 }
0019 
0020 std::vector<RefCountedKinematicTree> KinematicParticleFitter::fit(
0021     KinematicConstraint* cs, const std::vector<RefCountedKinematicTree>& trees) const {
0022   std::vector<RefCountedKinematicTree> tr = parentFitter->fit(trees, cs);
0023   // In case of problem in fit:
0024   if (tr.empty())
0025     return tr;
0026   tr = cUpdator->update(tr);
0027   return tr;
0028 }
0029 
0030 RefCountedKinematicTree KinematicParticleFitter::fit(KinematicConstraint* cs, RefCountedKinematicTree tree) const {
0031   std::vector<RefCountedKinematicTree> trees;
0032   trees.push_back(tree);
0033   std::vector<RefCountedKinematicTree> tr = parentFitter->fit(trees, cs);
0034   // In case of problem in fit:
0035   if (tr.empty())
0036     return ReferenceCountingPointer<KinematicTree>(new KinematicTree());
0037   tr = cUpdator->update(tr);
0038   return tr.front();
0039 }