32 from background
import add_output
46 sad =
'phase2.1.4_collimators_1'
55 sad =
'phase2.1.4_collimators_1'
64 sad =
'phase2.1.4_collimators_1'
86 print(
'basf2', argvs[0],
87 '(Touschek,Coulomb,Brems) (HER,LER) equivTime_us num [(study,usual,ECL,PXD) phase outdir]')
91 inputSAD =
"/group/belle2/BGcampaigns/SAD/forG4/"
92 bgType = bgType +
'_' + accRing
93 sadFile = inputSAD + bgType +
'_' + sad +
'.root'
94 realTime = float(equivTime) * 1000
95 fname = bgType +
'_' + sampleType +
'-phase' + str(phase) +
'-' + num
96 outputFile = outdir +
'/' + fname +
'.root'
100 if not os.path.exists(sadFile):
101 b2.B2ERROR(
'SAD file ' + sadFile +
' not found')
106 if not os.path.exists(outdir):
110 b2.B2RESULT(
'Output file: ' + outputFile)
111 b2.B2RESULT(
'Corresponds to ' + equivTime +
' us of running phase ' + str(phase))
114 b2.set_log_level(b2.LogLevel.RESULT)
117 main = b2.create_path()
121 eventinfosetter = b2.register_module(
'EventInfoSetter')
122 eventinfosetter.param(
'evtNumList', [10000000])
123 main.add_module(eventinfosetter)
126 gearbox = b2.register_module(
'Gearbox')
128 gearbox.param(
'fileName',
'geometry/Beast2_phase2.xml')
130 gearbox.param(
'fileName',
'geometry/Belle2_earlyPhase3.xml')
131 if sampleType ==
'study':
132 gearbox.param(
'override', [
133 (
"/DetectorComponent[@name='PXD']//ActiveChips",
'true',
''),
134 (
"/DetectorComponent[@name='PXD']//SeeNeutrons",
'true',
''),
135 (
"/DetectorComponent[@name='SVD']//ActiveChips",
'true',
''),
136 (
"/DetectorComponent[@name='SVD']//SeeNeutrons",
'true',
''),
137 (
"/DetectorComponent[@name='TOP']//BeamBackgroundStudy",
'1',
''),
138 (
"/DetectorComponent[@name='ARICH']//BeamBackgroundStudy",
'1',
''),
139 (
"/DetectorComponent[@name='ECL']//BeamBackgroundStudy",
'1',
''),
140 (
"/DetectorComponent[@name='KLM']//BeamBackgroundStudy",
'1',
''),
142 main.add_module(gearbox)
145 generator = b2.register_module(
'BeamBkgGenerator')
146 generator.param(
'fileName', sadFile)
147 generator.param(
'ringName', accRing)
148 generator.param(
'realTime', realTime)
149 main.add_module(generator)
152 geometry = b2.register_module(
'Geometry')
153 geometry.param(
'useDB',
False)
155 geometry.param(
'additionalComponents', [
'BEAMABORT',
'MICROTPC',
'CLAWS',
'HE3TUBE'])
156 main.add_module(geometry)
159 fullsim = b2.register_module(
'FullSim')
160 if sampleType ==
'study':
161 fullsim.param(
'PhysicsList',
'FTFP_BERT_HP')
162 fullsim.param(
'UICommandsAtIdle', [
'/process/inactivate nKiller'])
163 fullsim.param(
'StoreAllSecondaries',
True)
164 fullsim.param(
'SecondariesEnergyCut', 0.000001)
165 main.add_module(fullsim)
168 progress = b2.register_module(
'Progress')
169 main.add_module(progress)
176 excludeBranch = [
'MCParticles']
177 add_output(main, bgType, realTime, sampleType, phase, fileName=outputFile, excludeBranches=excludeBranch)