def main():
    print "# --------------------------------------------------------------------------------------"
    print "# Modify cgs.conf file. "
    print "# --------------------------------------------------------------------------------------"
    print "# You are using the following configuration: "
    print "# --setup             :", opt.setuppath
    print "# --channels          :", opt.channels
    print "# --periods           :", opt.periods
    print "# --categories        :", opt.categories
    print "# --add-to-signal     :", opt.addsignal
    print "# --add-to-background :", opt.addbackground
    print "# Check option --help in case of doubt about the meaning of one or more of these confi-"
    print "# guration parameters.                           "
    print "# --------------------------------------------------------------------------------------"

    setuppath = opt.setuppath
    cgs_shuffle = UncertAdaptor()
    for channel in opt.channels:
        for period in opt.periods:
            for category in opt.categories:
                filename = "{SETUP}/{CHANNEL}/cgs-{ANA}-{PERIOD}-{CATEGORY}.conf".format(
                    SETUP=setuppath, CHANNEL=channel, ANA=opt.analysis, PERIOD=period, CATEGORY=category
                )
                print "processing file:", filename
                cgs_shuffle.cgs_processes(filename, opt.addsignal, opt.addbackground)
Exemplo n.º 2
0
def add_zero_jet(path) :
    """
    Add signal to the 0jet event categories
    """
    cgs_adaptor = UncertAdaptor()
    for channel in config.channels:
        for period in config.periods:
            for category in config.categories[channel][period]:
                if '0jet' in config.categoryname[channel][config.categories[channel][period].index(category)]:
                    filename="{PATH}/{CHANNEL}/cgs-sm-{PERIOD}-{CATEGORY}.conf".format(PATH=path, CHANNEL=channel, PERIOD=period, CATEGORY=category if int(category)>9 else '0'+category)
                    print 'processing file:', filename
                    cgs_adaptor.cgs_processes(filename,['ggH','qqH','VH'])
Exemplo n.º 3
0
def main() :
    print "# --------------------------------------------------------------------------------------"
    print "# Modify cgs.conf file. "
    print "# --------------------------------------------------------------------------------------"
    print "# You are using the following configuration: "
    print "# --setup             :", opt.setuppath
    print "# --channels          :", opt.channels
    print "# --periods           :", opt.periods
    print "# --categories        :", opt.categories
    print "# --add-to-signal     :", opt.addsignal
    print "# --add-to-background :", opt.addbackground
    print "# Check option --help in case of doubt about the meaning of one or more of these confi-"
    print "# guration parameters.                           "
    print "# --------------------------------------------------------------------------------------"

    setuppath=opt.setuppath
    cgs_shuffle = UncertAdaptor()
    for channel in opt.channels :
        for period in opt.periods :
            for category in opt.categories :
                filename="{SETUP}/{CHANNEL}/cgs-{ANA}-{PERIOD}-{CATEGORY}.conf".format(SETUP=setuppath, CHANNEL=channel, ANA=opt.analysis, PERIOD=period, CATEGORY=category)
                print 'processing file:', filename
                cgs_shuffle.cgs_processes(filename, opt.addsignal, opt.addbackground)
Exemplo n.º 4
0
def add_zero_jet(path) :
    """
    Add signal to the 0jet event categories
    """
    cgs_adaptor = UncertAdaptor()
    for channel in config.channels:
        for period in config.periods:
            for category in config.categories[channel][period]:
                if '0jet' in config.categoryname[channel][int(category)]:
                    filename="{PATH}/{CHANNEL}/cgs-sm-{PERIOD}-0{CATEGORY}.conf".format(PATH=path, CHANNEL=channel, PERIOD=period, CATEGORY=category)
                    print 'processing file:', filename
                    cgs_adaptor.cgs_processes(filename,['ggH','qqH','VH'])
            if options.add_mutau_soft and channel == 'mt' and period == '8TeV':
                for category in 10, 11, 12:
                    filename="{PATH}/{CHANNEL}/cgs-sm-{PERIOD}-{CATEGORY}.conf".format(PATH=path, CHANNEL=channel, PERIOD=period, CATEGORY=category)
                    print 'processing file:', filename
                    cgs_adaptor.cgs_processes(filename,['ggH','qqH','VH'])
                             NORMALIZE=normalize_bbb,
                             CAT=config.bbbcat[chn][per][idx],
                             PROC=config.bbbproc[chn][idx].replace(
                                 '>', ',') if options.new_merging else
                             config.bbbproc[chn][idx],
                             THR=config.bbbthreshold[chn]))
                 os.system("rm -rf {DIR}/{ANA}".format(DIR=dir,
                                                       ANA=ana))
                 os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(
                     DIR=dir, ANA=ana))
 if options.SMHasBackground:
     analysesv2 = []
     for ana in analyses:
         os.system("cp -r {DIR}/{TARGET} {DIR}/{TARGET}-SMHbkg".format(
             DIR=dir, TARGET=ana))
         cgs_adaptor = UncertAdaptor()
         for chn in ['em', 'et', 'mm', 'mt', 'tt']:
             if chn in config.channels:
                 for period in config.periods:
                     for category in config.categories[chn][period]:
                         filename = "{DIR}/{TARGET}-SMHbkg/{CHN}/cgs-mssm-{PERIOD}-0{CATEGORY}.conf".format(
                             DIR=dir,
                             TARGET=ana,
                             CHN=chn,
                             PERIOD=period,
                             CATEGORY=category)
                         print 'processing file:', filename
                         cgs_adaptor.cgs_processes(
                             filename, None,
                             ['ggH_SM125', 'qqH_SM125', 'VH_SM125'],
                             None, None)
                        os.system("add_bbb_errors.py '{CHN}:{PER}:{CAT}:{PROC}' --normalize -f --in {DIR}/{ANA} --out {DIR}/{ANA}-tmp --threshold {THR} --mssm".format(
                            CHN=chn,
                            PER=per,
                            CAT=config.bbbcat[chn][per][idx],
                            PROC=config.bbbproc[chn][idx],
                            DIR=dir,
                            ANA=ana,
                            THR=config.bbbthreshold[chn]
                            ))                   
                        os.system("rm -rf {DIR}/{ANA}".format(DIR=dir, ANA=ana))
                        os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(DIR=dir, ANA=ana))
        if options.SMHasBackground : 
            analysesv2 = []
            for ana in analyses :
                os.system("cp -r {DIR}/{TARGET} {DIR}/{TARGET}-SMHbkg".format(DIR=dir, TARGET=ana))
                cgs_adaptor = UncertAdaptor()
                for chn in ['em', 'et', 'mm', 'mt', 'tt']:
                    if chn in config.channels:
                        for period in config.periods:
                            for category in config.categories[chn][period]:
                                filename="{DIR}/{TARGET}-SMHbkg/{CHN}/cgs-mssm-{PERIOD}-0{CATEGORY}.conf".format(DIR=dir, TARGET=ana, CHN=chn, PERIOD=period, CATEGORY=category)
                                print 'processing file:', filename
                                cgs_adaptor.cgs_processes(filename,None,['ggH_SM125','qqH_SM125','VH_SM125'],None,None)
                analysesv2.append(ana)                
                analysesv2.append(ana+'-SMHbkg')
        analyses=analysesv2
                                
if options.update_aux :
    print "##"
    print "## update aux directory:"
    print "##"
                                        ))
                        os.system("add_bbb_errors.py '{CHN}:{PER}:{CAT}:{PROC}' --normalize -f --in {DIR}/{ANA} --out {DIR}/{ANA}-tmp --threshold {THR}".format(
                            DIR=dir,
                            ANA=ana,
                            CHN=chn,
                            PER=per,
                            CAT=config.bbbcat[chn][per][idx],
                            PROC=config.bbbproc[chn][idx].replace('>',',') if options.new_merging else config.bbbproc[chn][idx],
                            THR=config.bbbthreshold[chn]
                            ))
                        os.system("rm -rf {DIR}/{ANA}".format(DIR=dir, ANA=ana))
                        os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(DIR=dir, ANA=ana))                            
    for ana in analyses :
        if 'hww-sig' in ana :
            os.system("cp -r {DIR}/{SOURCE} {DIR}/{TARGET}".format(DIR=dir, SOURCE=ana[:ana.find(':')], TARGET=ana[ana.find(':')+1:]))
            cgs_adaptor = UncertAdaptor()
            if 'em' in config.channels:
                for period in config.periods:
                    for category in config.categories['em'][period]:
                        filename="{DIR}/{TARGET}/em/cgs-sm-{PERIOD}-0{CATEGORY}.conf".format(DIR=dir, TARGET=ana[ana.find(':')+1:], PERIOD=period, CATEGORY=category)
                        print 'processing file:', filename
                        cgs_adaptor.cgs_processes(filename,['ggH','qqH','VH','ggH_hww','qqH_hww'],None,None,['ggH_hww125','qqH_hww125'])
                for file in glob.glob("{DIR}/{ANA}/em/unc-sm-*.vals".format(DIR=dir, ANA=ana[ana.find(':')+1:])) :
                    os.system("perl -pi -e 's/ggH_hww125/ggH_hww/g' {FILE}".format(FILE=file))
                    os.system("perl -pi -e 's/qqH_hww125/qqH_hww/g' {FILE}".format(FILE=file))

if options.update_aux :
    print "##"
    print "## update aux directory:"
    print "##"    
    ## setup directory structure
Exemplo n.º 8
0
                     os.system("add_bbb_errors.py '{CHN}:{PER}:{CAT}:{PROC}' {NORMALIZE} -f --in {DIR}/{ANA} --out {DIR}/{ANA}-tmp --threshold {THR}".format(
                         DIR=dir,
                         ANA=ana,
                         CHN=chn,
                         PER=per,
                         NORMALIZE=normalize_bbb,
                         CAT=config.bbbcat[chn][per][idx],
                         PROC=config.bbbproc[chn][idx].replace('>',',') if options.new_merging else config.bbbproc[chn][idx],
                         THR=config.bbbthreshold[chn]
                         ))
                     os.system("rm -rf {DIR}/{ANA}".format(DIR=dir, ANA=ana))
                     os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(DIR=dir, ANA=ana))                            
 for ana in analyses :
     if 'hww-sig' in ana :
         os.system("cp -r {DIR}/{SOURCE} {DIR}/{TARGET}".format(DIR=dir, SOURCE=ana[:ana.find(':')], TARGET=ana[ana.find(':')+1:]))
         cgs_adaptor = UncertAdaptor()
         ## drop ggH_hww and qqH_hww template for ee and mm unless
         ## templates for other masspoints but 125 GeV are provided            
         for chn in ['em']:
             if chn in config.channels:
                 for period in config.periods:
                     for category in config.categories[chn][period]:
                         filename="{DIR}/{TARGET}/{CHN}/cgs-sm-{PERIOD}-0{CATEGORY}.conf".format(DIR=dir, TARGET=ana[ana.find(':')+1:], CHN=chn, PERIOD=period, CATEGORY=category)
                         print 'processing file:', filename
                         cgs_adaptor.cgs_processes(filename,['ggH','qqH','VH','ggH_hww','qqH_hww'],None,None,['ggH_hww125','qqH_hww125'])
                 for file in glob.glob("{DIR}/{ANA}/{CHN}/unc-sm-*.vals".format(DIR=dir, ANA=ana[ana.find(':')+1:], CHN=chn)) :
                     if chn in ['ee','mm'] :
                         pass
                     else:
                         os.system("perl -pi -e 's/ggH_hww125/ggH_hww/g' {FILE}".format(FILE=file))
                         os.system("perl -pi -e 's/qqH_hww125/qqH_hww/g' {FILE}".format(FILE=file))
Exemplo n.º 9
0
                                 CAT=config.bbbcat[chn][per][idx],
                                 PROC=config.bbbproc[chn][idx].replace(
                                     '>', ',') if options.new_merging else
                                 config.bbbproc[chn][idx],
                                 THR=config.bbbthreshold[chn]))
                     os.system("rm -rf {DIR}/{ANA}".format(DIR=dir,
                                                           ANA=ana))
                     os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(
                         DIR=dir, ANA=ana))
 for ana in analyses:
     if 'hww-sig' in ana:
         os.system("cp -r {DIR}/{SOURCE} {DIR}/{TARGET}".format(
             DIR=dir,
             SOURCE=ana[:ana.find(':')],
             TARGET=ana[ana.find(':') + 1:]))
         cgs_adaptor = UncertAdaptor()
         if 'em' in config.channels:
             for period in config.periods:
                 for category in config.categories['em'][period]:
                     filename = "{DIR}/{TARGET}/em/cgs-sm-{PERIOD}-0{CATEGORY}.conf".format(
                         DIR=dir,
                         TARGET=ana[ana.find(':') + 1:],
                         PERIOD=period,
                         CATEGORY=category)
                     print 'processing file:', filename
                     cgs_adaptor.cgs_processes(
                         filename,
                         ['ggH', 'qqH', 'VH', 'ggH_hww', 'qqH_hww'], None,
                         None, ['ggH_hww125', 'qqH_hww125'])
             for file in glob.glob("{DIR}/{ANA}/em/unc-sm-*.vals".format(
                     DIR=dir, ANA=ana[ana.find(':') + 1:])):
Exemplo n.º 10
0
                     os.system("add_bbb_errors.py '{CHN}:{PER}:{CAT}{SOFT}:{PROC}' --normalize -f --in {DIR}/{ANA} --out {DIR}/{ANA}-tmp --threshold {THR}".format(
                         DIR=dir,
                         ANA=ana,
                         CHN=chn,
                         PER=per,
                         CAT=config.bbbcat[chn][per][idx],
                         PROC=config.bbbproc[chn][idx],
                         SOFT=',10,11,12,13,15,16' if options.add_mutau_soft and chn=='mt' and per=='8TeV' else '',
                         THR=config.bbbthreshold
                         ))
                     os.system("rm -rf {DIR}/{ANA}".format(DIR=dir, ANA=ana))
                     os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(DIR=dir, ANA=ana))                            
 for ana in analyses :
     if 'hww-bg' in ana :
         os.system("cp -r {DIR}/{SOURCE} {DIR}/{TARGET}".format(DIR=dir, SOURCE=ana[:ana.find(':')], TARGET=ana[ana.find(':')+1:]))
         cgs_adaptor = UncertAdaptor()
         if 'em' in config.channels:
             for period in config.periods:
                 for category in config.categories['em'][period]:
                     filename="{DIR}/{TARGET}/em/cgs-sm-{PERIOD}-0{CATEGORY}.conf".format(DIR=dir, TARGET=ana[ana.find(':')+1:], PERIOD=period, CATEGORY=category)
                     print 'processing file:', filename
                     cgs_adaptor.cgs_processes(filename,None,['ggH_hww','qqH_hww'])
         if 'vhtt' in config.channels:
             for period in config.periods:
                 for category in ['0','1','2','3','4','5','6']:
                     if period == '7TeV' and category == '2': continue
                     filename="{DIR}/{TARGET}/vhtt/cgs-sm-{PERIOD}-0{CATEGORY}.conf".format(DIR=dir, TARGET=ana[ana.find(':')+1:], PERIOD=period, CATEGORY=category)
                     print 'processing file:', filename
                     cgs_adaptor.cgs_processes(filename,None,['WH_hww' if int(cat) < 3 else 'ZH_hww'])
         for file in glob.glob("{DIR}/{TARGET}/em/cgs-sm-*.conf".format(  DIR=dir, TARGET=ana[ana.find(':')+1:])) :
             os.system("perl -pi -e 's/ggH_hww/ggH_hww{MASS}/g' {FILE}".format(MASS='125', FILE=file))
                     os.system("add_bbb_errors.py '{CHN}:{PER}:{CAT}:{PROC}' {NORMALIZE} -f --in {DIR}/{ANA} --out {DIR}/{ANA}-tmp --threshold {THR}".format(
                         DIR=dir,
                         ANA=ana,
                         CHN=chn,
                         PER=per,
                         NORMALIZE=normalize_bbb,
                         CAT=config.bbbcat[chn][per][idx],
                         PROC=config.bbbproc[chn][idx].replace('>',',') if options.new_merging else config.bbbproc[chn][idx],
                         THR=config.bbbthreshold[chn]
                         ))
                     os.system("rm -rf {DIR}/{ANA}".format(DIR=dir, ANA=ana))
                     os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(DIR=dir, ANA=ana))                            
 for ana in analyses :
     if 'hww-sig' in ana :
         os.system("cp -r {DIR}/{SOURCE} {DIR}/{TARGET}".format(DIR=dir, SOURCE=ana[:ana.find(':')], TARGET=ana[ana.find(':')+1:]))
         cgs_adaptor = UncertAdaptor()
         ## drop ggH_hww and qqH_hww template for ee and mm unless
         ## templates for other masspoints but 125 GeV are provided            
         for chn in ['em']:
             if chn in config.channels:
                 for period in config.periods:
                     for category in config.categories[chn][period]:
                         filename="{DIR}/{TARGET}/{CHN}/cgs-sm-{PERIOD}-0{CATEGORY}.conf".format(DIR=dir, TARGET=ana[ana.find(':')+1:], CHN=chn, PERIOD=period, CATEGORY=category)
                         print 'processing file:', filename
                         cgs_adaptor.cgs_processes(filename,['ggH','qqH','WH','ZH','ggH_hww','qqH_hww'],None,None,['ggH_hww125','qqH_hww125'])
                 for file in glob.glob("{DIR}/{ANA}/{CHN}/unc-sm-*.vals".format(DIR=dir, ANA=ana[ana.find(':')+1:], CHN=chn)) :
                     if chn in ['ee','mm'] :
                         pass
                     else:
                         os.system("perl -pi -e 's/ggH_hww125/ggH_hww/g' {FILE}".format(FILE=file))
                         os.system("perl -pi -e 's/qqH_hww125/qqH_hww/g' {FILE}".format(FILE=file))
Exemplo n.º 12
0
                        os.system("add_bbb_errors.py '{CHN}:{PER}:{CAT}:{PROC}' {NORMALIZE} -f --in {DIR}/{ANA} --out {DIR}/{ANA}-tmp --threshold {THR} --AZh".format(
                            DIR=dir,
                            ANA=ana,
                            CHN=chn,
                            PER=per,
                            NORMALIZE=normalize_bbb,
                            CAT=config.bbbcat[chn][per][idx],
                            PROC=config.bbbproc[chn][idx].replace('>',',') if options.new_merging else config.bbbproc[chn][idx],
                            THR=config.bbbthreshold[chn]
                            ))
                        os.system("rm -rf {DIR}/{ANA}".format(DIR=dir, ANA=ana))
                        os.system("mv {DIR}/{ANA}-tmp {DIR}/{ANA}".format(DIR=dir, ANA=ana))
    if options.SMHasBackground : 
        for ana in analyses :
            os.system("cp -r {DIR}/{ANA} {DIR}/{ANA}".format(DIR=dir, ANA=ana))
            cgs_adaptor = UncertAdaptor()
            if chn in config.channels:
                for period in config.periods:
                    for category in config.categories[chn][period]:
                        filename="{DIR}/{ANA}/{CHN}/cgs-AZh-{PERIOD}-0{CATEGORY}.conf".format(DIR=dir, ANA=ana, CHN=chn, PERIOD=period, CATEGORY=category)
                        print 'processing file:', filename
                        cgs_adaptor.cgs_processes(filename,None,['ZH_ww125','ZH_tt125'],None,None)

if options.update_aux :
    print "##"
    print "## update aux directory:"
    print "##"    
    ## setup directory structure
    dir = "{CMSSW_BASE}/src/aux{LABEL}".format(CMSSW_BASE=cmssw_base, LABEL=options.label)
    if os.path.exists(dir) :
        if os.path.exists(dir.replace('src/', 'src/backup/')):