The unit test case for the AllParticleCombiner
Definition at line 15 of file allparticlecombiner.py.
◆ testCombination()
def testCombination |
( |
|
self | ) |
|
Run the test fit
Definition at line 18 of file allparticlecombiner.py.
18 def testCombination(self):
19 """Run the test fit"""
21 testFile = tempfile.NamedTemporaryFile()
26 basf2.set_random_seed(
"1234")
27 main = basf2.create_path()
29 'analysis/tests/mdst.root', py_case=self)
32 inputFileNames=[inputfile],
33 logLevel=basf2.LogLevel.ERROR)
35 ma.fillParticleList(
'pi+:fromPV',
'dr < 2 and abs(dz) < 5', path=main)
37 ma.variablesToExtraInfo(
'pi+:fromPV', {
'medianValueInList(pi+:fromPV, dz)':
'medianDZ'}, path=main)
38 variables.addAlias(
'medianDzFromPV',
'extraInfo(medianDZ)')
39 variables.addAlias(
'dzFromMedianDz',
'formula(dz - medianDzFromPV)')
40 ma.applyCuts(
'pi+:fromPV',
'abs(dzFromMedianDz) < 0.05', path=main)
42 ma.combineAllParticles([
'pi+:fromPV'],
'vpho:PVFit', path=main)
44 kFit(
'vpho:PVFit', conf_level=-1, fit_type=
'vertex', constraint=
'iptube', path=main)
46 variables.addAlias(
'PVX',
'x')
47 variables.addAlias(
'PVY',
'y')
48 variables.addAlias(
'PVZ',
'z')
49 variables.addAlias(
'nGoodTracksFromPV',
'nParticlesInList(pi+:fromPV)')
53 particleList=
'vpho:PVFit',
54 fileName=testFile.name,
63 ma.summaryOfLists([
'vpho:PVFit'], path=main)
67 ntuplefile = TFile(testFile.name)
68 ntuple = ntuplefile.Get(
'ntuple')
70 self.assertFalse(ntuple.GetEntries() == 0,
"Ntuple is empty.")
72 converged = ntuple.GetEntries(
"chiProb > 0")
74 self.assertFalse(converged == 0,
"No fit converged.")
76 print(
"Test passed, cleaning up.")
The documentation for this class was generated from the following file: