MINT2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AssociatingDecayTree Class Reference

#include <AssociatingDecayTree.h>

Public Member Functions

 AssociatingDecayTree (const DecayTree &tree)
 
 AssociatingDecayTree (const AssociatingDecayTree &other)
 
const AssociatedDecayTreegetTreePtr (const DalitzEventPattern &pat) const
 
const AssociatedDecayTreegetTreePtr (const IDalitzEvent &evt) const
 
const AssociatedDecayTreegetTree (const DalitzEventPattern &pat) const
 
const AssociatedDecayTreegetTree (const IDalitzEvent &evt) const
 
DecayTree getBareTree () const
 
const DalitzEventPatterngetTreePattern () const
 

Protected Member Functions

bool associate (const DalitzEventPattern &pat) const
 
bool associate (const IDalitzEvent &evt) const
 
bool associateFinalStates (const DalitzEventPattern &pat) const
 
bool associateFinalStates (const IDalitzEvent &evt) const
 
bool associateResonances () const
 
std::vector< int > addAssociations (MINT::counted_ptr< AssociatedDecayTree > ctree) const
 
std::vector< int > addAssociations (AssociatedDecayTree *tree) const
 
bool patternHasChanged (const DalitzEventPattern &pat) const
 
bool patternHasChanged (const IDalitzEvent &evt) const
 

Protected Attributes

AssociatedDecayTree _theDecay
 
DalitzEventPattern _prevPattern
 
DalitzEventPattern _theTreesPattern
 

Detailed Description

Definition at line 26 of file AssociatingDecayTree.h.

Constructor & Destructor Documentation

◆ AssociatingDecayTree() [1/2]

AssociatingDecayTree::AssociatingDecayTree ( const DecayTree tree)
inline

Definition at line 47 of file AssociatingDecayTree.h.

48  : _theDecay(tree)
49  , _prevPattern()
50  , _theTreesPattern(tree)
51  {
52  //associate();
53  // std::cout << "associated the decay tree\n" << *this << std::endl;
54  }
AssociatedDecayTree _theDecay
DalitzEventPattern _theTreesPattern
DalitzEventPattern _prevPattern

◆ AssociatingDecayTree() [2/2]

AssociatingDecayTree::AssociatingDecayTree ( const AssociatingDecayTree other)
inline

Definition at line 56 of file AssociatingDecayTree.h.

57  : _theDecay(other._theDecay)
58  , _prevPattern(other._prevPattern)
60  {}
AssociatedDecayTree _theDecay
DalitzEventPattern _theTreesPattern
DalitzEventPattern _prevPattern

Member Function Documentation

◆ addAssociations() [1/2]

std::vector< int > AssociatingDecayTree::addAssociations ( MINT::counted_ptr< AssociatedDecayTree ctree) const
protected

Definition at line 74 of file AssociatingDecayTree.cpp.

74  {
75  return addAssociations(ctree.get());
76 }
std::vector< int > addAssociations(MINT::counted_ptr< AssociatedDecayTree > ctree) const
X * get() const
Definition: counted_ptr.h:123

◆ addAssociations() [2/2]

std::vector< int > AssociatingDecayTree::addAssociations ( AssociatedDecayTree tree) const
protected

Definition at line 78 of file AssociatingDecayTree.cpp.

78  {
79  if(tree->isFinalState()){
80  return tree->getVal()._asi;
81  }
82  std::vector<int> allAsis;
83 
84  for(int i=0; i< tree->nDgtr(); i++){
85  std::vector<int> thisAsi = addAssociations(tree->getDgtrTreePtr(i));
86  for(unsigned int j=0; j<thisAsi.size(); j++){ allAsis.push_back(thisAsi[j]);}
87  }
88  stable_sort(allAsis.begin(), allAsis.end());
89  tree->getVal()._asi=allAsis;
90  return allAsis;
91 }
const ValueType & getVal() const
Definition: DDTree.h:102
bool isFinalState() const
Definition: DDTree.h:93
MINT::const_counted_ptr< DDTree< ValueType > > getDgtrTreePtr(int i) const
Definition: DDTree.h:114
std::vector< int > addAssociations(MINT::counted_ptr< AssociatedDecayTree > ctree) const
int nDgtr() const
Definition: DDTree.h:96

◆ associate() [1/2]

bool AssociatingDecayTree::associate ( const DalitzEventPattern pat) const
protected

Definition at line 14 of file AssociatingDecayTree.cpp.

14  {
15  bool success=true;
16  success &= associateFinalStates(pat);
17  if(! success) return false;
18  success &= associateResonances();
19  _prevPattern=pat;
20  return success;
21 }
bool associateFinalStates(const DalitzEventPattern &pat) const
DalitzEventPattern _prevPattern

◆ associate() [2/2]

bool AssociatingDecayTree::associate ( const IDalitzEvent evt) const
protected

Definition at line 11 of file AssociatingDecayTree.cpp.

11  {
12  return associate(evt.eventPattern());
13 }
virtual const DalitzEventPattern & eventPattern() const =0
bool associate(const DalitzEventPattern &pat) const

◆ associateFinalStates() [1/2]

bool AssociatingDecayTree::associateFinalStates ( const DalitzEventPattern pat) const
protected

Definition at line 26 of file AssociatingDecayTree.cpp.

26  {
27  bool dbThis=false;
28  if(dbThis) cout << "associateFinalStates was called " << endl;
29  if(pat.empty())return false;
30  vector<int> fs_pat= pat.finalStates();
31 
32  if(dbThis) cout << "got pattern of size " << pat.size() << endl;
33  if(fs_pat.empty()) return false;
34  if(dbThis) cout << "pattern not empty" << endl;
35  std::vector<AssociatedDecayTreeItem*> sorted
37  if(dbThis) cout << "sorted" << endl;
38  if(sorted.size() != fs_pat.size()){
39  cout << "Sizes: " << sorted.size() << " " << fs_pat.size() << endl;
40 
41  std::cout << "ERROR in AssociatingDecayTree::associate!"
42  << " fs_pattern : ";
43  for(unsigned int i=0; i<fs_pat.size(); i++){
44  std::cout << "(" << i << ") " << fs_pat[i] << ", ";
45  }
46  std::cout << std::endl;
47 
48  for(unsigned int i=0; i<sorted.size(); i++){
49  std::cout << "(" << i << ") " << *(sorted[i]) << ", ";
50  }
51  std::cout << std::endl;
52  // std::cout << "\n does not match decay:\n" << _theDecay << std::endl;
53  return false;
54  }
55  // cout << "now putting it all in" << endl;
56  for(unsigned int i=0; i<sorted.size(); i++){
57  sorted[i]->_asi.clear();
58  sorted[i]->_asi.push_back(i+1);
59  }
60  if(dbThis){
61  std::cout << "the new sorted thing" << std::endl;
62  for(unsigned int i=0; i<sorted.size(); i++){
63  std::cout << "(" << i << ") " << *(sorted[i]) << ", ";
64  }
65  }
66 
67  // cout << "associateFinalStates returning true" << endl;
68  return true;
69 }
std::vector< int > finalStates() const
AssociatedDecayTree _theDecay
unsigned int size() const
std::vector< ValueType * > finalStateInThisOrder(const std::vector< COMPARABLE_CLASS > &pattern)
Definition: DDTree.h:337

◆ associateFinalStates() [2/2]

bool AssociatingDecayTree::associateFinalStates ( const IDalitzEvent evt) const
protected

Definition at line 23 of file AssociatingDecayTree.cpp.

23  {
24  return associateFinalStates(evt.eventPattern());
25 }
virtual const DalitzEventPattern & eventPattern() const =0
bool associateFinalStates(const DalitzEventPattern &pat) const

◆ associateResonances()

bool AssociatingDecayTree::associateResonances ( ) const
protected

Definition at line 71 of file AssociatingDecayTree.cpp.

71  {
72  return ! (addAssociations(&_theDecay).empty());
73 }
AssociatedDecayTree _theDecay
std::vector< int > addAssociations(MINT::counted_ptr< AssociatedDecayTree > ctree) const

◆ getBareTree()

DecayTree AssociatingDecayTree::getBareTree ( ) const
inline

Definition at line 68 of file AssociatingDecayTree.h.

68  {
69  return _theDecay;
70  }
AssociatedDecayTree _theDecay

◆ getTree() [1/2]

const AssociatedDecayTree & AssociatingDecayTree::getTree ( const DalitzEventPattern pat) const

Definition at line 135 of file AssociatingDecayTree.cpp.

135  {
136  if(patternHasChanged(pat)) associate(pat);
137  return _theDecay;
138 }
AssociatedDecayTree _theDecay
bool patternHasChanged(const DalitzEventPattern &pat) const
bool associate(const DalitzEventPattern &pat) const

◆ getTree() [2/2]

const AssociatedDecayTree & AssociatingDecayTree::getTree ( const IDalitzEvent evt) const

Definition at line 131 of file AssociatingDecayTree.cpp.

131  {
132  if(patternHasChanged(evt)) associate(evt);
133  return getTree(evt.eventPattern());
134 }
bool patternHasChanged(const DalitzEventPattern &pat) const
const AssociatedDecayTree & getTree(const DalitzEventPattern &pat) const
virtual const DalitzEventPattern & eventPattern() const =0
bool associate(const DalitzEventPattern &pat) const

◆ getTreePattern()

const DalitzEventPattern & AssociatingDecayTree::getTreePattern ( ) const

Definition at line 140 of file AssociatingDecayTree.cpp.

140  {
141  return _theTreesPattern;
142 }
DalitzEventPattern _theTreesPattern

◆ getTreePtr() [1/2]

const AssociatedDecayTree * AssociatingDecayTree::getTreePtr ( const DalitzEventPattern pat) const

Definition at line 126 of file AssociatingDecayTree.cpp.

126  {
127  if(patternHasChanged(pat)) associate(pat);
128  return & _theDecay;
129 }
AssociatedDecayTree _theDecay
bool patternHasChanged(const DalitzEventPattern &pat) const
bool associate(const DalitzEventPattern &pat) const

◆ getTreePtr() [2/2]

const AssociatedDecayTree * AssociatingDecayTree::getTreePtr ( const IDalitzEvent evt) const

Definition at line 122 of file AssociatingDecayTree.cpp.

122  {
123  if(patternHasChanged(evt)) associate(evt);
124  return getTreePtr(evt.eventPattern());
125 }
const AssociatedDecayTree * getTreePtr(const DalitzEventPattern &pat) const
bool patternHasChanged(const DalitzEventPattern &pat) const
virtual const DalitzEventPattern & eventPattern() const =0
bool associate(const DalitzEventPattern &pat) const

◆ patternHasChanged() [1/2]

bool AssociatingDecayTree::patternHasChanged ( const DalitzEventPattern pat) const
protected

Definition at line 98 of file AssociatingDecayTree.cpp.

98  {
99  bool dbThis=false ;
100  if(pat.empty()) return false;
101  if(_prevPattern.size() != pat.size()){
102  if(dbThis){
103  std::cout << "prev pattern size != new pattern size: "
104  << _prevPattern.size() << " != " << pat.size() << endl;
105  std::cout << " returning pattern has changed = true " << std::endl;
106  }
107  return true;
108  }
109  // only compare final state:
110  // (this means for D or Dbar to same final state will be treated
111  // as having the same pattern).
112  for(unsigned int i=1; i< _prevPattern.size(); i++){
113  if (_prevPattern[i] != pat[i]){
114  if(dbThis)
115  std::cout << " returning pattern has changed = true " << std::endl;
116  return true;
117  }
118  }
119  return false;
120 }
unsigned int size() const
DalitzEventPattern _prevPattern

◆ patternHasChanged() [2/2]

bool AssociatingDecayTree::patternHasChanged ( const IDalitzEvent evt) const
protected

Definition at line 95 of file AssociatingDecayTree.cpp.

95  {
96  return patternHasChanged(evt.eventPattern());
97 }
bool patternHasChanged(const DalitzEventPattern &pat) const
virtual const DalitzEventPattern & eventPattern() const =0

Member Data Documentation

◆ _prevPattern

DalitzEventPattern AssociatingDecayTree::_prevPattern
mutableprotected

Definition at line 29 of file AssociatingDecayTree.h.

◆ _theDecay

AssociatedDecayTree AssociatingDecayTree::_theDecay
mutableprotected

Definition at line 28 of file AssociatingDecayTree.h.

◆ _theTreesPattern

DalitzEventPattern AssociatingDecayTree::_theTreesPattern
protected

Definition at line 32 of file AssociatingDecayTree.h.


The documentation for this class was generated from the following files: