CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
KinematicTree Class Reference

#include <KinematicTree.h>

Inheritance diagram for KinematicTree:
ReferenceCounted

Public Member Functions

void addParticle (RefCountedKinematicVertex prodVtx, RefCountedKinematicVertex decVtx, RefCountedKinematicParticle part)
 
void addTree (RefCountedKinematicVertex vtx, KinematicTree *tr)
 
RefCountedKinematicVertex currentDecayVertex () const
 
RefCountedKinematicParticle currentParticle () const
 
RefCountedKinematicVertex currentProductionVertex () const
 
std::vector
< RefCountedKinematicParticle
daughterParticles () const
 
std::vector
< RefCountedKinematicParticle
finalStateParticles () const
 
bool findDecayVertex (const RefCountedKinematicVertex vert) const
 
bool findDecayVertex (KinematicVertex *vert) const
 
bool findParticle (const RefCountedKinematicParticle part) const
 
bool isConsistent () const
 
bool isEmpty () const
 
bool isValid () const
 
 KinematicTree ()
 
std::pair< bool,
RefCountedKinematicParticle
motherParticle () const
 
bool movePointerToTheFirstChild () const
 
bool movePointerToTheMother () const
 
bool movePointerToTheNextChild () const
 
void movePointerToTheTop () const
 
void replaceCurrentParticle (RefCountedKinematicParticle newPart) const
 
void replaceCurrentVertex (RefCountedKinematicVertex newVert) const
 
RefCountedKinematicParticle topParticle () const
 
 ~KinematicTree () override
 

Private Member Functions

void leftBranchAdd (KinematicTree *otherTree, RefCountedKinematicVertex vtx)
 
bool leftBranchSearch (RefCountedKinematicParticle part) const
 
bool leftBranchVertexSearch (RefCountedKinematicVertex vtx) const
 
bool leftFinalParticle () const
 

Private Attributes

bool empt
 
math::Graph
< RefCountedKinematicVertex,
RefCountedKinematicParticle
treeGraph
 
math::GraphWalker
< RefCountedKinematicVertex,
RefCountedKinematicParticle > * 
treeWalker
 

Detailed Description

Class describing the decay chain inside the kinematic fit. Uses the boost graph based DDD library. KinematicVertices are vertices, kinemtaic particles become nodes.

Kirill Prokofiev, April 2003 WARNING: before using any of these methods please make sure you understand correctly what part of tree are you looking at now and where the pointer will be after the desiring operation.

"Left" and "Right" notation reflects the order of creating a three: from bottom to top, from left to right EXAMPLE: Bs->J/Psi Phi -> mumu KK First creating a mumu branch, fit it to J/Psi, Then adding Phi->KK and reconstructing a Bs will look like: left bottom particle: muon, top of the tree is Bs, right bottom is K.

Definition at line 36 of file KinematicTree.h.

Constructor & Destructor Documentation

KinematicTree::KinematicTree ( )

Constructor initializing everything and setting all values to 0

Definition at line 3 of file KinematicTree.cc.

References empt, and treeWalker.

3  {
4  empt = true;
5  treeWalker = nullptr;
6 }
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
KinematicTree::~KinematicTree ( )
override

Definition at line 8 of file KinematicTree.cc.

References treeWalker.

8 { delete treeWalker; }
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker

Member Function Documentation

void KinematicTree::addParticle ( RefCountedKinematicVertex  prodVtx,
RefCountedKinematicVertex  decVtx,
RefCountedKinematicParticle  part 
)

Methods adding nodes and edges to the graph representation of the Kinematic Tree

Definition at line 20 of file KinematicTree.cc.

References empt, movePointerToTheTop(), and treeGraph.

Referenced by addTree(), and leftBranchAdd().

22  {
23  part->setTreePointer(this);
24  treeGraph.addEdge(prodVtx, decVtx, part);
25  empt = false;
27  prodVtx->setTreePointer(this);
28  decVtx->setTreePointer(this);
29 }
math::Graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
void movePointerToTheTop() const
void KinematicTree::addTree ( RefCountedKinematicVertex  vtx,
KinematicTree tr 
)

Method adding a tree tr to the vertex vtx of current tree in such a way, that vtx become a production vertex for the top particle of the tr. The whole contetnts of tr is the rewritten to current tree. This method is purely technical and contains no mathematics. To be used by KinematicParticleVertexFitter after the corresponding fit.

Definition at line 391 of file KinematicTree.cc.

References addParticle(), currentDecayVertex(), currentParticle(), currentProductionVertex(), findDecayVertex(), leftBranchAdd(), movePointerToTheMother(), movePointerToTheNextChild(), movePointerToTheTop(), and up.

391  {
392  //adding new tree to the existing one:
393  bool fnd = findDecayVertex(vtx);
394  if (!fnd)
395  throw VertexException("KinematicTree::addTree; Current tree does not contain the vertex passed");
396  tr->movePointerToTheTop();
397 
398  // adding the root of the tree:
401  addParticle(vtx, dec_vertex, mP);
402 
403  // adding the left branch if any
404  leftBranchAdd(tr, dec_vertex);
405 
406  //now the pointer is at the left down
407  //edge of the otherTree.
408  //current tree pointer is where the
409  //add operation was stoped last time.
410  bool right = true;
411  bool up = true;
412  do {
413  right = tr->movePointerToTheNextChild();
414  if (right) {
415  //production vertex is already at the current tree
416  //adding current partilce
420  addParticle(prodVertex, decVertex, cPart);
421 
422  //adding the rest of the branch
423  leftBranchAdd(tr, decVertex);
424  } else {
425  up = tr->movePointerToTheMother();
426  }
427  } while (up);
428 }
Definition: BitonicSort.h:7
RefCountedKinematicVertex currentDecayVertex() const
bool movePointerToTheNextChild() const
Common base class.
void leftBranchAdd(KinematicTree *otherTree, RefCountedKinematicVertex vtx)
RefCountedKinematicVertex currentProductionVertex() const
bool movePointerToTheMother() const
bool findDecayVertex(const RefCountedKinematicVertex vert) const
void movePointerToTheTop() const
RefCountedKinematicParticle currentParticle() const
void addParticle(RefCountedKinematicVertex prodVtx, RefCountedKinematicVertex decVtx, RefCountedKinematicParticle part)
RefCountedKinematicVertex KinematicTree::currentDecayVertex ( ) const

Returns a current decay vertex pointer is NOT moved

Definition at line 91 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

Referenced by addTree(), findDecayVertex(), leftBranchAdd(), leftBranchVertexSearch(), and replaceCurrentVertex().

91  {
92  if (isEmpty())
93  throw VertexException("KinematicTree::currentDecayVertex; tree is empty!");
94  return treeWalker->current().first;
95 }
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
RefCountedKinematicParticle KinematicTree::currentParticle ( ) const

Returns a current particle pointer is NOT moved

Definition at line 212 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

Referenced by addTree(), currentProductionVertex(), daughterParticles(), finalStateParticles(), findParticle(), leftBranchAdd(), leftBranchSearch(), and replaceCurrentParticle().

212  {
213  if (isEmpty())
214  throw VertexException("KinematicTree::currentParticle; tree is empty!");
215  return treeWalker->current().second;
216 }
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
RefCountedKinematicVertex KinematicTree::currentProductionVertex ( ) const

Returns a current production vertex pointer is NOT moved

Definition at line 162 of file KinematicTree.cc.

References currentParticle(), down, isEmpty(), eostools::move(), movePointerToTheMother(), GetRecoTauVFromDQM_MC_cff::next, treeGraph, treeWalker, and up.

Referenced by addTree(), and motherParticle().

162  {
163  if (isEmpty())
164  throw VertexException("KinematicTree::currentProductionVertex; tree is empty!");
165  //current particle
167 
168  bool up;
169  bool down;
171  up = movePointerToTheMother();
172 
173  if (up) {
174  res = treeWalker->current().first;
175 
176  //pointer moved so we going back
177  down = treeWalker->firstChild();
178 
179  //_down_ variable is always TRUE here, if
180  //the tree is valid.
181  if (down) {
182  if (initial == treeWalker->current().second) {
183  return res;
184  } else {
185  bool next = true;
186  do {
187  next = treeWalker->nextSibling();
188  if (treeWalker->current().second == initial)
189  next = false;
190  } while (next);
191  return res;
192  }
193  } else {
194  throw VertexException("KinematicTree::Navigation failed, tree invalid?");
195  }
196  } else {
197  //very unprobable case. This efectively means that user is
198  //already out of the tree. Moving back to the top
199  delete treeWalker;
201  res = treeWalker->current().first;
202  //now pointer is a pair: fake vertex and
203  //icoming 0 pointer to the particle
204  //moving it to decayed particle
205  bool move = treeWalker->firstChild();
206  if (!move)
207  throw VertexException("KinematicTree::movePointerToTheTop; non consistent tree?");
208  return res;
209  }
210 }
Definition: BitonicSort.h:7
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool movePointerToTheMother() const
math::Graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
def move
Definition: eostools.py:511
RefCountedKinematicParticle currentParticle() const
bool isEmpty() const
std::vector< RefCountedKinematicParticle > KinematicTree::daughterParticles ( ) const

Returns a non-zero vector in case of success and 0 vector in case of failure Pointer is NOT moved

Definition at line 126 of file KinematicTree.cc.

References currentParticle(), down, findParticle(), isEmpty(), and treeWalker.

126  {
127  if (isEmpty())
128  throw VertexException("KinematicTree::daughterParticles; tree is empty!");
129  std::vector<RefCountedKinematicParticle> sResult;
131  bool down = treeWalker->firstChild();
132  if (down) {
133  sResult.push_back(treeWalker->current().second);
134  bool sibling = true;
135  do {
136  sibling = treeWalker->nextSibling();
137  if (sibling)
138  sResult.push_back(treeWalker->current().second);
139  } while (sibling);
140  }
141 
142  //getting the pointer back to the mother
143  bool back = findParticle(initial);
144  if (!back)
145  throw VertexException("KinematicTree::daughterParticles; error occured while getting back");
146  return sResult;
147 }
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool findParticle(const RefCountedKinematicParticle part) const
RefCountedKinematicParticle currentParticle() const
bool isEmpty() const
std::vector< RefCountedKinematicParticle > KinematicTree::finalStateParticles ( ) const

Kinematic Tree navigation methods Returns the complete vector of final state particles for the whole decay tree. Pointer is NOT moved after this operation

Definition at line 31 of file KinematicTree.cc.

References gather_cfg::cout, currentParticle(), findParticle(), isConsistent(), isEmpty(), leftFinalParticle(), movePointerToTheMother(), movePointerToTheNextChild(), movePointerToTheTop(), and up.

31  {
32  if (isEmpty() || !(isConsistent())) {
33  throw VertexException("KinematicTree::finalStateParticles; tree is empty or not consistent");
34  } else {
36  std::vector<RefCountedKinematicParticle> rs;
38  if (!(leftFinalParticle())) {
39  std::cout << "top particle has no daughters, empty vector returned" << std::endl;
40  } else {
41  //now pointer is at the most left final particle
42  rs.push_back(currentParticle());
43  bool next_right = true;
44  bool up = true;
45  do {
46  next_right = movePointerToTheNextChild();
47  if (next_right) {
48  //if there's a way to the right,
49  //we go right and down possible
51  rs.push_back(currentParticle());
52  } else {
53  //once there's no way to right anymore
54  //trying to find a way upper
56  }
57  //loop stops when we are at the top:
58  //no way up, no way to the right
59  } while (up);
60  }
61  //getting the pointer back
62  bool back = findParticle(initial);
63  if (!back)
64  throw VertexException("KinematicTree::FinalStateParticles; error occured while getting back");
65  return rs;
66  }
67 }
Definition: BitonicSort.h:7
bool movePointerToTheNextChild() const
Common base class.
bool leftFinalParticle() const
bool findParticle(const RefCountedKinematicParticle part) const
bool movePointerToTheMother() const
void movePointerToTheTop() const
bool isConsistent() const
RefCountedKinematicParticle currentParticle() const
tuple cout
Definition: gather_cfg.py:144
bool isEmpty() const
bool KinematicTree::findDecayVertex ( const RefCountedKinematicVertex  vert) const

Pointer goes to the particle for which the neede vertex will be the decay one (true case) Or pointer stays at the top of teh tree if search is unsuccessfull (false case).

Definition at line 286 of file KinematicTree.cc.

References currentDecayVertex(), isConsistent(), isEmpty(), leftBranchVertexSearch(), movePointerToTheMother(), movePointerToTheNextChild(), movePointerToTheTop(), and up.

Referenced by addTree().

286  {
287  if (isEmpty() || !(isConsistent())) {
288  throw VertexException("KinematicTree::findParticle; tree is empty or not consistent");
289  } else {
290  bool res = false;
292  if (currentDecayVertex() == vert) {
293  res = true;
294  } else if (leftBranchVertexSearch(vert)) {
295  res = true;
296  } else {
297  bool up = true;
298  bool fnd = false;
299  do {
301  fnd = leftBranchVertexSearch(vert);
302  } else {
303  up = movePointerToTheMother();
304  if (currentDecayVertex() == vert)
305  fnd = true;
306  }
307  } while (up && !fnd);
308  res = fnd;
309  }
310  return res;
311  }
312 }
Definition: BitonicSort.h:7
RefCountedKinematicVertex currentDecayVertex() const
bool movePointerToTheNextChild() const
bool leftBranchVertexSearch(RefCountedKinematicVertex vtx) const
Common base class.
bool movePointerToTheMother() const
void movePointerToTheTop() const
bool isConsistent() const
bool isEmpty() const
bool KinematicTree::findDecayVertex ( KinematicVertex vert) const

Definition at line 314 of file KinematicTree.cc.

References currentDecayVertex(), isConsistent(), isEmpty(), leftBranchVertexSearch(), movePointerToTheMother(), movePointerToTheNextChild(), movePointerToTheTop(), and up.

314  {
315  if (isEmpty() || !(isConsistent())) {
316  throw VertexException("KinematicTree::findParticle; tree is empty or not consistent");
317  } else {
318  bool res = false;
320  if (*currentDecayVertex() == vert) {
321  res = true;
322  } else if (leftBranchVertexSearch(vert)) {
323  res = true;
324  } else {
325  bool up = true;
326  bool fnd = false;
327  do {
329  fnd = leftBranchVertexSearch(vert);
330  } else {
331  up = movePointerToTheMother();
332  if (currentDecayVertex() == vert)
333  fnd = true;
334  }
335  } while (up && !fnd);
336  res = fnd;
337  }
338  return res;
339  }
340 }
Definition: BitonicSort.h:7
RefCountedKinematicVertex currentDecayVertex() const
bool movePointerToTheNextChild() const
bool leftBranchVertexSearch(RefCountedKinematicVertex vtx) const
Common base class.
bool movePointerToTheMother() const
void movePointerToTheTop() const
bool isConsistent() const
bool isEmpty() const
bool KinematicTree::findParticle ( const RefCountedKinematicParticle  part) const

Pointer goes to the needed particle inside the tree if found (true). Pointer goes to the top of the tree if not found (false)

Definition at line 239 of file KinematicTree.cc.

References currentParticle(), newFWLiteAna::found, isConsistent(), isEmpty(), leftBranchSearch(), movePointerToTheMother(), movePointerToTheNextChild(), movePointerToTheTop(), and up.

Referenced by daughterParticles(), and finalStateParticles().

239  {
240  if (isEmpty() || !(isConsistent())) {
241  throw VertexException("KinematicTree::findParticle; tree is empty or not consistent");
242  } else {
243  bool res = false;
245  if (currentParticle() == part) {
246  res = true;
247  } else if (leftBranchSearch(part)) {
248  res = true;
249  } else {
250  bool found = false;
251  bool up = true;
252  bool next_right = false;
253  do {
254  // if(*(currentParticle()) == *part) found = true;
255  next_right = movePointerToTheNextChild();
256  if (next_right) {
257  found = leftBranchSearch(part);
258  } else {
259  up = movePointerToTheMother();
260  if (currentParticle() == part)
261  found = true;
262  }
263  } while (up && !found);
264  res = found;
265  }
266  return res;
267  }
268 }
Definition: BitonicSort.h:7
bool movePointerToTheNextChild() const
Common base class.
bool leftBranchSearch(RefCountedKinematicParticle part) const
bool movePointerToTheMother() const
void movePointerToTheTop() const
bool isConsistent() const
RefCountedKinematicParticle currentParticle() const
bool isEmpty() const
bool KinematicTree::isConsistent ( ) const

This method checks if the tree is consistent, i.e. the top vertex is only one.

Definition at line 12 of file KinematicTree.cc.

References movePointerToTheTop(), and treeWalker.

Referenced by finalStateParticles(), findDecayVertex(), and findParticle().

12  {
14  bool des = false;
15  if (!treeWalker->nextSibling())
16  des = true;
17  return des;
18 }
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
void movePointerToTheTop() const
bool KinematicTree::isEmpty ( void  ) const
bool KinematicTree::isValid ( void  ) const
inline

Definition at line 50 of file KinematicTree.h.

References empt.

Referenced by ntupleDataFormat._Object::_checkIsValid(), and core.AutoHandle.AutoHandle::ReallyLoad().

50 { return !empt; }
void KinematicTree::leftBranchAdd ( KinematicTree otherTree,
RefCountedKinematicVertex  vtx 
)
private

Definition at line 359 of file KinematicTree.cc.

References addParticle(), currentDecayVertex(), currentParticle(), movePointerToTheFirstChild(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by addTree().

359  {
360  RefCountedKinematicVertex previous_decay = otherTree->currentDecayVertex();
361 
362  //children of current particle of the
363  //other tree: in the end the whole
364  //left branch should be added.
365  bool next = true;
366  do {
367  next = otherTree->movePointerToTheFirstChild();
368  if (next) {
369  RefCountedKinematicParticle par = otherTree->currentParticle();
370  RefCountedKinematicVertex current_decay = otherTree->currentDecayVertex();
371  addParticle(previous_decay, current_decay, par);
372  previous_decay = current_decay;
373  }
374  } while (next);
375 }
RefCountedKinematicVertex currentDecayVertex() const
bool movePointerToTheFirstChild() const
RefCountedKinematicParticle currentParticle() const
void addParticle(RefCountedKinematicVertex prodVtx, RefCountedKinematicVertex decVtx, RefCountedKinematicParticle part)
bool KinematicTree::leftBranchSearch ( RefCountedKinematicParticle  part) const
private

Private methods to walk around the tree: Needed to collect final state or particle search.

Definition at line 270 of file KinematicTree.cc.

References currentParticle(), newFWLiteAna::found, movePointerToTheFirstChild(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by findParticle().

270  {
271  bool found = false;
272  bool next = true;
273  if (currentParticle() == part) {
274  found = true;
275  } else {
276  do {
278  if (currentParticle() == part) {
279  found = true;
280  }
281  } while (next && !found);
282  }
283  return found;
284 }
bool movePointerToTheFirstChild() const
RefCountedKinematicParticle currentParticle() const
bool KinematicTree::leftBranchVertexSearch ( RefCountedKinematicVertex  vtx) const
private

Definition at line 342 of file KinematicTree.cc.

References currentDecayVertex(), newFWLiteAna::found, movePointerToTheFirstChild(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by findDecayVertex().

342  {
343  bool found = false;
344  if (currentDecayVertex() == vtx) {
345  found = true;
346  } else {
347  bool next = true;
348  bool res = false;
349  do {
351  if (currentDecayVertex() == vtx)
352  res = true;
353  } while (next && !res);
354  found = res;
355  }
356  return found;
357 }
RefCountedKinematicVertex currentDecayVertex() const
bool movePointerToTheFirstChild() const
bool KinematicTree::leftFinalParticle ( ) const
private

Definition at line 69 of file KinematicTree.cc.

References movePointerToTheFirstChild(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by finalStateParticles().

69  {
70  bool res = false;
72  res = true;
73  bool next = true;
74  do {
76  } while (next);
77  } else {
78  res = false;
79  }
80  return res;
81 }
bool movePointerToTheFirstChild() const
std::pair< bool, RefCountedKinematicParticle > KinematicTree::motherParticle ( ) const

Returns true and state of mother particle if successfull, false and state of current particle in case of failure Pointer is NOT moved.

Definition at line 97 of file KinematicTree.cc.

References currentProductionVertex(), isEmpty(), treeWalker, and up.

97  {
98  if (isEmpty())
99  throw VertexException("KinematicTree::motherParticle; tree is empty!");
100  bool top = currentProductionVertex()->vertexIsValid();
101  RefCountedKinematicParticle cr = treeWalker->current().second;
102  bool up = treeWalker->parent();
103  std::pair<bool, RefCountedKinematicParticle> res;
104  if (up && top) {
105  RefCountedKinematicParticle pr = treeWalker->current().second;
106 
107  //now putting the pointer back
108  bool fc = treeWalker->firstChild();
109  if (!fc)
110  throw VertexException("KinematicTree::motherParticle; tree is incorrect!");
111  if (*(treeWalker->current().second) != *cr) {
112  do {
113  bool nx = treeWalker->nextSibling();
114  if (!nx)
115  throw VertexException("KinematicTree::motherParticle; tree is incorrect!");
116  } while (*(treeWalker->current().second) != *cr);
117  }
118  res = std::pair<bool, RefCountedKinematicParticle>(true, pr);
119  return res;
120  } else {
122  return std::pair<bool, RefCountedKinematicParticle>(false, fk);
123  }
124 }
Definition: BitonicSort.h:7
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
RefCountedKinematicVertex currentProductionVertex() const
bool isEmpty() const
bool KinematicTree::movePointerToTheFirstChild ( ) const

Pointer goes to the first child(if any) in the list

Definition at line 226 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

Referenced by leftBranchAdd(), leftBranchSearch(), leftBranchVertexSearch(), and leftFinalParticle().

226  {
227  if (isEmpty())
228  throw VertexException("KinematicTree::movePointerToTheFirstChild; tree is empty!");
229  return treeWalker->firstChild();
230 }
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
bool KinematicTree::movePointerToTheMother ( ) const

Pointer goes to the mother particle (if any) with respest to the current one

Definition at line 218 of file KinematicTree.cc.

References isEmpty(), treeWalker, and up.

Referenced by addTree(), currentProductionVertex(), finalStateParticles(), findDecayVertex(), and findParticle().

218  {
219  if (isEmpty())
220  throw VertexException("KinematicTree::movePointerToTheMother; tree is empty!");
221  bool up = treeWalker->parent();
222  bool cr = treeWalker->current().first->vertexIsValid();
223  return (up && cr);
224 }
Definition: BitonicSort.h:7
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
bool KinematicTree::movePointerToTheNextChild ( ) const

Pointer goes to the next child in the list (if any)

Definition at line 232 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

Referenced by addTree(), finalStateParticles(), findDecayVertex(), and findParticle().

232  {
233  if (isEmpty())
234  throw VertexException("KinematicTree::movePointerToTheNextChild; tree is empty!");
235  bool res = treeWalker->nextSibling();
236  return res;
237 }
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
void KinematicTree::movePointerToTheTop ( ) const

Puts the pointer to the top (root) of the tree. The Graph walker object gets recreated inside the tree.

Definition at line 149 of file KinematicTree.cc.

References isEmpty(), eostools::move(), treeGraph, and treeWalker.

Referenced by addParticle(), addTree(), ConstrainedTreeBuilderT::buildRealTree(), FinalTreeBuilder::buildTree(), ConstrainedTreeBuilder::buildTree(), finalStateParticles(), findDecayVertex(), findParticle(), isConsistent(), and topParticle().

149  {
150  if (isEmpty())
151  throw VertexException("KinematicTree::movePointerToTheTop; tree is empty!");
152  delete treeWalker;
154  //now pointer is a pair: fake vertex and
155  //icoming 0 pointer to the particle
156  //moving it to decayed particle
157  bool move = treeWalker->firstChild();
158  if (!move)
159  throw VertexException("KinematicTree::movePointerToTheTop; non consistent tree?");
160 }
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
math::Graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
def move
Definition: eostools.py:511
bool isEmpty() const
void KinematicTree::replaceCurrentParticle ( RefCountedKinematicParticle  newPart) const

Methods replacing Particles and Vertices inside the tree during the refit. Methods should used by corresponding KinematicFitter classe only. Replace the current track or current (decay) vertex WARNING: replace methods are not available at this version of KinematicFitPrimitives.

Definition at line 377 of file KinematicTree.cc.

References currentParticle(), python.rootplot.root2matplotlib::replace(), and treeGraph.

Referenced by ConstrainedTreeBuilderT::buildRealTree(), FinalTreeBuilder::buildTree(), and ConstrainedTreeBuilder::buildTree().

377  {
379  bool replace = treeGraph.replaceEdge(cDParticle, newPart);
380  if (!replace)
381  throw VertexException("KinematicTree::Particle To Replace not found");
382 }
Common base class.
math::Graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
RefCountedKinematicParticle currentParticle() const
void KinematicTree::replaceCurrentVertex ( RefCountedKinematicVertex  newVert) const

Replaces decay vertex of the current particle with the given value

Definition at line 384 of file KinematicTree.cc.

References currentDecayVertex(), python.rootplot.root2matplotlib::replace(), and treeGraph.

384  {
386  bool replace = treeGraph.replace(cDVertex, newVert);
387  if (!replace)
388  throw VertexException("KinematicTree::Vertex To Replace not found");
389 }
RefCountedKinematicVertex currentDecayVertex() const
Common base class.
math::Graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
RefCountedKinematicParticle KinematicTree::topParticle ( ) const

Returns the top particle of decay. Pointer is moved to the TOP of the decay tree.

Definition at line 83 of file KinematicTree.cc.

References isEmpty(), movePointerToTheTop(), and treeWalker.

83  {
84  if (isEmpty())
85  throw VertexException("KinematicTree::topParticle; tree is empty!");
86  //putting pointer to the top of the tree
88  return treeWalker->current().second;
89 }
Common base class.
math::GraphWalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
void movePointerToTheTop() const
bool isEmpty() const

Member Data Documentation

bool KinematicTree::empt
mutableprivate

Definition at line 208 of file KinematicTree.h.

Referenced by addParticle(), isEmpty(), isValid(), and KinematicTree().

math::Graph<RefCountedKinematicVertex, RefCountedKinematicParticle> KinematicTree::treeGraph
mutableprivate
math::GraphWalker<RefCountedKinematicVertex, RefCountedKinematicParticle>* KinematicTree::treeWalker
mutableprivate