2 @file ap_gen_to_slic_job.py
4 Job script to generate A-prime events, convert to StdHep, apply transformations,
5 and resulting simulate signal events using SLIC.
7 There are options to generate prompt and displaced events.
8 You can use them by adjusting the StdHepConverter options as seen below.
12 from hpsmc.tools import DisplaceUni, Unzip, BeamCoords, AddMotherFullTruth, SLIC
14 job.description =
'ap from generation to slic'
17 inputs = list(job.input_files.values())
19 if 'nevents' in job.params:
20 nevents = job.params[
'nevents']
30 mg =
MG4(name=
'ap', event_types=[
'unweighted'])
32 if 'ap_decay_dist' in job.params:
33 ap_decay_dist = job.params[
'ap_decay_dist']
35 ap_decay_dist =
"lhe_uniform"
38 unzip =
Unzip(inputs=[
"ap_unweighted_events.lhe.gz"], outputs=[
"ap_unweighted_events.lhe"])
40 if ap_decay_dist ==
"lhe_uniform":
43 elif ap_decay_dist ==
"lhe_prompt":
45 cnv =
StdHepConverter(name=
"lhe_prompt", inputs=[
"ap_unweighted_events.lhe"])
46 elif ap_decay_dist ==
"displace_time":
47 if 'ctau' in job.params:
49 cnv =
DisplaceUni(inputs=[
"ap_unweighted_events.lhe"])
51 logger.error(
"Missing parameter ctau")
53 logger.error(
"Invalid ap decay distribution: ap_decay_dist = %s" % ap_decay_dist)
56 mom =
AddMotherFullTruth(inputs=[
"ap_unweighted_events.stdhep", unzip.output_files()[0]], outputs=[
"ap_mom.stdhep"])
59 rot =
BeamCoords(inputs=mom.output_files(), outputs=[
"ap_rot.stdhep"])
62 slic =
SLIC(nevents=nevents + 1, inputs=rot.output_files(), outputs=[
"ap.slcio"])
65 job.add([mg, unzip, cnv, mom, rot, slic])
Run the MadGraph 4 event generator.
Convert LHE files to StdHep using EGS5.