00001 #ifndef KinematicTree_H 00002 #define KinematicTree_H 00003 00004 #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicParticle.h" 00005 #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicVertex.h" 00006 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h" 00007 #include "DetectorDescription/Core/interface/adjgraph.h" 00008 #include "DetectorDescription/Core/interface/graphwalker.h" 00009 00036 class KinematicTree : public ReferenceCounted 00037 { 00038 public: 00039 00044 KinematicTree(); 00045 00046 00047 virtual ~KinematicTree(); 00048 00052 bool isEmpty() const; 00053 bool isValid() const {return !empt;} 00054 00061 bool isConsistent() const; 00062 00068 void addParticle(RefCountedKinematicVertex prodVtx, 00069 RefCountedKinematicVertex decVtx, 00070 RefCountedKinematicParticle part); 00071 00081 std::vector<RefCountedKinematicParticle> finalStateParticles() const; 00082 00088 RefCountedKinematicParticle topParticle() const; 00089 00094 RefCountedKinematicVertex currentDecayVertex() const; 00095 00100 RefCountedKinematicVertex currentProductionVertex() const; 00101 00106 RefCountedKinematicParticle currentParticle() const; 00107 00114 std::pair<bool,RefCountedKinematicParticle> motherParticle() const; 00115 00116 00122 std::vector<RefCountedKinematicParticle> daughterParticles() const; 00123 00129 void movePointerToTheTop() const; 00130 00136 bool movePointerToTheMother() const; 00137 00142 bool movePointerToTheFirstChild() const; 00143 00148 bool movePointerToTheNextChild() const; 00149 00157 bool findParticle(const RefCountedKinematicParticle part) const; 00158 00166 bool findDecayVertex(const RefCountedKinematicVertex vert) const; 00167 bool findDecayVertex(KinematicVertex * vert) const; 00168 00178 void replaceCurrentParticle(RefCountedKinematicParticle newPart) const; 00179 00180 00185 void replaceCurrentVertex(RefCountedKinematicVertex newVert) const; 00186 00196 void addTree(RefCountedKinematicVertex vtx, KinematicTree * tr); 00197 private: 00198 00205 bool leftBranchSearch(RefCountedKinematicParticle part) const; 00206 00207 bool leftBranchVertexSearch(RefCountedKinematicVertex vtx) const; 00208 00209 bool leftFinalParticle() const; 00210 00211 void leftBranchAdd(KinematicTree * otherTree, RefCountedKinematicVertex vtx); 00212 00213 mutable bool empt; 00214 00215 mutable graph<RefCountedKinematicVertex,RefCountedKinematicParticle> treeGraph; 00216 mutable graphwalker<RefCountedKinematicVertex, RefCountedKinematicParticle> * treeWalker; 00217 00218 }; 00219 #endif