Belle II Software development
Digitize.py
1
8import basf2 as b2
9import sys
10import datetime
11
12
13argvs = sys.argv
14argc = len(argvs)
15
16bgType = argvs[1] # Coulomb, Touschek, Brems
17accRing = argvs[2] # LER or HER
18num = int(argvs[3]) # output file number
19folder = argvs[4]
20
21d = datetime.datetime.today()
22print(d.strftime('job start: %Y-%m-%d %H:%M:%S\n'))
23
24main = b2.create_path()
25
26fnames = []
27patha = "/group/belle2/BGcampaigns/g4sim/" + folder
28
29pathb = patha + '/output/'
30pathc = patha + '/beast_hist/'
31# takes 10 input files
32for i in range(num * 10, (num + 1) * 10):
33 filenn = pathb + bgType + '_' + accRing + '_study-phase2-' + str(i) + '.root'
34 print(filenn)
35 fnames.append(filenn)
36
37histfile = pathc + bgType + '_' + accRing + '_' + str(num) + '.root'
38
39input_module = b2.register_module('RootInput')
40input_module.param('inputFileNames', fnames)
41main.add_module(input_module)
42
43# Histogram manager module
44histo = b2.register_module('HistoManager')
45histo.param('histoFileName', histfile) # File to save histograms
46main.add_module(histo)
47
48gearbox = b2.register_module('Gearbox')
49gearbox.param('fileName', '/geometry/Beast2_phase2.xml')
50main.add_module(gearbox)
51
52main.add_module("Progress")
53
54# set digitizers and study modules parameters according to my best knowledge
55# should be examined by beast experts
56
57MIP_to_PE = [27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27]
58he3digi = b2.register_module('He3Digitizer')
59he3digi.param('conversionFactor', 0.303132019)
60he3digi.param('useMCParticles', False)
61main.add_module(he3digi)
62diadigi = b2.register_module('BeamDigitizer')
63diadigi.param('WorkFunction', 13.25)
64diadigi.param('FanoFactor', 0.382)
65main.add_module(diadigi)
66pindigi = b2.register_module('PinDigitizer')
67pindigi.param('WorkFunction', 3.64)
68pindigi.param('FanoFactor', 0.13)
69main.add_module(pindigi)
70clawsdigi = b2.register_module('ClawsDigitizer')
71clawsdigi.param('C_MIP_to_PE', MIP_to_PE)
72main.add_module(clawsdigi)
73qcssdigi = b2.register_module('QcsmonitorDigitizer')
74qcssdigi.param('ScintCell', 40)
75qcssdigi.param('C_keV_to_MIP', 1629.827)
76qcssdigi.param('C_MIP_to_PE', 15.0)
77qcssdigi.param('MIPthres', 0.5)
78main.add_module(qcssdigi)
79fangsdigi = b2.register_module('FANGSDigitizer')
80main.add_module(fangsdigi)
81tpcdigi = b2.register_module('TpcDigitizer')
82main.add_module(tpcdigi)
83
84beamab_study = b2.register_module('BeamabortStudy')
85main.add_module(beamab_study)
86
87claws_study = b2.register_module('ClawsStudy')
88main.add_module(claws_study)
89
90fangs_study = b2.register_module('FANGSStudy')
91main.add_module(fangs_study)
92
93tpc_study = b2.register_module('MicrotpcStudy')
94main.add_module(tpc_study)
95
96he3_study = b2.register_module('He3tubeStudy')
97main.add_module(he3_study)
98
99pin_study = b2.register_module('PindiodeStudy')
100# main.add_module(pin_study)
101
102qcs_study = b2.register_module('QcsmonitorStudy')
103# main.add_module(qcs_study)
104
105b2.process(main)
106
107print('Event Statistics:')
108print(b2.statistics)
109
110d = datetime.datetime.today()
111print(d.strftime('job finish: %Y-%m-%d %H:%M:%S\n'))