The unit test case for the AllParticleCombiner
Definition at line 21 of file allparticlecombiner.py.
◆ testCombination()
def testCombination |
( |
|
self | ) |
|
Run the test fit
Definition at line 24 of file allparticlecombiner.py.
24 def testCombination(self):
25 """Run the test fit"""
27 testFile = tempfile.NamedTemporaryFile()
32 basf2.set_random_seed(
"1234")
33 main = basf2.create_path()
35 'analysis/tests/mdst.root', py_case=self)
38 inputFileNames=[inputfile],
39 logLevel=basf2.LogLevel.ERROR)
41 ma.fillParticleList(
'pi+:fromPV',
'dr < 2 and abs(dz) < 5', path=main)
43 ma.variablesToExtraInfo(
'pi+:fromPV', {
'medianValueInList(pi+:fromPV, dz)':
'medianDZ'}, path=main)
44 variables.addAlias(
'medianDzFromPV',
'extraInfo(medianDZ)')
45 variables.addAlias(
'dzFromMedianDz',
'formula(dz - medianDzFromPV)')
46 ma.applyCuts(
'pi+:fromPV',
'abs(dzFromMedianDz) < 0.05', path=main)
48 ma.combineAllParticles([
'pi+:fromPV'],
'vpho:PVFit', path=main)
50 kFit(
'vpho:PVFit', conf_level=-1, fit_type=
'vertex', constraint=
'iptube', path=main)
52 variables.addAlias(
'PVX',
'x')
53 variables.addAlias(
'PVY',
'y')
54 variables.addAlias(
'PVZ',
'z')
55 variables.addAlias(
'nGoodTracksFromPV',
'nParticlesInList(pi+:fromPV)')
59 particleList=
'vpho:PVFit',
60 fileName=testFile.name,
69 ma.summaryOfLists([
'vpho:PVFit'], path=main)
73 ntuplefile = TFile(testFile.name)
74 ntuple = ntuplefile.Get(
'ntuple')
76 self.assertFalse(ntuple.GetEntries() == 0,
"Ntuple is empty.")
78 converged = ntuple.GetEntries(
"chiProb > 0")
80 self.assertFalse(converged == 0,
"No fit converged.")
82 print(
"Test passed, cleaning up.")
def configure_logging_for_tests(user_replacements=None)
def require_file(filename, data_type="", py_case=None)
The documentation for this class was generated from the following file: