The unit test for ParticleExtractorFromROE module
Definition at line 20 of file test_particleExtractorFromROE.py.
◆ test_mainpath()
def test_mainpath |
( |
|
self | ) |
|
Test the extractParticlesFromROE function in main path
Definition at line 85 of file test_particleExtractorFromROE.py.
85 def test_mainpath(self):
86 """ Test the extractParticlesFromROE function in main path """
88 testFile = tempfile.NamedTemporaryFile()
90 main = basf2.create_path()
93 ma.inputMdst(inputfile, path=main)
95 ma.fillParticleList(
'pi+:sig',
'pionID > 0.5', path=main)
97 ma.fillParticleList(
'gamma:all',
'', path=main)
98 ma.reconstructDecay(
'pi0:sig -> gamma:all gamma:all',
'0.125 < InvM < 0.145', path=main)
100 ma.reconstructDecay(
'B0:sig -> pi-:sig pi+:sig pi0:sig',
'', path=main)
102 ma.matchMCTruth(
'B0:sig', path=main)
103 ma.applyCuts(
'B0:sig',
'isSignal==1', path=main)
105 ma.buildRestOfEvent(
'B0:sig', fillWithMostLikely=
True, path=main)
107 plists = [
'%s:in_roe' % ptype
for ptype
in [
'pi+',
'gamma',
'K_L0',
'K+',
'p+',
'e+',
'mu+']]
108 ma.extractParticlesFromROE(plists, maskName=
'all', path=main, signalSideParticleList=
'B0:sig')
110 charged_inROE = [
'nParticlesInList(%s:in_roe)' % ptype
for ptype
in [
'pi+',
'K+',
'p+',
'e+',
'mu+']]
111 neutral_inROE = [
'nParticlesInList(%s:in_roe)' % ptype
for ptype
in [
'gamma',
'K_L0']]
113 default = [
'nParticlesInList(pi+:all)',
'nParticlesInList(gamma:all)',
'nParticlesInList(K_L0:roe_default)']
114 mostLikely = [
'nParticlesInList(%s:mostlikely_roe)' % ptype
for ptype
in [
'K+',
'p+',
'e+',
'mu+']]
116 ma.variablesToNtuple(
'B0:sig', charged_inROE + neutral_inROE + default + mostLikely,
117 filename=testFile.name,
122 ntuplefile = TFile(testFile.name)
123 ntuple = ntuplefile.Get(
'variables')
125 self.assertFalse(ntuple.GetEntries() == 0,
"Ntuple is empty.")
127 nEntries = ntuple.GetEntries()
132 nPass_chargedCheck = ntuple.GetEntries(cut)
133 self.assertFalse(nPass_chargedCheck < nEntries,
"Charged particles are not correctly extracted")
138 nPass_electronCheck = ntuple.GetEntries(cut)
139 self.assertFalse(nPass_electronCheck < nEntries,
"MostLikely option seems broken")
static std::string makeROOTCompatible(std::string str)
Remove special characters that ROOT dislikes in branch names, e.g.
def require_file(filename, data_type="", py_case=None)
◆ test_roepath()
The documentation for this class was generated from the following file: