The unit test
Definition at line 14 of file test_mbc_cut_eff.py.
◆ testMbcEff()
Reconstruct stuff with tight Mbc cut.
Definition at line 17 of file test_mbc_cut_eff.py.
18 """Reconstruct stuff with tight Mbc cut."""
20 testFile = tempfile.NamedTemporaryFile()
22 main = basf2.create_path()
25 'analysis/1000_B_DstD0Kpi_skimmed.root',
'validation', py_case=self)
26 ma.inputMdst(
'default', inputfile, path=main)
28 ma.fillParticleList(
'pi+:a',
'pidProbabilityExpert(211, ALL) > 0.5', path=main)
29 ma.fillParticleList(
'K+:a',
'pidProbabilityExpert(321, ALL) > 0.5', path=main)
31 ma.reconstructDecay(
'D0:rec -> K-:a pi+:a',
'', 0, path=main)
32 ma.reconstructDecay(
'D*+:rec -> D0:rec pi+:a',
'', 0, path=main)
33 ma.reconstructDecay(
'B0:rec -> D*+:rec pi-:a',
' InvM > 5.27', 0, path=main)
34 ma.matchMCTruth(
'B0:rec', path=main)
36 ntupler = basf2.register_module(
'VariablesToNtuple')
37 ntupler.param(
'fileName', testFile.name)
38 ntupler.param(
'variables', [
'isSignal'])
39 ntupler.param(
'particleList',
'B0:rec')
40 main.add_module(ntupler)
44 ntuplefile = TFile(testFile.name)
45 ntuple = ntuplefile.Get(
'ntuple')
47 self.assertFalse(ntuple.GetEntries() == 0,
"Ntuple is empty.")
49 allBkg = ntuple.GetEntries(
"isSignal == 0")
50 allSig = ntuple.GetEntries(
"isSignal > 0")
52 print(
"True candidates {0}".format(allSig))
53 print(
"False candidates {0}".format(allBkg))
59 allSig == sig_expected,
60 f
"Mbc cut efficency has changed! n_sig expected: {sig_expected} found: {allSig}.")
61 self.assertTrue(allBkg == bkg_expected, f
"Mbc cut background has changed! n_bkg expected: {bkg_expected} found: {allBkg}.")
63 print(
"Test passed, cleaning up.")
The documentation for this class was generated from the following file: