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