Belle II Software development
SVDReconstructionWithNN.py
1#!/usr/bin/env python3
2
3
10
11
17
18import basf2 as b2
19from svd.dump_digits import dump_digits
20from svd.dump_clusters import dump_clusters
21
22# show warnings during processing
23b2.set_log_level(b2.LogLevel.WARNING)
24
25# Register modules
26
27# Particle gun module
28particlegun = b2.register_module('ParticleGun')
29# Create Event information
30eventinfosetter = b2.register_module('EventInfoSetter')
31# Show progress of processing
32progress = b2.register_module('Progress')
33# Load parameters
34gearbox = b2.register_module('Gearbox')
35# Create geometry
36geometry = b2.register_module('Geometry')
37# Run simulation
38simulation = b2.register_module('FullSim')
39# Add the PXD digitizer, too, to avoid problems with empty events.
40PXDDIGI = b2.register_module('PXDDigitizer')
41# SVD digitization module
42SVDDIGI = b2.register_module('SVDDigitizer')
43SVDDIGI.param('StartSampling', -31.44)
44SVDDIGI.param('GenerateShaperDigits', True)
45# SVDDIGI.param('signalsList', 'SVDSignalsList.csv')
46# SVDDIGI.param('RandomizeEventTimes', True)
47# SVDDIGI.param('TimeFrameLow', -180)
48# SVDDIGI.param('TimeFrameHigh', 150)
49# SVD signal reconstructor
50SVDSIGR = b2.register_module('SVDNNShapeReconstructor')
51# Write RecoDigits so that we can check them
52SVDSIGR.param('WriteRecoDigits', True)
53# RecoDigit clusterizer
54SVDCLUST1 = b2.register_module('SVDNNClusterizer')
55# ShaperDigit clusterizer
56SVDCLUST2 = b2.register_module("SVDClusterizerDirect")
57# Save output of simulation
58output = b2.register_module('RootOutput')
59
60# ============================================================================
61# Set a fixed random seed for particle generation:
62b2.set_random_seed(1028307)
63
64# ============================================================================
65# Setting the list of particle codes (PDG codes) for the generated particles
66particlegun.param('pdgCodes', [-11, 11])
67
68# ============================================================================
69# Setting the number of tracks to be generated per event:
70particlegun.param('nTracks', 1)
71
72# Set the number of events to be processed (100 events)
73eventinfosetter.param({'evtNumList': [1000], 'expList': [0], 'runList': [0]})
74
75# Set output filename
76output.param('outputFileName', 'SVDTestOutput.root')
77
78# Select subdetectors to be built
79# geometry.param('Components', ['PXD','SVD'])
80geometry.param('components', ['MagneticField', 'PXD', 'SVD'])
81
82# ============================================================================
83# Do the simulation
84
85main = b2.create_path()
86main.add_module(eventinfosetter)
87main.add_module(progress)
88main.add_module(gearbox)
89main.add_module(geometry)
90main.add_module(particlegun)
91main.add_module(simulation)
92main.add_module(PXDDIGI)
93main.add_module(SVDDIGI)
94main.add_module(SVDSIGR)
95main.add_module(dump_digits())
96main.add_module(SVDCLUST2)
97main.add_module(dump_clusters())
98main.add_module(output)
99
100# Process events
101b2.process(main)
102
103# Print call statistics
104print(b2.statistics)