32from background
import add_output
73 print(
' basf2', argvs[0],
'bgType accRing equivTime_us num [sampleType phase outdir]')
75 print(
' bgType Coulomb, Coulomb_base, Coulomb_dynamic, Touschek, Brems, Brems_base, Brems_dynamic')
76 print(
' accRing LER or HER')
77 print(
' equivTime_us equivalent SuperKEKB running time in micro-seconds')
78 print(
' num output file number')
79 print(
' sampleType one of: study, usual, PXD, ECL (D = usual)')
80 print(
' phase 2, 31 (= early phase 3, ie Run 1), 32 (= Run 2) or 3 (D = 3)')
81 print(
' outdir output directory path (D = output)')
89 subdir =
'phase3-early/'
91 subdir =
'phase3-Run2/'
95 print(
'phase ', phase,
'not supported')
100bgType = bgType +
'_' + accRing
101sadFile =
'input/' + subdir + bgType +
'.root'
102realTime = float(equivTime) * 1000
103fname = bgType +
'_' + sampleType +
'-phase' + str(phase) +
'-' + num
104outputFile = outdir +
'/' + fname +
'.root'
108if not os.path.exists(sadFile):
109 b2.B2ERROR(
'SAD file ' + sadFile +
' not found')
114if not os.path.exists(outdir):
118b2.B2RESULT(
'SAD file (input): ' + sadFile)
119b2.B2RESULT(
'Output file: ' + outputFile)
120b2.B2RESULT(
'Corresponds to ' + equivTime +
' us of running phase ' + str(phase))
123b2.set_log_level(b2.LogLevel.RESULT)
126main = b2.create_path()
130eventinfosetter = b2.register_module(
'EventInfoSetter')
131eventinfosetter.param(
'evtNumList', [10000000])
132main.add_module(eventinfosetter)
135gearbox = b2.register_module(
'Gearbox')
137 gearbox.param(
'fileName',
'geometry/Beast2_phase2.xml')
139 gearbox.param(
'fileName',
'geometry/Belle2_earlyPhase3.xml')
141 gearbox.param(
'fileName',
'geometry/Belle2_Run2.xml')
142if sampleType ==
'study':
143 gearbox.param(
'override', [
144 (
"/DetectorComponent[@name='PXD']//ActiveChips",
'true',
''),
145 (
"/DetectorComponent[@name='PXD']//SeeNeutrons",
'true',
''),
146 (
"/DetectorComponent[@name='SVD']//ActiveChips",
'true',
''),
147 (
"/DetectorComponent[@name='SVD']//SeeNeutrons",
'true',
''),
148 (
"/DetectorComponent[@name='TOP']//BeamBackgroundStudy",
'1',
''),
149 (
"/DetectorComponent[@name='ARICH']//BeamBackgroundStudy",
'1',
''),
150 (
"/DetectorComponent[@name='ECL']//BeamBackgroundStudy",
'1',
''),
151 (
"/DetectorComponent[@name='KLM']//BKLM/BeamBackgroundStudy",
'1',
''),
152 (
"/DetectorComponent[@name='KLM']//EKLM/BeamBackgroundStudy",
'1',
''),
154main.add_module(gearbox)
157generator = b2.register_module(
'BeamBkgGenerator')
158generator.param(
'fileName', sadFile)
159generator.param(
'ringName', accRing)
160generator.param(
'realTime', realTime)
161main.add_module(generator)
164geometry = b2.register_module(
'Geometry')
165geometry.param(
'useDB',
False)
167if sampleType ==
'study' and (phase == 31
or phase == 32):
168 geometry.param(
'additionalComponents', [
"BEAMABORT",
"MICROTPC",
"CLAWS",
"HE3TUBE"])
169main.add_module(geometry)
172fullsim = b2.register_module(
'FullSim')
173if sampleType ==
'study':
174 fullsim.param(
'PhysicsList',
'FTFP_BERT_HP')
175 fullsim.param(
'UICommandsAtIdle', [
'/process/inactivate nKiller'])
176 fullsim.param(
'StoreAllSecondaries',
True)
177 fullsim.param(
'SecondariesEnergyCut', 0.000001)
178main.add_module(fullsim)
181progress = b2.register_module(
'Progress')
182main.add_module(progress)
185if phase == 31
or phase == 32:
187add_output(main, bgType, realTime, sampleType, phase, fileName=outputFile)