14 import modularAnalysis
as ma
17 main = basf2.create_path()
21 kaons = (
'K-',
'kaonID > 0.05')
22 pions = (
'pi+',
'pionID > 0.05')
23 photons = (
'gamma',
'')
24 ma.fillParticleLists([kaons, pions, photons], path=main)
26 ma.reconstructDecay(
'pi0 -> gamma gamma',
'0.11 < M < 0.15', 0, path=main)
27 ma.reconstructDecay(
'D0 -> K- pi+ pi0',
'1.7 < M < 1.9', 0, path=main)
29 output = basf2.register_module(
'RootOutput')
30 output.param(
'outputFileName',
'removeparticlesnotinlists_full.root')
31 main.add_module(output)
33 ma.summaryOfLists([
'D0'], path=main)
35 ma.removeParticlesNotInLists([
'D0'], path=main)
37 ma.matchMCTruth(
'D0', path=main)
38 ma.matchMCTruth(
'pi0', path=main)
41 ntupler = basf2.register_module(
'VariablesToNtuple')
42 ntupler.param(
'fileName',
'removeparticlesnotinlists_D0ntuple.root')
43 ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'daughter(2, M)',
'mcPDG'])
44 ntupler.param(
'particleList',
'D0')
45 main.add_module(ntupler)
48 ntupler = basf2.register_module(
'VariablesToNtuple')
49 ntupler.param(
'fileName',
'removeparticlesnotinlists_pi0ntuple.root')
50 ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'mcPDG'])
51 ntupler.param(
'particleList',
'pi0')
52 main.add_module(ntupler)
54 output = basf2.register_module(
'RootOutput')
55 output.param(
'outputFileName',
'removeparticlesnotinlists_reduced.root')
56 main.add_module(output)
61 statfull = os.stat(
'removeparticlesnotinlists_full.root').st_size
62 statreduced = os.stat(
'removeparticlesnotinlists_reduced.root').st_size
63 basf2.B2RESULT(
"original size (kB): " + str(statfull / 1024))
64 basf2.B2RESULT(
"reduced size (kB): " + str(statreduced / 1024))
65 if statfull <= statreduced:
66 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)