36from beamparameters
import add_beamparameters
37from simulation
import add_simulation
43from pxd
import add_pxd_reconstruction
44from svd
import add_svd_reconstruction
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, 4],
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])
133evtgenInput = b2.register_module(
'EvtGenInput')
134evtgenInput.logging.log_level = b2.LogLevel.WARNING
135main.add_module(evtgenInput)
142add_simulation(path=main,
143 usePXDDataReduction=
False,
147main.add_module(
'SetupGenfitExtrapolation')
150add_pxd_reconstruction(path=main)
151add_svd_reconstruction(path=main)
155mctrackfinder = b2.register_module(
'TrackFinderMCTruthRecoTracks')
156mctrackfinder.param(
'UseCDCHits',
False)
157mctrackfinder.param(
'UseSVDHits',
True)
160mctrackfinder.param(
'UsePXDHits',
False)
161mctrackfinder.param(
'Smearing',
False)
162mctrackfinder.param(
'MinimalNDF', 6)
163mctrackfinder.param(
'WhichParticles', [
'primary'])
164mctrackfinder.param(
'RecoTracksStoreArrayName',
'MCRecoTracks')
166mctrackfinder.param(
'UseNLoops', 0.5)
167mctrackfinder.param(
'discardAuxiliaryHits',
True)
168main.add_module(mctrackfinder)
172main.add_module(
"IPTrackTimeEstimator", recoTracksStoreArrayName=
"MCRecoTracks", useFittedInformation=
False)
174daffitter = b2.register_module(
"DAFRecoFitter")
175daffitter.param(
'recoTracksStoreArrayName',
"MCRecoTracks")
177main.add_module(daffitter)
180main.add_module(
'TrackCreator', recoTrackColName=
"MCRecoTracks", pdgCodes=[211, 321, 2212])
184outputFileName = outputDir +
'./'
185if os.environ.get(
'USE_BEAST2_GEOMETRY'):
186 outputFileName +=
"SimEvts_Beast2"
188 outputFileName +=
"SimEvts_Belle2"
189outputFileName +=
'_' + str(rndseed) +
'.root'
192rootOutput = b2.register_module(
'RootOutput')
193rootOutput.param(
'outputFileName', outputFileName)
195rootOutput.param(
'excludeBranchNames', [
"ARICHAeroHits",
199 "BKLMSimHitPositions",
204 "CDCSimHitsToCDCHits4Trg",
218main.add_module(rootOutput)
220b2.log_to_file(
'createSim.log', append=
False)