6 from ROOT
import Belle2
7 import modularAnalysis
as ma
10 main = basf2.create_path()
14 kaons = (
'K-',
'kaonID > 0.05')
15 pions = (
'pi+',
'pionID > 0.05')
16 photons = (
'gamma',
'')
17 ma.fillParticleLists([kaons, pions, photons], path=main)
19 ma.reconstructDecay(
'pi0 -> gamma gamma',
'0.11 < M < 0.15', 0, path=main)
20 ma.reconstructDecay(
'D0 -> K- pi+ pi0',
'1.7 < M < 1.9', 0, path=main)
22 output = basf2.register_module(
'RootOutput')
23 output.param(
'outputFileName',
'removeparticlesnotinlists_full.root')
24 main.add_module(output)
26 ma.summaryOfLists([
'D0'], path=main)
28 ma.removeParticlesNotInLists([
'D0'], path=main)
30 ma.matchMCTruth(
'D0', path=main)
31 ma.matchMCTruth(
'pi0', path=main)
34 ntupler = basf2.register_module(
'VariablesToNtuple')
35 ntupler.param(
'fileName',
'removeparticlesnotinlists_D0ntuple.root')
36 ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'daughter(2, M)',
'mcPDG'])
37 ntupler.param(
'particleList',
'D0')
38 main.add_module(ntupler)
41 ntupler = basf2.register_module(
'VariablesToNtuple')
42 ntupler.param(
'fileName',
'removeparticlesnotinlists_pi0ntuple.root')
43 ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'mcPDG'])
44 ntupler.param(
'particleList',
'pi0')
45 main.add_module(ntupler)
47 output = basf2.register_module(
'RootOutput')
48 output.param(
'outputFileName',
'removeparticlesnotinlists_reduced.root')
49 main.add_module(output)
54 statfull = os.stat(
'removeparticlesnotinlists_full.root').st_size
55 statreduced = os.stat(
'removeparticlesnotinlists_reduced.root').st_size
56 basf2.B2RESULT(
"original size (kB): " + str(statfull / 1024))
57 basf2.B2RESULT(
"reduced size (kB): " + str(statreduced / 1024))
58 if statfull <= statreduced:
59 basf2.B2FATAL(
"Reduced file is not smaller than original")