37 from beamparameters
import add_beamparameters
38 from simulation
import add_simulation
44 from pxd
import add_pxd_reconstruction
45 from svd
import add_svd_reconstruction
46 from generators
import add_babayaganlo_generator
53 if(len(sys.argv) > 1):
58 if(len(sys.argv) > 2):
59 outputDir = sys.argv[2]
61 b2.set_random_seed(rndseed)
65 b2.set_log_level(b2.LogLevel.ERROR)
68 main = b2.create_path()
70 eventinfosetter = b2.register_module(
'EventInfoSetter')
74 if os.environ.get(
'USE_BEAST2_GEOMETRY'):
76 eventinfosetter.param(
"expList", [exp_number])
77 main.add_module(eventinfosetter)
79 eventinfoprinter = b2.register_module(
'EventInfoPrinter')
80 main.add_module(eventinfoprinter)
82 progress = b2.register_module(
'Progress')
83 main.add_module(progress)
99 vertex_x = random.uniform(vertex_x_min, vertex_x_max)
100 vertex_y = random.uniform(vertex_y_min, vertex_y_max)
101 vertex_z = random.uniform(vertex_z_min, vertex_z_max)
103 print(
"WARNING: setting non-default beam vertex at x= " + str(vertex_x) +
" y= " + str(vertex_y) +
" z= " + str(vertex_z))
111 particlegun = b2.register_module(
'ParticleGun')
112 particlegun.logging.log_level = b2.LogLevel.WARNING
114 'pdgCodes': [13, -13],
116 'momentumGeneration':
'uniform',
117 'momentumParams': [0.1, 7],
118 'vertexGeneration':
'uniform',
119 'xVertexParams': [vertex_x - vertex_delta, vertex_x + vertex_delta],
120 'yVertexParams': [vertex_y - vertex_delta, vertex_y + vertex_delta],
121 'zVertexParams': [vertex_z - vertex_delta, vertex_z + vertex_delta]
124 particlegun.param(param_pGun)
125 main.add_module(particlegun)
130 beamparameters = add_beamparameters(main,
"Y4S")
131 beamparameters.param(
"vertex", [vertex_x, vertex_y, vertex_z])
139 add_babayaganlo_generator(path=main, finalstate=
'ee')
146 add_simulation(path=main,
147 usePXDDataReduction=
False,
151 main.add_module(
'SetupGenfitExtrapolation')
154 add_pxd_reconstruction(path=main)
155 add_svd_reconstruction(path=main)
159 mctrackfinder = b2.register_module(
'TrackFinderMCTruthRecoTracks')
160 mctrackfinder.param(
'UseCDCHits',
False)
161 mctrackfinder.param(
'UseSVDHits',
True)
164 mctrackfinder.param(
'UsePXDHits',
False)
165 mctrackfinder.param(
'Smearing',
False)
166 mctrackfinder.param(
'MinimalNDF', 6)
167 mctrackfinder.param(
'WhichParticles', [
'primary'])
168 mctrackfinder.param(
'RecoTracksStoreArrayName',
'MCRecoTracks')
170 mctrackfinder.param(
'UseNLoops', 0.5)
171 mctrackfinder.param(
'discardAuxiliaryHits',
True)
172 main.add_module(mctrackfinder)
176 main.add_module(
"IPTrackTimeEstimator", recoTracksStoreArrayName=
"MCRecoTracks", useFittedInformation=
False)
178 daffitter = b2.register_module(
"DAFRecoFitter")
179 daffitter.param(
'recoTracksStoreArrayName',
"MCRecoTracks")
181 main.add_module(daffitter)
184 main.add_module(
'TrackCreator', recoTrackColName=
"MCRecoTracks", pdgCodes=[211, 321, 2212])
188 outputFileName = outputDir +
'./'
189 if os.environ.get(
'USE_BEAST2_GEOMETRY'):
190 outputFileName +=
"SimEvts_Beast2"
192 outputFileName +=
"SimEvts_Belle2"
193 outputFileName +=
'_' + str(rndseed) +
'.root'
196 rootOutput = b2.register_module(
'RootOutput')
197 rootOutput.param(
'outputFileName', outputFileName)
199 rootOutput.param(
'excludeBranchNames', [
"ARICHAeroHits",
203 "BKLMSimHitPositions",
208 "CDCSimHitsToCDCHits4Trg",
222 main.add_module(rootOutput)
224 b2.log_to_file(
'createSim.log', append=
False)