MINT2
DalitzPdfBaseMCInteg.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
4 #include "Mint/FitAmpSum.h"
5 #include "Mint/DalitzBWBoxSet.h"
6 #include "Mint/Minimiser.h"
7 
8 #include <iostream>
9 
10 using namespace std;
11 using namespace MINT;
12 
14  return (0 == _mps ? MinuitParameterSet::getDefaultSet() : _mps);
15 }
17  return (0 == _mps ? MinuitParameterSet::getDefaultSet() : _mps);
18 }
19 
20 
22  _integrating = true;
23 
24  if(!_mcint.initialised())_mcint.initialise(_pat, getAmps(), getEventGenerator(), gRandom, _precision);
25  else _mcint.resetIntegrand(getAmps());
26  _norm = _mcint.getVal();
27 
28  _integrating = false;
29  return _norm > 0;
30 }
31 
33  if(_pat.empty()) return 0;
34  if(0 == getAmps()) return 0;
36  ptr(getAmps()->makeEventGenerator(_pat));
37  _defaultGenerator = ptr;
38  return _defaultGenerator.get();
39 }
40 
42  if(0 == _generator) makeDefaultGenerator();
43  return _generator;
44 }
46  if(0 == _generator){
47  cout << "WARNING in DalitzPdfBaseMCInteg::getEventGenerator() const"
48  << " returning 0 pointer." << endl;
49  }
50  return _generator;
51 }
52 
54  _precision = prec;
55  _mcint.setPrecision(_precision);
56 }
57 
59  getNorm();
60  _val= -1;
61 }
63  , double prec, IEventGenerator<IDalitzEvent>* generator, MinuitParameterSet* mps)
65  , _mps(mps)
66  , _pat(pat)
67  , _norm(-1)
68  , _precision(prec)
69  , _amps(amps)
70  , _generator(generator)
71  , _integrating(0)
72  , _defaultGenerator(0)
73  , _val(-1)
74 {
75 }
76 
77 
80  , IPdf<IDalitzEvent>()
81  , IDalitzPdf()
82  , PdfBase<IDalitzEvent>(other)
83  , _mps(other._mps)
84  , _pat(other._pat)
85  , _norm(other._norm)
86  , _precision(other._precision)
87  , _amps(other._amps)
88  , _generator(other._generator)
89  , _integrating(other._integrating)
90  , _defaultGenerator(other._defaultGenerator)
91  , _val(-1)
92 {
93 }
94 
96 }
97 
99  if(0 == _amps && (! _pat.empty())){
100  _amps = new FitAmpSum(_pat, getMPS());
101  }
102  return _amps;
103 }
104 
106  return _integrating;
107 }
108 
110  return evt.phaseSpace();
111 }
113  //if(_integrating) return getVal_withPs(evt);else
114  return getVal_noPs(evt);
115 }
117 
118  if(_integrating){
119  // shouldn't really do that - use getVal or getVal_withPs
120  // when you integrate (automatically done in getVal()):
121  return un_normalised_noPs(evt);
122  }else{
123  if(_norm == -1) getNorm();
124  double num = un_normalised_noPs(evt);
125  _val= num/_norm;
126 
127  return num/_norm;
128  }
129 }
131 
132  if(_integrating){
133  return un_normalised_noPs(evt)*phaseSpace(evt);
134  }else{
135  if(_norm == -1) getNorm();
136  double num = un_normalised_noPs(evt)*phaseSpace(evt);
137  return num/_norm;
138  }
139 }
140 
141 
143  // non-const version to satisfy IDalitzPdf
144  return (_mcint.histoSet());
145 }
146 
147 /*
148 bool DalitzPdfBaseMCInteg::makePlots(const std::string& filename) const{
149  return histoSet().save(filename);
150 }
151 DalitzHistoSet DalitzPdfBaseMCInteg::histoSet() const{
152  return (_faint.histoSet());
153 }
154 
155 
156 void DalitzPdfBaseMCInteg::saveEachAmpsHistograms(const std::string& prefix) const{
157  _faint.saveEachAmpsHistograms(prefix);
158  return;
159 }
160 
161 std::vector<DalitzHistoSet> DalitzPdfBaseMCInteg::GetEachAmpsHistograms(){
162  return _faint.GetEachAmpsHistograms();
163 }
164 
165 DalitzHistoSet DalitzPdfBaseMCInteg::interferenceHistoSet() const{
166  return (_faint.interferenceHistoSet());
167 }
168 DalitzHistoSet DalitzPdfBaseMCInteg::interferenceHistoSet(){
169  // non-const version to satisfy IDalitzPdf
170  return (_faint.interferenceHistoSet());
171 }
172 void DalitzPdfBaseMCInteg::saveInterferenceHistograms(const std::string& prefix) const{
173  _faint.saveInterferenceHistograms(prefix);
174  return;
175 }
176 std::vector<DalitzHistoSet> DalitzPdfBaseMCInteg::GetInterferenceHistograms(){
177  return _faint.GetInterferenceHistograms();
178 }
179 */
181 
182  //_faint.doFinalStats();
183 }
184 
186  //_faint.doFinalStats(mini);
187  (void)mini;
188 }
189 
190 
191 
192 //
DalitzMCIntegrator _mcint
virtual double phaseSpace() const =0
virtual double getVal_withPs(IDalitzEvent &evt)
IFastAmplitudeIntegrable * getAmps()
virtual double getVal_noPs(IDalitzEvent &evt)
DalitzHistoSet histoSet()
DalitzPdfBaseMCInteg(const DalitzEventPattern &pat, IFastAmplitudeIntegrable *amps, double precision=1.e-3, MINT::IEventGenerator< IDalitzEvent > *generator=0, MINT::MinuitParameterSet *mps=0)
MINT::IEventGenerator< IDalitzEvent > * getEventGenerator()
DalitzEventPattern _pat
void setIntegrationPrecision(double prec)
virtual DalitzHistoSet histoSet()
virtual double getVal(IDalitzEvent &evt)
void doFinalStats(MINT::Minimiser *mini=0)
MINT::MinuitParameterSet * getMPS()
MINT::IEventGenerator< IDalitzEvent > * makeDefaultGenerator()
X * get() const
Definition: counted_ptr.h:123
virtual double un_normalised_noPs(IDalitzEvent &evt)=0
IFastAmplitudeIntegrable * _amps
virtual double phaseSpace(IDalitzEvent &evt)