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