Belle II Software  release-05-01-25
SVDChargeStudy.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 from basf2 import *
5 from SVDChargeSharing import SVDChargeSharing
6 logging.log_level = LogLevel.WARNING
7 
8 # Particle gun module
9 particlegun = register_module('ParticleGun')
10 # Create Event information
11 eventinfosetter = register_module('EventInfoSetter')
12 # Show progress of processing
13 progress = register_module('Progress')
14 # Load parameters
15 gearbox = register_module('Gearbox')
16 # Create geometry
17 geometry = register_module('Geometry')
18 # Run simulation
19 simulation = register_module('FullSim')
20 # SVD digitization module
21 svddigi = register_module('SVDDigitizer')
22 # SVD clustering module
23 svdclust = register_module('SVDClusterizer')
24 # RootOutput
25 output = register_module('RootOutput')
26 
27 analyze = SVDChargeSharing()
28 
29 # Specify number of events to generate
30 eventinfosetter.param('evtNumList', [100000])
31 
32 # Set parameters for particlegun
33 particlegun.param({
34  'nTracks': 1,
35  'pdgCodes': [211, -211, 11, -11],
36  'momentumGeneration': 'normal',
37  'momentumParams': [3, 0.2],
38  'phiGeneration': 'uniform',
39  'phiParams': [0, 360],
40  'thetaGeneration': 'uniform',
41  'thetaParams': [89, 91],
42  'vertexGeneration': 'normal',
43  'xVertexParams': [0.0, 0.1],
44  'yVertexParams': [0.0, 0.1],
45  'zVertexParams': [0.0, 5.0]
46 })
47 
48 # Override backplane capacitances in gearbox:
49 
50 factor = 2.0
51 
52 if (factor != 1.0):
53  base_params = {
54  'Barrel': {'U': 0.12, 'V': 0.39},
55  'Layer3': {'U': 0.08, 'V': 0.26},
56  'Slanted': {'U': 0.11, 'V': 0.42}
57  }
58 
59  gearbox.param({
60  "overridePrefix": "//DetectorComponent[@name='SVD']//Components/",
61  "override": [
62  (('Sensor' if sensor == 'Layer3' else 'SensorBase') +
63  '[@type=\"' + sensor + '\"]/Active/BackplaneCapacitance' + coordinate,
64  str(factor * value), 'pF')
65  for (sensor, vals) in base_params.items() for (coordinate, value) in vals.items()
66  ],
67  })
68 
69 # Select subdetectors to be built
70 geometry.param('components', ['SVD'])
71 
72 # svddigi.param('statisticsFilename', 'digi.root')
73 svddigi.param('ElectronicEffects', True)
74 
75 # create processing path
76 main = create_path()
77 main.add_module(eventinfosetter)
78 main.add_module(progress)
79 main.add_module(particlegun)
80 main.add_module(gearbox)
81 main.add_module(geometry)
82 main.add_module(simulation)
83 main.add_module(svddigi)
84 main.add_module(svdclust)
85 main.add_module(analyze)
86 
87 # generate events
88 process(main)
89 
90 # show call statistics
91 print(statistics)
SVDChargeSharing
Definition: SVDChargeSharing.py:1