6 from ROOT
import Belle2
7 from math
import pi, tan
10 from subprocess
import call
19 hostname = socket.gethostname()
20 if 'cc.kek.jp' in hostname:
21 lib_source =
'/home/belle2/tasheng/tsim/'
22 rdi_path =
'/home/belle2/tasheng/Vivado_2017.2/lib/lnx64.o'
23 elif 'btrgpc09' == hostname:
24 lib_source =
'/home/trgadmin/tsim/'
25 rdi_path =
'/home/trgadmin/Xilinx/Vivado/2017.2/lib/lnx64.o'
26 elif 'belle2' '= hostname':
27 lib_source =
'/home/ta/tsim/'
28 rdi_path =
'/home/ta/Vivado_2017.2/lib/lnx64.o'
35 if rdi_path
not in os.environ[
'LD_LIBRARY_PATH']:
36 print(
'please set environment variable first! do either')
37 print(
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:' + rdi_path)
39 print(
'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:' + rdi_path)
43 for link
in [
'xsim.dir',
'innerLRLUT.mif',
'outerLRLUT.mif']:
44 if link
not in os.listdir(os.getcwd()):
45 call([
'ln',
'-s', lib_source + link])
48 generate tracks with particle gun, simulate CDC and CDC trigger, save the output.
58 particlegun_params = {
59 'pdgCodes': [-13, 13],
61 'momentumGeneration':
'inversePt',
62 'momentumParams': [2., 10.],
63 'thetaGeneration':
'uniform',
64 'thetaParams': [35, 145],
65 'phiGeneration':
'uniform',
66 'phiParams': [46, 135],
67 'vertexGeneration':
'uniform',
68 'xVertexParams': [0, 0.0],
69 'yVertexParams': [0, 0.0],
70 'zVertexParams': [-10., 10.]}
76 if not environment.getNumberEventsOverride():
77 environment.setNumberEventsOverride(evtnum)
80 basf2.set_random_seed(seed)
84 main = basf2.create_path()
86 empty_path = basf2.create_path()
90 main.add_module(
'RootInput', inputFileName=
'/home/belle2/tasheng/gcr/cdc/cosmic.0001.03898.HLT1.f00007.root')
92 main.add_module(
'Progress')
95 main.add_module(
'EventInfoSetter', evtNumList=evtnum)
96 main.add_module(
'Gearbox')
97 main.add_module(
'Geometry', components=[
'BeamPipe',
99 'MagneticFieldConstant4LimitedRCDC'])
100 particlegun = basf2.register_module(
'ParticleGun')
101 particlegun.param(particlegun_params)
102 main.add_module(particlegun)
104 main.add_module(
'FullSim')
105 main.add_module(
'CDCDigitizer')
112 main.add_module(
'Gearbox')
113 main.add_module(
'Geometry', components=[
'BeamPipe',
115 'MagneticFieldConstant4LimitedRCDC'])
116 main.add_module(
'CDCTriggerTSF',
120 firmtsf = register_module(
'CDCTriggerTSFFirmware')
121 firmtsf.param(
'mergerOnly', merger_only)
122 firmtsf.logging.log_level = basf2.LogLevel.DEBUG
123 firmtsf.logging.debug_level = 10
124 firmtsf.logging.set_info(basf2.LogLevel.DEBUG, basf2.LogInfo.LEVEL | basf2.LogInfo.MESSAGE)
125 main.add_module(firmtsf)
136 main.add_module(
'RootOutput', outputFileName=
'tsfout.root')
142 print(basf2.statistics)