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