MINT2
DalitzPdfBaseFlexiFastInteg.h
Go to the documentation of this file.
1 #ifndef DALITZ_PDF_BASE_FLEXIFAST_INTEG_HH
2 #define DALITZ_PDF_BASE_FLEXIFAST_INTEG_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:18:01 GMT
5 
6 #include "Mint/PdfBase.h"
8 
9 #include "Mint/IEventGenerator.h"
10 #include "Mint/IDalitzEvent.h"
13 #include "Mint/DalitzEvent.h"
15 #include "Mint/DalitzHistoSet.h"
16 
18 
19 #include "Mint/counted_ptr.h"
20 
21 #include <string>
22 
23 //#define CHECK_INTEGRATOR
24 
25 #ifdef CHECK_INTEGRATOR
27 #endif
28 
30 
31 #include "Mint/IDalitzPdf.h"
32 
33 /*
34  As a user, you will need to implement this method:
35 
36  virtual double un_normalised_noPs(IDalitzEvent& evt);
37 
38  it returns the PDF without the phase-space factor,
39  no need for normalisation. Typical implementation if you
40  have a FitAmpSum called _amps:
41 
42  double un_normalised_noPs(IDalitzEvent& evt){
43  return _amps->RealVal(evt);
44  }
45 
46  */
47 
48 namespace MINT{
49  class Minimiser;
50 }
51 
53 : public MINT::PdfBase<IDalitzEvent>
54 , virtual public IDalitzPdf
55 {
56  protected:
59  double _norm;
60  double _precision;
61 #ifdef CHECK_INTEGRATOR
62  DalitzMCIntegrator _mcint;
63 #endif
67 
68  // MINT::counted_ptr<IGetDalitzEvent> _efficiency;
69 
73 
75 
76  void setup();
77  bool makeAmps();
78 
79  virtual double un_normalised_noPs(IDalitzEvent& evt)=0;
80  // This replaces un_normalised. Make sure it
81  // does not contain the phase space component.
82  // ... turned out that it's important in several
83  // places to separate this out.
84 
85  virtual double phaseSpace(IDalitzEvent& evt);
86  virtual bool getNorm();
87  virtual bool integrating();
88 
90 
91 
93 
94  public:
98  , double precision = 1.e-3
100  );
101 
104  //, MINT::counted_ptr<IGetDalitzEvent> eff=0
105  , MINT::MinuitParameterSet* mps=0
106  , double precision = 1.e-3
107  );
108 
110 
112 
113  void setIntegrationPrecision(double prec);
117 
118  void parametersChanged();
119  virtual double getVal(IDalitzEvent& evt);
120  virtual double getVal_withPs(IDalitzEvent& evt);
121  virtual double getVal_noPs(IDalitzEvent& evt);
122 
123  virtual double getNewVal(IDalitzEvent& evt){
124  this->parametersChanged();
125  return getVal(evt);
126  };
127 
128  // next 4 for backward compability (will be removed one day):
129  virtual double getVal(IDalitzEvent* evt){
130  if(0 == evt) return 0;
131  return getVal(*evt);
132  }
133  virtual double getVal_withPs(IDalitzEvent* evt){
134  if(0 == evt) return 0;
135  return getVal_withPs(*evt);
136  }
137  virtual double getVal_noPs(IDalitzEvent* evt){
138  if(0 == evt) return 0;
139  return getVal_noPs(*evt);
140  }
141  virtual double getNewVal(IDalitzEvent* evt){
142  this->parametersChanged();
143  if(0 == evt) return 0;
144  return getNewVal(*evt);
145  }
146 
147  virtual double RealVal(IDalitzEvent& evt){return getVal(evt);}
148  // w/o phase space - more robust if your events leak out of
149  // the kinematically allowed region.
150 
152  const MINT::MinuitParameterSet* getMPS() const;
153 
154  bool saveIntegrator(const std::string& fname)const;
155 
156  bool makePlots(const std::string& filename) const;
157 
158  virtual DalitzHistoSet histoSet() const;
159  virtual DalitzHistoSet histoSet();
160  void saveEachAmpsHistograms(const std::string& prefix) const;
161  std::vector<DalitzHistoSet> GetEachAmpsHistograms();
162 
163  virtual DalitzHistoSet interferenceHistoSet() const;
165  void saveInterferenceHistograms(const std::string& prefix) const;
166  std::vector<DalitzHistoSet> GetInterferenceHistograms();
167 
169  //double efficiency(){return _efficiency->RealVal();}
170 
171  virtual void beginFit();
172  virtual void endFit();
173 
174 
175  double getIntegralValue() const{
176  return _norm;
177  }
178  //double getIntegralValue(){
179  // if(_norm < 0) getNorm(); return _norm;
180  // not threadsave
181  //}
182  double redoIntegrator(){
183  _norm = -1;
184  getNorm();
185  return _norm;
186  }
187 
188  double integralForMatchingPatterns(bool match,int pattern_sign){
189  if(!_faint.initialised())getNorm();
190  return _faint.integralForMatchingPatterns(match, pattern_sign);
191  }
192 
193  std::complex<double> ComplexSumForMatchingPatterns(bool match){
194  if(!_faint.initialised())getNorm();
196  }
197 
198 
199  std::complex<double> ComplexIntegralForTags(int tag1, int tag2){
200  if(!_faint.initialised())getNorm();
201  return _faint.ComplexIntegralForTags(tag1, tag2);
202  }
203 
204  double sumOfFitFractions() {
205  if(!_faint.initialised())getNorm();
206  return _faint.sumOfFitFractions();
207  }
208 
210  if(!_faint.initialised())getNorm();
212  }
213 
215  if(!_faint.initialised())getNorm();
217  }
218 
220  if(!_faint.initialised())getNorm();
221  return _faint.sumOfSqrtFitFractions();
222  }
223 
226  }
227 
230  bool doFractions() {return _faint.doFractions();}
231 
232  void doFinalStats(MINT::Minimiser* mini=0);
233  void doFinalStatsAndSave(MINT::Minimiser* min=0,const std::string& fname = "FitAmpResults.txt", const std::string& fnameROOT="fitFractions.root");
234 };
235 
236 #endif
237 //
virtual double getVal(IDalitzEvent *evt)
virtual double getNewVal(IDalitzEvent *evt)
virtual double phaseSpace(IDalitzEvent &evt)
int numberOfFitFractionsLargerThanThreshold(double threshold)
IFastAmplitudeIntegrable * getAmps()
std::complex< double > ComplexIntegralForTags(int tag1, int tag2)
virtual double getNewVal(IDalitzEvent &evt)
std::vector< DalitzHistoSet > GetEachAmpsHistograms()
std::complex< double > ComplexSumForMatchingPatterns(bool match)
std::vector< DalitzHistoSet > GetInterferenceHistograms()
MINT::counted_ptr< IFastAmplitudeIntegrable > _countedAmps
void doFinalStats(MINT::Minimiser *mini=0)
virtual double getVal_noPs(IDalitzEvent &evt)
virtual double un_normalised_noPs(IDalitzEvent &evt)=0
std::complex< double > ComplexSumForMatchingPatterns(bool match)
void saveEachAmpsHistograms(const std::string &prefix) const
IFastAmplitudeIntegrable * getFitAmpSum()
MINT::MinuitParameterSet * getMPS()
virtual double getVal(IDalitzEvent &evt)
MINT::counted_ptr< MINT::IEventGenerator< IDalitzEvent > > _defaultGenerator
void setEventGenerator(MINT::IEventGenerator< IDalitzEvent > *g)
DalitzPdfBaseFlexiFastInteg(const DalitzEventPattern &pat, MINT::IEventGenerator< IDalitzEvent > *generator, IFastAmplitudeIntegrable *amps, double precision=1.e-3, MINT::MinuitParameterSet *mps=0)
virtual double getVal_withPs(IDalitzEvent *evt)
FlexiFastAmplitudeIntegrator _faint
void saveInterferenceHistograms(const std::string &prefix) const
int numberOfFitFractionsLargerThanThreshold(double threshold)
std::complex< double > ComplexIntegralForTags(int tag1, int tag2)
double integralForMatchingPatterns(bool match, int pattern_sign)
virtual DalitzHistoSet interferenceHistoSet() const
virtual DalitzHistoSet histoSet() const
double integralForMatchingPatterns(bool match, int pattern_sign)
bool makePlots(const std::string &filename) const
virtual double getVal_noPs(IDalitzEvent *evt)
FitFractionList getInterferenceTerms() const
static const double g
FitFractionList getInterferenceTerms() const
void doFinalStatsAndSave(MINT::Minimiser *min=0, const std::string &fname="FitAmpResults.txt", const std::string &fnameROOT="fitFractions.root")
MINT::IEventGenerator< IDalitzEvent > * getEventGenerator()
virtual double RealVal(IDalitzEvent &evt)
bool saveIntegrator(const std::string &fname) const
IFastAmplitudeIntegrable * _amps
MINT::IEventGenerator< IDalitzEvent > * _generator
virtual double getVal_withPs(IDalitzEvent &evt)
MINT::IEventGenerator< IDalitzEvent > * makeDefaultGenerator()