12from ROOT
import Belle2
13from math
import pi, tan
15from subprocess
import call
23 lib_source =
'/home/belle2/tasheng/tsim/'
24 rdi_path =
'/home/belle2/tasheng/Vivado_2017.2/lib/lnx64.o'
26 lib_source =
'/home/trgadmin/tsim/'
27 rdi_path =
'/home/trgadmin/Xilinx/Vivado/2017.2/lib/lnx64.o'
33if rdi_path
not in os.environ[
'LD_LIBRARY_PATH']:
34 print(
'please set environment variable first! do either')
35 print(
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:' + rdi_path)
37 print(
'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:' + rdi_path)
41for link
in [
'xsim.dir',
'innerLRLUT.mif',
'outerLRLUT.mif']:
42 if link
not in os.listdir(os.getcwd()):
43 call([
'ln',
'-s', lib_source + link])
46generate tracks with particle gun, simulate CDC and CDC trigger, save the output.
57 particlegun_params = {
58 'pdgCodes': [-13, 13],
60 'momentumGeneration':
'inversePt',
62 'momentumParams': [3., 10.],
63 'thetaGeneration':
'uniform',
65 'thetaParams': [80, 100],
66 'phiGeneration':
'uniform',
67 'phiParams': [46, 135],
68 'vertexGeneration':
'uniform',
69 'xVertexParams': [0, 0.0],
70 'yVertexParams': [0, 0.0],
72 'zVertexParams': [-10., 10.]}
79 b2.set_random_seed(seed)
83main = b2.create_path()
85empty_path = b2.create_path()
88z_SL0 = [-31 - 1.5 / tan(30 / 180. * pi), 57 + 1.5 / tan(17 / 180. * pi)]
95 Reject tracks with bad combination of z0
and theta
100 Initialize self.mc with MCParticles StoreArray
107 Reject tracks with bad combination of z0
and theta
110 z0 = self.mc[0].getVertex().Z()
111 vec = self.mc[0].getMomentum()
113 if z_SL0[0] < z0 + r_SL0 / vec.Pt() * vec.Z() < z_SL0[1]:
117main.add_module(
'Progress')
120 inputName =
'tsfout.root'
122 main.add_module(
'RootInput', inputFileName=inputName)
125 main.add_module(
'EventInfoSetter', evtNumList=evtnum)
126 main.add_module(
'Gearbox')
127 main.add_module(
'Geometry', components=[
'BeamPipe',
129 'MagneticFieldConstant4LimitedRCDC'])
130 particlegun = b2.register_module(
'ParticleGun')
131 particlegun.param(particlegun_params)
132 main.add_module(particlegun)
136 main.add_module(skim)
137 skim.if_false(empty_path)
139 main.add_module(
'FullSim')
140 main.add_module(
'CDCDigitizer')
151 firmtsf = b2.register_module(
'CDCTriggerTSFFirmware')
155 main.add_module(firmtsf)
161firm2d = b2.register_module(
'CDCTrigger2DFinderFirmware')
162firm2d.logging.log_level = b2.LogLevel.DEBUG
163firm2d.logging.debug_level = 20
164firm2d.logging.set_info(b2.LogLevel.DEBUG, b2.LogInfo.LEVEL | b2.LogInfo.MESSAGE)
165firm2d.param(
'nClocks', 32)
166main.add_module(firm2d)
169 main.add_module(
'RootOutput', outputFileName=
'tsfout.root')
A (simplified) python wrapper for StoreArray.
mc
MCParticles StoreArray.