Belle II Software development
simLaserCalibSystemWithCalpulse.py
1#!/usr/bin/env python3
2
3
10
11# ---------------------------------------------------------------
12# Simulation of the laser system including a double pulse
13# ---------------------------------------------------------------
14
15import basf2 as b2
16
17
18def addSource(x, angle, slotID, path):
19 '''
20 Adds a laser source to the path
21 @param x local x coordinate of teh source in the bar frame
22 @param angle vertical tilt of the source
23 @param slotID 1-16, slot number. If it's 0, then all the coorinates are in the BelleII frame
24 '''
25 path.add_module('OpticalGun',
26 minAlpha=0.0, # not used if angulardistribution == 'Gaussian'
27 maxAlpha=33.0, # not used if angulardistribution == 'Gaussian'
28 na=0.50, # used only if angulardistribution == 'Gaussian'
29 startTime=-53.0, # start time relative to the first cal pulse (according to run 8/414)
30 pulseWidth=10.0e-3, # laser time jitter (1 Gaussian sigma), [ns]
31 numPhotons=62.5, # according to run 8/414
32 diameter=10.0e-3, # source diameter in cm
33 slotID=slotID, # if nonzero, local (slot) frame, otherwise Belle II
34 x=x,
35 y=-3.26,
36 z=-131.33,
37 theta=180 + angle,
38 phi=0.0,
39 psi=0.0,
40 angularDistribution='uniform'
41 # angularDistribution='(40-x)*TMath::Sin(x)'
42 )
43
44
45# Create path
46main = b2.create_path()
47
48# Set number of events to generate
49main.add_module('EventInfoSetter',
50 expList=[1003], # 0 for nominal phase 3, 1002 for phase II, 1003 for early phase III
51 evtNumList=[100])
52
53# Gearbox: access to database (xml files)
54main.add_module('Gearbox')
55
56# Geometry
57main.add_module('Geometry')
58
59# Pulse generator
60main.add_module('TOPCalPulseGenerator',
61 asicChannels=[0],
62 amplitude=600.)
63
64# Optical sources
65for slotId in range(1, 17):
66 for pos in [0.9, 5.7, 11.3, 16.9, 22.5, 28.1, 33.7, 39.3, 44.1]:
67 angle = 17
68 x = -45. / 2. + pos
69 addSource(x, angle, slotId, main)
70
71# Simulation
72main.add_module('FullSim')
73
74# TOP digitization
75main.add_module('TOPDigitizer')
76
77# Output
78main.add_module('RootOutput',
79 outputFileName='opticalGunWithCalPulse.root')
80
81# Show progress of processing
82main.add_module('Progress')
83
84# Process events
85b2.process(main, calculateStatistics=True)
86
87# Print call statistics
88print(b2.statistics)