Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "RecoVertex/KinematicFit/interface/ConstrainedTreeBuilderT.h"
0002 #include "DataFormats/CLHEP/interface/Migration.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 RefCountedKinematicTree ConstrainedTreeBuilderT::buildRealTree(
0006     const RefCountedKinematicParticle virtualParticle,
0007     const RefCountedKinematicVertex vtx,
0008     const std::vector<RefCountedKinematicParticle>& particles) const {
0009   //making a resulting tree:
0010   RefCountedKinematicTree resTree = ReferenceCountingPointer<KinematicTree>(new KinematicTree());
0011 
0012   //fake production vertex:
0013   RefCountedKinematicVertex fVertex = vFactory.vertex();
0014   resTree->addParticle(fVertex, vtx, virtualParticle);
0015 
0016   //adding final state
0017   for (std::vector<RefCountedKinematicParticle>::const_iterator il = particles.begin(); il != particles.end(); il++) {
0018     if ((*il)->previousParticle()->correspondingTree() != nullptr) {
0019       KinematicTree* tree = (*il)->previousParticle()->correspondingTree();
0020       tree->movePointerToTheTop();
0021       tree->replaceCurrentParticle(*il);
0022       RefCountedKinematicVertex cdVertex = resTree->currentDecayVertex();
0023       resTree->addTree(cdVertex, tree);
0024     } else {
0025       RefCountedKinematicVertex ffVertex = vFactory.vertex();
0026       resTree->addParticle(vtx, ffVertex, *il);
0027     }
0028   }
0029   return resTree;
0030 }