CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoVertex/KinematicFit/src/ConstrainedTreeBuilderT.cc

Go to the documentation of this file.
00001 #include "RecoVertex/KinematicFit/interface/ConstrainedTreeBuilderT.h"
00002 #include "DataFormats/CLHEP/interface/Migration.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 
00005 
00006 
00007 
00008 RefCountedKinematicTree ConstrainedTreeBuilderT::buildRealTree(const RefCountedKinematicParticle virtualParticle,
00009                                                            const RefCountedKinematicVertex vtx, const std::vector<RefCountedKinematicParticle> & particles) const
00010 {
00011 
00012 //making a resulting tree:
00013  RefCountedKinematicTree resTree = ReferenceCountingPointer<KinematicTree>(new KinematicTree());
00014 
00015 //fake production vertex:
00016  RefCountedKinematicVertex fVertex = vFactory.vertex();
00017  resTree->addParticle(fVertex, vtx, virtualParticle);
00018 
00019 //adding final state
00020  for(std::vector<RefCountedKinematicParticle>::const_iterator il = particles.begin(); il != particles.end(); il++)
00021  {
00022   if((*il)->previousParticle()->correspondingTree() != 0)
00023   {
00024    KinematicTree * tree = (*il)->previousParticle()->correspondingTree();
00025    tree->movePointerToTheTop();
00026    tree->replaceCurrentParticle(*il);
00027    RefCountedKinematicVertex cdVertex = resTree->currentDecayVertex();
00028    resTree->addTree(cdVertex, tree);
00029   }else{
00030    RefCountedKinematicVertex ffVertex = vFactory.vertex();
00031    resTree->addParticle(vtx,ffVertex,*il);
00032   }
00033  }
00034  return resTree;
00035 }
00036