6 #include <goofit/Version.h> 20 std::vector<size_t> xbins;
21 std::vector<size_t> ybins;
22 std::vector<std::vector<fptype>> pdfValues;
31 : m12(signalDalitz->_m12)
32 , m13(signalDalitz->_m13)
33 , eventNumber(signalDalitz->_eventNumber)
34 , data({m12, m13, eventNumber})
56 auto old = overallSignal->getData();
57 overallSignal->setData(&data);
59 pdfValues = overallSignal->getCompProbsAtDataPoints();
60 overallSignal->setData(old);
66 std::random_device rd;
67 std::mt19937 gen(rd());
70 std::uniform_real_distribution<> unihalf(-.5, .5);
71 std::uniform_real_distribution<> uniwhole(0.0, 1.0);
74 std::vector<double> integral(pdfValues[0].size());
75 std::partial_sum(pdfValues[0].begin(), pdfValues[0].end(), integral.begin());
78 std::for_each(integral.begin(), integral.end(), [&integral](
double &val) { val /= integral.back(); });
80 for(
size_t i = 0; i < nTotal; i++) {
81 double r = uniwhole(gen);
84 size_t j = std::lower_bound(integral.begin(), integral.end(), r) - integral.begin();
99 size_t getX(
size_t event)
const {
return xbins.at(event); }
101 size_t getY(
size_t event)
const {
return ybins.at(event); }
109 fptype getVal(
size_t event,
size_t num = 0)
const {
return pdfValues.at(num).at(event); }
116 #if GOOFIT_ROOT_FOUND 117 TH2F *make2D(std::string name =
"dalitzplot", std::string title =
"") {
119 auto *dalitzplot =
new TH2F(name.c_str(),
129 size_t currm12 =
getX(j);
130 size_t currm13 =
getY(j);
133 dalitzplot->SetBinContent(1 + currm12, 1 + currm13, val);
size_t getNumEvents() const
fptype getBinSize() const
Get the bin size, (upper-lower) / bins.
UnbinnedDataSet * getDataSet()
void fillDataSetMC(UnbinnedDataSet &dataset, size_t nTotal)
Fill a dataset with MC events.
size_t getX(size_t event) const
void setValue(fptype val)
Set the value.
Special class for observables. Used in DataSets.
fptype getValue(const Observable &var, size_t idx) const
Get the value at a specific variable and event number.
DalitzPlotter(GooPdf *overallSignal, DalitzPlotPdf *signalDalitz)
size_t getY(size_t event) const
size_t getNumBins() const
Get the number of bins.
__host__ __device__ bool inDalitz(const fptype &m12, const fptype &m13, const fptype &bigM, const fptype &dm1, const fptype &dm2, const fptype &dm3)
fptype getVal(size_t event, size_t num=0) const
fptype getLowerLimit() const
Get the lower limit.
fptype getZval(size_t event) const
fptype getValue() const
Get the value.
fptype getXval(size_t event) const
fptype getUpperLimit() const
Get the upper limit.
size_t getNumEvents() const
fptype getYval(size_t event) const
const Observable & getM13() const
This class makes it easy to make plots over 3 body Dalitz PDFs. You can use ROOT style value access o...
const Observable & getM12() const