def write_param_card(self): logger.info('Writing param_card.dat') # Use the write_param_card.py module that is in the newly created model_dir sys.path.append(self.new_model_dir) from write_param_card import ParamCardWriter param_card_file = osp.join(self.new_model_dir, 'param_card.dat') ParamCardWriter(param_card_file, generic=True) logger.info('Done writing param_card.dat')
def write_param_card(self): """ Using the freshly copied file `write_param_card.py`, create the parameter card `param_card.dat`. """ logger.info('Writing param_card.dat') # Use the write_param_card.py module that is in the newly created model_dir sys.path.append(self.new_model_dir) from write_param_card import ParamCardWriter param_card_file = osp.join(self.new_model_dir, 'param_card.dat') ParamCardWriter(param_card_file, generic=True) logger.info('Done writing param_card.dat')
def getMadGraphCards(self, base_dir, lhaid, events=1, cores=1): if base_dir[-1] != '/': base_dir = base_dir + '/' # helper for templates def fill_template(inname, outname=None, **kwargs): if outname is None: outname = inname with open(inname, 'r') as temp: old_lines = Template(temp.read()) new_lines = old_lines.substitute(**kwargs) with open(inname, 'w') as temp: temp.write(new_lines) if inname != outname: shutil.move(inname, outname) mg_model_dir = os.path.expandvars(base_dir + "mg_model_templates") # replace parameters in relevant file param_args = dict( mediator_mass="{:g}".format(self.mMediator), dark_quark_mass="{:g}".format(self.mSqua), ) if self.yukawa is not None: param_args["dark_yukawa"] = "{:g}".format(self.yukawa) fill_template(os.path.join(mg_model_dir, "parameters.py"), **param_args) # use parameters to generate card sys.path.append(mg_model_dir) from write_param_card import ParamCardWriter param_card_file = os.path.join(mg_model_dir, "param_card.dat") ParamCardWriter(param_card_file, generic=True) mg_input_dir = os.path.expandvars(base_dir + "mg_input_templates") modname = self.getOutName(events=events, outpre="SVJ", sanitize=True) template_paths = [ p for ftype in ["dat", "patch"] for p in glob(os.path.join(mg_input_dir, "*." + ftype)) ] for template in template_paths: fill_template( os.path.join(mg_input_dir, template), os.path.join(mg_input_dir, template.replace("modelname", modname)), modelName=modname, totalEvents="{:g}".format(events), cores="{:g}".format(cores), lhaid="{:g}".format(lhaid), ) return mg_model_dir, mg_input_dir
'muF2_ref_fixed': str(scale) } build_run_card(run_card_old=get_default_runcard(isNLO=False), run_card_new='run_card.dat', nevts=nevents, rand_seed=runArgs.randomSeed, beamEnergy=beamEnergy, extras=extras) #Build param_card.dat from UFO, and set Higgs masses #write_param_card is part of the 2HDMTypeII model import os import sys sys.path.append(os.environ['MADPATH'] + '/models/2HDMtypeII/') from write_param_card import ParamCardWriter ParamCardWriter('param_card.TMP.dat') masses = { '25': str(mh1) + ' # mh1', '35': str(mh2) + ' # mh2', '36': str(mh2) + ' # mh2', '37': str(mhc) + ' # mhc' } build_param_card(param_card_old='param_card.TMP.dat', param_card_new='param_card.dat', masses=masses) print_cards() runName = 'run_01' process_dir = new_process()