1#include <pybind11/pybind11.h>
2#include <pybind11/stl.h>
3#include <pybind11/numpy.h>
7namespace py = pybind11;
17 PYBIND11_OVERRIDE_PURE(
27 PYBIND11_OVERRIDE_PURE(
36 PYBIND11_OVERRIDE_PURE(
44 PYBIND11_OVERRIDE_PURE_NAME(
63 PYBIND11_OVERRIDE_PURE_NAME(
66 "setup_weight_pointers",
74 PYBIND11_OVERRIDE_PURE(
83 PYBIND11_OVERRIDE_PURE_NAME(
94 PYBIND11_OVERRIDE_PURE_NAME(
105 PYBIND11_OVERRIDE_PURE_NAME(
108 "setup_experiment_MC",
115 PYBIND11_OVERRIDE_PURE_NAME(
124 PYBIND11_OVERRIDE_PURE_NAME(
127 "get_kinematic_by_name",
129 py::arg(
"variable_name")
134 PYBIND11_OVERRIDE_PURE_NAME(
137 "get_kinematic_name",
139 py::arg(
"variable_id")
144 PYBIND11_OVERRIDE_PURE_NAME(
147 "get_event_kinematic_value",
155 PYBIND11_OVERRIDE_PURE_NAME(
158 "get_event_kinematic_value",
166 PYBIND11_OVERRIDE_PURE_NAME(
169 "get_event_kinematic_value_reference",
176 PYBIND11_OVERRIDE_PURE_NAME(
179 "get_event_kinematic_value_reference",
187 PYBIND11_OVERRIDE_PURE_NAME(
190 "register_functional_parameters",
198 auto m_samples = m.def_submodule(
"samples");
200 "This is a Python binding of MaCh3s C++ based samples library.";
203 py::enum_<TestStatistic>(m_samples,
"TestStatistic")
217 "reweight the MC events in this sample. You will need to override this."
223 "Get the sample likelihood at the current point in your model space. You will need to override this."
229 "Set the test statistic that should be used when calculating likelihoods. \n\
230 :param test_stat: The new test statistic to use",
237 "Get the LLH for a bin by comparing the data and MC. The result depends on having previously set the test statistic using :py:meth:`pyMaCh3.samples.SampleHandlerBase.set_test_stat` \n\
238 :param data: The data content of the bin. \n\
239 :param mc: The mc content of the bin \n\
240 :param w2: The Sum(w_{i}^2) (sum of weights squared) in the bin, which is sigma^2_{MC stats}",
249 py::init<std::string, ParameterHandlerGeneric*>(),
250 "This should never be called directly as SampleHandlerFD is an abstract base class. \n\
251 However when creating a derived class, in the __init__() method, you should call the parent constructor i.e. this one by doing:: \n\
253 \tsuper(<your derived SampleHandler class>, self).__init__(*args) \n\
255 py::arg(
"mc_version"),
@ kNTestStatistics
Number of test statistics.
@ kPearson
Standard Pearson likelihood .
@ kBarlowBeeston
Barlow-Beeston () following Conway approximation ()
@ kDembinskiAbdelmotteleb
Based on .
@ kPoisson
Standard Poisson likelihood .
EW: As SampleHandlerBase is an abstract base class we have to do some gymnastics to get it to get it ...
std::string GetSampleName(int iSample) const override
void CleanMemoryBeforeFit() override
Allow to clean not used memory before fit starts.
double GetLikelihood() override
As SampleHandlerFD is an abstract base class we have to do some gymnastics to get it to get it into p...
void SetupSplines() override
initialise your splineXX object and then use InitialiseSplineObject to conviently setup everything up
void SetupWeightPointers() override
DB Function to determine which weights apply to which types of samples pure virtual!...
double ReturnKinematicParameter(int, int) override
const double * GetPointerToKinematicParameter(double, int) override
int SetupExperimentMC() override
Experiment specific setup, returns the number of events which were loaded.
void CleanMemoryBeforeFit() override
Allow to clean not used memory before fit starts.
void Init() override
Initialise any variables that your experiment specific SampleHandler needs.
int ReturnKinematicParameterFromString(std::string)
const double * GetPointerToKinematicParameter(std::string, int) override
void SetupFDMC() override
Function which translates experiment struct into core struct.
double ReturnKinematicParameter(std::string, int) override
Return the value of an assocaited kinematic parameter for an event.
void RegisterFunctionalParameters() override
HH - a experiment-specific function where the maps to actual functions are set up.
std::string ReturnStringFromKinematicParameter(int)
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...
virtual void Reweight()=0
SampleHandlerBase()
The main constructor.
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...
SampleHandlerFD(std::string ConfigFileName, ParameterHandlerGeneric *xsec_cov, const std::shared_ptr< OscillationHandler > &OscillatorObj_=nullptr)
Constructor.
void SetTestStatistic(TestStatistic testStat)
Set the test statistic to be used when calculating the binned likelihoods.
virtual double GetLikelihood()=0
double GetTestStatLLH(double data, double mc) const
Calculate test statistic for a single bin using Poisson.
void initSamples(py::module &m)