Belle II Software
development
2_recoTest.py
1
#!/usr/bin/env python3
2
3
10
11
"""
12
<header>
13
<output>TOPNtupleRecoTest.root</output>
14
<contact>marko.staric
@ijs.si
</contact>
15
<description>Makes a flat ntuple
for
validation of top reconstruction </description>
16
</header>
17
"""
18
19
import basf2 as b2
20
21
# ---------------------------------------------------------------------------------
22
# Simulate, reconstruct and make a flat ntuple for validation of top reconstruction
23
# Here we just want to test intrinsic TOP PID (no other material and ideal tracks)
24
# ---------------------------------------------------------------------------------
25
26
# Suppress messages and warnings during processing:
27
b2.set_log_level(b2.LogLevel.ERROR)
28
29
b2.set_random_seed(123452)
30
31
# Create path
32
main = b2.create_path()
33
34
# Set number of events to generate
35
eventinfosetter = b2.register_module('EventInfoSetter')
36
eventinfosetter.param('evtNumList', [10000])
37
main.add_module(eventinfosetter)
38
39
# Gearbox: access to database (xml files)
40
gearbox = b2.register_module('Gearbox')
41
main.add_module(gearbox)
42
43
# Geometry (only TOP and B-field, since we are testing intrinsic TOP PID)
44
geometry = b2.register_module('Geometry')
45
geometry.param('useDB', False)
46
geometry.param('components', ['MagneticField', 'TOP'])
47
main.add_module(geometry)
48
49
# Particle gun: generate multiple tracks
50
particlegun = b2.register_module('ParticleGun')
51
particlegun.param('pdgCodes', [211, -211, 321, -321])
52
particlegun.param('nTracks', 1)
53
particlegun.param('varyNTracks', False)
54
particlegun.param('momentumGeneration', 'fixed')
55
particlegun.param('momentumParams', [3])
56
particlegun.param('thetaGeneration', 'uniformCos')
57
particlegun.param('thetaParams', [30, 122])
58
particlegun.param('phiGeneration', 'uniform')
59
particlegun.param('phiParams', [0, 360])
60
particlegun.param('vertexGeneration', 'fixed')
61
particlegun.param('xVertexParams', [0])
62
particlegun.param('yVertexParams', [0])
63
particlegun.param('zVertexParams', [0])
64
main.add_module(particlegun)
65
66
# Simulation
67
simulation = b2.register_module('FullSim')
68
main.add_module(simulation)
69
70
# TOP digitization
71
topdigi = b2.register_module('TOPDigitizer')
72
main.add_module(topdigi)
73
74
# Dedicated track maker using MC information only
75
trackmaker = b2.register_module('TOPMCTrackMaker')
76
main.add_module(trackmaker)
77
78
# Channel masker
79
main.add_module('TOPChannelMasker')
80
81
# TOP reconstruction
82
topreco = b2.register_module('TOPReconstructor')
83
main.add_module(topreco)
84
85
# Output: make flat ntuple from TOPLikelihoods, tracking info and MC truth
86
output = b2.register_module('TOPNtuple')
87
output.param('outputFileName', '../TOPNtupleRecoTest.root')
88
main.add_module(output)
89
90
# Show progress of processing
91
main.add_module('Progress')
92
93
# Process events
94
b2.process(main)
95
96
# Print call statistics
97
print(b2.statistics)
top
validation
2_recoTest.py
Generated on Tue Nov 12 2024 02:42:55 for Belle II Software by
1.9.6