MINT2
BWFct.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:57 GMT
3 #include "Mint/BWFct.h"
4 
6 
7 #include <cmath>
8 #include <iostream>
9 
10 using namespace std;
11 
12 BWFct::BWFct(const DalitzCoordinate& c, double M, double Gamma)
13  : _coord(c)
14  , _M(M)
15  , _G(Gamma)
16 {}
17 BWFct::BWFct(const BWFct& other)
18  : IGenFct()
19  , _coord(other._coord)
20  , _M(other._M)
21  , _G(other._G)
22 {}
23 
24 /*
25 counted_ptr<IGenFct> BWFct::Clone()const{
26  counted_ptr<IGenFct> cptr ( (IGenFct*) new BWFct(*this) );
27  return cptr;
28 }
29 */
30 
31 void BWFct::setLimits(double sMin, double sMax){
32  // cout << "setting limits to " << sMin << ", " << sMax << endl;
33  _coord.setMin(sMin);
34  _coord.setMax(sMax);
35 }
36 
37 double BWFct::rhoMi() const{
38  double rhoMi = -0.5*pi;
39  if(_coord.min() < _coord.max() ){
41  }
42  return rhoMi;
43 }
44 double BWFct::rhoMa() const{
45  double rhoMa = 0.5*pi;
46  if(_coord.min() < _coord.max() ){
48  }
49  return rhoMa;
50 }
51 double BWFct::generateRho(TRandom* rnd) const{
52  // bool dbThis = false;
53 
54  double rho = rhoMi() + rnd->Rndm()*(rhoMa() - rhoMi());
55  return rho;
56 }
57 
59  return unitFactor()/(_G*_M);
60 }
61 double BWFct::generate(TRandom* rnd) const{
62  bool dbThis = false;
63 
64  double rho = generateRho(rnd);
65  double s = coordTransformToS(rho);
66 
67  if(dbThis) cout << "_M = " << _M
68  << ", _G = " << _G
69  << ", rho = " << rho
70  << ", rhoMi = " << rhoMi()
71  << ", rhoMa = " << rhoMa()
72  << ", sMi = " << _coord.min()
73  << ", sMa = " << _coord.max()
74  << ", s = " << s
75  << endl;
76 
77  return s;
78 }
79 
80 double BWFct::unitFactor() const{
81  return (GeV*GeV)*(GeV*GeV);
82 }
83 double BWFct::coordTransformFromS(double s)const{
84  return atan( ( s - _M*_M)/(_M*_G) );
85 }
86 double BWFct::coordTransformToS(double rho)const{
87  return _M * _G * tan(rho) + _M*_M;
88 }
89 
90 double BWFct::transformedPDFValue(double rho)const{
91  if(rho > rhoMa() || rho < rhoMi()) return 0;
92  return 1.0*unitFactor()/(rhoMa() - rhoMi());
93 }
94 
95 double BWFct::transformedFctValue(double rho)const{
96  if(rho > rhoMa() || rho < rhoMi()) return 0;
97  return 1.0*unitFactor()/(_G*_M);
98 }
100  return 1.0*unitFactor()*(rhoMa() - rhoMi())/(_G*_M);
101 }
102 
103 
104 double BWFct::integral() const{
105  return unitFactor()*(rhoMa() - rhoMi())/(_G*_M);
106 }
107 
108 double BWFct::generatingPDFValue(double sij) const{
109  bool dbThis=false;
110 
111  double nr = integral();
112  if(nr <= 0) return 0;
113  double fct = generatingFctValue(sij);
114  if(dbThis){
115  cout << " BWFct::generatingPDFValue "
116  << _coord
117  << " _M^2 " << _M*_M
118  << " _G = " << _G
119  << ", sij = " << sij
120  << " returning " << fct << " / " << nr
121  << " = " << fct/nr
122  << endl;
123  }
124  return fct/nr;
125 }
126 double BWFct::generatingFctValue(double sij) const{
127  // bool dbThis = false;
128  if(sij < _coord.min() || sij > _coord.max()) return 0;
129 
130  double m2diff = _M * _M - sij;
131  double fct = unitFactor()/(m2diff*m2diff + _M*_M * _G*_G);
132  return fct;
133 }
134 
136  return _coord;
137 }
139  _coord = c;
140 }
141 
142 //
double min() const
virtual double coordTransformFromS(double s) const
Definition: BWFct.cpp:83
virtual double transformedFctValue(double rho) const
Definition: BWFct.cpp:95
void setMax(double max)
static const double pi
BWFct(const DalitzCoordinate &c, double M, double Gamma)
Definition: BWFct.cpp:12
static const double s
virtual void setCoordinate(const DalitzCoordinate &c)
Definition: BWFct.cpp:138
double max() const
double rhoMi() const
Definition: BWFct.cpp:37
virtual DalitzCoordinate getCoordinate() const
Definition: BWFct.cpp:135
virtual double coordTransformToS(double rho) const
Definition: BWFct.cpp:86
Definition: BWFct.h:11
virtual double transformedPDFValue(double rho) const
Definition: BWFct.cpp:90
virtual double generateRho(TRandom *rnd=gRandom) const
Definition: BWFct.cpp:51
virtual void setLimits(double sMin, double sMax)
Definition: BWFct.cpp:31
virtual double integral() const
Definition: BWFct.cpp:104
virtual double generatingPDFValue(double sij) const
Definition: BWFct.cpp:108
double _G
Definition: BWFct.h:13
static const double GeV
DalitzCoordinate _coord
Definition: BWFct.h:12
double rhoMa() const
Definition: BWFct.cpp:44
virtual double transformedFctMax() const
Definition: BWFct.cpp:58
virtual double generatingFctValue(double sij) const
Definition: BWFct.cpp:126
void setMin(double min)
virtual double generate(TRandom *rnd=gRandom) const
Definition: BWFct.cpp:61
virtual double transformedIntegral() const
Definition: BWFct.cpp:99
double _M
Definition: BWFct.h:13
double unitFactor() const
Definition: BWFct.cpp:80