def writeparamcard(options,masses,parameters):
    from MadGraphControl.MadGraphUtils import new_process
    process_dir = new_process()
    options["processdir"] = process_dir
    
    from MadGraphControl.MadGraphUtils import build_param_card
    from os.path import join as pathjoin
    build_param_card(param_card_old=pathjoin(options["processdir"],'Cards/param_card.dat'),param_card_new='param_card_new.dat',
                     masses=masses,params=parameters)
Example #2
0
def writeparamcard(options,masses,parameters):
    from MadGraphControl.MadGraphUtils import new_process
    process_dir = new_process()
    options["processdir"] = process_dir
    
    from MadGraphControl.MadGraphUtils import build_param_card
    from os.path import join as pathjoin
    build_param_card(param_card_old=pathjoin(options["processdir"],'Cards/param_card.dat'),param_card_new='param_card_new.dat',
                     masses=masses,params=parameters)
Example #3
0
evgenConfig.keywords += ['gaugino', 'chargino', 'neutralino', 'stau']
evgenConfig.description = 'direct stau pair production in the pMSSM with direct decays, m_stauLR = %s GeV, M1 = %s GeV' % (
    MassToFloat(cardAppend.split('_')[0]), MassToFloat(
        cardAppend.split('_')[1]))

#defining input slha file
param_card_in = 'susy.%s.pMSSM_%s_%s_%s.slha' % (dsid, gentype, decaytype,
                                                 cardAppend)
#defing output card file
decaytype += "." + cardAppend
param_card_out = 'param_card.SM.%s.%s.dat' % (gentype, decaytype)

#Creating final parameter card
from MadGraphControl.MadGraphUtils import build_param_card
build_param_card(param_card_old=param_card_in, param_card_new=param_card_out)

#Reading stau-mass from parameter file
include('MC15JobOptions/SUSYMetadata.py')
stauMass = mass_extract(param_card_out, ['1000015'])
masses['1000015'] = MassToFloat(stauMass[0])

evt_multiplier = 3

include('MC15JobOptions/MadGraphControl_SimplifiedModelPostInclude.py')

if njets > 0:
    genSeq.Pythia8.Commands += [
        "Merging:Process = pp>{ta1+,1000015}{ta1-,-1000015}",
        "Merging:Process = pp>{ta2+,2000015}{ta2-,-2000015}",
        "Merging:Process = pp>{ta1+,1000015}{ta2-,-2000015}",
Example #4
0
def get_SMEFT_cards(model_nick,
                    process,
                    param_name=None,
                    reweight_name=None,
                    eft_params=None):

    #determine model from nick and use naming conventions of model
    if model_nick == "EFTAaUm":
        model = "SMEFTsim_A_U35_alphaScheme_UFO"
        eft_parameter_block = 'frblock'
        restriction = None
        sm_restriction = 'SMlimit'
    elif model_nick == "EFTAWUm":
        model = "SMEFTsim_A_U35_MwScheme_UFO"
        eft_parameter_block = 'frblock'
        restriction = None
        sm_restriction = 'SMlimit'
    elif model_nick == "EFTBaUm":
        model = "SMEFT_alpha_FLU_UFO"
        eft_parameter_block = 'NEWCOUP'
        restriction = None
        sm_restriction = 'SM'
    elif model_nick == "EFTBWUm":
        model = "SMEFT_mW_FLU_UFO"
        eft_parameter_block = 'NEWCOUP'
        restriction = None
        sm_restriction = 'SM'
    elif model_nick == "EFTAaU":
        model = "SMEFTsim_A_U35_alphaScheme_UFO"
        eft_parameter_block = 'frblock'
        restriction = 'massless'
        sm_restriction = 'SMlimit_massless'
    elif model_nick == "EFTAWU":
        model = "SMEFTsim_A_U35_MwScheme_UFO"
        eft_parameter_block = 'frblock'
        restriction = 'massless'
        sm_restriction = 'SMlimit_massless'

    else:
        raise RuntimeError("Unkown model: " + model_nick)

    # get reweight card and param card for reweighting
    reweight_card_loc = None
    if reweight_name != None:
        param_card_loc = 'MadGraph_param_card_' + model_nick + '_reweight' + reweight_name + '.dat'
        restrict_card_loc = 'MadGraph_restrict_card_' + model_nick + '_reweight' + reweight_name + '.dat'
        reweight_card_loc = 'MadGraph_reweight_card_' + model_nick + '_' + reweight_name + '.dat'
        get_param_file = subprocess.Popen(
            ['get_files', '-data', param_card_loc])
        get_param_file.wait()
        if not os.path.exists(param_card_loc):
            raise RuntimeError("Cannot find " + param_card_loc)
        get_restrict_file = subprocess.Popen(
            ['get_files', '-data', restrict_card_loc])
        get_restrict_file.wait()
        if not os.path.exists(restrict_card_loc):
            print 'running without user defined restriction card'
            restrict_card_loc = None
        get_reweight_file = subprocess.Popen(
            ['get_files', '-data', reweight_card_loc])
        get_reweight_file.wait()
        if not os.path.exists(reweight_card_loc):
            raise RuntimeError("Cannot find " + reweight_card_loc)
        eft_params = None

    # get param card and set non-zero parameters
    elif param_name != None:
        param_card_loc = 'MadGraph_param_card_' + model_nick + '_' + param_name + '.dat'
        param_card_loc = 'MadGraph_restrict_card_' + model_nick + '_' + param_name + '.dat'
        get_param_file = subprocess.Popen(
            ['get_files', '-data', param_card_loc])
        get_param_file.wait()
        if not os.path.exists(param_card_loc):
            raise RuntimeError("Cannot find " + param_card_loc)
        get_restrict_file = subprocess.Popen(
            ['get_files', '-data', restrict_card_loc])
        get_restrict_file.wait()
        if not os.path.exists(restrict_card_loc):
            print 'running without user defined restriction card'
            restrict_card_loc = None

    # set only one or a few parameter non-zero
    # dynamically create restricted model that only contains the relevant operators
    else:
        param_card_default = 'MadGraph_param_card_' + model_nick + '.dat'
        get_param_file = subprocess.Popen(
            ['get_files', '-data', param_card_default])
        get_param_file.wait()
        if not os.path.exists(param_card_default):
            raise RuntimeError("Cannot find " + param_card_default)
        param_card_loc = param_card_default.replace('.dat', '_updated.dat')
        if len(eft_params) > 0:
            build_param_card(param_card_default,
                             param_card_loc,
                             params={eft_parameter_block: eft_params})
        else:
            shutil.copy(param_card_default, param_card_loc)
        if os.path.exists('mgmodels_local'):
            shutil.rmtree('mgmodels_local')
        os.mkdir('mgmodels_local')
        restricted_model = 'mgmodels_local/' + model
        shutil.copytree(mgmodels + model, restricted_model)
        eft_params_to_keep = eft_params
        for p in eft_params_to_keep:
            eft_params_to_keep[p] = '9.999999e-01'
        if len(eft_params_to_keep) == 0:
            process = process.replace('NP==0', '')
        restriction = 'without_irrelevant_couplings'
        if len(eft_params_to_keep) > 0:
            build_param_card(param_card_default,
                             restricted_model + '/' + 'restrict_' +
                             restriction + '.dat',
                             params={eft_parameter_block: eft_params_to_keep})
        else:
            shutil.copy(
                param_card_default,
                restricted_model + '/' + 'restrict_' + restriction + '.dat')
        model = './' + restricted_model
        restrict_card_loc = None

    if restrict_card_loc != None and (reweight_name != None
                                      or param_name != None):
        if os.path.exists('mgmodels_local'):
            shutil.rmtree('mgmodels_local')
        os.mkdir('mgmodels_local')
        restricted_model = 'mgmodels_local/' + model
        shutil.copytree(mgmodels + model, restricted_model)
        restriction = 'without_irrelevant_couplings'
        shutil.copy(
            restrict_card_loc,
            restricted_model + '/' + 'restrict_' + restriction + '.dat')
        model = './' + restricted_model

    # write process card
    proc_card = "import model " + model
    if restriction != None:
        proc_card += '-' + restriction
    proc_card += "\n"
    proc_card += process + "\noutput -f\n"
    proc_card_loc = 'proc_card.dat'
    f_proc_card = open(proc_card_loc, 'w')
    f_proc_card.write(proc_card)
    f_proc_card.close()

    return proc_card_loc, param_card_loc, reweight_card_loc
'''
njets = 2
evgenLog.info('Registered generation of stau pair production, decay via stau; grid point '+str(runArgs.runNumber) )

evgenConfig.keywords += ['gaugino', 'chargino', 'neutralino', 'stau']
evgenConfig.description = 'direct stau pair production in the pMSSM with direct decays, m_stauLR = %s GeV, M1 = %s GeV'%(MassToFloat(cardAppend.split('_')[0]),MassToFloat(cardAppend.split('_')[1]))

#defining input slha file
param_card_in = 'susy.%s.pMSSM_%s_%s_%s.slha'%(dsid,gentype,decaytype,cardAppend)
#defing output card file
decaytype  += "."+cardAppend
param_card_out = 'param_card.SM.%s.%s.dat'%(gentype,decaytype)

#Creating final parameter card
from MadGraphControl.MadGraphUtils import build_param_card
build_param_card( param_card_old = param_card_in, param_card_new = param_card_out )

#Reading stau-mass from parameter file
include ( 'MC15JobOptions/SUSYMetadata.py' )
stauMass = mass_extract( param_card_out, ['1000015'] )
masses['1000015'] = MassToFloat(stauMass[0])

evt_multiplier = 3

include ( 'MC15JobOptions/MadGraphControl_SimplifiedModelPostInclude.py' )

if njets>0:
    genSeq.Pythia8.Commands += [ "Merging:Process = pp>{ta1+,1000015}{ta1-,-1000015}",
                                 "Merging:Process = pp>{ta2+,2000015}{ta2-,-2000015}",
                                 "Merging:Process = pp>{ta1+,1000015}{ta2-,-2000015}",
                                 "Merging:Process = pp>{ta2+,2000015}{ta1-,-1000015}"]
Example #6
0
mk_jo_proxy(cvmfs_mc15, "MC15JobOptions", "_joproxy15")

# Updating JOBOPTSEARCHPATH env var on the athena side
import re, os
from AthenaCommon import Include
Include.optionsPathEnv = os.environ['JOBOPTSEARCHPATH']
Include.optionsPath = re.split(',|' + os.pathsep, Include.optionsPathEnv)

# Include the job options themselves
include(JO)

# Build the param card, aka SLHA file
from MadGraphControl.MadGraphUtils import build_param_card
build_param_card(param_card_old='param_card.SM.%s.%s.dat' %
                 (gentype, decaytype),
                 param_card_new='SLHA_INPUT.DAT',
                 masses=masses,
                 decays=decays)

# Get the spectrum number if it's in the metadata
spectrum = 1 if 'SPECTRUM' not in simdict else simdict['SPECTRUM']

# Last step, load up the files
load_files_for_rhadrons_scenario('SLHA_INPUT.DAT', spectrum)

# Add any lines that were missing
# In case we want to use Pythia8 for decays during simulation
lifetime = float(simdict['LIFETIME']) if simdict.has_key("LIFETIME") else -1.
if lifetime > 0.:
    if lifetime < 1. and hasattr(runArgs, 'outputEVNT_TRFile'):
        rhlog.warning(