13 from ROOT
import Belle2
14 from math
import pi, tan
16 from subprocess
import call
24 lib_source =
'/home/belle2/tasheng/tsim/'
25 rdi_path =
'/home/belle2/tasheng/Vivado_2017.2/lib/lnx64.o'
27 lib_source =
'/home/trgadmin/tsim/'
28 rdi_path =
'/home/trgadmin/Xilinx/Vivado/2017.2/lib/lnx64.o'
34 if rdi_path
not in os.environ[
'LD_LIBRARY_PATH']:
35 print(
'please set environment variable first! do either')
36 print(
'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:' + rdi_path)
38 print(
'setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:' + rdi_path)
42 for link
in [
'xsim.dir',
'innerLRLUT.mif',
'outerLRLUT.mif']:
43 if link
not in os.listdir(os.getcwd()):
44 call([
'ln',
'-s', lib_source + link])
47 generate tracks with particle gun, simulate CDC and CDC trigger, save the output.
58 particlegun_params = {
59 'pdgCodes': [-13, 13],
61 'momentumGeneration':
'inversePt',
63 'momentumParams': [3., 10.],
64 'thetaGeneration':
'uniform',
66 'thetaParams': [80, 100],
67 'phiGeneration':
'uniform',
68 'phiParams': [46, 135],
69 'vertexGeneration':
'uniform',
70 'xVertexParams': [0, 0.0],
71 'yVertexParams': [0, 0.0],
73 'zVertexParams': [-10., 10.]}
80 b2.set_random_seed(seed)
84 main = b2.create_path()
86 empty_path = b2.create_path()
89 z_SL0 = [-31 - 1.5 /
tan(30 / 180. * pi), 57 + 1.5 /
tan(17 / 180. * pi)]
96 Reject tracks with bad combination of z0 and theta
101 Initialize self.mc with MCParticles StoreArray
108 Reject tracks with bad combination of z0 and theta
111 z0 = self.
mcmc[0].getVertex().Z()
112 vec = self.
mcmc[0].getMomentum()
114 if z_SL0[0] < z0 + r_SL0 / vec.Pt() * vec.Z() < z_SL0[1]:
118 main.add_module(
'Progress')
121 inputName =
'tsfout.root'
123 main.add_module(
'RootInput', inputFileName=inputName)
126 main.add_module(
'EventInfoSetter', evtNumList=evtnum)
127 main.add_module(
'Gearbox')
128 main.add_module(
'Geometry', components=[
'BeamPipe',
130 'MagneticFieldConstant4LimitedRCDC'])
131 particlegun = b2.register_module(
'ParticleGun')
132 particlegun.param(particlegun_params)
133 main.add_module(particlegun)
137 main.add_module(skim)
138 skim.if_false(empty_path)
140 main.add_module(
'FullSim')
141 main.add_module(
'CDCDigitizer')
152 firmtsf = b2.register_module(
'CDCTriggerTSFFirmware')
156 main.add_module(firmtsf)
162 firm2d = b2.register_module(
'CDCTrigger2DFinderFirmware')
163 firm2d.logging.log_level = b2.LogLevel.DEBUG
164 firm2d.logging.debug_level = 20
165 firm2d.logging.set_info(b2.LogLevel.DEBUG, b2.LogInfo.LEVEL | b2.LogInfo.MESSAGE)
166 firm2d.param(
'nClocks', 32)
167 main.add_module(firm2d)
170 main.add_module(
'RootOutput', outputFileName=
'tsfout.root')
A (simplified) python wrapper for StoreArray.
mc
MCParticles StoreArray.
double tan(double a)
tan for double