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