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