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