345 py::enum_<TestStatistic>(m_samples,
"TestStatistic")
359 "reweight the MC events in this sample. You will need to override this.")
364 "Get the total number of samples"
371 "Get the dimension of a given sample"
378 auto hist_original =
M3::Clone(
self.GetMCHist(sample));
384 py::return_value_policy::reference_internal,
386 "Get MC histogram as numpy arrays.\n"
387 "For 1D: Returns (contents, edges)\n"
388 "For 2D: Returns (contents, edgesX, edgesY)\n"
389 "where contents is shape (nbinsY, nbinsX) for 2D")
394 "Get the sample likelihood at the current point in your model space. You will need to override this.")
399 "Set the test statistic that should be used when calculating likelihoods. \n\
400 :param test_stat: The new test statistic to use",
401 py::arg(
"test_stat"))
406 "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\
407 :param data: The data content of the bin. \n\
408 :param mc: The mc content of the bin \n\
409 :param w2: The Sum(w_{i}^2) (sum of weights squared) in the bin, which is sigma^2_{MC stats}",
419 py::init<std::string, ParameterHandlerGeneric *>(),
420 "This should never be called directly as SampleHandlerBase is an abstract base class. \n\
421 However when creating a derived class, in the __init__() method, you should call the parent constructor i.e. this one by doing:: \n\
423 \tsuper(<your derived SampleHandler class>, self).__init__(*args) \n\
425 py::arg(
"mc_version"), py::arg(
"xsec_cov"))
431 py::arg(
"data_array"),
432 "Set the data for your sample handler (assumes the binning is the same as your MC!)"
442 "Get the title for a given sample"
448 "Returns the contents of the MC histogram as a flat list"
455 "Returns the contents of the MC histogram as a flat list"
462 "Returns the contents of the W2 histogram as a flat list"
469 auto hist_original =
M3::Clone(
self.GetDataHist(sample));
474 py::arg(
"Dimension"),
475 "Get Data histogram as numpy arrays.\n"
476 "For 1D: Returns (contents, edges)\n"
477 "For 2D: Returns (contents, edgesX, edgesY)\n"
478 "where contents is shape (nbinsY, nbinsX) for 2D")
484 auto hist_original =
M3::Clone(
self.GetW2Hist(sample));
492 "Get W2 histogram as numpy arrays.\n"
493 "For 1D: Returns (contents, edges)\n"
494 "For 2D: Returns (contents, edgesX, edgesY)\n"
495 "where contents is shape (nbinsY, nbinsX) for 2D")
499 const std::string& ProjectionVarX,
500 const std::string& ProjectionVarY=
"",
501 const std::vector<KinematicCut> &EventSelectionVec = {},
503 const std::vector< KinematicCut >& SubEventSelectionVec = {})
505 py::array_t<M3::float_t> edgesY, edgesX, contents;
506 std::unique_ptr<TH1> hist;
508 if(ProjectionVarY==
""){
509 hist =
self.Get1DVarHist(iSample,
513 SubEventSelectionVec);
515 hist =
self.Get2DVarHist(iSample,
520 SubEventSelectionVec);
528 py::class_<KinematicCut>(m_samples,
"KinematicCut")
529 .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.
auto GetMCArray() const
Return array storing MC entries for every bin.
auto GetW2Array() const
Return array storing W2 entries for every bin.
std::string GetSampleTitle(const int iSample) const final
Get fancy title for specified samples.
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.