Belle II Software  release-08-01-10
CDCTrigger.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import basf2
13 from cdctrigger import add_cdc_trigger
14 
15 """
16 generate tracks with particle gun, simulate CDC and CDC trigger, save the output.
17 """
18 
19 # ------------ #
20 # user options #
21 # ------------ #
22 
23 # general options
24 seed = 10000
25 evtnum = 100
26 particlegun_params = {
27  'pdgCodes': [-13, 13],
28  'nTracks': 2,
29  'momentumGeneration': 'inversePt',
30  'momentumParams': [0.3, 10.],
31  'thetaGeneration': 'uniform',
32  'thetaParams': [35, 123],
33  'phiGeneration': 'uniform',
34  'phiParams': [0, 360],
35  'vertexGeneration': 'uniform',
36  'xVertexParams': [0, 0.0],
37  'yVertexParams': [0, 0.0],
38  'zVertexParams': [-50.0, 50.0]}
39 
40 # ------------------------- #
41 # create path up to trigger #
42 # ------------------------- #
43 
44 # set random seed
45 basf2.set_random_seed(seed)
46 # suppress messages and warnings during processing:
47 basf2.set_log_level(basf2.LogLevel.ERROR)
48 
49 main = basf2.create_path()
50 
51 main.add_module('EventInfoSetter', evtNumList=evtnum)
52 main.add_module('Progress')
53 main.add_module('Gearbox')
54 main.add_module('Geometry', components=['BeamPipe',
55  'PXD', 'SVD', 'CDC',
56  'MagneticFieldConstant4LimitedRCDC'])
57 particlegun = basf2.register_module('ParticleGun')
58 particlegun.param(particlegun_params)
59 main.add_module(particlegun)
60 main.add_module('FullSim')
61 main.add_module('CDCDigitizer')
62 
63 # ---------------------- #
64 # CDC trigger and output #
65 # ---------------------- #
66 
67 add_cdc_trigger(main)
68 main.add_module('RootOutput', outputFileName='cdctrigger.root')
69 
70 # Process events
71 basf2.process(main)
72 
73 # Print call statistics
74 print(basf2.statistics)