CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
 
virtual ~KinematicTree ()
 

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
 
graph
< RefCountedKinematicVertex,
RefCountedKinematicParticle
treeGraph
 
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.

4 {
5  empt = true;
6  treeWalker = 0;
7 }
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
KinematicTree::~KinematicTree ( )
virtual

Definition at line 9 of file KinematicTree.cc.

References treeWalker.

10 {
11  delete treeWalker;
12 }
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 26 of file KinematicTree.cc.

References empt, movePointerToTheTop(), and treeGraph.

Referenced by addTree(), and leftBranchAdd().

29 {
30  part->setTreePointer(this);
31  treeGraph.addEdge(prodVtx,decVtx,part);
32  empt = false;
34  prodVtx->setTreePointer(this);
35  decVtx->setTreePointer(this);
36 }
void movePointerToTheTop() const
graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
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 432 of file KinematicTree.cc.

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

433 {
434 //adding new tree to the existing one:
435  bool fnd = findDecayVertex(vtx);
436  if(!fnd) throw VertexException("KinematicTree::addTree; Current tree does not contain the vertex passed");
437  tr->movePointerToTheTop();
438 
439 // adding the root of the tree:
442  addParticle(vtx,dec_vertex,mP);
443 
444 // adding the left branch if any
445  leftBranchAdd(tr,dec_vertex);
446 
447 //now the pointer is at the left down
448 //edge of the otherTree.
449 //current tree pointer is where the
450 //add operation was stoped last time.
451  bool right = true;
452  bool up = true;
453  do
454  {
455  right = tr->movePointerToTheNextChild();
456  if(right)
457  {
458 
459 //production vertex is already at the current tree
460 //adding current partilce
464  addParticle(prodVertex, decVertex, cPart);
465 
466 //adding the rest of the branch
467  leftBranchAdd(tr,decVertex);
468  }else{
469  up = tr->movePointerToTheMother();
470  }
471  }while(up);
472 }
Definition: BitonicSort.h:8
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 107 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

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

108  {
109  if(isEmpty()) throw VertexException("KinematicTree::currentDecayVertex; tree is empty!");
110  return treeWalker->current().first;
111  }
Common base class.
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
RefCountedKinematicParticle KinematicTree::currentParticle ( ) const

Returns a current particle pointer is NOT moved

Definition at line 229 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

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

230 {
231  if(isEmpty()) throw VertexException("KinematicTree::currentParticle; tree is empty!");
232  return treeWalker->current().second;
233 }
Common base class.
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
RefCountedKinematicVertex KinematicTree::currentProductionVertex ( ) const

Returns a current production vertex pointer is NOT moved

Definition at line 177 of file KinematicTree.cc.

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

Referenced by addTree(), and motherParticle().

178 {
179  if(isEmpty()) throw VertexException("KinematicTree::currentProductionVertex; tree is empty!");
180 //current particle
182 
183  bool up;
184  bool down;
186  up = movePointerToTheMother();
187 
188  if(up)
189  {
190  res = treeWalker->current().first;
191 
192 //pointer moved so we going back
193  down = treeWalker->firstChild();
194 
195 //_down_ variable is always TRUE here, if
196 //the tree is valid.
197  if(down){
198  if(initial == treeWalker->current().second)
199  {
200  return res;
201  }else{
202  bool next = true;
203  do
204  {
205  next = treeWalker->nextSibling();
206  if(treeWalker->current().second == initial) next = false;
207  }while(next);
208  return res;
209  }
210  }else{throw VertexException("KinematicTree::Navigation failed, tree invalid?");}
211  }else
212  {
213 //very unprobable case. This efectively means that user is
214 //already out of the tree. Moving back to the top
215  delete treeWalker;
218  (treeGraph);
219  res = treeWalker->current().first;
220 //now pointer is a pair: fake vertex and
221 //icoming 0 pointer to the particle
222 //moving it to decayed particle
223  bool move = treeWalker->firstChild();
224  if(!move) throw VertexException("KinematicTree::movePointerToTheTop; non consistent tree?");
225  return res;
226  }
227 }
Definition: BitonicSort.h:8
Common base class.
bool movePointerToTheMother() const
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
def move
Definition: eostools.py:510
graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
ReferenceCountingPointer< KinematicVertex > RefCountedKinematicVertex
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 141 of file KinematicTree.cc.

References prof2calltree::back, currentParticle(), down, findParticle(), isEmpty(), and treeWalker.

142  {
143  if(isEmpty()) throw VertexException("KinematicTree::daughterParticles; tree is empty!");
144  std::vector<RefCountedKinematicParticle> sResult;
146  bool down = treeWalker->firstChild();
147  if(down)
148  {
149  sResult.push_back(treeWalker->current().second);
150  bool sibling = true;
151  do
152  {
153  sibling = treeWalker->nextSibling();
154  if(sibling) sResult.push_back(treeWalker->current().second);
155  }while(sibling);
156  }
157 
158 //getting the pointer back to the mother
159  bool back = findParticle(initial);
160  if(!back) throw VertexException("KinematicTree::daughterParticles; error occured while getting back");
161  return sResult;
162  }
Common base class.
bool findParticle(const RefCountedKinematicParticle part) const
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
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 38 of file KinematicTree.cc.

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

39 {
40  if(isEmpty() || !(isConsistent()))
41  {
42  throw VertexException("KinematicTree::finalStateParticles; tree is empty or not consistent");
43  }else{
45  std::vector<RefCountedKinematicParticle> rs;
47  if(!(leftFinalParticle()))
48  {
49  std::cout<<"top particle has no daughters, empty vector returned"<<std::endl;
50  }else{
51 //now pointer is at the most left final particle
52  rs.push_back(currentParticle());
53  bool next_right = true;
54  bool up = true;
55  do
56  {
57  next_right = movePointerToTheNextChild();
58  if(next_right)
59  {
60 //if there's a way to the right,
61 //we go right and down possible
63  rs.push_back(currentParticle());
64  }else{
65 //once there's no way to right anymore
66 //trying to find a way upper
68  }
69 //loop stops when we are at the top:
70 //no way up, no way to the right
71  }while(up);
72  }
73 //getting the pointer back
74  bool back = findParticle(initial);
75  if(!back) throw VertexException("KinematicTree::FinalStateParticles; error occured while getting back");
76  return rs;
77  }
78 }
Definition: BitonicSort.h:8
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:121
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 312 of file KinematicTree.cc.

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

Referenced by addTree().

313 {
314  if(isEmpty() || !(isConsistent()))
315  {
316  throw VertexException("KinematicTree::findParticle; tree is empty or not consistent");
317  }else{
318  bool res = false;
320  if(currentDecayVertex() == vert)
321  {
322  res = true;
323  }else if(leftBranchVertexSearch(vert)){
324  res = true;
325  }else{
326  bool up = true;
327  bool fnd = false;
328  do
329  {
331  {
332  fnd = leftBranchVertexSearch(vert);
333  }else{
335  if(currentDecayVertex() == vert) fnd = true;
336  }
337  }while(up && !fnd);
338  res = fnd;
339  }
340  return res;
341  }
342 }
Definition: BitonicSort.h:8
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 344 of file KinematicTree.cc.

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

345 {
346  if(isEmpty() || !(isConsistent()))
347  {
348  throw VertexException("KinematicTree::findParticle; tree is empty or not consistent");
349  }else{
350  bool res = false;
352  if(*currentDecayVertex() == vert)
353  {
354  res = true;
355  }else if(leftBranchVertexSearch(vert)){
356  res = true;
357  }else{
358  bool up = true;
359  bool fnd = false;
360  do
361  {
363  {
364  fnd = leftBranchVertexSearch(vert);
365  }else{
367  if(currentDecayVertex() == vert) fnd = true;
368  }
369  }while(up && !fnd);
370  res = fnd;
371  }
372  return res;
373  }
374 }
Definition: BitonicSort.h:8
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 256 of file KinematicTree.cc.

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

Referenced by daughterParticles(), and finalStateParticles().

257 {
258  if(isEmpty() || !(isConsistent()))
259  {
260  throw VertexException("KinematicTree::findParticle; tree is empty or not consistent");
261  }else{
262  bool res = false;
264  if(currentParticle() == part)
265  {
266  res = true;
267  }else if(leftBranchSearch(part)){
268  res = true;
269  }else{
270  bool found = false;
271  bool up = true;
272  bool next_right = false;
273  do
274  {
275 // if(*(currentParticle()) == *part) found = true;
276  next_right = movePointerToTheNextChild();
277  if(next_right)
278  {
279  found = leftBranchSearch(part);
280  }else{
281  up = movePointerToTheMother();
282  if(currentParticle() == part) found = true;
283  }
284  }while(up && !found);
285  res = found;
286  }
287  return res;
288  }
289 }
Definition: BitonicSort.h:8
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 18 of file KinematicTree.cc.

References movePointerToTheTop(), and treeWalker.

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

19 {
21  bool des = false;
22  if(!treeWalker->nextSibling()) des = true;
23  return des;
24 }
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
void movePointerToTheTop() const
bool KinematicTree::isEmpty ( void  ) const
bool KinematicTree::isValid ( void  ) const
inline

Definition at line 53 of file KinematicTree.h.

References empt.

Referenced by core.AutoHandle.AutoHandle::ReallyLoad().

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

Definition at line 396 of file KinematicTree.cc.

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

Referenced by addTree().

397 {
398  RefCountedKinematicVertex previous_decay = otherTree->currentDecayVertex();
399 
400 //children of current particle of the
401 //other tree: in the end the whole
402 //left branch should be added.
403  bool next = true;
404  do
405  {
406  next = otherTree->movePointerToTheFirstChild();
407  if(next)
408  {
409  RefCountedKinematicParticle par = otherTree->currentParticle();
410  RefCountedKinematicVertex current_decay = otherTree->currentDecayVertex();
411  addParticle(previous_decay, current_decay, par);
412  previous_decay = current_decay;
413  }
414  }while(next);
415 }
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 292 of file KinematicTree.cc.

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

Referenced by findParticle().

293 {
294  bool found = false;
295  bool next = true;
296  if(currentParticle() == part)
297  {
298  found = true;
299  }else{
300  do
301  {
303  if(currentParticle() == part)
304  {
305  found = true;
306  }
307  }while(next && !found);
308  }
309  return found;
310 }
bool movePointerToTheFirstChild() const
RefCountedKinematicParticle currentParticle() const
bool KinematicTree::leftBranchVertexSearch ( RefCountedKinematicVertex  vtx) const
private

Definition at line 377 of file KinematicTree.cc.

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

Referenced by findDecayVertex().

378 {
379  bool found = false;
380  if(currentDecayVertex() == vtx)
381  {
382  found = true;
383  }else{
384  bool next = true;
385  bool res = false;
386  do
387  {
389  if(currentDecayVertex() == vtx) res = true;
390  }while(next && !res);
391  found = res;
392  }
393  return found;
394 }
RefCountedKinematicVertex currentDecayVertex() const
bool movePointerToTheFirstChild() const
bool KinematicTree::leftFinalParticle ( ) const
private

Definition at line 80 of file KinematicTree.cc.

References movePointerToTheFirstChild(), and GetRecoTauVFromDQM_MC_cff::next.

Referenced by finalStateParticles().

81 {
82  bool res = false;
84  {
85  res = true;
86  bool next = true;
87  do
88  {
90  }while(next);
91  }else{
92  res =false;
93  }
94  return res;
95 }
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 113 of file KinematicTree.cc.

References currentProductionVertex(), benchmark_cfg::fc, isEmpty(), treeWalker, and up.

114  {
115  if(isEmpty()) throw VertexException("KinematicTree::motherParticle; tree is empty!");
116  bool top = currentProductionVertex()->vertexIsValid();
117  RefCountedKinematicParticle cr = treeWalker->current().second;
118  bool up = treeWalker->parent();
119  std::pair<bool,RefCountedKinematicParticle> res;
120  if(up && top){
121  RefCountedKinematicParticle pr = treeWalker->current().second;
122 
123 //now putting the pointer back
124  bool fc = treeWalker->firstChild();
125  if(!fc) throw VertexException("KinematicTree::motherParticle; tree is incorrect!");
126  if(*(treeWalker->current().second) != *cr)
127  {
128  do{
129  bool nx = treeWalker->nextSibling();
130  if(!nx) throw VertexException("KinematicTree::motherParticle; tree is incorrect!");
131  }while(*(treeWalker->current().second) != *cr);
132  }
133  res = std::pair<bool,RefCountedKinematicParticle>(true,pr);
134  return res;
135  }else{
137  return std::pair<bool,RefCountedKinematicParticle>(false,fk);
138  }
139  }
Definition: BitonicSort.h:8
Common base class.
RefCountedKinematicVertex currentProductionVertex() const
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
bool isEmpty() const
bool KinematicTree::movePointerToTheFirstChild ( ) const

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

Definition at line 243 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

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

244 {
245  if(isEmpty()) throw VertexException("KinematicTree::movePointerToTheFirstChild; tree is empty!");
246  return treeWalker->firstChild();
247 }
Common base class.
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 235 of file KinematicTree.cc.

References isEmpty(), treeWalker, and up.

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

236 {
237  if(isEmpty()) throw VertexException("KinematicTree::movePointerToTheMother; tree is empty!");
238  bool up = treeWalker->parent();
239  bool cr = treeWalker->current().first->vertexIsValid();
240  return (up && cr);
241 }
Definition: BitonicSort.h:8
Common base class.
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 249 of file KinematicTree.cc.

References isEmpty(), and treeWalker.

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

250 {
251  if(isEmpty()) throw VertexException("KinematicTree::movePointerToTheNextChild; tree is empty!");
252  bool res = treeWalker->nextSibling();
253  return res;
254 }
Common base class.
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 164 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().

165 {
166  if(isEmpty()) throw VertexException("KinematicTree::movePointerToTheTop; tree is empty!");
167  delete treeWalker;
170 //now pointer is a pair: fake vertex and
171 //icoming 0 pointer to the particle
172 //moving it to decayed particle
173  bool move = treeWalker->firstChild();
174  if(!move) throw VertexException("KinematicTree::movePointerToTheTop; non consistent tree?");
175 }
Common base class.
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
def move
Definition: eostools.py:510
graph< RefCountedKinematicVertex, RefCountedKinematicParticle > treeGraph
ReferenceCountingPointer< KinematicVertex > RefCountedKinematicVertex
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 417 of file KinematicTree.cc.

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

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

418 {
420  bool replace = treeGraph.replaceEdge(cDParticle,newPart);
421  if(!replace) throw VertexException("KinematicTree::Particle To Replace not found");
422 }
Common base class.
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 424 of file KinematicTree.cc.

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

425 {
427  bool replace = treeGraph.replace(cDVertex,newVert);
428  if(! replace) throw VertexException("KinematicTree::Vertex To Replace not found");
429 }
RefCountedKinematicVertex currentDecayVertex() const
Common base class.
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 98 of file KinematicTree.cc.

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

99  {
100  if(isEmpty()) throw VertexException("KinematicTree::topParticle; tree is empty!");
101 //putting pointer to the top of the tree
103  return treeWalker->current().second;
104  }
Common base class.
graphwalker< RefCountedKinematicVertex, RefCountedKinematicParticle > * treeWalker
void movePointerToTheTop() const
bool isEmpty() const

Member Data Documentation

bool KinematicTree::empt
mutableprivate

Definition at line 213 of file KinematicTree.h.

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

graph<RefCountedKinematicVertex,RefCountedKinematicParticle> KinematicTree::treeGraph
mutableprivate
graphwalker<RefCountedKinematicVertex, RefCountedKinematicParticle>* KinematicTree::treeWalker
mutableprivate