Belle II Software  light-2212-foldex
TestNewMCDecayFinder Class Reference
Inheritance diagram for TestNewMCDecayFinder:
Collaboration diagram for TestNewMCDecayFinder:

Public Member Functions

def testReconstructMCDecay (self)
 
def testMCDecayFinder (self)
 

Detailed Description

The unit test

Definition at line 19 of file test_reconstructmcdecay.py.

Member Function Documentation

◆ testMCDecayFinder()

def testMCDecayFinder (   self)
Reconstruct/search for an MC decay chain using the findMCDecay tool.

Definition at line 70 of file test_reconstructmcdecay.py.

70  def testMCDecayFinder(self):
71  """Reconstruct/search for an MC decay chain using the findMCDecay tool."""
72 
73  testFile = tempfile.NamedTemporaryFile()
74 
75  main = create_path()
76 
77  inputfile = b2test_utils.require_file(
78  'analysis/1000_B_DstD0Kpi_skimmed.root', 'validation', py_case=self)
79  inputMdst(inputfile, path=main)
80 
81  findMCDecay(
82  'B0:DstD0Kpi',
83  'B0 =direct=> [D*+ =direct=> [D0 =direct=> K- pi+ ] pi+] pi-',
84  path=main)
85 
86  ntupler = register_module('VariablesToNtuple')
87  ntupler.param('fileName', testFile.name)
88  ntupler.param('variables', ['isSignal'])
89  ntupler.param('particleList', 'B0:DstD0Kpi')
90  main.add_module(ntupler)
91 
93 
94  ntuplefile = TFile(testFile.name)
95  ntuple = ntuplefile.Get('ntuple')
96 
97  self.assertFalse(ntuple.GetEntries() == 0, "Ntuple is empty.")
98 
99  allBkg = ntuple.GetEntries("isSignal == 0")
100  allSig = ntuple.GetEntries("isSignal > 0")
101 
102  print(f"True candidates {allSig}")
103  print(f"False candidates {allBkg}")
104 
105  sig_expected = 406
106 
107  self.assertTrue(
108  allSig == sig_expected,
109  f"n_sig expected: {sig_expected} found: {sig_expected}.")
110  self.assertTrue(allBkg == 0, f"n_bkg expected 0, found: {allBkg}.")
111 
112  print("Test passed, cleaning up.")
113 
114 
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:54
def safe_process(*args, **kwargs)
Definition: __init__.py:233

◆ testReconstructMCDecay()

def testReconstructMCDecay (   self)
Reconstruct/search for an MC decay chain using the reconstructMCDecay tool.

Definition at line 22 of file test_reconstructmcdecay.py.


The documentation for this class was generated from the following file: