MINT2
FlatFct.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 #include "Mint/FlatFct.h"
4 #include <iostream>
5 using namespace std;
6 
8  : _coord(c)
9  , _boxLimit_min(-9998)
10  , _boxLimit_max(-9999)
11  , _min(-9999)
12  , _max(-9999)
13 {}
14 
16  : IGenFct()
17  , _coord(other._coord)
18  , _boxLimit_min(other._boxLimit_min)
19  , _boxLimit_max(other._boxLimit_max)
20  , _min(other._min)
21  , _max(other._max)
22 {}
23 
24 /*
25 counted_ptr<IGenFct> FlatFct::Clone() const{
26  counted_ptr<IGenFct> cptr ( (IGenFct*) new FlatFct(*this) );
27  return cptr;
28 
29 }
30 */
31 
32 void FlatFct::setLimits(double sMin, double sMax){
33  bool dbThis=false;
34  _coord.setMin(sMin);
35  _coord.setMax(sMax);
36  if(dbThis){
37  cout << "set limits " << sMin << ", " << sMax
38  << ". check: " << min() << ", " << max()
39  << endl;
40  }
41  redoLimits();
42  if(dbThis){
43  cout << "set limits " << sMin << ", " << sMax
44  << ". check: 2 " << min() << ", " << max()
45  << endl;
46  }
47 }
48 void FlatFct::setBoxLimits(double sMin, double sMax){
49  bool dbThis=false;
50  if(dbThis) cout << "setBoxLimits(" << sMin << ", " << sMax << ")" << endl;
51  _boxLimit_min=sMin;
52  _boxLimit_max=sMax;
53  redoLimits();
54 }
56  _boxLimit_min= -9998;
57  _boxLimit_max= -9999;
58  redoLimits();
59 }
60 
61 double FlatFct::min() const{
62  return _min;
63 }
64 double FlatFct::max() const{
65  return _max;
66 }
67 
69  bool dbThis=false;
70  _min= _coord.min();
71  if(dbThis){
72  cout << "_min now " << _min << ", min() " << min() << endl;
73  cout << "boxlimits: " << _boxLimit_min
74  << ", " << _boxLimit_max << endl;
75  }
76  if(_boxLimit_min < _boxLimit_max && _min > _boxLimit_min){
78  }
79  _max= _coord.max();
80  if(_boxLimit_min < _boxLimit_max && _max > _boxLimit_max){
82  }
83  if(dbThis){
84  cout << "and _min now " << _min << endl;
85  cout << "boxlimits: " << _boxLimit_min
86  << ", " << _boxLimit_max << endl;
87  }
88 }
89 
90 double FlatFct::generate(TRandom* rnd) const{
91  double val = min() + rnd->Rndm() * (max() - min());
92  return val;
93 }
94 
95 double FlatFct::generateRho(TRandom* rnd) const{
96  return generate(rnd);
97 }
98 
99 double FlatFct::generatingPDFValue(double sij) const{
100  double num = generatingFctValue(sij);
101  if(num <=0) return 0;
102  double norm = integral();
103  if(norm <= 0) return 0;
104  return num/norm;
105 }
106 
107 double FlatFct::generatingFctValue(double sij) const{
108  if( sij < min() || sij > max()) return 0;
109  return 1;
110 }
111 double FlatFct::transformedFctValue(double sij) const{
112  if( sij < min() || sij > max()) return 0;
113  return 1;
114 }
115 
117  return 1;
118 }
119 
120 double FlatFct::integral()const{
121  return (max() - min());
122 }
123 
125  return _coord;
126 }
128  _coord = c;
129 }
130 
131 //
double min() const
virtual void setLimits(double sMin, double sMax)
Definition: FlatFct.cpp:32
virtual double transformedFctMax() const
Definition: FlatFct.cpp:116
double _max
Definition: FlatFct.h:15
virtual DalitzCoordinate getCoordinate() const
Definition: FlatFct.cpp:124
double _boxLimit_max
Definition: FlatFct.h:14
void setMax(double max)
virtual void setBoxLimits(double sMin, double sMax)
Definition: FlatFct.cpp:48
DalitzCoordinate _coord
Definition: FlatFct.h:13
double max() const
virtual void resetBoxLimits()
Definition: FlatFct.cpp:55
double _boxLimit_min
Definition: FlatFct.h:14
FlatFct(const DalitzCoordinate &c)
Definition: FlatFct.cpp:7
virtual double generatingPDFValue(double sij) const
Definition: FlatFct.cpp:99
double _min
Definition: FlatFct.h:15
void redoLimits()
Definition: FlatFct.cpp:68
virtual double generatingFctValue(double sij) const
Definition: FlatFct.cpp:107
virtual double generate(TRandom *rnd=gRandom) const
Definition: FlatFct.cpp:90
virtual double transformedFctValue(double sij) const
Definition: FlatFct.cpp:111
virtual double min() const
Definition: FlatFct.cpp:61
void setMin(double min)
virtual void setCoordinate(const DalitzCoordinate &c)
Definition: FlatFct.cpp:127
virtual double integral() const
Definition: FlatFct.cpp:120
virtual double max() const
Definition: FlatFct.cpp:64
virtual double generateRho(TRandom *rnd=gRandom) const
Definition: FlatFct.cpp:95