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 path.add_module('OpticalGun',
25 minAlpha=0.0, # not used if angulardistribution == 'Gaussian'
26 maxAlpha=33.0, # not used if angulardistribution == 'Gaussian'
27 na=0.50, # used only if angulardistribution == 'Gaussian'
28 startTime=-53.0, # start time relative to the first cal pulse (according to run 8/414)
29 pulseWidth=10.0e-3, # laser time jitter (1 Gaussian sigma), [ns]
30 numPhotons=62.5, # according to run 8/414
31 diameter=10.0e-3, # source diameter in cm
32 slotID=slotID, # if nonzero, local (slot) frame, otherwise Belle II
33 x=x,
34 y=-3.26,
35 z=-131.33,
36 theta=180 + angle,
37 phi=0.0,
38 psi=0.0,
39 angularDistribution='uniform'
40 # angularDistribution='(40-x)*TMath::Sin(x)'
41 )
42
43
44# Create path
45main = b2.create_path()
46
47# Set number of events to generate
48main.add_module('EventInfoSetter',
49 expList=[1003], # 0 for nominal phase 3, 1002 for phase II, 1003 for early phase III
50 evtNumList=[100])
51
52# Gearbox: access to database (xml files)
53main.add_module('Gearbox')
54
55# Geometry
56main.add_module('Geometry')
57
58# Pulse generator
59main.add_module('TOPCalPulseGenerator',
60 asicChannels=[0],
61 amplitude=600.)
62
63# Optical sources
64for slotId in range(1, 17):
65 for pos in [0.9, 5.7, 11.3, 16.9, 22.5, 28.1, 33.7, 39.3, 44.1]:
66 angle = 17
67 x = -45. / 2. + pos
68 addSource(x, angle, slotId, main)
69
70# Simulation
71main.add_module('FullSim')
72
73# TOP digitization
74main.add_module('TOPDigitizer')
75
76# Output
77main.add_module('RootOutput',
78 outputFileName='opticalGunWithCalPulse.root')
79
80# Show progress of processing
81main.add_module('Progress')
82
83# Process events
84b2.process(main)
85
86# Print call statistics
87print(b2.statistics)
88