#include <DalitzBox.h>
Definition at line 22 of file DalitzBox.h.
◆ DalitzBox() [1/5]
Definition at line 76 of file DalitzBox.cpp.
DalitzEventList _eventList
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
unsigned int _heightProblems
◆ DalitzBox() [2/5]
Definition at line 97 of file DalitzBox.cpp.
double amps(IDalitzEvent &ep)
DalitzEventList _eventList
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
unsigned int _heightProblems
bool setAmps(MINT::IReturnRealForEvent< IDalitzEvent > *amps)
◆ DalitzBox() [3/5]
Definition at line 121 of file DalitzBox.cpp.
130 ,
_area(pat, limit, rnd)
double amps(IDalitzEvent &ep)
DalitzEventList _eventList
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
unsigned int _heightProblems
bool setAmps(MINT::IReturnRealForEvent< IDalitzEvent > *amps)
◆ DalitzBox() [4/5]
Definition at line 146 of file DalitzBox.cpp.
155 ,
_area(pat, limits, rnd)
double amps(IDalitzEvent &ep)
DalitzEventList _eventList
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
unsigned int _heightProblems
bool setAmps(MINT::IReturnRealForEvent< IDalitzEvent > *amps)
◆ DalitzBox() [5/5]
DalitzBox::DalitzBox |
( |
const DalitzBox & |
other | ) |
|
Definition at line 171 of file DalitzBox.cpp.
DalitzEventList _eventList
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
unsigned int _heightProblems
◆ ~DalitzBox()
DalitzBox::~DalitzBox |
( |
| ) |
|
◆ amps()
Definition at line 268 of file DalitzBox.cpp.
271 if(0 ==
_amps)
return 1;
272 if(dbThis) cout <<
" the event: " << endl;
273 if(dbThis) evt.print();
274 if(dbThis) cout <<
" ... now getting RealVal() " << endl;
276 if(dbThis) cout <<
" all done, returning " << val << endl;
virtual double RealVal(EVENT_TYPE &evt)=0
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
◆ ampsWithPhaseSpace()
Definition at line 285 of file DalitzBox.cpp.
288 double a =
amps(evt_in);
289 if(dbThis) cout <<
"amps " << a << endl;
291 if(dbThis) cout <<
"ps " << ps << endl;
double amps(IDalitzEvent &ep)
double phaseSpace(IDalitzEvent &ep)
◆ area() [1/2]
◆ area() [2/2]
◆ encloseInPhaseSpaceArea()
void DalitzBox::encloseInPhaseSpaceArea |
( |
| ) |
|
|
inline |
Definition at line 128 of file DalitzBox.h.
const MappedDalitzArea & area() const
void encloseInPhaseSpaceArea()
◆ estimateHeight()
bool DalitzBox::estimateHeight |
( |
std::vector< double > & |
vals | ) |
|
|
private |
Definition at line 406 of file DalitzBox.cpp.
409 int maxEvents = 100000;
410 int maxTries = 10000000;
411 double meanPhaseSpaceSum = 0;
428 cout <<
"DalitzBox::estimateHeight" << endl;
433 int numEvents=0, counter=0;
434 while(numEvents < maxEvents && counter < maxTries){
436 double tmp_s0 =
_rnd->Rndm();
437 double tmp_s1 =
_rnd->Rndm();
438 double tmp_s2 =
_rnd->Rndm();
439 double tmp_s3 =
_rnd->Rndm();
440 double tmp_s4 =
_rnd->Rndm();
442 if(0 == tmpEvtPtr)
continue;
443 if(dbThis) cout <<
"estimate height got event " 444 <<
" printing it: " << endl;
445 if(dbThis) cout << *tmpEvtPtr << endl;
466 meanPhaseSpaceSum += p;
472 double meanPhaseSpace = meanPhaseSpaceSum/((double)numEvents);
473 cout <<
"mean phase space " << meanPhaseSpace
478 double CL = 1.0 - 1.e-7;
479 std::cout <<
"actual max = " << max << std::endl;
483 <<
" events. Taking 5*max = 5*" << max
485 <<
" and return false." << endl;
490 double actualMax=-1, paretoMax=-1;
498 std::cout <<
" Pareto max " << paretoMax << std::endl;
511 cout <<
"compare to guessed height: " 515 if(fabs( (paretoMax - actualMax)/actualMax) > 0.3 ){
double ampsWithPhaseSpace(IDalitzEvent &ep)
double generalisedPareto_estimateMaximum(const std::vector< double > &input, double CL=0.001)
DalitzEventList _eventList
double phaseSpace(IDalitzEvent &ep)
double guessedHeight() const
const MappedDalitzArea & area() const
virtual unsigned int size() const
bool insideDaddysArea(const DalitzEvent &evt) const
◆ estimateHeight_old()
bool DalitzBox::estimateHeight_old |
( |
std::vector< double > & |
vals | ) |
|
|
private |
Definition at line 522 of file DalitzBox.cpp.
524 double saveFactor = 2.0;
526 cout <<
"DalitzBox::estimateHeight" << endl;
536 time_t startTime = time(0);
538 unsigned int counter=0;
546 double maxPhaseSpace = -9999;
551 if(p > maxPhaseSpace || 0 == counter){
556 if(d > max || 0 == counter){
562 std::cout <<
" calculated amps for event " 564 <<
", its value is " << d
566 double deltaT = difftime(time(0), startTime);
567 std::cout <<
" this took " << deltaT <<
" s";
569 std::cout <<
"; rate (before throwing away) = " 573 std::cout << std::endl;
577 cout <<
" max phase space: " << maxPhaseSpace << endl;
579 double epsilon = 0.25;
582 std::cout <<
"actual max = " << max << std::endl;
586 <<
" events. Taking 5*max = 5*" << max
588 <<
" and return false." << endl;
593 double actualMax=-1, paretoMax=-1;
601 std::cout <<
" Pareto max " << paretoMax << std::endl;
602 max *= 1.0 + epsilon;
603 std::cout <<
"Now added " << epsilon * 100 <<
"% for safety " 608 std::cout <<
"and multiplied by safety factor " 612 cout <<
"compare to guessed height: " 616 if(fabs( (paretoMax - actualMax)/actualMax) > 0.3 ){
double ampsWithPhaseSpace(IDalitzEvent &ep)
virtual double phaseSpace() const =0
double generalisedPareto_estimateMaximum(const std::vector< double > &input, double CL=0.001)
DalitzEventList _eventList
double guessedHeight() const
virtual unsigned int size() const
◆ estimateHeightMinuit()
bool DalitzBox::estimateHeightMinuit |
( |
| ) |
|
|
private |
Definition at line 296 of file DalitzBox.cpp.
394 mini.Command(
"Simplex 10000000");
395 mini.Command(
"MIGRAD");
397 double safetyMargin = 0;
399 _height = -(mini.getFCNVal() * (1.0 + safetyMargin));
402 cout <<
" setting height to " <<
_height << endl;
◆ eventList() [1/2]
Definition at line 112 of file DalitzBox.h.
DalitzEventList _eventList
◆ eventList() [2/2]
Definition at line 113 of file DalitzBox.h.
DalitzEventList _eventList
◆ getEventsPdf()
Definition at line 830 of file DalitzBox.cpp.
virtual double phaseSpace() const
virtual double RealVal(EVENT_TYPE &evt)=0
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
◆ getReady()
void DalitzBox::getReady |
( |
| ) |
|
Definition at line 796 of file DalitzBox.cpp.
797 time_t startTime = time(0);
799 cout <<
" DalitzBox::getReady() " << *
this << endl;
808 double deltaT = difftime(time(0), startTime);
809 cout <<
" DalitzBox::getRead(): am ready. This took " 810 << deltaT/60 <<
" min" << endl;
DalitzEventList _eventList
virtual unsigned int size() const
◆ guessedHeight()
double DalitzBox::guessedHeight |
( |
| ) |
const |
|
inline |
◆ height()
double DalitzBox::height |
( |
| ) |
const |
|
inline |
◆ insideArea()
bool DalitzBox::insideArea |
( |
const DalitzEvent & |
evt | ) |
const |
Definition at line 214 of file DalitzBox.cpp.
const MappedDalitzArea & area() const
bool isInside(const DalitzEvent &evt) const
◆ insideDaddysArea()
bool DalitzBox::insideDaddysArea |
( |
const DalitzEvent & |
evt | ) |
const |
Definition at line 232 of file DalitzBox.cpp.
233 if(0 ==
_daddy)
return false;
bool insideMyOrDaddysArea(const DalitzEvent &evt) const
◆ insideMyOrDaddysArea()
bool DalitzBox::insideMyOrDaddysArea |
( |
const DalitzEvent & |
evt | ) |
const |
Definition at line 237 of file DalitzBox.cpp.
bool insideArea(const DalitzEvent &evt) const
bool insideDaddysArea(const DalitzEvent &evt) const
◆ makeFlatEventsKeepAll()
int DalitzBox::makeFlatEventsKeepAll |
( |
int |
N | ) |
|
|
private |
Definition at line 241 of file DalitzBox.cpp.
242 cout <<
"making " << N <<
" flat event" << endl;
244 int guessedWasteFactor = 110*5;
245 if(
fastTest) guessedWasteFactor = 150;
247 for(
int i=0; i< N*guessedWasteFactor; i++){
250 if(printdbg) cout <<
" nTries " <<
_nTries << endl;
253 if(printdbg) cout <<
" made event" << endl;
256 if(printdbg)cout <<
" area OK " << endl;
258 if(printdbg)cout <<
" added event" << endl;
260 if(++counter >= N)
break;
virtual bool Add(const EVENT_TYPE &evt)
DalitzEventList _eventList
const MappedDalitzArea & area() const
virtual unsigned int size() const
bool insideDaddysArea(const DalitzEvent &evt) const
◆ makeStarterSet()
bool DalitzBox::makeStarterSet |
( |
| ) |
|
|
private |
Definition at line 623 of file DalitzBox.cpp.
624 double safetyFactor = 2.5;
626 time_t startTime = time(0);
627 cout <<
"making starter set" << endl;
629 int NperLoop = 20000;
641 bool successfulHeightEstimate =
false;
642 std::vector<double> vals;
645 double prevHeight = -0.1;
646 double heightErrorEstimate = 0.1;
649 bool doMinuitHeight=
false;
655 = fabs(prevHeight -
_height)/( 0.5*(fabs(prevHeight) + fabs(
_height) ));
663 successfulHeightEstimate &= heightErrorEstimate < 0.25;
667 double deltaT = difftime(time(0), startTime);
668 cout <<
" making " << counter
669 <<
" " << NperLoop <<
"-events starter set(s)" 670 <<
" took " << deltaT/60 <<
" min" << endl;
671 cout <<
" current heightErrorEstimate: " << heightErrorEstimate << endl;
675 }
while(counter < maxLoop
676 && (! successfulHeightEstimate)
679 cout <<
" DONE \"old\" height guess, now MINUIT " << endl;
681 double search_height =
_height;
682 double minuit_height = -1;
689 _height = ( search_height > minuit_height ? search_height : minuit_height);
692 cout <<
"Different Heights:" 693 <<
"\n\t search_height " << search_height
694 <<
"\n\t minuit_height " << minuit_height
696 <<
"\n\t chosen height " <<
_height 699 if(! successfulHeightEstimate){
700 cout <<
"DalitzBox::makeStarterSet " 701 <<
"WARNING - no reliable estimate of box-height" 703 cout <<
" I'll multiply it by " << 1.0 + 2*heightErrorEstimate
704 <<
", and continue..." << endl;
707 cout <<
"DalitzBox::makeStarterSet " 708 <<
"I think I found a reliable Height Estimate of " 718 cout <<
" appliying safety factor of " << safetyFactor << endl;
720 cout <<
"final height " <<
_height << endl;
bool estimateHeight(std::vector< double > &vals)
double guessedHeight() const
bool estimateHeightMinuit()
◆ name()
const std::string& DalitzBox::name |
( |
| ) |
const |
|
inline |
◆ number()
int DalitzBox::number |
( |
| ) |
const |
|
inline |
◆ phaseSpace()
◆ popEventFromList()
Definition at line 908 of file DalitzBox.cpp.
void resize(unsigned int N)
DalitzEventList _eventList
virtual unsigned int size() const
◆ print()
void DalitzBox::print |
( |
std::ostream & |
os = std::cout | ) |
const |
Definition at line 961 of file DalitzBox.cpp.
962 os <<
"DalitzBox: " <<
name() <<
" number " <<
number()
963 <<
"\n area " <<
area()
965 <<
"\n height " <<
height()
double guessedHeight() const
const std::string & name() const
const MappedDalitzArea & area() const
◆ setAmps()
Definition at line 198 of file DalitzBox.cpp.
202 if(0 ==
_amps)
return false;
double amps(IDalitzEvent &ep)
DalitzEventList _eventList
MINT::IReturnRealForEvent< IDalitzEvent > * _amps
◆ setDaddy()
void DalitzBox::setDaddy |
( |
const DalitzBox * |
daddy | ) |
|
◆ setFlatPhaseSpace()
void DalitzBox::setFlatPhaseSpace |
( |
bool |
flat = true | ) |
|
|
inline |
◆ setGuessedHeight()
void DalitzBox::setGuessedHeight |
( |
double |
h | ) |
|
|
inline |
◆ setHeight()
double DalitzBox::setHeight |
( |
double |
h | ) |
|
|
inline |
◆ setName()
void DalitzBox::setName |
( |
const std::string & |
name | ) |
|
|
inline |
Definition at line 97 of file DalitzBox.h.
const std::string & name() const
◆ setNumber()
void DalitzBox::setNumber |
( |
int |
num | ) |
|
|
inline |
◆ setRnd()
bool DalitzBox::setRnd |
( |
TRandom * |
rnd = gRandom | ) |
|
Definition at line 974 of file DalitzBox.cpp.
const MappedDalitzArea & area() const
bool setRnd(TRandom *rnd=gRandom)
◆ split()
std::vector< DalitzBox > DalitzBox::split |
( |
unsigned int |
nWays | ) |
const |
Definition at line 917 of file DalitzBox.cpp.
919 std::vector<MappedDalitzArea> areaList(
_area.
split(nWays));
921 std::vector<DalitzBox> newSet;
922 if(areaList.empty())
return newSet;
924 for(
unsigned int i=0; i < areaList.size(); i++){
926 newBox.area() = areaList[i];
927 if( ! (newBox.area().isInside((this->
area().centre())))){
929 newBox.setGuessedHeight(-1);
933 newSet.push_back(newBox);
935 if(
false && (! foundCtr)){
936 cout <<
"ERROR split box " << *
this <<
" " << nWays <<
" ways," 937 <<
" but center: is gone." << endl;
938 cout <<
"newSet\n: " << newSet << endl;
std::vector< MappedDalitzArea > split(unsigned int nWays) const
const MappedDalitzArea & area() const
◆ splitIfWiderThan()
std::vector< DalitzBox > DalitzBox::splitIfWiderThan |
( |
double |
maxWidth | ) |
const |
Definition at line 943 of file DalitzBox.cpp.
947 std::vector<DalitzBox> newSet;
948 if(areaList.empty())
return newSet;
949 for(
unsigned int i=0; i < areaList.size(); i++){
951 newBox.area() = areaList[i];
952 if( ! (newBox.area().isInside((this->
area().centre())))){
954 newBox.setGuessedHeight(-1);
956 newSet.push_back(newBox);
std::vector< MappedDalitzArea > splitIfWiderThan(double maxWidth) const
const MappedDalitzArea & area() const
◆ throwAwayData()
int DalitzBox::throwAwayData |
( |
const std::vector< double > & |
vals | ) |
|
|
private |
Definition at line 727 of file DalitzBox.cpp.
729 time_t startTime = time(0);
732 cout <<
" ERROR in DalitzBox::throwAwayData: " 733 <<
" vals.size()=" << vals.size()
734 <<
", but _eventList.size()=" 737 throw "this is bad.";
744 unsigned int counter=0;
756 std::cout <<
" remembering amps for event " 758 <<
", its value is " << d
767 std::cout <<
" So the waste factor for \n" << this->
name() <<
" is ";
769 else std::cout <<
" infinity! - that's big!";
770 std::cout << std::endl;
773 double deltaTFinal = difftime(time(0), startTime);
774 std::cout <<
" this took " << deltaTFinal/60.0 <<
" min";
776 std::cout <<
" rate = " << (
_eventList.
size()/deltaTFinal) <<
" evts/s" 781 std::cout << std::endl;
783 std::cout <<
" ---------------\n " << std::endl;
virtual bool Add(const EVENT_TYPE &evt)
double ampsWithPhaseSpace(IDalitzEvent &ep)
DalitzEventList _eventList
const std::string & name() const
virtual unsigned int size() const
◆ tryEventForOwner()
Definition at line 817 of file DalitzBox.cpp.
DalitzEventList _eventList
MINT::counted_ptr< DalitzEvent > tryNewEvent()
MINT::counted_ptr< DalitzEvent > tryEventFromList()
◆ tryEventFromList()
Definition at line 894 of file DalitzBox.cpp.
MINT::counted_ptr< DalitzEvent > popEventFromList()
◆ tryNewEvent()
Definition at line 839 of file DalitzBox.cpp.
853 cout <<
"ERROR in DalitzBox::tryNewEvent()\n" << (*this)
854 <<
"\n val > _height: " << val <<
" > " <<
_height 855 <<
"\n (for phase space = " << evt->phaseSpace() <<
")." 856 <<
"\n if _height had been correctly estimated," 857 <<
" this should not be possible." << endl;
859 <<
" times in this box " << endl;
const MappedDalitzArea & area() const
double getEventsPdf(DalitzEvent &evt)
unsigned int _heightProblems
bool insideDaddysArea(const DalitzEvent &evt) const
◆ tryWeightedEventForOwner()
Definition at line 867 of file DalitzBox.cpp.
878 if(dbThis)cout <<
" DalitzBox::tryWeightedEventForOwner() " 879 <<
" got event with ptr " 881 <<
", setting val: " << endl;
882 if(dbThis)cout <<
" now printing event: " 886 if(dbThis)cout <<
" val = " << val <<
", now setting weight " << endl;
888 if(dbThis)cout <<
" done weight, now generator..." << endl;
889 evt->setGeneratorPdfRelativeToPhaseSpace(
amps(*evt));
890 if(dbThis)cout <<
" all OK, returning " << evt << endl;
double amps(IDalitzEvent &ep)
double ampsWithPhaseSpace(IDalitzEvent &ep)
const MappedDalitzArea & area() const
bool insideDaddysArea(const DalitzEvent &evt) const
◆ volume()
double DalitzBox::volume |
( |
| ) |
const |
Definition at line 788 of file DalitzBox.cpp.
790 cout <<
" volume: returning area " << a
const MappedDalitzArea & area() const
◆ _amps
◆ _area
◆ _daddy
◆ _eventList
◆ _flatPhaseSpace
bool DalitzBox::_flatPhaseSpace |
|
private |
◆ _guessedHeight
double DalitzBox::_guessedHeight |
|
private |
◆ _height
double DalitzBox::_height |
|
private |
◆ _heightProblems
unsigned int DalitzBox::_heightProblems |
|
private |
◆ _max_s0
double DalitzBox::_max_s0 |
|
private |
◆ _max_s1
double DalitzBox::_max_s1 |
|
private |
◆ _max_s2
double DalitzBox::_max_s2 |
|
private |
◆ _max_s3
double DalitzBox::_max_s3 |
|
private |
◆ _max_s4
double DalitzBox::_max_s4 |
|
private |
◆ _maxPhaseSpace
double DalitzBox::_maxPhaseSpace |
|
private |
◆ _name
std::string DalitzBox::_name |
|
private |
◆ _nEventsForTries
int DalitzBox::_nEventsForTries |
|
private |
◆ _nTries
◆ _number
◆ _pat
◆ _ready
◆ _rnd
The documentation for this class was generated from the following files: