MINT2
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
FastAmplitudeIntegrator Class Reference

#include <FastAmplitudeIntegrator.h>

Inheritance diagram for FastAmplitudeIntegrator:
IDalitzIntegrator MINT::IReturnReal

Public Member Functions

 FastAmplitudeIntegrator ()
 
 FastAmplitudeIntegrator (const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
 
 FastAmplitudeIntegrator (const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps, const std::string &fname)
 
virtual ~FastAmplitudeIntegrator ()
 
bool initialise (const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
 
bool initialise (const std::string &commaSeparatedList, const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
 
bool initialiseFromFile (const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps, const std::string &commaSeparatedList)
 
virtual bool add (const FastAmplitudeIntegrator &other)
 
bool setValues (const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
 
void setPrecision (double prec)
 
bool initialised () const
 
double getVal ()
 
void Gradient (MINT::MinuitParameterSet *mps, std::vector< double > &grad)
 
void GradientForLasso (MINT::MinuitParameterSet *mps, std::vector< double > &grad)
 
double RealVal ()
 
double sumOfFitFractions ()
 
double absSumOfSqrtInterferenceFractions ()
 
double absSumOfInterferenceFractions ()
 
double sumOfSqrtFitFractions ()
 
int numberOfFitFractionsLargerThanThreshold (double threshold)
 
double variance () const
 
DalitzHistoSet histoSet () const
 
void saveEachAmpsHistograms (const std::string &prefix) const
 
std::vector< DalitzHistoSetGetEachAmpsHistograms ()
 
DalitzHistoSet interferenceHistoSet () const
 
void saveInterferenceHistograms (const std::string &prefix) const
 
std::vector< DalitzHistoSetGetInterferenceHistograms ()
 
virtual void doFinalStats (MINT::Minimiser *mini=0)
 
double getFractionChi2 () const
 
bool ensureFreshEvents ()
 
bool save (const std::string &fname) const
 
- Public Member Functions inherited from MINT::IReturnReal
virtual ~IReturnReal ()
 

Protected Member Functions

double weight (IDalitzEvent *evtPtr)
 
int updateEventSet (long int Nevents)
 
double evaluateSum ()
 
int determineNumEvents ()
 
int generateEnoughEvents ()
 
int addEvents (long int Nevents)
 
TRandom * makeNewRnd (int seed=-9999)
 
- Protected Member Functions inherited from MINT::IReturnReal
 IReturnReal ()
 

Protected Attributes

DalitzEventPattern _pat
 
IFastAmplitudeIntegrable_amps
 
MINT::counted_ptr< IntegCalculator_integCalc
 
MINT::counted_ptr< IntegCalculator_integCalc_copyForDebug
 
TRandom * _rnd
 
MINT::counted_ptr< TRandom > _localRnd
 
double _precision
 
MINT::IEventGenerator< IDalitzEvent > * _generator
 

Private Attributes

double _mean
 
int _numEvents
 
int _Ncalls
 
bool _initialised
 
bool _db
 

Static Private Attributes

static const long int _minEvents =100
 

Detailed Description

Definition at line 32 of file FastAmplitudeIntegrator.h.

Constructor & Destructor Documentation

◆ FastAmplitudeIntegrator() [1/3]

FastAmplitudeIntegrator::FastAmplitudeIntegrator ( )

Definition at line 45 of file FastAmplitudeIntegrator.cpp.

◆ FastAmplitudeIntegrator() [2/3]

FastAmplitudeIntegrator::FastAmplitudeIntegrator ( const DalitzEventPattern pattern,
IFastAmplitudeIntegrable amps = 0,
MINT::IEventGenerator< IDalitzEvent > *  eventGenerator = 0,
TRandom *  rnd = 0,
double  precision = 1.e-2 
)

Definition at line 22 of file FastAmplitudeIntegrator.cpp.

29  : _db(false)
30 {
31  // initialise(pattern, amps, weight, generator, rnd, precision);
32  initialise(pattern, amps, generator, rnd, precision);
33 }
bool initialise(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)

◆ FastAmplitudeIntegrator() [3/3]

FastAmplitudeIntegrator::FastAmplitudeIntegrator ( const DalitzEventPattern pattern,
IFastAmplitudeIntegrable amps,
const std::string &  fname 
)

Definition at line 35 of file FastAmplitudeIntegrator.cpp.

39  : _db(false)
40 {
41  // initialise(pattern, amps, weight, generator, rnd, precision);
42  initialiseFromFile(pattern, amps, fname);
43 }
bool initialiseFromFile(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps, const std::string &commaSeparatedList)

◆ ~FastAmplitudeIntegrator()

virtual FastAmplitudeIntegrator::~FastAmplitudeIntegrator ( )
inlinevirtual

Definition at line 83 of file FastAmplitudeIntegrator.h.

83 {}

Member Function Documentation

◆ absSumOfInterferenceFractions()

double FastAmplitudeIntegrator::absSumOfInterferenceFractions ( )
inline

Definition at line 149 of file FastAmplitudeIntegrator.h.

149  {
151  }
double absSumOfInterferenceFractions()
MINT::counted_ptr< IntegCalculator > _integCalc

◆ absSumOfSqrtInterferenceFractions()

double FastAmplitudeIntegrator::absSumOfSqrtInterferenceFractions ( )
inline

Definition at line 145 of file FastAmplitudeIntegrator.h.

145  {
147  }
double absSumOfSqrtInterferenceFractions()
MINT::counted_ptr< IntegCalculator > _integCalc

◆ add()

bool FastAmplitudeIntegrator::add ( const FastAmplitudeIntegrator other)
virtual

Definition at line 114 of file FastAmplitudeIntegrator.cpp.

114  {
115  int totalEvents = _numEvents + other._numEvents;
116  if(totalEvents > 0){
117  _mean = (_numEvents * _mean + other._numEvents * other._mean)/totalEvents;
118  }
119  _numEvents = totalEvents;
120  _Ncalls += other._Ncalls;
121  if(0 != this->_integCalc){
122  _integCalc->add(other._integCalc);
123  }else{
124  if(0 != other._integCalc){
126  _integCalc = nL;
127  }
128  }
129  if(0 != this->_integCalc_copyForDebug){
131  }else{
132  if(0 != other._integCalc_copyForDebug){
134  nLc(new IntegCalculator(*(other._integCalc_copyForDebug)));
136  }
137  }
138  _initialised |= other._initialised;
139  _db |= other._db;
140 
141  // other quantities we take over if they aren't defined, here:
142  if(0 == _amps) _amps = other._amps;
143  if(0 == _rnd) _rnd = other._rnd;
144  if(0 == _localRnd) _localRnd = other._localRnd;
145  if(_precision <= 0.0) _precision = other._precision;
146 
147  return true;
148 }
MINT::counted_ptr< IntegCalculator > _integCalc_copyForDebug
MINT::counted_ptr< TRandom > _localRnd
IFastAmplitudeIntegrable * _amps
virtual bool add(const IntegCalculator &other)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ addEvents()

int FastAmplitudeIntegrator::addEvents ( long int  Nevents)
protected

Definition at line 242 of file FastAmplitudeIntegrator.cpp.

242  {
243  bool dbThis=false;
244  if(! _initialised){
245  cout << " FastAmplitudeIntegrator::addEvents "
246  << " need to get initialised first." << endl;
247  return 0;
248  }
249  if(dbThis) cout << "FastAmplitudeIntegrator::addEvents "
250  << " got called " << endl;
251  if(Nevents <= 0) return _integCalc->numEvents();
252 
253  if(0 == _generator){
254  cout << "FastAmplitudeIntegrator::addEvents "
255  << " adding flat events. " << endl;
256  for(int i=0; i < Nevents; i++){
257  DalitzEvent evt(_pat, _rnd);
258  _integCalc->addEvent(&evt, weight(&evt));
259  }
260  }else{
261  int N_success = 0;
262  unsigned long int maxTries = (unsigned long int) Nevents * 1000;
263  // dealing with possible overflow:
264  if(maxTries < (unsigned long int) Nevents) maxTries = Nevents * 100;
265  if(maxTries < (unsigned long int) Nevents) maxTries = Nevents * 10;
266  if(maxTries < (unsigned long int) Nevents) maxTries = Nevents;
267 
268  time_t startTime = time(0);
269  for(unsigned long int i=0; i < maxTries && N_success < Nevents; i++){
271  if(dbThis) cout << "got event with ptr: " << ptr << endl;
272  if(0 == ptr){
273  if(_generator->exhausted()){
274  cout << "ERROR in FastAmplitudeIntegrator::addEvents"
275  << "\n\t Generator exhausted, cannot generate more events."
276  << endl;
277  break;
278  }
279  }else{
280  _integCalc->addEvent(ptr, weight(ptr.get()));
281  N_success++;
282  int printEvery = 1000;
283  if(N_success > 1000) printEvery = 50000;
284  if(N_success > 100000) printEvery = 100000;
285  bool printout = (N_success%printEvery == 0);
286  if(dbThis) printout |= (N_success < 20);
287 
288  if(printout){
289  cout << " FastAmplitudeIntegrator::addEvents: added " << N_success
290  << " th event";
291  evaluateSum();
292  double v= variance();
293  double sigma = -9999;
294  if(v > 0) sigma = sqrt(v);
295  cout << "\t integ= " << _mean << " +/- " << sigma;
296  cout << "\t("
297  << MINT::stringtime(difftime(time(0), startTime))
298  << ")";
299  cout << endl;
300  }
301  }
302  }
303  }
304  if(_integCalc->numEvents() < Nevents){
305  cout << "ERROR in FastAmplitudeIntegrator::addEvents"
306  << "\n\t> I was supposed to add " << Nevents << " events,"
307  << "\n\t> but now the total list size is only "
308  << _integCalc->numEvents()
309  << endl;
310  }else{
311  cout << " added " << Nevents << " _integCalc->numEvents "
312  << _integCalc->numEvents() << endl;
313 
314  }
315  return _integCalc->numEvents();
316 }
virtual bool exhausted() const =0
MINT::IEventGenerator< IDalitzEvent > * _generator
virtual counted_ptr< RETURN_TYPE > newEvent()=0
virtual int numEvents() const
virtual void addEvent(IDalitzEvent *evtPtr, double weight=1)
std::string stringtime(double dt)
Definition: Utils.cpp:14
MINT::counted_ptr< IntegCalculator > _integCalc
double weight(IDalitzEvent *evtPtr)

◆ determineNumEvents()

int FastAmplitudeIntegrator::determineNumEvents ( )
protected

Definition at line 373 of file FastAmplitudeIntegrator.cpp.

373  {
374  if(! _initialised){
375  cout << " FastAmplitudeIntegrator::determineNumEvents "
376  << " need to get initialised first." << endl;
377  return 0;
378  }
379 
381  evaluateSum();
382  double v = variance();
383  double safetyFactor = 1.15;
384  double maxVariance = _precision*_precision * _mean*_mean;
386  (v*safetyFactor/maxVariance);
387  // round to the nearest 100:
388  _numEvents = (_numEvents/100 + 1)*100;
389 
390  cout << " FastAmplitudeIntegrator::determineNumEvents():"
391  << "\n\t> mean: " << _mean << ", rms " << sqrt(v)
392  << "\n\t> currently, our relative precision is "
393  << sqrt(v)/_mean
394  << "\n\t> to achieve the requested pecision of " << _precision << ","
395  << "\n\t> (with a safety factor) I think we'll need "
396  << (v*safetyFactor/maxVariance)
397  << " times that, i.e. " << _numEvents << " events" << endl;
398 
399  return _numEvents;
400 }
virtual int numEvents() const
static const long int _minEvents
int updateEventSet(long int Nevents)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ doFinalStats()

void FastAmplitudeIntegrator::doFinalStats ( MINT::Minimiser mini = 0)
virtual

Implements IDalitzIntegrator.

Definition at line 481 of file FastAmplitudeIntegrator.cpp.

481  {
482  bool dbThis=true;
483  if(dbThis){
484  cout << "FastAmplitudeIntegrator::doFinalStats() called" << endl;
485  cout << "Am I initialised? " << _initialised << endl;
486  cout << "Got called with these pointers: mini " << mini
487  << " and my own _integCalc " << _integCalc << endl;
488  }
489  if(! _initialised){
490  cout << " FastAmplitudeIntegrator::doFinalStats "
491  << " need to get initialised first." << endl;
492  cout << " So I won't do anything." << endl;
493  return;
494  }
495 
496  _integCalc->doFinalStats(mini);
497 }
virtual void doFinalStats(MINT::Minimiser *mini=0)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ ensureFreshEvents()

bool FastAmplitudeIntegrator::ensureFreshEvents ( )

Definition at line 150 of file FastAmplitudeIntegrator.cpp.

150  {
151  _rnd = makeNewRnd(time(0));
152  if(0 != _generator){
154  }
155  return true;
156 }
MINT::IEventGenerator< IDalitzEvent > * _generator
virtual bool ensureFreshEvents()=0
TRandom * makeNewRnd(int seed=-9999)

◆ evaluateSum()

double FastAmplitudeIntegrator::evaluateSum ( )
protected

Definition at line 326 of file FastAmplitudeIntegrator.cpp.

326  {
327  if(! _initialised){
328  cout << " FastAmplitudeIntegrator::evaluateSum "
329  << " need to get initialised first." << endl;
330  return 0;
331  }
332 
333  time_t tstart = time(0);
334  _Ncalls++;
335 
337  double v = variance();
338  double sigma = -9999;
339  if(v >= 0) sigma = sqrt(v);
340  double actualPrecision = -9999;
341  if(_mean != 0 && sigma > 0) actualPrecision = sigma/_mean;
342 
343  double delT = difftime(time(0), tstart);
344 
345  int printEvery = 100;
346  if(_Ncalls > 1000) printEvery = 1000;
347  if(_Ncalls > 10000) printEvery = 10000;
348  if(_Ncalls > 100000) printEvery = 100000;
349  bool printout = _Ncalls < 3 || (0 == _Ncalls%printEvery);
350 
351  if(printout || _db){
352  cout << " FastAmplitudeIntegrator::evaluateSum() for "
353  << _integCalc->numEvents() << " events, "
354  << _Ncalls << " th call:"
355  << "\n\t> getting: " << _mean << " +/- " << sigma
356  << "\n\t> precision: requested: " << _precision*100
357  << "%, actual: " << actualPrecision*100 << "%"
358  << "\n\t> This took " << delT << " s."
359  << endl;
360  if(_db){
361  cout << "checking save and read-back:" << endl;
362  _integCalc->save("checkSaveAndReadBack");
363  _integCalc_copyForDebug->retrieve("checkSaveAndReadBack");
364  cout << " copy values:"
365  << "\n\t mean: " << _integCalc_copyForDebug->integral()
366  << "\n\t variance: " << _integCalc_copyForDebug->variance()
367  << endl;
368  }
369  }
370  return _mean;
371 }
virtual bool retrieve(const std::string &commaSeparatedList)
MINT::counted_ptr< IntegCalculator > _integCalc_copyForDebug
virtual double integral() const
virtual bool save(const std::string &dirname) const
virtual int numEvents() const
virtual double variance() const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ generateEnoughEvents()

int FastAmplitudeIntegrator::generateEnoughEvents ( )
protected

Definition at line 402 of file FastAmplitudeIntegrator.cpp.

402  {
403  if(! _initialised){
404  cout << " FastAmplitudeIntegrator::generateEnoughEvents "
405  << " need to get initialised first." << endl;
406  return 0;
407  }
408 
410  int counter(0);
411  while(determineNumEvents() > _integCalc->numEvents() &&
412  counter < 10 && _numEvents > 0){
414  counter++;
415  }
416  return _integCalc->numEvents();
417 }
virtual int numEvents() const
static const long int _minEvents
int updateEventSet(long int Nevents)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ GetEachAmpsHistograms()

std::vector< DalitzHistoSet > FastAmplitudeIntegrator::GetEachAmpsHistograms ( )

Definition at line 442 of file FastAmplitudeIntegrator.cpp.

442  {
443  if(! _initialised){
444  cout << " FastAmplitudeIntegrator::GetEachAmpsHistograms "
445  << " need to get initialised first." << endl;
446  std::vector<DalitzHistoSet> dummy;
447  return dummy;
448  }
450 }
virtual std::vector< DalitzHistoSet > GetEachAmpsHistograms()
MINT::counted_ptr< IntegCalculator > _integCalc

◆ getFractionChi2()

double FastAmplitudeIntegrator::getFractionChi2 ( ) const

Definition at line 498 of file FastAmplitudeIntegrator.cpp.

498  {
499  if(! _initialised){
500  cout << " FastAmplitudeIntegrator::getFractionChi2() "
501  << " need to get initialised first." << endl;
502  return -9999;
503  }
504  return _integCalc->getFractionChi2();
505 }
virtual double getFractionChi2() const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ GetInterferenceHistograms()

std::vector< DalitzHistoSet > FastAmplitudeIntegrator::GetInterferenceHistograms ( )

Definition at line 470 of file FastAmplitudeIntegrator.cpp.

470  {
471  if(! _initialised){
472  cout << " FastAmplitudeIntegrator::GetInterferenceHistograms "
473  << " need to get initialised first." << endl;
474  std::vector<DalitzHistoSet> dummy;
475  return dummy;
476  }
477 
479 }
virtual std::vector< DalitzHistoSet > GetInterferenceHistograms()
MINT::counted_ptr< IntegCalculator > _integCalc

◆ getVal()

double FastAmplitudeIntegrator::getVal ( )

Definition at line 419 of file FastAmplitudeIntegrator.cpp.

419  {
420  evaluateSum();
421  return _mean;
422 }

◆ Gradient()

void FastAmplitudeIntegrator::Gradient ( MINT::MinuitParameterSet mps,
std::vector< double > &  grad 
)
inline

Definition at line 130 of file FastAmplitudeIntegrator.h.

130  {
131  _integCalc->Gradient(mps,grad);
132  }
virtual void Gradient(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ GradientForLasso()

void FastAmplitudeIntegrator::GradientForLasso ( MINT::MinuitParameterSet mps,
std::vector< double > &  grad 
)
inline

Definition at line 133 of file FastAmplitudeIntegrator.h.

133  {
134  _integCalc->GradientForLasso(mps,grad);
135  }
virtual void GradientForLasso(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ histoSet()

DalitzHistoSet FastAmplitudeIntegrator::histoSet ( ) const

Definition at line 424 of file FastAmplitudeIntegrator.cpp.

424  {
425  if(! _initialised){
426  cout << " FastAmplitudeIntegrator::histoSet "
427  << " need to get initialised first." << endl;
428  throw "bummer";
429  }
430 
431  return _integCalc->histoSet();
432 }
virtual DalitzHistoSet histoSet() const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ initialise() [1/2]

bool FastAmplitudeIntegrator::initialise ( const DalitzEventPattern pattern,
IFastAmplitudeIntegrable amps = 0,
MINT::IEventGenerator< IDalitzEvent > *  eventGenerator = 0,
TRandom *  rnd = 0,
double  precision = 1.e-2 
)

Definition at line 52 of file FastAmplitudeIntegrator.cpp.

58  {
59  bool sc=true;
60  sc &= setValues(pattern, amps, generator, rnd, precision);
61  sc &= generateEnoughEvents();
62  return sc;
63 }
bool setValues(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)

◆ initialise() [2/2]

bool FastAmplitudeIntegrator::initialise ( const std::string &  commaSeparatedList,
const DalitzEventPattern pattern,
IFastAmplitudeIntegrable amps = 0,
MINT::IEventGenerator< IDalitzEvent > *  eventGenerator = 0,
TRandom *  rnd = 0,
double  precision = 1.e-2 
)

Definition at line 84 of file FastAmplitudeIntegrator.cpp.

90  {
91  // with file and top up
92  bool sc=true;
93  sc &= setValues(pattern, amps, generator, rnd, precision);
94  if(! sc) return false;
95  std::string firstDir;
96  std::stringstream is(commaSeparatedList);
97  getline(is, firstDir, ',');
98 
99  struct stat buf;
100  // if(firstDir != "" && access(firstDir.c_str(), 0) == 0){
101  if(firstDir != "" && stat(firstDir.c_str(), &buf) == 0){
102  // it exists, we can retrieve it
103  sc &= _integCalc->retrieve(commaSeparatedList);
104  // if we add events to this, we need to avoid
105  // duplication. The below will refuse to re-use
106  // events read from a file, and will randomise
107  // the random seed:
108  this->ensureFreshEvents();
109  }
110  sc &= generateEnoughEvents();
111  return sc;
112 }
virtual bool retrieve(const std::string &commaSeparatedList)
bool setValues(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ initialised()

bool FastAmplitudeIntegrator::initialised ( ) const
inline

Definition at line 125 of file FastAmplitudeIntegrator.h.

125  {
126  return _initialised;
127  }

◆ initialiseFromFile()

bool FastAmplitudeIntegrator::initialiseFromFile ( const DalitzEventPattern pattern,
IFastAmplitudeIntegrable amps,
const std::string &  commaSeparatedList 
)

Definition at line 66 of file FastAmplitudeIntegrator.cpp.

69  {
70  bool sc = setValues(pattern, amps, 0, 0, 1.e-10);
71  if(! sc) return false;
72  sc &= _integCalc->retrieve(commaSeparatedList);
73  return sc;
74 }
virtual bool retrieve(const std::string &commaSeparatedList)
bool setValues(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ interferenceHistoSet()

DalitzHistoSet FastAmplitudeIntegrator::interferenceHistoSet ( ) const

Definition at line 452 of file FastAmplitudeIntegrator.cpp.

452  {
453  if(! _initialised){
454  cout << " FastAmplitudeIntegrator::interferenceHistoSet "
455  << " need to get initialised first." << endl;
456  DalitzHistoSet dummy;
457  return dummy;
458  }
460 }
virtual DalitzHistoSet interferenceHistoSet() const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ makeNewRnd()

TRandom * FastAmplitudeIntegrator::makeNewRnd ( int  seed = -9999)
protected

Definition at line 158 of file FastAmplitudeIntegrator.cpp.

158  {
159  if(seed < -9998) seed = time(0);
160  cout << "FastAmplitudeIntegrator::makeNewRnd with seed " << seed << endl;
161  counted_ptr<TRandom> lr(new TRandom3(seed));
162  _localRnd = lr;
163  _rnd = lr.get();
164  return _rnd;
165 }
MINT::counted_ptr< TRandom > _localRnd

◆ numberOfFitFractionsLargerThanThreshold()

int FastAmplitudeIntegrator::numberOfFitFractionsLargerThanThreshold ( double  threshold)
inline

Definition at line 157 of file FastAmplitudeIntegrator.h.

157  {
159  }
int numberOfFitFractionsLargerThanThreshold(double threshold)
MINT::counted_ptr< IntegCalculator > _integCalc

◆ RealVal()

double FastAmplitudeIntegrator::RealVal ( )
inlinevirtual

Implements MINT::IReturnReal.

Definition at line 137 of file FastAmplitudeIntegrator.h.

137  {
138  return getVal();
139  }

◆ save()

bool FastAmplitudeIntegrator::save ( const std::string &  fname) const

Definition at line 507 of file FastAmplitudeIntegrator.cpp.

507  {
508  if(! _initialised){
509  cout << " FastAmplitudeIntegrator::save( " << fname << " ):"
510  << " need to get initialised first." << endl;
511  cout << " So I won't do anything." << endl;
512  return false;
513  }
514  return _integCalc->save(fname);
515 }
virtual bool save(const std::string &dirname) const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ saveEachAmpsHistograms()

void FastAmplitudeIntegrator::saveEachAmpsHistograms ( const std::string &  prefix) const

Definition at line 433 of file FastAmplitudeIntegrator.cpp.

433  {
434  if(! _initialised){
435  cout << " FastAmplitudeIntegrator::saveEachAmpsHistograms "
436  << " need to get initialised first." << endl;
437  cout << "So I won't do anything" << endl;
438  return;
439  }
440  return _integCalc->saveEachAmpsHistograms(prefix);
441 }
virtual void saveEachAmpsHistograms(const std::string &prefix) const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ saveInterferenceHistograms()

void FastAmplitudeIntegrator::saveInterferenceHistograms ( const std::string &  prefix) const

Definition at line 461 of file FastAmplitudeIntegrator.cpp.

461  {
462  if(! _initialised){
463  cout << " FastAmplitudeIntegrator::saveInterferenceAmpsHistograms "
464  << " need to get initialised first." << endl;
465  cout << "So I won't do anything" << endl;
466  return;
467  }
468  return _integCalc->saveInterferenceHistograms(prefix);
469 }
virtual void saveInterferenceHistograms(const std::string &prefix) const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ setPrecision()

void FastAmplitudeIntegrator::setPrecision ( double  prec)
inline

Definition at line 115 of file FastAmplitudeIntegrator.h.

115  {
116  _precision=prec;
117  if(initialised()){
119  }
120  }

◆ setValues()

bool FastAmplitudeIntegrator::setValues ( const DalitzEventPattern pattern,
IFastAmplitudeIntegrable amps = 0,
MINT::IEventGenerator< IDalitzEvent > *  eventGenerator = 0,
TRandom *  rnd = 0,
double  precision = 1.e-2 
)

Definition at line 167 of file FastAmplitudeIntegrator.cpp.

173  {
174  bool dbThis=false;
175  _pat = pattern;
176  _amps = amps;
177  //_weight = weight;
178  if(0 != rnd){
179  _rnd = rnd;
180  }else{
181  _rnd = makeNewRnd(time(0));
182  }
183  _precision = precision;
184 
185  _generator = generator;
186 
188  if(dbThis){
189  cout << "FastAmplitudeIntegrator::setValues: Have _integCalc ptr " << _integCalc
190  << ", now printing it." << endl;
191  _integCalc->print();
192  }
193 
195 
196  if(0 == _integCalc){
197  cout << "ERROR in FastAmplitudeIntegrator::initialise"
198  << " amps->makeIntegCalculator()"
199  << " return NULL pointer!" << endl;
200  cout << "\t This will go wrong." << endl;
201  }
202  _Ncalls=0;
203 
204  _initialised = true;
205  return _initialised;
206 }
MINT::IEventGenerator< IDalitzEvent > * _generator
MINT::counted_ptr< IntegCalculator > _integCalc_copyForDebug
virtual void print(std::ostream &os=std::cout) const
IFastAmplitudeIntegrable * _amps
TRandom * makeNewRnd(int seed=-9999)
MINT::counted_ptr< IntegCalculator > _integCalc
virtual MINT::counted_ptr< IntegCalculator > makeIntegCalculator()=0

◆ sumOfFitFractions()

double FastAmplitudeIntegrator::sumOfFitFractions ( )
inline

Definition at line 141 of file FastAmplitudeIntegrator.h.

141  {
142  return _integCalc->sumOfFitFractions();
143  }
MINT::counted_ptr< IntegCalculator > _integCalc

◆ sumOfSqrtFitFractions()

double FastAmplitudeIntegrator::sumOfSqrtFitFractions ( )
inline

Definition at line 153 of file FastAmplitudeIntegrator.h.

153  {
155  }
double sumOfSqrtFitFractions()
MINT::counted_ptr< IntegCalculator > _integCalc

◆ updateEventSet()

int FastAmplitudeIntegrator::updateEventSet ( long int  Nevents)
protected

Definition at line 208 of file FastAmplitudeIntegrator.cpp.

208  {
209  if(! _initialised){
210  cout << " FastAmplitudeIntegrator::updateEventSet "
211  << " need to know pattern first." << endl;
212  return 0;
213  }
214  int missingEvents = Nevents - _integCalc->numEvents();
215 
216  if(missingEvents > 0){
217  cout << "missing events: " << missingEvents
218  << " = " << Nevents
219  << " - " << _integCalc->numEvents()
220  << endl;
221  addEvents(missingEvents);
222  }else{
223  cout << "want " << Nevents
224  << ", have " << _integCalc->numEvents()
225  << ", so no more events missing." << endl;
226  }
227  return _integCalc->numEvents();
228 }
virtual int numEvents() const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ variance()

double FastAmplitudeIntegrator::variance ( ) const

Definition at line 318 of file FastAmplitudeIntegrator.cpp.

318  {
319  if(! _initialised){
320  cout << " FastAmplitudeIntegrator::variance "
321  << " need to get initialised first." << endl;
322  return 0;
323  }
324  return _integCalc->variance();
325 }
virtual double variance() const
MINT::counted_ptr< IntegCalculator > _integCalc

◆ weight()

double FastAmplitudeIntegrator::weight ( IDalitzEvent evtPtr)
protected

Definition at line 230 of file FastAmplitudeIntegrator.cpp.

230  {
231  return 1;
232  // (not in use, but left as a hook should the need arise)
233  /*
234  if(0 == _weight) return 1;
235 
236  _weight->setEvent(evtPtr);
237  double wght = _weight->RealVal();
238  _weight->resetEventRecord();
239  return wght;
240  */
241 }

Member Data Documentation

◆ _amps

IFastAmplitudeIntegrable* FastAmplitudeIntegrator::_amps
protected

Definition at line 44 of file FastAmplitudeIntegrator.h.

◆ _db

bool FastAmplitudeIntegrator::_db
private

Definition at line 40 of file FastAmplitudeIntegrator.h.

◆ _generator

MINT::IEventGenerator<IDalitzEvent>* FastAmplitudeIntegrator::_generator
protected

Definition at line 65 of file FastAmplitudeIntegrator.h.

◆ _initialised

bool FastAmplitudeIntegrator::_initialised
private

Definition at line 38 of file FastAmplitudeIntegrator.h.

◆ _integCalc

MINT::counted_ptr<IntegCalculator> FastAmplitudeIntegrator::_integCalc
protected

Definition at line 49 of file FastAmplitudeIntegrator.h.

◆ _integCalc_copyForDebug

MINT::counted_ptr<IntegCalculator> FastAmplitudeIntegrator::_integCalc_copyForDebug
protected

Definition at line 50 of file FastAmplitudeIntegrator.h.

◆ _localRnd

MINT::counted_ptr<TRandom> FastAmplitudeIntegrator::_localRnd
protected

Definition at line 53 of file FastAmplitudeIntegrator.h.

◆ _mean

double FastAmplitudeIntegrator::_mean
mutableprivate

Definition at line 33 of file FastAmplitudeIntegrator.h.

◆ _minEvents

const long int FastAmplitudeIntegrator::_minEvents =100
staticprivate

Definition at line 34 of file FastAmplitudeIntegrator.h.

◆ _Ncalls

int FastAmplitudeIntegrator::_Ncalls
private

Definition at line 36 of file FastAmplitudeIntegrator.h.

◆ _numEvents

int FastAmplitudeIntegrator::_numEvents
private

Definition at line 35 of file FastAmplitudeIntegrator.h.

◆ _pat

DalitzEventPattern FastAmplitudeIntegrator::_pat
protected

Definition at line 43 of file FastAmplitudeIntegrator.h.

◆ _precision

double FastAmplitudeIntegrator::_precision
protected

Definition at line 54 of file FastAmplitudeIntegrator.h.

◆ _rnd

TRandom* FastAmplitudeIntegrator::_rnd
protected

Definition at line 52 of file FastAmplitudeIntegrator.h.


The documentation for this class was generated from the following files: