Belle II Software  release-08-01-10
trgcdctsstream.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import basf2 as b2
13 import os
14 
15 # suppress messages and warnings during processing:
16 # set_log_level(LogLevel.ERROR)
17 basf2datadir = os.path.join(os.environ.get('BELLE2_LOCAL_DIR', None), 'data')
18 
19 # Register modules
20 particlegun = b2.register_module('ParticleGun')
21 # particlegun.param('randomSeed', 3452346)
22 # particlegun.param('randomSeed', 345)
23 particlegun.param('randomSeed', 346)
24 # The particle we are shooting
25 particlegun.param('pdgCodes', [11])
26 particlegun.param('nTracks', 1)
27 particlegun.param('momentumGeneration', 'uniformPt')
28 # particlegun.param('momentumGeneration', 'uniform')
29 particlegun.param('momentumParams', [1.0, 1.0])
30 particlegun.param('thetaGeneration', 'uniform')
31 # particlegun.param('thetaParams', [35, 127])
32 particlegun.param('thetaParams', [45, 45])
33 particlegun.param('phiGeneration', 'uniform')
34 particlegun.param('phiParams', [0, 360])
35 particlegun.param('vertexGeneration', 'fixed')
36 particlegun.param('vertexGeneration', 'normal')
37 particlegun.param('xVertexParams', [0, 0.0])
38 particlegun.param('yVertexParams', [0, 0.0])
39 particlegun.param('zVertexParams', [0, 0.0])
40 
41 # Register modules
42 eventinfosetter = b2.register_module('EventInfoSetter')
43 eventinfoprinter = b2.register_module('Progress')
44 # eventinfoprinter = fw.register_module("EventInfoPrinter")
45 paramloader = b2.register_module('Gearbox')
46 geobuilder = b2.register_module('Geometry')
47 # geobuilder.log_level = LogLevel.INFO
48 g4sim = b2.register_module('FullSim')
49 cdcdigitizer = b2.register_module('CDCDigitizer')
50 out = b2.register_module('SimpleOutput')
51 cdctrg = b2.register_module("TRGCDC")
52 tsstream = b2.register_module("TRGCDCTSStream")
53 # mcparticle = fw.register_module('PrintMCParticles')
54 
55 # ...EventInfoSetter...
56 eventinfosetter.param({'EvtNumList': [10], 'RunList': [1]})
57 
58 # ...CDC Trigger...
59 cdctrg.param('ConfigFile',
60  os.path.join(basf2datadir,
61  "trg/TRGCDCConfig_0_20101111_1051.dat"))
62 cdctrg.param('DebugLevel', 0)
63 cdctrg.param('CurlBackStop', 1)
64 cdctrg.param('HoughFinderPerfect', 1)
65 
66 # ...CDC Trigger TS Stream...
67 tsstream.param('DebugLevel', 2)
68 tsstream.param('Mode', 0)
69 tsstream.param('OutputStreamFile', "TRGCDCTSStream.dat")
70 
71 
72 # set mcprinter
73 mcparticleprinter = b2.register_module('PrintMCParticles')
74 mcparticleprinter.param('maxLevel', -1)
75 
76 # set geometry(geobuilder)
77 geobuilder.param('Components', ['MagneticField', 'CDC'
78  ])
79 
80 # set digitizer to no smearing
81 param_cdcdigi = {'Fraction': 1, 'Resolution1': 0.00, 'Resolution2': 0.0}
82 cdcdigitizer.param(param_cdcdigi)
83 
84 # Create paths
85 main = b2.create_path()
86 
87 # Add modules to paths
88 main.add_module(eventinfosetter)
89 main.add_module(eventinfoprinter)
90 main.add_module(paramloader)
91 main.add_module(geobuilder)
92 main.add_module(particlegun)
93 main.add_module(mcparticleprinter)
94 main.add_module(g4sim)
95 main.add_module(cdcdigitizer)
96 main.add_module(cdctrg)
97 main.add_module(tsstream)
98 # main.add_module(out)
99 
100 # Process events
101 b2.process(main)
102 
103 # Print call statistics
104 print(b2.statistics)