196 {
197
198 auto m_samples = m.def_submodule("samples");
199 m_samples.doc() =
200 "This is a Python binding of MaCh3s C++ based samples library.";
201
202
203 py::enum_<TestStatistic>(m_samples, "TestStatistic")
210
212 .def(py::init())
213
214 .def(
215 "reweight",
217 "reweight the MC events in this sample. You will need to override this."
218 )
219
220 .def(
221 "get_likelihood",
223 "Get the sample likelihood at the current point in your model space. You will need to override this."
224 )
225
226 .def(
227 "set_test_stat",
229 "Set the test statistic that should be used when calculating likelihoods. \n\
230 :param test_stat: The new test statistic to use",
231 py::arg("test_stat")
232 )
233
234 .def(
235 "get_bin_LLH",
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}",
241 py::arg("data"),
242 py::arg("mc"),
243 py::arg("w2")
244 )
245 ;
246
248 .def(
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\
252 \n\
253 \tsuper(<your derived SampleHandler class>, self).__init__(*args) \n\
254 \n ",
255 py::arg("mc_version"),
256 py::arg("xsec_cov")
257 )
258 ;
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288}
@ 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 ...
As SampleHandlerFD is an abstract base class we have to do some gymnastics to get it to get it into p...
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...
virtual void Reweight()=0
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...
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.