|
||||
File indexing completed on 2024-04-06 12:29:13
0001 #ifndef KinematicTree_H 0002 #define KinematicTree_H 0003 0004 #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicParticle.h" 0005 #include "RecoVertex/KinematicFitPrimitives/interface/RefCountedKinematicVertex.h" 0006 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h" 0007 #include "DataFormats/Math/interface/Graph.h" 0008 #include "DataFormats/Math/interface/GraphWalker.h" 0009 0010 /** 0011 * Class describing the decay 0012 * chain inside the kinematic fit. 0013 * Uses the boost graph based DDD 0014 * library. KinematicVertices are 0015 * vertices, kinemtaic particles become nodes. 0016 * 0017 * Kirill Prokofiev, April 2003 0018 */ 0019 /** 0020 * WARNING: before using any of these 0021 * methods please make sure you _understand correctly_ 0022 * what part of tree are you looking at now and 0023 * where the pointer will be after the desiring 0024 * operation. 0025 * 0026 * "Left" and "Right" notation reflects the order 0027 * of creating a three: from bottom to top, 0028 * from left to right 0029 * EXAMPLE: Bs->J/Psi Phi -> mumu KK 0030 * First creating a mumu branch, fit it to J/Psi, 0031 * Then adding Phi->KK and reconstructing a Bs will 0032 * look like: left bottom particle: muon, top of 0033 * the tree is Bs, right bottom is K. 0034 */ 0035 0036 class KinematicTree : public ReferenceCounted { 0037 public: 0038 /** 0039 * Constructor initializing 0040 * everything and setting all values to 0 0041 */ 0042 KinematicTree(); 0043 0044 ~KinematicTree() override; 0045 0046 /** 0047 * Access methods 0048 */ 0049 bool isEmpty() const; 0050 bool isValid() const { return !empt; } 0051 0052 /** 0053 * This method checks if the tree 0054 * is consistent, i.e. the top vertex is 0055 * only one. 0056 */ 0057 0058 bool isConsistent() const; 0059 0060 /** 0061 * Methods adding nodes and 0062 * edges to the graph representation 0063 * of the Kinematic Tree 0064 */ 0065 void addParticle(RefCountedKinematicVertex prodVtx, 0066 RefCountedKinematicVertex decVtx, 0067 RefCountedKinematicParticle part); 0068 0069 /** 0070 * Kinematic Tree navigation methods 0071 */ 0072 0073 /** 0074 * Returns the complete vector of final state 0075 * particles for the whole decay tree. 0076 * Pointer is NOT moved after this operation 0077 */ 0078 std::vector<RefCountedKinematicParticle> finalStateParticles() const; 0079 0080 /** 0081 * Returns the top particle of 0082 * decay. Pointer is moved to the 0083 * TOP of the decay tree. 0084 */ 0085 RefCountedKinematicParticle topParticle() const; 0086 0087 /** 0088 * Returns a current decay vertex 0089 * pointer is NOT moved 0090 */ 0091 RefCountedKinematicVertex currentDecayVertex() const; 0092 0093 /** 0094 * Returns a current production vertex 0095 * pointer is NOT moved 0096 */ 0097 RefCountedKinematicVertex currentProductionVertex() const; 0098 0099 /** 0100 * Returns a current particle 0101 * pointer is NOT moved 0102 */ 0103 RefCountedKinematicParticle currentParticle() const; 0104 0105 /** 0106 * Returns _true_ and state of mother particle 0107 * if successfull, _false_ and state of current particle 0108 * in case of failure 0109 * Pointer is NOT moved. 0110 */ 0111 std::pair<bool, RefCountedKinematicParticle> motherParticle() const; 0112 0113 /** 0114 * Returns a non-zero vector in case of success and 0115 * 0 vector in case of failure 0116 * Pointer is NOT moved 0117 */ 0118 std::vector<RefCountedKinematicParticle> daughterParticles() const; 0119 0120 /** 0121 * Puts the pointer to the top (root) 0122 * of the tree. The Graph walker 0123 * object gets recreated inside the tree. 0124 */ 0125 void movePointerToTheTop() const; 0126 0127 /** 0128 * Pointer goes to the mother 0129 * particle (if any) with respest to 0130 * the current one 0131 */ 0132 bool movePointerToTheMother() const; 0133 0134 /** 0135 * Pointer goes to the first 0136 * child(if any) in the list 0137 */ 0138 bool movePointerToTheFirstChild() const; 0139 0140 /** 0141 * Pointer goes to the next 0142 * child in the list (if any) 0143 */ 0144 bool movePointerToTheNextChild() const; 0145 0146 /** 0147 * Pointer goes to the needed 0148 * particle inside the tree if 0149 * found (true). Pointer goes 0150 * to the top of the tree if not 0151 * found (false) 0152 */ 0153 bool findParticle(const RefCountedKinematicParticle part) const; 0154 0155 /** 0156 * Pointer goes to the particle 0157 * for which the neede vertex will be 0158 * the decay one (true case) 0159 * Or pointer stays at the top of teh tree 0160 * if search is unsuccessfull (false case). 0161 */ 0162 bool findDecayVertex(const RefCountedKinematicVertex vert) const; 0163 bool findDecayVertex(KinematicVertex* vert) const; 0164 0165 /** 0166 * Methods replacing Particles and Vertices 0167 * inside the tree during the refit. Methods 0168 * should used by corresponding KinematicFitter 0169 * classe only. Replace the current track or 0170 * current (decay) vertex 0171 * WARNING: replace methods are not available 0172 * at this version of KinematicFitPrimitives. 0173 */ 0174 void replaceCurrentParticle(RefCountedKinematicParticle newPart) const; 0175 0176 /** 0177 * Replaces _decay_ vertex of the 0178 * current particle with the given value 0179 */ 0180 void replaceCurrentVertex(RefCountedKinematicVertex newVert) const; 0181 0182 /** 0183 * Method adding a tree _tr_ to the vertex vtx 0184 * of current tree in such a way, that vtx become a 0185 * production vertex for the top particle of the _tr_. 0186 * The whole contetnts of _tr_ is the rewritten to 0187 * current tree. This method is purely technical 0188 * and contains no mathematics. To be used by 0189 * KinematicParticleVertexFitter after the corresponding fit. 0190 */ 0191 void addTree(RefCountedKinematicVertex vtx, KinematicTree* tr); 0192 0193 private: 0194 /** 0195 * Private methods to walk around the tree: 0196 * Needed to collect final state or 0197 * particle search. 0198 */ 0199 0200 bool leftBranchSearch(RefCountedKinematicParticle part) const; 0201 0202 bool leftBranchVertexSearch(RefCountedKinematicVertex vtx) const; 0203 0204 bool leftFinalParticle() const; 0205 0206 void leftBranchAdd(KinematicTree* otherTree, RefCountedKinematicVertex vtx); 0207 0208 mutable bool empt; 0209 0210 mutable math::Graph<RefCountedKinematicVertex, RefCountedKinematicParticle> treeGraph; 0211 mutable math::GraphWalker<RefCountedKinematicVertex, RefCountedKinematicParticle>* treeWalker; 0212 }; 0213 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |