#include <FastAmplitudeIntegrator.h>
|
| 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< DalitzHistoSet > | GetEachAmpsHistograms () |
|
DalitzHistoSet | interferenceHistoSet () const |
|
void | saveInterferenceHistograms (const std::string &prefix) const |
|
std::vector< DalitzHistoSet > | GetInterferenceHistograms () |
|
virtual void | doFinalStats (MINT::Minimiser *mini=0) |
|
double | getFractionChi2 () const |
|
bool | ensureFreshEvents () |
|
bool | save (const std::string &fname) const |
|
virtual | ~IReturnReal () |
|
Definition at line 32 of file FastAmplitudeIntegrator.h.
◆ FastAmplitudeIntegrator() [1/3]
FastAmplitudeIntegrator::FastAmplitudeIntegrator |
( |
| ) |
|
◆ FastAmplitudeIntegrator() [2/3]
Definition at line 22 of file FastAmplitudeIntegrator.cpp.
32 initialise(pattern, amps, generator, rnd, precision);
bool initialise(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
◆ FastAmplitudeIntegrator() [3/3]
Definition at line 35 of file FastAmplitudeIntegrator.cpp.
bool initialiseFromFile(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps, const std::string &commaSeparatedList)
◆ ~FastAmplitudeIntegrator()
virtual FastAmplitudeIntegrator::~FastAmplitudeIntegrator |
( |
| ) |
|
|
inlinevirtual |
◆ absSumOfInterferenceFractions()
double FastAmplitudeIntegrator::absSumOfInterferenceFractions |
( |
| ) |
|
|
inline |
Definition at line 149 of file FastAmplitudeIntegrator.h.
double absSumOfInterferenceFractions()
MINT::counted_ptr< IntegCalculator > _integCalc
◆ absSumOfSqrtInterferenceFractions()
double FastAmplitudeIntegrator::absSumOfSqrtInterferenceFractions |
( |
| ) |
|
|
inline |
Definition at line 145 of file FastAmplitudeIntegrator.h.
double absSumOfSqrtInterferenceFractions()
MINT::counted_ptr< IntegCalculator > _integCalc
◆ add()
Definition at line 114 of file FastAmplitudeIntegrator.cpp.
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.
245 cout <<
" FastAmplitudeIntegrator::addEvents " 246 <<
" need to get initialised first." << endl;
249 if(dbThis) cout <<
"FastAmplitudeIntegrator::addEvents " 250 <<
" got called " << endl;
254 cout <<
"FastAmplitudeIntegrator::addEvents " 255 <<
" adding flat events. " << endl;
256 for(
int i=0; i < Nevents; i++){
262 unsigned long int maxTries = (
unsigned long int) Nevents * 1000;
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;
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;
274 cout <<
"ERROR in FastAmplitudeIntegrator::addEvents" 275 <<
"\n\t Generator exhausted, cannot generate more events." 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);
289 cout <<
" FastAmplitudeIntegrator::addEvents: added " << N_success
293 double sigma = -9999;
294 if(v > 0) sigma = sqrt(v);
295 cout <<
"\t integ= " <<
_mean <<
" +/- " << sigma;
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 " 311 cout <<
" added " << Nevents <<
" _integCalc->numEvents "
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)
MINT::counted_ptr< IntegCalculator > _integCalc
double weight(IDalitzEvent *evtPtr)
◆ determineNumEvents()
int FastAmplitudeIntegrator::determineNumEvents |
( |
| ) |
|
|
protected |
Definition at line 373 of file FastAmplitudeIntegrator.cpp.
375 cout <<
" FastAmplitudeIntegrator::determineNumEvents " 376 <<
" need to get initialised first." << endl;
383 double safetyFactor = 1.15;
386 (v*safetyFactor/maxVariance);
390 cout <<
" FastAmplitudeIntegrator::determineNumEvents():" 391 <<
"\n\t> mean: " <<
_mean <<
", rms " << sqrt(v)
392 <<
"\n\t> currently, our relative precision is " 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;
virtual int numEvents() const
static const long int _minEvents
int updateEventSet(long int Nevents)
MINT::counted_ptr< IntegCalculator > _integCalc
◆ doFinalStats()
Implements IDalitzIntegrator.
Definition at line 481 of file FastAmplitudeIntegrator.cpp.
484 cout <<
"FastAmplitudeIntegrator::doFinalStats() called" << endl;
486 cout <<
"Got called with these pointers: mini " << mini
487 <<
" and my own _integCalc " <<
_integCalc << endl;
490 cout <<
" FastAmplitudeIntegrator::doFinalStats " 491 <<
" need to get initialised first." << endl;
492 cout <<
" So I won't do anything." << endl;
virtual void doFinalStats(MINT::Minimiser *mini=0)
MINT::counted_ptr< IntegCalculator > _integCalc
◆ ensureFreshEvents()
bool FastAmplitudeIntegrator::ensureFreshEvents |
( |
| ) |
|
Definition at line 150 of file FastAmplitudeIntegrator.cpp.
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.
328 cout <<
" FastAmplitudeIntegrator::evaluateSum " 329 <<
" need to get initialised first." << endl;
333 time_t tstart = time(0);
338 double sigma = -9999;
339 if(v >= 0) sigma = sqrt(v);
340 double actualPrecision = -9999;
341 if(
_mean != 0 && sigma > 0) actualPrecision = sigma/
_mean;
343 double delT = difftime(time(0), tstart);
345 int printEvery = 100;
346 if(
_Ncalls > 1000) printEvery = 1000;
347 if(
_Ncalls > 10000) printEvery = 10000;
348 if(
_Ncalls > 100000) printEvery = 100000;
352 cout <<
" FastAmplitudeIntegrator::evaluateSum() for " 355 <<
"\n\t> getting: " <<
_mean <<
" +/- " << sigma
356 <<
"\n\t> precision: requested: " <<
_precision*100
357 <<
"%, actual: " << actualPrecision*100 <<
"%" 358 <<
"\n\t> This took " << delT <<
" s." 361 cout <<
"checking save and read-back:" << endl;
364 cout <<
" copy values:"
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.
404 cout <<
" FastAmplitudeIntegrator::generateEnoughEvents " 405 <<
" need to get initialised first." << endl;
412 counter < 10 && _numEvents > 0){
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.
444 cout <<
" FastAmplitudeIntegrator::GetEachAmpsHistograms " 445 <<
" need to get initialised first." << endl;
446 std::vector<DalitzHistoSet> dummy;
virtual std::vector< DalitzHistoSet > GetEachAmpsHistograms()
MINT::counted_ptr< IntegCalculator > _integCalc
◆ getFractionChi2()
double FastAmplitudeIntegrator::getFractionChi2 |
( |
| ) |
const |
Definition at line 498 of file FastAmplitudeIntegrator.cpp.
500 cout <<
" FastAmplitudeIntegrator::getFractionChi2() " 501 <<
" need to get initialised first." << endl;
virtual double getFractionChi2() const
MINT::counted_ptr< IntegCalculator > _integCalc
◆ GetInterferenceHistograms()
std::vector< DalitzHistoSet > FastAmplitudeIntegrator::GetInterferenceHistograms |
( |
| ) |
|
Definition at line 470 of file FastAmplitudeIntegrator.cpp.
472 cout <<
" FastAmplitudeIntegrator::GetInterferenceHistograms " 473 <<
" need to get initialised first." << endl;
474 std::vector<DalitzHistoSet> dummy;
virtual std::vector< DalitzHistoSet > GetInterferenceHistograms()
MINT::counted_ptr< IntegCalculator > _integCalc
◆ getVal()
double FastAmplitudeIntegrator::getVal |
( |
| ) |
|
◆ Gradient()
Definition at line 130 of file FastAmplitudeIntegrator.h.
virtual void Gradient(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
MINT::counted_ptr< IntegCalculator > _integCalc
◆ GradientForLasso()
Definition at line 133 of file FastAmplitudeIntegrator.h.
virtual void GradientForLasso(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
MINT::counted_ptr< IntegCalculator > _integCalc
◆ histoSet()
Definition at line 424 of file FastAmplitudeIntegrator.cpp.
426 cout <<
" FastAmplitudeIntegrator::histoSet " 427 <<
" need to get initialised first." << endl;
virtual DalitzHistoSet histoSet() const
MINT::counted_ptr< IntegCalculator > _integCalc
◆ initialise() [1/2]
Definition at line 52 of file FastAmplitudeIntegrator.cpp.
60 sc &=
setValues(pattern, amps, generator, rnd, precision);
bool setValues(const DalitzEventPattern &pattern, IFastAmplitudeIntegrable *amps=0, MINT::IEventGenerator< IDalitzEvent > *eventGenerator=0, TRandom *rnd=0, double precision=1.e-2)
int generateEnoughEvents()
◆ initialise() [2/2]
Definition at line 84 of file FastAmplitudeIntegrator.cpp.
93 sc &=
setValues(pattern, amps, generator, rnd, precision);
94 if(! sc)
return false;
96 std::stringstream is(commaSeparatedList);
97 getline(is, firstDir,
',');
101 if(firstDir !=
"" && stat(firstDir.c_str(), &buf) == 0){
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
int generateEnoughEvents()
◆ initialised()
bool FastAmplitudeIntegrator::initialised |
( |
| ) |
const |
|
inline |
◆ initialiseFromFile()
Definition at line 66 of file FastAmplitudeIntegrator.cpp.
70 bool sc =
setValues(pattern, amps, 0, 0, 1.e-10);
71 if(! sc)
return false;
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.
454 cout <<
" FastAmplitudeIntegrator::interferenceHistoSet " 455 <<
" need to get initialised first." << endl;
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.
159 if(seed < -9998) seed = time(0);
160 cout <<
"FastAmplitudeIntegrator::makeNewRnd with seed " << seed << endl;
MINT::counted_ptr< TRandom > _localRnd
◆ numberOfFitFractionsLargerThanThreshold()
int FastAmplitudeIntegrator::numberOfFitFractionsLargerThanThreshold |
( |
double |
threshold | ) |
|
|
inline |
Definition at line 157 of file FastAmplitudeIntegrator.h.
int numberOfFitFractionsLargerThanThreshold(double threshold)
MINT::counted_ptr< IntegCalculator > _integCalc
◆ RealVal()
double FastAmplitudeIntegrator::RealVal |
( |
| ) |
|
|
inlinevirtual |
◆ save()
bool FastAmplitudeIntegrator::save |
( |
const std::string & |
fname | ) |
const |
Definition at line 507 of file FastAmplitudeIntegrator.cpp.
509 cout <<
" FastAmplitudeIntegrator::save( " << fname <<
" ):" 510 <<
" need to get initialised first." << endl;
511 cout <<
" So I won't do anything." << endl;
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.
435 cout <<
" FastAmplitudeIntegrator::saveEachAmpsHistograms " 436 <<
" need to get initialised first." << endl;
437 cout <<
"So I won't do anything" << endl;
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.
463 cout <<
" FastAmplitudeIntegrator::saveInterferenceAmpsHistograms " 464 <<
" need to get initialised first." << endl;
465 cout <<
"So I won't do anything" << endl;
virtual void saveInterferenceHistograms(const std::string &prefix) const
MINT::counted_ptr< IntegCalculator > _integCalc
◆ setPrecision()
void FastAmplitudeIntegrator::setPrecision |
( |
double |
prec | ) |
|
|
inline |
◆ setValues()
Definition at line 167 of file FastAmplitudeIntegrator.cpp.
189 cout <<
"FastAmplitudeIntegrator::setValues: Have _integCalc ptr " <<
_integCalc 190 <<
", now printing it." << endl;
197 cout <<
"ERROR in FastAmplitudeIntegrator::initialise" 198 <<
" amps->makeIntegCalculator()" 199 <<
" return NULL pointer!" << endl;
200 cout <<
"\t This will go wrong." << endl;
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 |
◆ sumOfSqrtFitFractions()
double FastAmplitudeIntegrator::sumOfSqrtFitFractions |
( |
| ) |
|
|
inline |
◆ updateEventSet()
int FastAmplitudeIntegrator::updateEventSet |
( |
long int |
Nevents | ) |
|
|
protected |
Definition at line 208 of file FastAmplitudeIntegrator.cpp.
210 cout <<
" FastAmplitudeIntegrator::updateEventSet " 211 <<
" need to know pattern first." << endl;
216 if(missingEvents > 0){
217 cout <<
"missing events: " << missingEvents
223 cout <<
"want " << Nevents
225 <<
", so no more events missing." << endl;
virtual int numEvents() const
int addEvents(long int Nevents)
MINT::counted_ptr< IntegCalculator > _integCalc
◆ variance()
double FastAmplitudeIntegrator::variance |
( |
| ) |
const |
Definition at line 318 of file FastAmplitudeIntegrator.cpp.
320 cout <<
" FastAmplitudeIntegrator::variance " 321 <<
" need to get initialised first." << endl;
virtual double variance() const
MINT::counted_ptr< IntegCalculator > _integCalc
◆ weight()
double FastAmplitudeIntegrator::weight |
( |
IDalitzEvent * |
evtPtr | ) |
|
|
protected |
◆ _amps
◆ _db
bool FastAmplitudeIntegrator::_db |
|
private |
◆ _generator
◆ _initialised
bool FastAmplitudeIntegrator::_initialised |
|
private |
◆ _integCalc
◆ _integCalc_copyForDebug
◆ _localRnd
◆ _mean
double FastAmplitudeIntegrator::_mean |
|
mutableprivate |
◆ _minEvents
const long int FastAmplitudeIntegrator::_minEvents =100 |
|
staticprivate |
◆ _Ncalls
int FastAmplitudeIntegrator::_Ncalls |
|
private |
◆ _numEvents
int FastAmplitudeIntegrator::_numEvents |
|
private |
◆ _pat
◆ _precision
double FastAmplitudeIntegrator::_precision |
|
protected |
◆ _rnd
TRandom* FastAmplitudeIntegrator::_rnd |
|
protected |
The documentation for this class was generated from the following files: