MINT2
DalitzPdfBase.cpp
Go to the documentation of this file.
1 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
2 // status: Mon 9 Feb 2009 19:18:01 GMT
3 #include "Mint/DalitzPdfBase.h"
4 
5 #include <iostream>
6 
7 using namespace std;
8 using namespace MINT;
9 
11  if(_pat.size() <= 0) return false;
12 
13  _integrating = true;
14 
15  _mcint.initialise(_pat
16  , this
17  , _generator
18  , gRandom
19  , _precision
20  );
21  _norm = _mcint.getVal();
22  _integrating = false;
23  return _norm > 0;
24 }
25 
27  _precision = prec;
28  _mcint.setPrecision(_precision);
29 }
30 
31 
33  //getNorm();
34 }
36  getNorm(); // should implement caching here.
37 }
39 
40 }
41 
43  , double prec
44  )
46  , _pat()
47  , _norm(-1)
48  , _precision(prec)
49  , _generator(generator)
50  , _integrating(0)
51 {
52 
53 }
54 
56  return _integrating;
57 }
59  return evt.phaseSpace();
60 }
62  if(_pat.empty()) _pat = evt.eventPattern();
63  if(_integrating) return getVal_withPs(evt);
64  else return getVal_noPs(evt);
65 }
66 
68  bool dbthis = false;
69  if(_pat.empty()) _pat = evt.eventPattern();
70 
71  if(_integrating){
72  // shouldn't really do that - use getVal or getVal_withPs
73  // when you integrate (automatically done in getVal()):
74  return un_normalised_noPs(evt);
75  }else{
76  if(-1 == _norm) getNorm(); // not threadsave
77  //if(-1 == _norm){
78  // cout << "DalitzPdfBase::getVal_noPs: _norm = "
79  // << _norm << endl;
80  // throw "what's going on here?";
81  //}
82  double num = un_normalised_noPs(evt);
83  if(dbthis)cout << "un_normalised / norm: "
84  << num << " / " <<_norm
85  << " = " << num/_norm
86  << endl;
87  return num/_norm;
88  }
89 }
90 
92  bool dbthis = false;
93  if(_pat.empty()) _pat = evt.eventPattern();
94  if(_integrating){
95  return un_normalised_noPs(evt)*phaseSpace(evt);
96  }else{
97  if(_norm == -1) getNorm(); // not threadsave
98  //if(-1 == _norm){
99  // cout << "DalitzPdfBase::getVal_withPs: _norm = "
100  // << _norm << endl;
101  // throw "what's going on here?";
102  //}
103  double num = un_normalised_noPs(evt)*phaseSpace(evt);
104  if(dbthis)cout << "un_normalised / norm: "
105  << num << " / " <<_norm
106  << " = " << num/_norm
107  << endl;
108  return num/_norm;
109  }
110 }
111 
112 //
113 //
void setIntegrationPrecision(double prec)
virtual double getVal_noPs(IDalitzEvent &evt)
virtual void endFit()
virtual double phaseSpace() const =0
virtual double un_normalised_noPs(IDalitzEvent &evt)=0
virtual void parametersChanged()
virtual double phaseSpace(IDalitzEvent &evt)
virtual double getVal_withPs(IDalitzEvent &evt)
DalitzPdfBase(MINT::IEventGenerator< IDalitzEvent > *generator=0, double precision=1.e-2)
virtual const DalitzEventPattern & eventPattern() const =0
DalitzEventPattern _pat
Definition: DalitzPdfBase.h:22
virtual void beginFit()
virtual double getVal(IDalitzEvent &evt)