346 py::enum_<TestStatistic>(m_samples,
"TestStatistic")
360 "reweight the MC events in this sample. You will need to override this.")
365 "Get the total number of samples"
372 "Get the dimension of a given sample"
379 auto hist_original =
M3::Clone(
self.GetMCHist(sample));
385 py::return_value_policy::reference_internal,
387 "Get MC histogram as numpy arrays.\n"
388 "For 1D: Returns (contents, edges)\n"
389 "For 2D: Returns (contents, edgesX, edgesY)\n"
390 "where contents is shape (nbinsY, nbinsX) for 2D")
395 "Get the sample likelihood at the current point in your model space. You will need to override this.")
400 "Set the test statistic that should be used when calculating likelihoods. \n\
401 :param test_stat: The new test statistic to use",
402 py::arg(
"test_stat"))
407 "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.SampleHandlerInterface.set_test_stat` \n\
408 :param data: The data content of the bin. \n\
409 :param mc: The mc content of the bin \n\
410 :param w2: The Sum(w_{i}^2) (sum of weights squared) in the bin, which is sigma^2_{MC stats}",
420 py::init<std::string, ParameterHandlerGeneric *>(),
421 "This should never be called directly as SampleHandlerBase is an abstract base class. \n\
422 However when creating a derived class, in the __init__() method, you should call the parent constructor i.e. this one by doing:: \n\
424 \tsuper(<your derived SampleHandler class>, self).__init__(*args) \n\
426 py::arg(
"mc_version"), py::arg(
"xsec_cov"))
432 py::arg(
"data_array"),
433 "Set the data for your sample handler (assumes the binning is the same as your MC!)"
443 "Get the title for a given sample"
449 "Returns the contents of the MC histogram as a flat list"
456 "Returns the contents of the MC histogram as a flat list"
463 "Returns the contents of the W2 histogram as a flat list"
470 auto hist_original =
M3::Clone(
self.GetDataHist(sample));
476 py::arg(
"Dimension"),
477 "Get Data histogram as numpy arrays.\n"
478 "For 1D: Returns (contents, edges)\n"
479 "For 2D: Returns (contents, edgesX, edgesY)\n"
480 "where contents is shape (nbinsY, nbinsX) for 2D")
486 auto hist_original =
M3::Clone(
self.GetW2Hist(sample));
494 "Get W2 histogram as numpy arrays.\n"
495 "For 1D: Returns (contents, edges)\n"
496 "For 2D: Returns (contents, edgesX, edgesY)\n"
497 "where contents is shape (nbinsY, nbinsX) for 2D")
501 const std::string& ProjectionVarX,
502 const std::string& ProjectionVarY=
"",
503 const std::vector<KinematicCut> &EventSelectionVec = {},
505 const std::vector< KinematicCut >& SubEventSelectionVec = {})
508 py::array_t<M3::float_t> edgesY, edgesX, contents;
509 std::unique_ptr<TH1> hist;
511 if(ProjectionVarY==
""){
512 hist =
self.Get1DVarHist(iSample,
516 SubEventSelectionVec);
518 hist =
self.Get2DVarHist(iSample,
523 SubEventSelectionVec);
531 py::class_<KinematicCut>(m_samples,
"KinematicCut")
532 .def(py::init<>(),
"Simple wrapper around Kinematic cuts")
@ kNTestStatistics
Number of test statistics.
@ kPearson
Standard Pearson likelihood .
@ kBarlowBeeston
Barlow-Beeston () following Conway approximation ()
@ kDembinskiAbdelmotteleb
Based on .
@ kPoisson
Standard Poisson likelihood .
As SampleHandlerBase is an abstract base class we have to do some gymnastics to get it to get it into...
EW: As SampleHandlerBase is an abstract base class we have to do some gymnastics to get it to get it ...
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...
void AddData(const int Sample, TH1 *Data)
DB: Add data for a given sample from a ROOT histogram.
auto GetDataArray() const
Return array storing data entries for every bin.
std::string GetSampleTitle(const int Sample) const final
Get fancy title for specified samples.
auto GetMCArray() const
Return array storing MC entries for every bin.
auto GetW2Array() const
Return array storing W2 entries for every bin.
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...
virtual double GetLikelihood() const =0
Return likelihood (-logL) for all samples.
double GetTestStatLLH(const double data, const double mc, const double w2) const
Calculate test statistic for a single bin. Calculation depends on setting of fTestStatistic....
virtual M3::int_t GetNSamples()
returns total number of samples
virtual void Reweight()=0
main routine modifying MC prediction based on proposed parameter values
void SetTestStatistic(TestStatistic testStat)
Set the test statistic to be used when calculating the binned likelihoods.
virtual int GetNDim(const int Sample) const =0
DB Get what dimensionality binning for given sample has.
py::tuple HistToNumpy(std::unique_ptr< TH1 > &hist)
std::unique_ptr< ObjectType > Clone(const ObjectType *obj, const std::string &name="")
KS: Creates a copy of a ROOT-like object and wraps it in a smart pointer.
double UpperBound
Upper bound on which we apply cut.
double LowerBound
Lower bound on which we apply cut.
int ParamToCutOnIt
Index or enum value identifying the kinematic variable to cut on.