コード例 #1
0
ファイル: __init__.py プロジェクト: zhixing1996/dhad
def create_python_script(opts, dt_type, tag, mode, label):

    if tag not in ['single', 'double']:
        raise NameError(tag)

    content = '''#!/usr/bin/env python

import fit

fit.%s_tag_mode("%s", %s, "%s")

''' % (tag, dt_type, mode, label)

    if tag == 'single':
        filename = '%s-%s-m%s-%s.py' % (dt_type, tag, mode, label)
    else:
        filename = '%s-%s-m%s-%s-%s.py' % (dt_type, tag, mode[0], mode[1],
                                           label)

    file_ = os.path.join(attr.datpath, dt_type, label, 'src', filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1
    f = UserFile()
    f.append(content)
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
コード例 #2
0
def create_python_script_nondiag(opts, dt_type, stage, label, x, y):
    if stage not in ['nondiag'] :
        raise NameError(stage)

    content =  '''#!/usr/bin/env python

from fit import crossfeeds

crossfeeds.stage_%s("%s", "%s", %s, %s)

'''% (stage, dt_type, label, x, y)

    xstr = pair_to_str(x)
    ystr = pair_to_str(y)
    
    filename = 'crossfeeds-%s-%s-%s-%s.py' % (stage, dt_type, xstr, ystr)
    file_ = os.path.join(attr.datpath, dt_type, label, 'src', 'csf', filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1 
    
    f = UserFile()
    f.append(content) 
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
コード例 #3
0
ファイル: kkmass2.py プロジェクト: xshi/dhad
def create_python_script(opts, datatype, mode, label, lowmass, highmass):
    content =  '''#!/usr/bin/env python

from fit import kkmass2

kkmass2.fit_single_mode("%s", "%s", "%s", %s, %s, %s)

'''% (datatype, mode, label, lowmass, highmass, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'fit-%s.py' % ms

    filename = filename.replace('/', '-')
    
    file_ = os.path.join(attr.datpath, datatype, label, 'src',
                         'kkmass2/%s_%s' % (lowmass, highmass) , filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1
        
    f = UserFile()
    f.append(content) 
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
コード例 #4
0
ファイル: sidebands.py プロジェクト: xshi/dhad
def create_python_script(opts, dt_type, mode, label):
    content =  '''#!/usr/bin/env python

from fit import sidebands

sidebands.fit_sidebands_single_mode("%s", "%s", "%s", %s)

'''% (dt_type, mode, label, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'sidebands-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')
    
    file_ = os.path.join(attr.datpath, dt_type, label, 'src', filename)
    
    verbose = opts.verbose
    if opts.test:
        verbose = 1

    f = UserFile()
    f.append(content) 
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
コード例 #5
0
def check_decfile_double(opts, label, toppath, decfile, headername, modename):
    headerfile = os.path.join(toppath, 'tag_fragments', headername)
    modenames = modename.split('__')
    fragfile = os.path.join(toppath, 'tag_fragments', modenames[0])

    try:
        frag = open(fragfile, 'r')
    except IOError:
        tag_fragments(opts, [label])
        frag = open(fragfile, 'r')

    f = UserFile()
    fin = open(headerfile, 'r')
    f.extend(fin.readlines())
    f.extend(frag.readlines())
    fin.close()
    frag.close()

    fragfile2 = os.path.join(toppath, 'tag_fragments', modenames[1])
    frag2 = open(fragfile2, 'r')
    f.extend(frag2.readlines())
    frag2.close()

    f.append('End\n')
    verbose = opts.verbose
    if opts.test:
        verbose = 1

    f.output(decfile, verbose=verbose)
    frag2.close()
コード例 #6
0
def create_python_script(opts, datatype, mode, label, lowmass, highmass):
    content = '''#!/usr/bin/env python

from fit import kkmass2

kkmass2.fit_single_mode("%s", "%s", "%s", %s, %s, %s)

''' % (datatype, mode, label, lowmass, highmass, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'fit-%s.py' % ms

    filename = filename.replace('/', '-')

    file_ = os.path.join(attr.datpath, datatype, label, 'src',
                         'kkmass2/%s_%s' % (lowmass, highmass), filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    f = UserFile()
    f.append(content)
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
コード例 #7
0
ファイル: files.py プロジェクト: zhixing1996/dhad
def get_data_statonly_crosssectionsdef(prefix):
    filename = 'data_statonly_crosssectionsdef'
    file_ = tools.set_file(extbase=attr.brfpath, prefix=prefix, 
                           comname=filename)
    if '281ipb' in prefix:
        lumi = '281.50'
    elif '537ipb' in prefix:
        lumi = '536.57'
    elif '818ipb' in prefix or 'v13' in prefix:
        lumi = '818.10'
    else:
        raise NameError(prefix)

    content = '''0
4
%s
0.
0
n
0
n
n
n
''' % lumi

    f = UserFile()
    f.append(content)
    f.output(file_, verbose=1)
コード例 #8
0
ファイル: sidebands.py プロジェクト: zhixing1996/dhad
def create_python_script(opts, dt_type, mode, label):
    content = '''#!/usr/bin/env python

from fit import sidebands

sidebands.fit_sidebands_single_mode("%s", "%s", "%s", %s)

''' % (dt_type, mode, label, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'sidebands-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')

    file_ = os.path.join(attr.datpath, dt_type, label, 'src', filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    f = UserFile()
    f.append(content)
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
コード例 #9
0
ファイル: cleog.py プロジェクト: xshi/dhad
def check_decfile_double(opts, label, toppath, decfile, headername, modename):
    headerfile = os.path.join(toppath, 'tag_fragments', headername)
    modenames = modename.split('__')
    fragfile = os.path.join(toppath, 'tag_fragments', modenames[0])
    
    try:
        frag = open(fragfile, 'r')
    except IOError:
        tag_fragments(opts, [label])
        frag = open(fragfile, 'r')
         
    f = UserFile()
    fin = open(headerfile, 'r')
    f.extend(fin.readlines())
    f.extend(frag.readlines())
    fin.close()
    frag.close()

    fragfile2 = os.path.join(toppath, 'tag_fragments', modenames[1])
    frag2 = open(fragfile2, 'r')
    f.extend(frag2.readlines())
    frag2.close()
    
    f.append('End\n')
    verbose = opts.verbose
    if opts.test:
        verbose = 1
    
    f.output(decfile, verbose=verbose)
    frag2.close()
コード例 #10
0
ファイル: __init__.py プロジェクト: xshi/dhad
def create_python_script(opts, dt_type, tag, mode, label):

    if tag not in ['single', 'double'] :
        raise NameError(tag)

    content =  '''#!/usr/bin/env python

import fit

fit.%s_tag_mode("%s", %s, "%s")

'''% (tag, dt_type, mode, label)

    if tag == 'single':
        filename = '%s-%s-m%s-%s.py' % (dt_type, tag, mode, label)
    else:
        filename = '%s-%s-m%s-%s-%s.py' % (
            dt_type, tag, mode[0], mode[1], label)
    
    file_ = os.path.join(attr.datpath, dt_type, label, 'src', filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1
    f = UserFile()
    f.append(content) 
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
コード例 #11
0
ファイル: cleog.py プロジェクト: xshi/dhad
def cleog_mode(opts, mode, label, tasks=[1]):
    sys.stdout.write('dhad.gen: Mode %s \n' %mode )
    sys.stdout.write('dhad.gen: Label %s \n' %label)
    sys.stdout.write('dhad.gen: Task %s \n' %tasks)

    check_decfile(opts, mode, label)
    check_and_copy_file(opts, label, 'genmc.tcl')
    check_and_copy_file(opts, label, 'runlist')
    check_and_copy_file(opts, label, 'cleog-generic-array.sh')

    jobtype = 'cleog'
    seeds = tools.parse_opts_set(opts.set, 'seeds')
    
    edit_fix_single_mode_list(opts, mode, label)

    create_tag_numbers_file(opts, mode, label)

    for task_id in tasks:
        if  opts.set and 'interact' in opts.set:
            bash_file, logfile = create_bash_interact(
                jobtype, mode, task_id, label=label, seeds=seeds)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
            else:
                subprocess.Popen(bash_file)
            continue

        if opts.set and 'bg' in opts.set:
            bash_file, logfile = create_bash_interact(
                jobtype, mode, task_id, label=label, seeds=seeds)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
                sys.stdout.write(logfile + '\n')                
            else:
                sys.stdout.write('Save log as %s.\n' %logfile)
                process = subprocess.Popen(bash_file, stdout=subprocess.PIPE,
                                                stderr=subprocess.STDOUT)
                f = UserFile()
                f.append(process.communicate()[0])
                f.output(logfile)

            continue

        bash_file = create_bash_fix_mc_job(jobtype, label, task_id, seeds=seeds)

        if opts.test:
            sys.stdout.write(bash_file + '\n')
            continue

        output = commands.getoutput(bash_file)
        sys.stdout.write(output+ '\n')
コード例 #12
0
ファイル: backgrounds.py プロジェクト: xshi/dhad
def main(opts, args):
    parsed = parse_args(args)
    datatype  = parsed[0]
    tag       = parsed[1]
    modes     = parsed[2]
    label     = parsed[3]

    figname = '_'.join(args).replace('/', '_')

    org = UserFile()
    org.append(attr.fig_web_header)

    if 'allinone' in opts.set:
        msg = create_fig(datatype, label)
        org.append(msg)
    else:
        for mode in modes:
            msg = create_fig_mode(tag, datatype, mode, label)
            org.append(msg)
        
    org.append(attr.fig_web_footer)
    orgname = '%s.org' % figname
    orgfile = os.path.join(attr.figpath, orgname)
    org.output(orgfile)
    tools.org_export_as_html(orgfile)

    orglink = '[[./%s/fig/%s][figure]]' %(attr.analysis, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)
コード例 #13
0
ファイル: backgrounds.py プロジェクト: zhixing1996/dhad
def main(opts, args):
    parsed = parse_args(args)
    datatype = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    figname = '_'.join(args).replace('/', '_')

    org = UserFile()
    org.append(attr.fig_web_header)

    if 'allinone' in opts.set:
        msg = create_fig(datatype, label)
        org.append(msg)
    else:
        for mode in modes:
            msg = create_fig_mode(tag, datatype, mode, label)
            org.append(msg)

    org.append(attr.fig_web_footer)
    orgname = '%s.org' % figname
    orgfile = os.path.join(attr.figpath, orgname)
    org.output(orgfile)
    tools.org_export_as_html(orgfile)

    orglink = '[[./%s/fig/%s][figure]]' % (attr.analysis, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)
コード例 #14
0
def pass2_mode(opts, mode, label, tasks=[1]):
    sys.stdout.write('dhad.gen.pass2: Mode %s \n' % mode)
    sys.stdout.write('dhad.gen.pass2: Label %s \n' % label)
    sys.stdout.write('dhad.gen.pass2: Task %s \n' % tasks)

    jobtype = 'pass2'
    cleog.edit_fix_single_mode_list(opts, mode, label)
    cleog.check_and_copy_file(opts, label, 'mcp2.tcl')
    cleog.check_and_copy_file(opts, label, 'pass2-generic-array.sh')

    for task_id in tasks:
        if opts.set == 'interact':
            bash_file, logfile = cleog.create_bash_interact(jobtype,
                                                            mode,
                                                            task_id,
                                                            label=label)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
            else:
                subprocess.Popen(bash_file)
            return

        if opts.set == 'bg':
            bash_file, logfile = cleog.create_bash_interact(jobtype,
                                                            mode,
                                                            task_id,
                                                            label=label)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
                sys.stdout.write(logfile + '\n')
            else:
                sys.stdout.write('Save log as %s.\n' % logfile)
                process = subprocess.Popen(bash_file,
                                           stdout=subprocess.PIPE,
                                           stderr=subprocess.STDOUT)
                f = UserFile()
                f.append(process.communicate()[0])
                f.output(logfile)

            return

        bash_file = cleog.create_bash_fix_mc_job(jobtype, label, task_id)
        if opts.test:
            sys.stdout.write(bash_file + '\n')
            continue

        output = commands.getoutput(bash_file)
        sys.stdout.write(output + '\n')
コード例 #15
0
ファイル: backgrounds.py プロジェクト: zhixing1996/dhad
def create_python_script_allinone(dt_type, modes, label, test):
    content = '''#!/usr/bin/env python

from fit import backgrounds

backgrounds.fit_backgrounds_single("%s", %s, "%s", %s)

''' % (dt_type, modes, label, test)
    filename = 'backgrounds-%s-allinone-%s.py' % (dt_type, label)
    filename = filename.replace('/', '-')
    file_ = os.path.join(attr.srcfitpath, filename)
    f = UserFile()
    f.append(content)
    f.output(file_)
    os.chmod(file_, 0755)
    return filename
コード例 #16
0
ファイル: backgrounds.py プロジェクト: xshi/dhad
def create_python_script_allinone(dt_type, modes, label, test):
    content =  '''#!/usr/bin/env python

from fit import backgrounds

backgrounds.fit_backgrounds_single("%s", %s, "%s", %s)

'''% (dt_type, modes, label, test)
    filename = 'backgrounds-%s-allinone-%s.py' % (dt_type, label)
    filename = filename.replace('/', '-')
    file_ = os.path.join(attr.srcfitpath, filename)
    f = UserFile()
    f.append(content) 
    f.output(file_)
    os.chmod(file_, 0755)
    return filename
コード例 #17
0
ファイル: ntuple.py プロジェクト: zhixing1996/dhad
def create_sh(opts, filename, label, proc_version):
    code_dir = os.path.join(attr.base, 'src', proc_version, 'proc')
    outputdir = os.path.join(attr.datpath, 'signal', label,
                             'dtuple_' + attr.cleog + '_' + attr.pass2)

    if not os.access(outputdir, os.F_OK):
        sys.stdout.write('Creating dir %s ...\n' % outputdir)
        os.makedirs(outputdir)

    sh_content = '''#!/bin/sh
# request Bourne shell as shell for job
#$ -S /usr/local/bin/bash
#$ -j y
#$ -m a
#$ -M [email protected]
date
hostname

. /nfs/cleo3/Offline/scripts/cleo3logins
. /nfs/cleo3/Offline/scripts/cleo3defs

cd %s
. local_setup

export INDIR=$TOPDIR/dskim$SUFFIX

export INPUTDATA=USERLOCALMC_SKIMMED
export USE_SETUP_ANALYSIS=1

export OUTPUTDIR=$TOPDIR/dtuple$SUFFIX

export FILELIST=$SCRIPTDIR/pds_files/dt-$1
export FNAME=$1
suez -f HadronicDNtupleProc/Test/loadHadronicDNtupleProc.tcl

date
''' % code_dir

    sh_file = os.path.join(attr.datpath, 'signal', label, 'src', filename)
    f = UserFile()
    f.append(sh_content)
    verbose = opts.verbose
    if opts.test:
        verbose = 1
    f.output(sh_file, verbose=verbose)
コード例 #18
0
ファイル: files.py プロジェクト: zhixing1996/dhad
def get_data_crosssectionsdef(prefix):
    filename = 'data_crosssectionsdef'
    file_ = tools.set_file(extbase=attr.brfpath, prefix=prefix, 
                           comname=filename)
    if '281ipb' in prefix:
        lumi = '281.50'
        lumi_err = '2.8150'
    elif '537ipb' in prefix:
        lumi = '536.57'
        lumi_err = '5.3657'
    elif '818ipb' in prefix or 'v13' in prefix:
        lumi = '818.10'
        lumi_err = '8.1810'
    else:
        raise NameError(prefix)

    bffilename = 'bf_stat'
    bffile = tools.set_file(extbase=attr.brfpath, prefix=prefix,
                            comname=bffilename)
    brf = BrfFile(bffile)

    ne_xsec_err = brf.parsed['sigma(D0D0bar)'].split('+-')[-1].strip()
    ch_xsec_err = brf.parsed['sigma(D+D-)'].split('+-')[-1].strip()
    xsec_err =  brf.parsed['sigma(DDbar)'].split('+-')[-1].strip()
    xsec_ratio_err = brf.parsed['chg/neu'].split('+-')[-1].strip()

    content = '''0
4
%s
%s
0
y
%s
0
y
%s
y
%s
y
%s
''' % (lumi, lumi_err, ne_xsec_err, ch_xsec_err, xsec_err, xsec_ratio_err)

    f = UserFile()
    f.append(content)
    f.output(file_, verbose=1)
コード例 #19
0
def main(opts, args):

    dt_type = args[0]
    stage = args[1]
    label = args[2] + '/crossfeeds'

    single_modes = get_single_modes(opts.set)

    org = UserFile()
    org.append(attr.fig_web_header)

    if stage == 'diag':
        for mode, sign in single_modes:
            msg = create_fig_diag_mode(dt_type, stage, label, mode, sign)
            org.append(msg)

    elif stage == 'nondiag':
        for x, y in [(x, y) for x in single_modes for y in single_modes
                     if x != y]:
            sys.stdout.write('Creating mode %s, %s ... ' % (x, y))
            sys.stdout.flush()
            msg = create_fig_nondiag_mode(dt_type, stage, label, x, y)
            org.append(msg)
            sys.stdout.write('OK.\n')
    else:
        raise NameError(stage)

    figname = 'crossfeeds_' + '_'.join(args).replace('/', '_')

    org.append(attr.fig_web_footer)

    figlabel = label.split('/')[0]

    figname = figname.replace(figlabel, '')
    figname = figname.replace('__', '_')

    orgname = figname + '.org'
    orgname = orgname.replace('_.org', '.org')
    orgpath = os.path.join(attr.figpath, figlabel)
    orgfile = tools.check_and_join(orgpath, orgname)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    org.output(orgfile, verbose=verbose)
    orglink = '[[./fig/%s/%s][figure]]' % (figlabel, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    if opts.test:
        return

    tools.org_export_as_html(orgfile)
コード例 #20
0
ファイル: pass2.py プロジェクト: xshi/dhad
def pass2_mode(opts, mode, label, tasks=[1]):
    sys.stdout.write('dhad.gen.pass2: Mode %s \n' %mode )
    sys.stdout.write('dhad.gen.pass2: Label %s \n' %label)
    sys.stdout.write('dhad.gen.pass2: Task %s \n' %tasks)

    jobtype = 'pass2'
    cleog.edit_fix_single_mode_list(opts, mode, label)
    cleog.check_and_copy_file(opts, label, 'mcp2.tcl')
    cleog.check_and_copy_file(opts, label, 'pass2-generic-array.sh')

    for task_id in tasks:
        if opts.set == 'interact':
            bash_file, logfile = cleog.create_bash_interact(
                jobtype, mode, task_id, label=label)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
            else:
                subprocess.Popen(bash_file)
            return

        if opts.set == 'bg':
            bash_file, logfile = cleog.create_bash_interact(
                jobtype, mode, task_id, label=label)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
                sys.stdout.write(logfile + '\n')
            else:
                sys.stdout.write('Save log as %s.\n' %logfile)
                process = subprocess.Popen(bash_file, stdout=subprocess.PIPE,
                                           stderr=subprocess.STDOUT)
                f = UserFile()
                f.append(process.communicate()[0])
                f.output(logfile)

            return

        bash_file = cleog.create_bash_fix_mc_job(jobtype, label, task_id)
        if opts.test:
            sys.stdout.write(bash_file + '\n')
            continue

        output = commands.getoutput(bash_file)
        sys.stdout.write(output+ '\n')
コード例 #21
0
ファイル: crossfeeds.py プロジェクト: xshi/dhad
def main(opts, args):

    dt_type = args[0]
    stage = args[1] 
    label = args[2]+'/crossfeeds'

    single_modes = get_single_modes(opts.set)
        
    org = UserFile()
    org.append(attr.fig_web_header)

    if stage == 'diag':
        for mode, sign in single_modes:
            msg = create_fig_diag_mode(dt_type, stage, label, mode, sign)
            org.append(msg)

    elif stage == 'nondiag':
        for x, y  in [(x, y) for x in single_modes for y in single_modes if x!=y]:
            sys.stdout.write('Creating mode %s, %s ... ' % (x, y))
            sys.stdout.flush()
            msg = create_fig_nondiag_mode(dt_type, stage, label, x, y)
            org.append(msg)
            sys.stdout.write('OK.\n')
    else:
        raise NameError(stage)

    figname = 'crossfeeds_' + '_'.join(args).replace('/', '_')
    
    org.append(attr.fig_web_footer)

    figlabel = label.split('/')[0]

    figname = figname.replace(figlabel, '')
    figname = figname.replace('__', '_')

    orgname = figname+'.org'
    orgname = orgname.replace('_.org', '.org')
    orgpath = os.path.join(attr.figpath, figlabel)
    orgfile = tools.check_and_join(orgpath, orgname)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    org.output(orgfile, verbose=verbose)
    orglink = '[[./fig/%s/%s][figure]]' %(figlabel, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    if opts.test:
        return
    
    tools.org_export_as_html(orgfile)
コード例 #22
0
ファイル: __init__.py プロジェクト: zhixing1996/dhad
def create_bash_file(opts,
                     label,
                     dt_type,
                     script,
                     bashname='fit-mbc.sh',
                     optcommand='',
                     subdir=''):
    script_dir = os.path.join(attr.datpath, dt_type, label, 'src', subdir)

    bash_content = '''#!/bin/sh
#$ -S /usr/local/bin/bash
#$ -j y
#$ -m a
#$ -M [email protected]

date
hostname

.  ~/.bashrc
setdhad %s 

%s

cd %s
./%s

date

''' % (attr.version, optcommand, script_dir, script)

    bash_file = os.path.join(script_dir, bashname)

    verbose = opts.verbose
    if opts.test:
        verbose = 1
    f = UserFile()
    f.append(bash_content)
    f.output(bash_file, verbose=verbose)
    os.chmod(bash_file, 0755)
    return bash_file
コード例 #23
0
ファイル: kkmass.py プロジェクト: xshi/dhad
def main(opts, args):
    parsed = parse_args(args)
    datatype  = parsed[0]
    tag       = parsed[1]
    modes     = parsed[2]
    label     = parsed[3]

    figname = 'kkmass_'+'_'.join(args[:-1]).replace('/', '_')

    org = UserFile()
    org.append(attr.fig_web_header)

    binbase = parse_opts_set(opts.set, 'binbase')
    binwidth =  parse_opts_set(opts.set, 'binwidth')
    numbins = parse_opts_set(opts.set, 'numbins')
    
    for i in xrange(numbins):
        lowmass = binbase+i*binwidth
        highmass = binbase+(i+1)*binwidth

        for mode in modes:
            msg = create_fig_mode(opts, tag, datatype, mode,
                                  lowmass, highmass, label)
            org.append(msg)
    
    org.append(attr.fig_web_footer)
    orgname = '%s.org' % figname
    orgfile = os.path.join(attr.figpath, label, orgname)
    org.output(orgfile, verbose=1)

    orglink = '[[./fig/%s/%s][figure]]' %(label, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    tools.org_export_as_html(orgfile)
コード例 #24
0
def main(opts, args):
    parsed = parse_args(args)
    datatype = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    figname = 'kpimass_' + '_'.join(args[:-1]).replace('/', '_')

    org = UserFile()
    org.append(attr.fig_web_header)

    binbase = parse_opts_set(opts.set, 'binbase')
    binwidth = parse_opts_set(opts.set, 'binwidth')
    numbins = parse_opts_set(opts.set, 'numbins')

    for i in xrange(numbins):
        lowmass = binbase + i * binwidth
        highmass = binbase + (i + 1) * binwidth

        for mode in modes:
            msg = create_fig_mode(opts, tag, datatype, mode, lowmass, highmass,
                                  label)
            org.append(msg)

    org.append(attr.fig_web_footer)
    orgname = '%s.org' % figname
    orgfile = os.path.join(attr.figpath, label, orgname)
    org.output(orgfile, verbose=1)

    orglink = '[[./fig/%s/%s][figure]]' % (label, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    tools.org_export_as_html(orgfile)
コード例 #25
0
ファイル: ntuple.py プロジェクト: zhixing1996/dhad
def ntuple_mode(opts, mode, tasks, label, proc_version):
    sys.stdout.write('dhad.gen: Mode %s, %s \n' % (mode, label))
    cleog.edit_fix_single_mode_list(opts, mode, label)

    create_filelist(opts, mode, tasks, label)
    jobtype = 'ntuple'

    if opts.set == 'interact':
        bash_file, logfile = create_bash_interact(opts, mode, label,
                                                  proc_version)
        if opts.test:
            sys.stdout.write(bash_file + '\n')
        else:
            subprocess.Popen(bash_file)
        return

    if opts.set == 'bg':
        bash_file, logfile = create_bash_interact(opts, mode, label,
                                                  proc_version)
        if opts.test:
            sys.stdout.write(bash_file + '\n')
            sys.stdout.write(logfile + '\n')
        else:
            sys.stdout.write('Save log as %s.\n' % logfile)
            process = subprocess.Popen(bash_file,
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.STDOUT)
            f = UserFile()
            f.append(process.communicate()[0])
            f.output(logfile)
        return

    bash_file = cleog.create_bash_fix_mc_job(jobtype, label=label)
    if opts.test:
        sys.stdout.write(bash_file + '\n')
        return

    output = commands.getoutput(bash_file)
    sys.stdout.write(output + '\n')
コード例 #26
0
ファイル: cleog.py プロジェクト: xshi/dhad
def create_sh(filename, randomseeds=''):
    code_dir = os.path.join(attr.base, 'src', attr.src, 'gen')
    sh_file = tools.set_file(extbase=code_dir, comname=filename)

    sh_content =  '''#!/bin/sh
# request Bourne shell as shell for job
#$ -S /usr/local/bin/bash
#$ -j y
#$ -m a
#$ -M [email protected]
date
hostname

. /nfs/cleo3/Offline/scripts/cleo3logins
. /nfs/cleo3/Offline/scripts/cleo3defs

c3rel $CGRELEASE
echo $SHELL
cd $SCRIPTDIR

%s

export BATCH=$SGE_TASK_ID
export NUMEVT=`cat $SCRIPTDIR/tag_numbers/$1`
export RUNNUMBER=`nl -s " " $SCRIPTDIR/runlist | grep " $SGE_TASK_ID " | awk '{ print $2 }'`
export DECAYTITLE=$1
export UDECAY=$SCRIPTDIR/tag_decfiles/$1.dec
export OUTDIR=$TOPDIR/cleog$CGSUFFIX

suez -f genmc.tcl
date

''' % (randomseeds)
    
    f = UserFile()
    f.append(sh_content) 
    f.output(sh_file)
コード例 #27
0
ファイル: __init__.py プロジェクト: xshi/dhad
def create_bash_file(opts, datatype, label, script,
                     bashname='get-yields.sh',
                     subdir='yld',  optcommand=''):
    script_dir = os.path.join(
        attr.datpath, datatype, label, 'src', subdir)

    bash_content =  '''#!/bin/sh
#$ -S /usr/local/bin/bash
#$ -j y
#$ -m a
#$ -M [email protected]

date
hostname

.  ~/.bashrc
setdhad %s 

%s

cd %s
./%s

date

''' % (attr.version, optcommand, script_dir, script)
    
    bash_file = os.path.join(script_dir, bashname)

    verbose = opts.verbose
    if opts.test:
        verbose = 1
    f = UserFile()
    f.append(bash_content) 
    f.output(bash_file, verbose=verbose)
    os.chmod(bash_file, 0755)
    return bash_file
コード例 #28
0
def create_sh(filename, randomseeds=''):
    code_dir = os.path.join(attr.base, 'src', attr.src, 'gen')
    sh_file = tools.set_file(extbase=code_dir, comname=filename)

    sh_content = '''#!/bin/sh
# request Bourne shell as shell for job
#$ -S /usr/local/bin/bash
#$ -j y
#$ -m a
#$ -M [email protected]
date
hostname

. /nfs/cleo3/Offline/scripts/cleo3logins
. /nfs/cleo3/Offline/scripts/cleo3defs

c3rel $CGRELEASE
echo $SHELL
cd $SCRIPTDIR

%s

export BATCH=$SGE_TASK_ID
export NUMEVT=`cat $SCRIPTDIR/tag_numbers/$1`
export RUNNUMBER=`nl -s " " $SCRIPTDIR/runlist | grep " $SGE_TASK_ID " | awk '{ print $2 }'`
export DECAYTITLE=$1
export UDECAY=$SCRIPTDIR/tag_decfiles/$1.dec
export OUTDIR=$TOPDIR/cleog$CGSUFFIX

suez -f genmc.tcl
date

''' % (randomseeds)

    f = UserFile()
    f.append(sh_content)
    f.output(sh_file)
コード例 #29
0
ファイル: backgrounds.py プロジェクト: zhixing1996/dhad
def create_python_script(dt_type, mode, label, test):
    content = '''#!/usr/bin/env python

from fit import backgrounds

backgrounds.fit_backgrounds_single_mode("%s", "%s", "%s", %s)

''' % (dt_type, mode, label, test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'backgrounds-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')

    file_ = os.path.join(attr.srcfitpath, filename)

    f = UserFile()
    f.append(content)
    f.output(file_)
    os.chmod(file_, 0755)
    return filename
コード例 #30
0
ファイル: backgrounds.py プロジェクト: xshi/dhad
def create_python_script(dt_type, mode, label, test):
    content =  '''#!/usr/bin/env python

from fit import backgrounds

backgrounds.fit_backgrounds_single_mode("%s", "%s", "%s", %s)

'''% (dt_type, mode, label, test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'backgrounds-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')
    
    file_ = os.path.join(attr.srcfitpath, filename)
    
    f = UserFile()
    f.append(content) 
    f.output(file_)
    os.chmod(file_, 0755)
    return filename
コード例 #31
0
ファイル: parse.py プロジェクト: zhixing1996/dhad
def output_headerfiles(label):
    headernames = [
        'Double_D0D0B_header', 'Double_DpDm_header', 'Single_D0_header',
        'Single_D0B_header', 'Single_Dp_header', 'Single_Dm_header'
    ]
    outpath = os.path.join(attr.datpath, 'signal', label, 'src',
                           'tag_fragments')
    for hname in headernames:
        headerfile = tools.check_and_join(outpath, hname)
        f = UserFile()
        if 'D0D0B' in hname:
            alias_line = '#\nAlias myD0 D0\n#\n#\nAlias myanti-D0 anti-D0\n#\n'
            psi_decay_line = '1.000    myD0  myanti-D0         VSS;\n'

        if 'DpDm' in hname:
            alias_line = '#\nAlias myD+ D+\n#\n#\nAlias myD- D-\n#\n'
            psi_decay_line = '1.000    myD+  myD-         VSS;\n'

        elif 'Single_D0_' in hname:
            alias_line = '#\nAlias myD0 D0\n#\n'
            psi_decay_line = '1.000    myD0  anti-D0         VSS;\n'

        elif 'Single_D0B_' in hname:
            alias_line = '#\nAlias myanti-D0 anti-D0\n#\n'
            psi_decay_line = '1.000    D0  myanti-D0         VSS;\n'

        elif 'Single_Dp_' in hname:
            alias_line = '#\nAlias myD+ D+\n#\n'
            psi_decay_line = '1.000    myD+  D-         VSS;\n'

        elif 'Single_Dm_' in hname:
            alias_line = '#\nAlias myD- D-\n#\n'
            psi_decay_line = '1.000    D+  myD-         VSS;\n'

        f.append(alias_line)
        f.append(
            'Decay vpho\n1.000   psi(3770)  gamma    VPHOTOVISR ;\nEnddecay\n#\nDecay psi(3770)\n'
        )
        f.append(psi_decay_line)
        f.append('Enddecay\n#')
        f.output(headerfile, verbose=1)
コード例 #32
0
ファイル: parse.py プロジェクト: xshi/dhad
def output_headerfiles(label):
    headernames = ['Double_D0D0B_header', 'Double_DpDm_header',
                   'Single_D0_header', 'Single_D0B_header',
                   'Single_Dp_header', 'Single_Dm_header']
    outpath = os.path.join(attr.datpath, 'signal', label,
                           'src', 'tag_fragments')
    for hname in headernames:
        headerfile = tools.check_and_join(outpath, hname)
        f = UserFile()
        if 'D0D0B' in hname:
            alias_line = '#\nAlias myD0 D0\n#\n#\nAlias myanti-D0 anti-D0\n#\n'
            psi_decay_line = '1.000    myD0  myanti-D0         VSS;\n'

        if 'DpDm' in hname:
            alias_line = '#\nAlias myD+ D+\n#\n#\nAlias myD- D-\n#\n'
            psi_decay_line = '1.000    myD+  myD-         VSS;\n'

        elif 'Single_D0_' in hname:
            alias_line = '#\nAlias myD0 D0\n#\n'
            psi_decay_line = '1.000    myD0  anti-D0         VSS;\n'

        elif 'Single_D0B_' in hname:
            alias_line = '#\nAlias myanti-D0 anti-D0\n#\n'
            psi_decay_line = '1.000    D0  myanti-D0         VSS;\n'

        elif 'Single_Dp_' in hname:
            alias_line = '#\nAlias myD+ D+\n#\n'
            psi_decay_line = '1.000    myD+  D-         VSS;\n'

        elif 'Single_Dm_' in hname:
            alias_line = '#\nAlias myD- D-\n#\n'
            psi_decay_line = '1.000    D+  myD-         VSS;\n'

        f.append(alias_line)
        f.append('Decay vpho\n1.000   psi(3770)  gamma    VPHOTOVISR ;\nEnddecay\n#\nDecay psi(3770)\n')
        f.append(psi_decay_line)
        f.append('Enddecay\n#')
        f.output(headerfile, verbose=1)
コード例 #33
0
ファイル: ntuple.py プロジェクト: zhixing1996/dhad
def create_filelist(opts, mode, tasks, label):
    filelistpath = os.path.join(attr.datpath, 'signal', label, 'src',
                                'pds_files')
    filelistname = 'dt-%s' % mode
    filelist_ = os.path.join(filelistpath, filelistname)

    filelist = UserFile()
    filelist.append('source_format sel PDSSourceFormat\n')
    filelist.append('source create myChain\n')

    for task in tasks:
        inputname = 'dskim_%s_%s.pds' % (mode, task)
        inputpath = os.path.join(attr.datpath, 'signal', label,
                                 'dskim_' + attr.cleog + '_' + attr.pass2)
        inputfile = os.path.join(inputpath, inputname)
        filelist.append('file add myChain %s\n' % inputfile)

    filelist.append('source act myChain beginrun startrun event endrun\n')

    verbose = opts.verbose
    if opts.test:
        verbose = 1
    filelist.output(filelist_, verbose=verbose)
コード例 #34
0
ファイル: __init__.py プロジェクト: zhixing1996/dhad
def main(opts, args):
    if args[0] == 'backgrounds':
        import backgrounds
        backgrounds.main(opts, args[1:])
        return

    if args[0] == 'brs':
        import brs
        brs.main(opts, args[1:])
        return

    if args[0] == 'compare':
        import compare
        compare.main(opts, args[1:])
        return

    if args[0] == 'cbx':
        import cbx
        cbx.main(opts, args[1:])
        return

    if args[0] == 'crossfeeds':
        import crossfeeds
        crossfeeds.main(opts, args[1:])
        return

    if args[0] == 'evt':
        import evt
        evt.main(opts, args[1:])
        return

    if args[0] == 'fun':
        import fun
        fun.main(opts, args[1:])
        return

    if args[0] == 'kkmass':
        import kkmass
        kkmass.main(opts, args[1:])
        return

    if args[0] == 'kpimass':
        import kpimass
        kpimass.main(opts, args[1:])
        return

    if args[0] == 'trim':
        import trim
        trim.main(opts, args[1:])
        return

    if args[0] == 'trkmtm':
        import trkmtm
        trkmtm.main(opts, args[1:])
        return

    if args[0] == 'trkmtm1':
        import trkmtm1
        trkmtm1.main(opts, args[1:])
        return

    if args[0] == 'trkmtm2':
        import trkmtm2
        trkmtm2.main(opts, args[1:])
        return

    if args[0] == 'var':
        import var
        var.main(opts, args[1:])
        return

    figname = '_'.join(args).replace('/', '_')

    parsed = parse_args(args)
    dt_type = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    sqrt = False
    if opts.set and opts.set == 'sqrt':
        sqrt = True

    linr = False
    if opts.set and opts.set == 'linr':
        linr = True

    org = UserFile()
    org.append(attr.fig_web_header)

    for mode in modes:
        if mode == 'double_all_d0s' or mode == 'double_all_dps':
            modekey = mode
        else:
            modekey = get_modekey(mode)
        if sqrt:
            sqrt_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write('Creating %s ...' % mode)
        sys.stdout.flush()
        msg = create_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write(' OK.\n')
        org.append(msg)

    org.append(attr.fig_web_footer)
    figlabel = label.split('/')[0]

    figname = figname.replace(figlabel, '')
    figname = figname.replace('__', '_')

    orgname = figname + '.org'
    orgname = orgname.replace('_.org', '.org')
    orgpath = os.path.join(attr.figpath, figlabel)
    orgfile = tools.check_and_join(orgpath, orgname)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    org.output(orgfile, verbose=verbose)
    orglink = '[[./fig/%s/%s][figure]]' % (figlabel, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    if opts.test:
        return

    tools.org_export_as_html(orgfile)
コード例 #35
0
ファイル: ntuple.py プロジェクト: zhixing1996/dhad
def create_bash_dtuple_generic(dataset, grade, skim, label):
    generic_dir = os.path.join(attr.base, 'dat/generic', attr.src)
    log_dir = generic_dir
    outputdir = generic_dir

    comname = 'generic_%s_%s_%s' % (grade, skim, dataset)

    logfile_name = comname + '.txt'
    code_dir = os.path.join(attr.base, 'src', attr.src, 'proc')
    logfile = os.path.join(log_dir, logfile_name)

    qjobname = 'g%s%s' % (skim.replace('lumi', ''), dataset.replace(
        'data', 'd'))

    if len(qjobname) > 7:
        qjobname = dataset.replace('data', 'g')
        items = qjobname.split('_')
        if len(items) > 2:
            qjobname = '_'.join([items[0], items[-1]])

    inputdata = comname

    backup_and_remove(logfile)

    if _debug:
        sys.stdout.write('\ndebug: outputdir %s\n' % generic_dir)
        sys.stdout.write('\ndebug: logfile %s\n' % logfile)
        sys.stdout.write('\ndebug: inputdata %s\n' % inputdata)
        sys.stdout.write('\ndebug: qjobname %s\n' % qjobname)

    if not os.access(outputdir, os.F_OK):
        sys.stdout.write('Creating dir %s...' % outputdir)
        os.makedirs(outputdir)
        sys.stdout.write(' done.\n')

    fname = comname

    bash_file_name = comname + '.sh'

    bash_file = os.path.join(attr.genpath, bash_file_name)

    bash_content = '''#!/bin/sh
# request Bourne shell as shell for job
#$ -S /usr/local/bin/bash
#$ -j y
#$ -m ea
#$ -M [email protected]

# print date and time
date
hostname

. /nfs/cleo3/Offline/scripts/cleo3logins
. /nfs/cleo3/Offline/scripts/cleo3defs

cd %s
. local_setup

export INPUTDATA=%s
export OUTPUTDIR=%s
export FNAME=%s
export USE_SETUP_ANALYSIS=1

suez -f HadronicDNtupleProc/Test/loadHadronicDNtupleProc.tcl
# print date and time again
date

''' % (code_dir, inputdata, outputdir, fname)

    f = UserFile()
    f.append(bash_content)
    f.output(bash_file)

    return logfile, qjobname, bash_file
コード例 #36
0
ファイル: __init__.py プロジェクト: xshi/dhad
def main(opts, args):
    if args[0] == 'backgrounds':
        import backgrounds
        backgrounds.main(opts, args[1:])
        return

    if args[0] == 'brs':
        import brs
        brs.main(opts, args[1:])
        return

    if args[0] == 'compare':
        import compare
        compare.main(opts, args[1:])
        return

    if args[0] == 'cbx':
        import cbx
        cbx.main(opts, args[1:])
        return

    if args[0] == 'crossfeeds':
        import crossfeeds
        crossfeeds.main(opts, args[1:])
        return

    if args[0] == 'evt':
        import evt
        evt.main(opts, args[1:])
        return

    if args[0] == 'fun':
        import fun
        fun.main(opts, args[1:])
        return

    if args[0] == 'kkmass':
        import kkmass
        kkmass.main(opts, args[1:])
        return

    if args[0] == 'kpimass':
        import kpimass
        kpimass.main(opts, args[1:])
        return

    if args[0] == 'trim':
        import trim
        trim.main(opts, args[1:])
        return

    if args[0] == 'trkmtm':
        import trkmtm
        trkmtm.main(opts, args[1:])
        return

    if args[0] == 'trkmtm1':
        import trkmtm1
        trkmtm1.main(opts, args[1:])
        return

    if args[0] == 'trkmtm2':
        import trkmtm2
        trkmtm2.main(opts, args[1:])
        return

    if args[0] == 'var':
        import var
        var.main(opts, args[1:])
        return


    figname = '_'.join(args).replace('/', '_')

    parsed = parse_args(args)
    dt_type  = parsed[0]
    tag = parsed[1]
    modes = parsed[2]
    label = parsed[3]

    sqrt = False
    if opts.set and opts.set == 'sqrt':
        sqrt = True

    linr = False
    if opts.set and opts.set == 'linr':
        linr = True


    org = UserFile()
    org.append(attr.fig_web_header)

    for mode in modes:
        if mode == 'double_all_d0s' or mode == 'double_all_dps' :
            modekey = mode
        else:
            modekey = get_modekey(mode)
        if sqrt:
            sqrt_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write('Creating %s ...' % mode)
        sys.stdout.flush()
        msg = create_fig_mode(tag, dt_type, modekey, label)
        sys.stdout.write(' OK.\n')
        org.append(msg)

    org.append(attr.fig_web_footer)
    figlabel = label.split('/')[0]

    figname = figname.replace(figlabel, '')
    figname = figname.replace('__', '_')

    orgname = figname+'.org'
    orgname = orgname.replace('_.org', '.org')
    orgpath = os.path.join(attr.figpath, figlabel)
    orgfile = tools.check_and_join(orgpath, orgname)
    
    verbose = opts.verbose
    if opts.test:
        verbose = 1

    org.output(orgfile, verbose=verbose)
    orglink = '[[./fig/%s/%s][figure]]' %(figlabel, orgname)
    sys.stdout.write('\n%s\n\n' % orglink)

    if opts.test:
        return

    tools.org_export_as_html(orgfile)
コード例 #37
0
ファイル: ntuple.py プロジェクト: zhixing1996/dhad
def create_bash_interact(opts, mode, label, proc_version):
    bashname = 'dtuple-interact.sh'

    CGRELEASE = attr.cleog
    P2RELEASE = attr.pass2
    DSKIMRELEASE = attr.dskim
    CGSUFFIX = '_' + CGRELEASE
    SUFFIX = CGSUFFIX + '_' + P2RELEASE
    TOPDIR = os.path.join(attr.base, 'dat/signal', label)
    SCRIPTDIR = os.path.join(TOPDIR, 'src')

    logname = 'dtuple-%s.txt' % mode
    logpath = os.path.join(TOPDIR, 'log%s' % SUFFIX)
    logfile = set_file(extbase=logpath, comname=logname)

    code_dir = os.path.join(attr.base, 'src', proc_version, 'proc')
    outputdir = os.path.join(attr.base, 'dat/signal', label,
                             'dtuple_' + attr.cleog + '_' + attr.pass2)

    if not os.access(outputdir, os.F_OK):
        sys.stdout.write('Creating dir %s ...\n' % outputdir)
        os.makedirs(outputdir)

    bash_content = '''#!/usr/local/bin/bash
date
hostname

. /nfs/cleo3/Offline/scripts/cleo3logins
. /nfs/cleo3/Offline/scripts/cleo3defs

export CGRELEASE=%s
export P2RELEASE=%s
export DSKIMRELEASE=%s
export CGSUFFIX=%s
export SUFFIX=%s
export TOPDIR=%s
export SCRIPTDIR=%s

LOGDIR=$TOPDIR/log$SUFFIX

cd %s
. local_setup

STRING="%s"

if [ ! -e $SCRIPTDIR/tmp ] ; then mkdir -p $SCRIPTDIR/tmp; fi
if [ ! -e $TOPDIR/dtuple$SUFFIX ] ; then mkdir $TOPDIR/dtuple$SUFFIX ; fi

export INDIR=$TOPDIR/dskim$SUFFIX

export INPUTDATA=USERLOCALMC_SKIMMED
export USE_SETUP_ANALYSIS=1

export OUTPUTDIR=$TOPDIR/dtuple$SUFFIX/$LABEL
export FILELIST=$SCRIPTDIR/pds_files/dt-$STRING
export FNAME=$STRING
suez -f HadronicDNtupleProc/Test/loadHadronicDNtupleProc.tcl

date
''' % (CGRELEASE, P2RELEASE, DSKIMRELEASE, CGSUFFIX, SUFFIX, TOPDIR, SCRIPTDIR,
       code_dir, mode)

    bash_file = os.path.join(attr.datpath, 'signal', label, 'src', bashname)
    f = UserFile()
    f.append(bash_content)

    verbose = opts.verbose
    if opts.test:
        verbose = 1
    f.output(bash_file, verbose=verbose)
    os.chmod(bash_file, 0755)

    return bash_file, logfile
コード例 #38
0
ファイル: brs.py プロジェクト: zhixing1996/dhad
def create_brsfile_three(args):
    comname = '_'.join(args)
    comname = comname.replace('.', '_')

    brsfile = set_file(extbase=attr.srcmnfpath, comname=comname, ext='mnf')
    brs = UserFile()
    header = r'''
set def
del 0
dep nmodes = 9

'''

    brs.append(header)

    label_0, content_0 = get_brs(args[0])

    label_1, content_1 = get_brs(args[2])
    label_2, content_2 = get_brs(args[1])
        
    brs.extend(content_0)
    brs.extend(content_1)

    hmin = 0.4
    hmax = 1.6
    xleft = 0.45
    textsize = 0.45

    if args[0] == 'pdg2010':
        hmin = 0.85
        hmax = 1.10
        xleft = 0.86
        
    trunk = r'''
exec colors
dep yoffset = -0.15
exec pdgCompareMany %s %s white mustard burgundy "%s" 4 "%s" 8

! Add another set of data points
rename 1 11
rename 2 12

''' % (hmin, hmax, label_0, label_1)
 
    brs.append(trunk)
    brs.extend(content_0)
    brs.extend(content_2)
        
    footer = r'''
dep yoffset = 0.15
exec pdgCompareMany %s %s white mustard burgundy "%s" 3 "%s" 6.5

over 11 -60/lavender
over 12 -60/lavender

key
1
new
1000
%s
13 17.5 0.4 0 left cm -2000 lavender 3 0.01 black

draw line 1 black 1 plot
%s, -3.5
%s, -3.5


! xleft is the x position of the mode label in plot units
dep xleft = %s
dep textsize = %s

exec pdgCompareComment 1 xleft textsize "'K^-![p]^+'"
exec pdgCompareComment 2 xleft textsize "'K^-![p]^+![p]^0!'"
exec pdgCompareComment 3 xleft textsize "'K^-![p]^+![p]^-![p]^+!'"
exec pdgCompareComment 4 xleft textsize "'K^-![p]^+![p]^+!'"
exec pdgCompareComment 5 xleft textsize "'K^-![p]^+![p]^+![p]^0!'"
exec pdgCompareComment 6 xleft textsize "'K^0?S![p]^+!'"
exec pdgCompareComment 7 xleft textsize "'K^0?S![p]^+![p]^0!'"
exec pdgCompareComment 8 xleft textsize "'K^0?S![p]^+![p]^-![p]^+!'"
exec pdgCompareComment 9 xleft textsize "'K^-!K^+![p]^+!'"

hard epost
'''  % (hmin, hmax, label_0, label_2, label_1, hmin, hmax, xleft, textsize)
    brs.append(footer)
    brs.output(brsfile)
    return brsfile
コード例 #39
0
def cleog_mode(opts, mode, label, tasks=[1]):
    sys.stdout.write('dhad.gen: Mode %s \n' % mode)
    sys.stdout.write('dhad.gen: Label %s \n' % label)
    sys.stdout.write('dhad.gen: Task %s \n' % tasks)

    check_decfile(opts, mode, label)
    check_and_copy_file(opts, label, 'genmc.tcl')
    check_and_copy_file(opts, label, 'runlist')
    check_and_copy_file(opts, label, 'cleog-generic-array.sh')

    jobtype = 'cleog'
    seeds = tools.parse_opts_set(opts.set, 'seeds')

    edit_fix_single_mode_list(opts, mode, label)

    create_tag_numbers_file(opts, mode, label)

    for task_id in tasks:
        if opts.set and 'interact' in opts.set:
            bash_file, logfile = create_bash_interact(jobtype,
                                                      mode,
                                                      task_id,
                                                      label=label,
                                                      seeds=seeds)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
            else:
                subprocess.Popen(bash_file)
            continue

        if opts.set and 'bg' in opts.set:
            bash_file, logfile = create_bash_interact(jobtype,
                                                      mode,
                                                      task_id,
                                                      label=label,
                                                      seeds=seeds)
            if opts.test:
                sys.stdout.write(bash_file + '\n')
                sys.stdout.write(logfile + '\n')
            else:
                sys.stdout.write('Save log as %s.\n' % logfile)
                process = subprocess.Popen(bash_file,
                                           stdout=subprocess.PIPE,
                                           stderr=subprocess.STDOUT)
                f = UserFile()
                f.append(process.communicate()[0])
                f.output(logfile)

            continue

        bash_file = create_bash_fix_mc_job(jobtype,
                                           label,
                                           task_id,
                                           seeds=seeds)

        if opts.test:
            sys.stdout.write(bash_file + '\n')
            continue

        output = commands.getoutput(bash_file)
        sys.stdout.write(output + '\n')