MINT2
DalitzBWBox.cpp
Go to the documentation of this file.
1 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
2 // status: Mon 9 Feb 2009 19:17:58 GMT
3 
4 #include "Mint/DalitzBWBox.h"
5 
6 #include "Mint/Minimiser.h"
7 #include "Mint/Minimisable.h"
9 #include "Mint/FitParameter.h"
10 
11 #include <iostream>
12 #include <ctime>
13 
14 using namespace std;
15 using namespace MINT;
16 
18  : _name("noName")
19  , _area()
20  , _pat()
21  , _amps(0)
22  , _rnd(rnd)
23  , _height(-1)
24 {}
25 
26 
29  , TRandom* rnd)
30  : _name("noName")
31  , _area(pat, rnd)
32  , _pat(pat)
33  , _amps(0)
34  , _rnd(rnd)
35  , _height(1)
36 {
37  setAmps(amps);
38 }
39 
41  , const counted_ptr<IGenFct>& pdf
43  , TRandom* rnd)
44  : _name("noName")
45  , _area(pat, pdf, rnd)
46  , _pat(pat)
47  , _amps(0)
48  , _rnd(rnd)
49  , _height(1)
50 {
51  setAmps(amps);
52 }
53 
55  , const std::vector<counted_ptr<IGenFct> >& limits
57  , TRandom* rnd)
58  : _name("noName")
59  , _area(pat, limits, rnd)
60  , _pat(pat)
61  , _amps(0)
62  , _rnd(rnd)
63  , _height(-1)
64 {
65  setAmps(amps);
66 }
67 
69  : _name(other._name)
70  , _area(other._area)
71  , _pat(other._pat)
72  , _amps(other._amps)
73  , _rnd(other._rnd)
74  , _height(other._height)
75 {
76 }
77 
79  _amps = amps;
80  if(0 == _amps) return false;
81  return true;
82 }
83 
85 }
86 
87 bool DalitzBWBox::insideArea(const DalitzEvent& evt) const{
88  /*
89  cout << "Hello from DalitzBWBox::insideArea()" << endl;
90  cout << " my area is " << _area << endl;
91  cout << ", or the same with (): " << area() << endl;
92  cout << " and the event: " << evt << endl;
93  cout << " Let's check if the event is inside the area: " << endl;
94  */
95  bool inside = area().isInside(evt);
96 
97  /*
98  cout << "Goodbye from DalitzBWBox::insideArea(); returning "
99  << inside << endl;
100  */
101 
102  return inside;
103 }
104 
105 double DalitzBWBox::volume() const{
106  //return height(); //
107  bool dbThis=false;
108  if(dbThis){
109  cout << " DalitzBWBox::volume() " << name() << ": "
110  << area().integral() << " * " << height() << endl;
111  }
112  return area().integral() * height();
113 }
114 
115 double DalitzBWBox::genValue(const DalitzEvent& evt) const{
116  bool dbThis=false;
117  if(dbThis) {
118  cout << "DalitzBWBox::genValue called " << endl;
119  }
120 
121  double returnVal = area().genValue(evt)*height();
122  if(dbThis) {
123  cout << "DalitzBWBox::genValue returning "
124  << area().genValue(evt) << " * " << height()
125  << " = "
126  << returnVal << endl;
127  }
128  return returnVal;
129 }
130 
132 
134  return evt;
135 }
136 
138  int nTries;
139  return makeEventForOwner(nTries);
140 }
142  bool dbThis=false;
143 
144  int maxTries = 10000000;
145  for(int i=0; i< maxTries; i++){
147  if(dbThis && 0 != evt) cout << " DalitzBWBox::makeEventForOwner() got event " << evt << endl;
148  if(0 != evt) {
149  if(dbThis) cout << "DalitzBWBox::makeEventForOwner() - made event for value: "
150  << genValue(*evt) << endl;
151  nTries = i+1;
152  return evt;
153  }
154  }
155  cout << "WARINING DalitzBWBox::makeEventForOwner() - no success after " << maxTries
156  << " tries. Returning 0"
157  << endl;
158  nTries = maxTries;
160  return evt;
161 }
162 
164  bool dbThis=false;
166  if(dbThis && 0 != evt) {
167  cout << " DalitzBWBox::tryNewEvent() got event with weight "
168  << evt->getWeight() << endl;
169  }
170  return evt;
171 }
172 
173 bool DalitzBWBox::setRnd(TRandom* rnd){
174  _rnd = rnd;
175  area().setRnd(_rnd);
176  return true;
177 }
178 void DalitzBWBox::print(std::ostream& os) const{
179  os << "DalitzBWBox: " << name()
180  << "\n area " << area();
181 }
182 
183 ostream& operator<<(ostream& os, const DalitzBWBox& box){
184  box.print(os);
185  return os;
186 }
187 //
double & height()
Definition: DalitzBWBox.h:36
double integral() const
bool setRnd(TRandom *rnd=gRandom)
const std::string & name() const
Definition: DalitzBWBox.h:63
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
Definition: DalitzBWBox.h:28
bool insideArea(const DalitzEvent &evt) const
Definition: DalitzBWBox.cpp:87
void print(std::ostream &os=std::cout) const
bool setAmps(MINT::IReturnRealForEvent< IDalitzEvent > *amps)
Definition: DalitzBWBox.cpp:78
ostream & operator<<(ostream &os, const DalitzBWBox &box)
bool isInside(const DalitzEvent &evt) const
virtual double getWeight() const
bool setRnd(TRandom *rnd=gRandom)
double volume() const
const MappedDalitzBWArea & area() const
Definition: DalitzBWBox.h:65
double genValue(const DalitzEvent &evt) const
MINT::counted_ptr< DalitzEvent > makeEventForOwner()
TRandom * _rnd
Definition: DalitzBWBox.h:30
virtual ~DalitzBWBox()
Definition: DalitzBWBox.cpp:84
MINT::counted_ptr< DalitzEvent > tryEventForOwner()
MINT::counted_ptr< DalitzEvent > tryNewEvent()
double genValue(const DalitzEvent &evt) const
DalitzBWBox(TRandom *rnd=gRandom)
Definition: DalitzBWBox.cpp:17