36from beamparameters
import add_beamparameters
37from simulation
import add_simulation
43from pxd
import add_pxd_reconstruction
44from svd
import add_svd_reconstruction
45from generators
import add_babayaganlo_generator
58 outputDir = sys.argv[2]
60b2.set_random_seed(rndseed)
64b2.set_log_level(b2.LogLevel.ERROR)
67main = b2.create_path()
69eventinfosetter = b2.register_module(
'EventInfoSetter')
73if os.environ.get(
'USE_BEAST2_GEOMETRY'):
75eventinfosetter.param(
"expList", [exp_number])
76main.add_module(eventinfosetter)
78eventinfoprinter = b2.register_module(
'EventInfoPrinter')
79main.add_module(eventinfoprinter)
81progress = b2.register_module(
'Progress')
82main.add_module(progress)
98vertex_x = random.uniform(vertex_x_min, vertex_x_max)
99vertex_y = random.uniform(vertex_y_min, vertex_y_max)
100vertex_z = random.uniform(vertex_z_min, vertex_z_max)
102print(
"WARNING: setting non-default beam vertex at x= " + str(vertex_x) +
" y= " + str(vertex_y) +
" z= " + str(vertex_z))
110particlegun = b2.register_module(
'ParticleGun')
111particlegun.logging.log_level = b2.LogLevel.WARNING
113 'pdgCodes': [13, -13],
115 'momentumGeneration':
'uniform',
116 'momentumParams': [0.1, 7],
117 'vertexGeneration':
'uniform',
118 'xVertexParams': [vertex_x - vertex_delta, vertex_x + vertex_delta],
119 'yVertexParams': [vertex_y - vertex_delta, vertex_y + vertex_delta],
120 'zVertexParams': [vertex_z - vertex_delta, vertex_z + vertex_delta]
123particlegun.param(param_pGun)
124main.add_module(particlegun)
129beamparameters = add_beamparameters(main,
"Y4S")
130beamparameters.param(
"vertex", [vertex_x, vertex_y, vertex_z])
138add_babayaganlo_generator(path=main, finalstate=
'ee')
145add_simulation(path=main,
146 usePXDDataReduction=
False,
150main.add_module(
'SetupGenfitExtrapolation')
153add_pxd_reconstruction(path=main)
154add_svd_reconstruction(path=main)
158mctrackfinder = b2.register_module(
'TrackFinderMCTruthRecoTracks')
159mctrackfinder.param(
'UseCDCHits',
False)
160mctrackfinder.param(
'UseSVDHits',
True)
163mctrackfinder.param(
'UsePXDHits',
False)
164mctrackfinder.param(
'Smearing',
False)
165mctrackfinder.param(
'MinimalNDF', 6)
166mctrackfinder.param(
'WhichParticles', [
'primary'])
167mctrackfinder.param(
'RecoTracksStoreArrayName',
'MCRecoTracks')
169mctrackfinder.param(
'UseNLoops', 0.5)
170mctrackfinder.param(
'discardAuxiliaryHits',
True)
171main.add_module(mctrackfinder)
175main.add_module(
"IPTrackTimeEstimator", recoTracksStoreArrayName=
"MCRecoTracks", useFittedInformation=
False)
177daffitter = b2.register_module(
"DAFRecoFitter")
178daffitter.param(
'recoTracksStoreArrayName',
"MCRecoTracks")
180main.add_module(daffitter)
183main.add_module(
'TrackCreator', recoTrackColName=
"MCRecoTracks", pdgCodes=[211, 321, 2212])
187outputFileName = outputDir +
'./'
188if os.environ.get(
'USE_BEAST2_GEOMETRY'):
189 outputFileName +=
"SimEvts_Beast2"
191 outputFileName +=
"SimEvts_Belle2"
192outputFileName +=
'_' + str(rndseed) +
'.root'
195rootOutput = b2.register_module(
'RootOutput')
196rootOutput.param(
'outputFileName', outputFileName)
198rootOutput.param(
'excludeBranchNames', [
"ARICHAeroHits",
202 "BKLMSimHitPositions",
207 "CDCSimHitsToCDCHits4Trg",
221main.add_module(rootOutput)
223b2.log_to_file(
'createSim.log', append=
False)