13 import modularAnalysis
as ma
16 main = basf2.create_path()
20 kaons = (
'K-',
'kaonID > 0.05')
21 pions = (
'pi+',
'pionID > 0.05')
22 photons = (
'gamma',
'')
23 ma.fillParticleLists([kaons, pions, photons], path=main)
25 ma.reconstructDecay(
'pi0 -> gamma gamma',
'0.11 < M < 0.15', 0, path=main)
26 ma.reconstructDecay(
'D0 -> K- pi+ pi0',
'1.7 < M < 1.9', 0, path=main)
28 output = basf2.register_module(
'RootOutput')
29 output.param(
'outputFileName',
'removeparticlesnotinlists_full.root')
30 main.add_module(output)
32 ma.summaryOfLists([
'D0'], path=main)
34 ma.removeParticlesNotInLists([
'D0'], path=main)
36 ma.matchMCTruth(
'D0', path=main)
37 ma.matchMCTruth(
'pi0', path=main)
40 ntupler = basf2.register_module(
'VariablesToNtuple')
41 ntupler.param(
'fileName',
'removeparticlesnotinlists_D0ntuple.root')
42 ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'daughter(2, M)',
'mcPDG'])
43 ntupler.param(
'particleList',
'D0')
44 main.add_module(ntupler)
47 ntupler = basf2.register_module(
'VariablesToNtuple')
48 ntupler.param(
'fileName',
'removeparticlesnotinlists_pi0ntuple.root')
49 ntupler.param(
'variables', [
'M',
'daughter(0, M)',
'mcPDG'])
50 ntupler.param(
'particleList',
'pi0')
51 main.add_module(ntupler)
53 output = basf2.register_module(
'RootOutput')
54 output.param(
'outputFileName',
'removeparticlesnotinlists_reduced.root')
55 main.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)