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
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, 4],
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])
134 evtgenInput = b2.register_module(
'EvtGenInput')
135 evtgenInput.logging.log_level = b2.LogLevel.WARNING
136 main.add_module(evtgenInput)
143 add_simulation(path=main,
144 usePXDDataReduction=
False,
148 main.add_module(
'SetupGenfitExtrapolation')
151 add_pxd_reconstruction(path=main)
152 add_svd_reconstruction(path=main)
156 mctrackfinder = b2.register_module(
'TrackFinderMCTruthRecoTracks')
157 mctrackfinder.param(
'UseCDCHits',
False)
158 mctrackfinder.param(
'UseSVDHits',
True)
161 mctrackfinder.param(
'UsePXDHits',
False)
162 mctrackfinder.param(
'Smearing',
False)
163 mctrackfinder.param(
'MinimalNDF', 6)
164 mctrackfinder.param(
'WhichParticles', [
'primary'])
165 mctrackfinder.param(
'RecoTracksStoreArrayName',
'MCRecoTracks')
167 mctrackfinder.param(
'UseNLoops', 0.5)
168 mctrackfinder.param(
'discardAuxiliaryHits',
True)
169 main.add_module(mctrackfinder)
173 main.add_module(
"IPTrackTimeEstimator", recoTracksStoreArrayName=
"MCRecoTracks", useFittedInformation=
False)
175 daffitter = b2.register_module(
"DAFRecoFitter")
176 daffitter.param(
'recoTracksStoreArrayName',
"MCRecoTracks")
178 main.add_module(daffitter)
181 main.add_module(
'TrackCreator', recoTrackColName=
"MCRecoTracks", pdgCodes=[211, 321, 2212])
185 outputFileName = outputDir +
'./'
186 if os.environ.get(
'USE_BEAST2_GEOMETRY'):
187 outputFileName +=
"SimEvts_Beast2"
189 outputFileName +=
"SimEvts_Belle2"
190 outputFileName +=
'_' + str(rndseed) +
'.root'
193 rootOutput = b2.register_module(
'RootOutput')
194 rootOutput.param(
'outputFileName', outputFileName)
196 rootOutput.param(
'excludeBranchNames', [
"ARICHAeroHits",
200 "BKLMSimHitPositions",
205 "CDCSimHitsToCDCHits4Trg",
219 main.add_module(rootOutput)
221 b2.log_to_file(
'createSim.log', append=
False)