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