14import beamparameters
as bp
19basf2_dir = os.environ.get(
'BELLE2_LOCAL_DIR', os.environ.get(
'BELLE2_RELEASE_DIR'))
22mg_steeringtemplate = f
'{basf2_dir}/generators/madgraph/examples/run_darkphoton_isr.steeringtemplate'
24mg_beamenergy = str(bp.get_collisions_invariant_mass(experiment=0, run=0, verbose=
True) / 2.)
25b2_seed = b2.get_random_seed().encode(
'utf-8')
26mg_seed = f
'{int(hashlib.sha256(b2_seed).hexdigest(), 16) % 10**8}'
29mg_model = f
'{basf2_dir}/generators/madgraph/models/Dark_photon_UFO'
30mg_generate =
'e+ e- > a ap, ap > DM DM~'
32mg_parameter_mAp = str(mAp)
33mg_parameter_mDM = str(mAp / 3.0)
34mg_parameter_gDM =
'0.1'
35mg_parameter_kappa =
'0.001'
37mg_parameter_wAp =
'0.000001'
40mg_output = f
'Dark_photon_mass_{int(mAp)}_isr'
41if not os.path.exists(mg_output):
45 shutil.rmtree(mg_output, ignore_errors=
True)
49mg_externals =
'mg5_aMC'
50mg_steeringfile = f
'{mg_output}/run_darkphoton_isr.steering'
52mg_runcard = f
'{basf2_dir}/generators/madgraph/cards/run_card.dat'
57 'MGGENERATE': mg_generate,
58 'MGOUTPUT': mg_output,
59 'MGRUNDCARD': mg_runcard,
60 'MGBEAMENERGY': mg_beamenergy,
61 'MGNEVENTS': mg_nevents,
63 'MGPARAMETER_mAp': mg_parameter_mAp,
64 'MGPARAMETER_wAp': mg_parameter_wAp,
65 'MGPARAMETER_mDM': mg_parameter_mDM,
66 'MGPARAMETER_gDM': mg_parameter_gDM,
67 'MGPARAMETER_kappa': mg_parameter_kappa,
69with open(mg_steeringtemplate)
as template:
70 data = template.read()
71 for (key, value)
in mydict.items():
72 data = data.replace(key, value)
73steering = open(mg_steeringfile,
'w')
78subprocess.check_call([mg_externals, mg_steeringfile])
79subprocess.check_call([
'gunzip', f
'{mg_output}/Events/run_01/unweighted_events.lhe.gz'])
88main.add_module(
'LHEInput',
91 inputFileList=b2.find_file(f
'{mg_output}/Events/run_01/unweighted_events.lhe'),
92 createEventMetaData=
True,
98main.add_module(
'BoostMCParticles')
100main.add_module(
'SmearPrimaryVertex')
102main.add_module(
'Progress')
104main.add_module(
'RootOutput',
105 outputFileName=f
'Dark_photon_mass_{int(mAp)}_isr.root')
def add_particle(name, pdgCode, mass, width, charge, spin, max_width=None, lifetime=0, pythiaID=0, define_anti_particle=False)