16basf2.set_log_level(basf2.LogLevel.INFO)
19eventinfosetter = basf2.register_module(
'EventInfoSetter')
20eventinfosetter.param(
'evtNumList', [200])
23particlegun = basf2.register_module(
'ParticleGun')
24particlegun.param(
'nTracks', 1)
25particlegun.param(
'pdgCodes', [13, -13])
26particlegun.param(
'momentumGeneration',
'uniform')
27particlegun.param(
'momentumParams', [1, 3])
28particlegun.param(
'thetaGeneration',
'uniform')
29particlegun.param(
'thetaParams', [17, 150])
30particlegun.param(
'phiGeneration',
'uniform')
31particlegun.param(
'phiParams', [0, 360])
34paramloader = basf2.register_module(
'Gearbox')
37geobuilder = basf2.register_module(
'Geometry')
38geobuilder.param(
'components', [
'KLM'])
39geobuilder.param(
'useDB',
False)
42g4sim = basf2.register_module(
'FullSim')
45klm_digitizer = basf2.register_module(
'KLMDigitizer')
48klm_packer = basf2.register_module(
'KLMPacker')
51klm_unpacker = basf2.register_module(
'KLMUnpacker')
52klm_unpacker.param(
'outputKLMDigitsName',
'KLMDigitsUnpacked')
55klm_reconstructor = basf2.register_module(
'KLMReconstructor')
58output = basf2.register_module(
'RootOutput')
59output.param(
'outputFileName',
'ParticleGunMuonsKLM.root')
62main = basf2.create_path()
65main.add_module(eventinfosetter)
66main.add_module(particlegun)
67main.add_module(paramloader)
68main.add_module(geobuilder)
71main.add_module(klm_digitizer)
72main.add_module(klm_packer)
73main.add_module(klm_unpacker)
74main.add_module(klm_reconstructor)
76main.add_module(output)
80print(basf2.statistics)
83root_file = ROOT.TFile(
'ParticleGunMuonsKLM.root')
84tree = root_file.Get(
'tree')
85events = tree.GetEntriesFast()
86print(f
'Events: {int(events)}')
87for branch
in tree.GetListOfBranches():
88 name = branch.GetName()
89 if name.startswith(
'Raw'):
90 size = branch.GetTotBytes(
'*') * 1.0
91 zipsize = branch.GetZipBytes(
'*') * 1.0
92 print(f
"{name} {size / 1024.0 / events:.2f} ({zipsize / 1024.0 / events:.2f})")