The unit test
Definition at line 14 of file test_reconstructmcdecay.py.
◆ testNewMCDecayFinder()
def testNewMCDecayFinder |
( |
|
self | ) |
|
Reconstruct/search for an MC decay chain using the reconstructMCDecay tool.
Definition at line 17 of file test_reconstructmcdecay.py.
17 def testNewMCDecayFinder(self):
18 """Reconstruct/search for an MC decay chain using the reconstructMCDecay tool."""
20 testFile = tempfile.NamedTemporaryFile()
25 'analysis/1000_B_DstD0Kpi_skimmed.root',
'validation', py_case=self)
26 inputMdst(
'default', inputfile, path=main)
28 fillParticleListFromMC(
'gamma:MC',
'mcPrimary', path=main)
29 fillParticleListFromMC(
'K+:MC',
'mcPrimary', path=main)
30 fillParticleListFromMC(
'pi+:MC',
'mcPrimary', path=main)
33 'B0:DstD0Kpi =direct=> [D*+:MC =direct=> [D0:MC =direct=> K-:MC pi+:MC ] pi+:MC] pi-:MC',
37 ntupler = register_module(
'VariablesToNtuple')
38 ntupler.param(
'fileName', testFile.name)
39 ntupler.param(
'variables', [
'isSignal'])
40 ntupler.param(
'particleList',
'B0:DstD0Kpi')
41 main.add_module(ntupler)
45 ntuplefile = TFile(testFile.name)
46 ntuple = ntuplefile.Get(
'ntuple')
48 self.assertFalse(ntuple.GetEntries() == 0,
"Ntuple is empty.")
50 allBkg = ntuple.GetEntries(
"isSignal == 0")
51 allSig = ntuple.GetEntries(
"isSignal > 0")
53 print(
"True candidates {0}".format(allSig))
54 print(
"False candidates {0}".format(allBkg))
59 allSig == sig_expected,
60 f
"n_sig expected: {sig_expected} found: {sig_expected}.")
61 self.assertTrue(allBkg == 0, f
"n_bkg expected 0, found: {allBkg}.")
63 print(
"Test passed, cleaning up.")
The documentation for this class was generated from the following file: