13import modularAnalysis
as ma
16main = basf2.create_path()
20kaons = (
'K-',
'kaonID > 0.05')
21pions = (
'pi+',
'pionID > 0.05')
22photons = (
'gamma',
'')
23ma.fillParticleLists([kaons, pions, photons], path=main)
25ma.reconstructDecay(
'pi0 -> gamma gamma',
'0.11 < M < 0.15', 0, path=main)
26ma.reconstructDecay(
'D0 -> K- pi+ pi0',
'1.7 < M < 1.9', 0, path=main)
28output = basf2.register_module(
'RootOutput')
29output.param(
'outputFileName',
'removeparticlesnotinlists_full.root')
30main.add_module(output)
32ma.summaryOfLists([
'D0'], path=main)
34ma.removeParticlesNotInLists([
'D0'], path=main)
36ma.matchMCTruth(
'D0', path=main)
37ma.matchMCTruth(
'pi0', path=main)
40ntupler = basf2.register_module(
'VariablesToNtuple')
41ntupler.param(
'fileName',
'removeparticlesnotinlists_D0ntuple.root')
42ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'daughter(2, M)',
'mcPDG'])
43ntupler.param(
'particleList',
'D0')
44main.add_module(ntupler)
47ntupler = basf2.register_module(
'VariablesToNtuple')
48ntupler.param(
'fileName',
'removeparticlesnotinlists_pi0ntuple.root')
49ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'mcPDG'])
50ntupler.param(
'particleList',
'pi0')
51main.add_module(ntupler)
53output = basf2.register_module(
'RootOutput')
54output.param(
'outputFileName',
'removeparticlesnotinlists_reduced.root')
55main.add_module(output)
60 statfull = os.stat(
'removeparticlesnotinlists_full.root').st_size
61 statreduced = os.stat(
'removeparticlesnotinlists_reduced.root').st_size
62 basf2.B2RESULT(
"original size (kB): " + str(statfull / 1024))
63 basf2.B2RESULT(
"reduced size (kB): " + str(statreduced / 1024))
64 if statfull <= statreduced:
65 basf2.B2FATAL(
"Reduced file is not smaller than original")
def require_file(filename, data_type="", py_case=None)
def clean_working_directory()
def safe_process(*args, **kwargs)