Exemple #1
0
         '120' : 0.14300/0.0710*3*0.108*3*0.108,
         '125' : 0.21600/0.0637*3*0.108*3*0.108,
         '130' : 0.30500/0.0548*3*0.108*3*0.108,
         '135' : 0.40300/0.0452*3*0.108*3*0.108,
         '140' : 0.50300/0.0354*3*0.108*3*0.108,
         '145' : 0.60200/0.0261*3*0.108*3*0.108,
         }
     ## multiply with proper xsec and correct for proper BR everywhere, where any of the above processes occurs
     for file in glob.glob("{SETUP}/em/*inputs-sm-*.root".format(SETUP=setup)) :
         os.system("scale2SM.py -i {FILE} -s '{PROCS}' {MASSES}".format(
             FILE=file,
             PROCS=', '.join(hww_processes),
             MASSES=' '.join(masses)
             ))
         for proc in hww_processes :
             for mass in parseArgs(masses) :
                 os.system(r"root -l -b -q {CMSSW_BASE}/src/HiggsAnalysis/HiggsToTauTau/macros/rescaleSignal.C+\(true,{SCALE},\"{INPUTFILE}\",\"{PROCESS}\",0\)".format(
                     CMSSW_BASE=os.environ.get("CMSSW_BASE"),
                     SCALE=hww_over_htt[str(mass)]*float(options.hww_scale),
                     INPUTFILE=file,
                     PROCESS=proc+str(mass)
                     ))
 ## set up directory structure
 dir = "{CMSSW_BASE}/src/setups{LABEL}".format(CMSSW_BASE=cmssw_base, LABEL=options.label)
 if os.path.exists(dir) :
     if os.path.exists(dir.replace('src/', 'src/backup/')):
         os.system("rm -r "+dir.replace('src/', 'src/backup/'))
     os.system("mv {DIR} {CMSSW_BASE}/src/backup/".format(DIR=dir, CMSSW_BASE=cmssw_base))
 os.system("mkdir -p {DIR}".format(DIR=dir))
 for ana in analyses :
     if 'hww-bg' in ana :
    if not os.path.exists("{OUTPUT}/{CHN}{LABEL}".format(OUTPUT=options.out, CHN=channel, LABEL=label)) :
        os.system("mkdir {OUTPUT}/{CHN}{LABEL}".format(OUTPUT=options.out, CHN=channel, LABEL=label))
for channel in channels :
    category_names = directories(channel)
    for cat in categories[channel] :
        for dir in category_names[channel][cat]:
            if not os.path.exists("{OUTPUT}/{DIR}{LABEL}".format(OUTPUT=options.out, DIR=dir, LABEL=label)) :
                os.system("mkdir {OUTPUT}/{DIR}{LABEL}".format(OUTPUT=options.out, DIR=dir, LABEL=label))

verb = "-v" if options.verbose else ""

for channel in channels :
    category_names = directories(channel)
    for period in periods :
        for cat in categories[channel] :
            for mass in parseArgs(args) :
                if options.model!="" :
                    print "setup directory structure for", options.analysis, options.model, period, channel, cat, mass
                    ## setup combined
                    os.system("cvs2local.py -i {INPUT} -o {OUTPUT} -p {PER} -a {ANA} -c {CHN} --model={MODEL} --no-update --{ANA}-categories-{CHN} {CAT} {VERB} -- {MASS}".format(
                        INPUT=options.input, OUTPUT=options.out+"/cmb"+label, PER=period, ANA=options.analysis, CHN=channel, MODEL=options.model, CAT=cat, VERB=verb, MASS=mass))
                    if options.setup == "all" or options.setup == "chn" :
                        ## setup channel-wise
                        os.system("cvs2local.py -i {INPUT} -o {OUTPUT} -p {PER} -a {ANA} -c {CHN} --model={MODEL} --no-update --{ANA}-categories-{CHN} {CAT} {VERB} -- {MASS}".format(
                            INPUT=options.input, OUTPUT=options.out+"/"+channel+label, PER=period, ANA=options.analysis, CHN=channel, MODEL=options.model, CAT=cat, VERB=verb, MASS=mass))
                    if options.setup == "all" or options.setup == "cat" :
                        ## setup category-wise
                        for category in category_names[channel][cat]:
                            os.system("cvs2local.py -i {INPUT} -o {OUTPUT} -p {PER} -a {ANA} -c {CHN} --model={MODEL} --no-update  --{ANA}-categories-{CHN} {CAT} {VERB} -- {MASS}".format(
                                INPUT=options.input, OUTPUT=options.out+"/"+category+label, PER=period, ANA=options.analysis, CHN=channel, MODEL=options.model, CAT=cat, VERB=verb, MASS=mass))
    if not os.path.exists("{OUTPUT}/{CHN}{LABEL}".format(OUTPUT=options.out, CHN=channel, LABEL=label)) :
        os.system("mkdir {OUTPUT}/{CHN}{LABEL}".format(OUTPUT=options.out, CHN=channel, LABEL=label))
for channel in channels :
    category_names = directories(channel)
    for cat in categories[channel] :
        for dir in category_names[channel][cat]:
            if not os.path.exists("{OUTPUT}/{DIR}{LABEL}".format(OUTPUT=options.out, DIR=dir, LABEL=label)) :
                os.system("mkdir {OUTPUT}/{DIR}{LABEL}".format(OUTPUT=options.out, DIR=dir, LABEL=label))

verb = "-v" if options.verbose else ""

for channel in channels :
    category_names = directories(channel)
    for period in periods :
        for cat in categories[channel] :
            for mass in parseArgs(args) :
                print "setup directory structure for", options.analysis, period, channel, cat, mass
                ## setup combined
                os.system("cvs2local.py -i {INPUT} -o {OUTPUT} -p {PER} -a {ANA} -c {CHN} --no-update --{ANA}-categories-{CHN} {CAT} {VERB} {MASS}".format(
                    INPUT=options.input, OUTPUT=options.out+"/cmb"+label, PER=period, ANA=options.analysis, CHN=channel, CAT=cat, VERB=verb, MASS=mass))
                if options.setup == "all" or options.setup == "chn" :
                    ## setup channel-wise
                    os.system("cvs2local.py -i {INPUT} -o {OUTPUT} -p {PER} -a {ANA} -c {CHN} --no-update --{ANA}-categories-{CHN} {CAT} {VERB} {MASS}".format(
                        INPUT=options.input, OUTPUT=options.out+"/"+channel+label, PER=period, ANA=options.analysis, CHN=channel, CAT=cat, VERB=verb, MASS=mass))
                if options.setup == "all" or options.setup == "cat" :
                    ## setup category-wise
                    for category in category_names[channel][cat]:
                        os.system("cvs2local.py -i {INPUT} -o {OUTPUT} -p {PER} -a {ANA} -c {CHN} --no-update  --{ANA}-categories-{CHN} {CAT} {VERB} {MASS}".format(
                            INPUT=options.input, OUTPUT=options.out+"/"+category+label, PER=period, ANA=options.analysis, CHN=channel, CAT=cat, VERB=verb, MASS=mass))

	parser.add_argument("-w", "--weight", default="1.0",
	                    help="Additional weight (cut) expression. [Default: %(default)s]")
	parser.add_argument("-m", "--higgs-masses", nargs="+", default=["125"],
	                    help="Higgs masses. [Default: %(default)s]")
	parser.add_argument("--analysis-modules", default=[], nargs="+",
	                    help="Additional analysis Modules. [Default: %(default)s]")
	parser.add_argument("-a", "--args", default="--plot-modules PlotRootHtt",
	                    help="Additional Arguments for HarryPlotter. [Default: %(default)s]")
	parser.add_argument("-n", "--n-processes", type=int, default=1,
	                    help="Number of (parallel) processes. [Default: %(default)s]")
	parser.add_argument("-f", "--n-plots", type=int,
	                    help="Number of plots. [Default: all]")

	args = parser.parse_args()
	logger.initLogger(args)
	args.higgs_masses = parseArgs(args.higgs_masses)
	
	list_of_samples = [getattr(samples.Samples, sample) for sample in args.samples]
	sample_settings = samples.Samples()
	
	args.categories = [None if category == "None" else category for category in args.categories]
	
	configs = []
	for channel in args.channels:
		for category in args.categories:
			
			configs.append(sample_settings.get_config(
					samples=list_of_samples,
					channel=channel,
					category=category,
					higgs_masses=args.higgs_masses,
Exemple #5
0
        traceback.print_exception(type, value, tb)
        print
        # ...then start the debugger in post-mortem mode.
        pdb.pm()


sys.excepthook = info

## catch up user input errors with analsis=sm and sm_to_mssm=True
if options.analysis == "sm":
    options.sm_to_mssm = False

## detemine list of channels and list of periods from the datacards in the input
## directory

files = os.listdir("%s/%s" % (options.input, parseArgs(args)[0]))
# expr1  = r"(?P<ANALYSIS>v?htt)_^.*
expr = r"(?P<ANALYSIS>v?htt)_(?P<CHANNEL>\w+)_(?P<CATEGORY>[a-z0-9]+)_(?P<PERIOD>[0-9][a-zA-Z]*).txt"
exprV = r"(?P<CHANNEL>v?htt)_(?P<CATEGORY>[a-z0-9]+)_(?P<PERIOD>[0-9][a-zA-Z]*).txt"
exprB = r"(?P<ANALYSIS>v?htt)_(?P<CHANNEL>\w+)_(?P<CATEGORY>[a-z0-9]+)_?(?P<PERIOD>[a-zA-Z0-9]*).txt"
for file in files:
    matcher = re.compile(exprB)
    if not ".txt" in file:
        continue
    if file == "tmp.txt":
        # Ignore generated combined file - can't be parsed..
        continue
    an = matcher.match(file).group("ANALYSIS")
    matcher = re.compile(exprV)
    if an != "vhtt":
        matcher = re.compile(expr)
Exemple #6
0
      # we are NOT in interactive mode, print the exception...
      traceback.print_exception(type, value, tb)
      print
      # ...then start the debugger in post-mortem mode.
      pdb.pm()

sys.excepthook = info

## catch up user input errors with analsis=sm and sm_to_mssm=True
if options.analysis=="sm" :
    options.sm_to_mssm=False

## detemine list of channels and list of periods from the datacards in the input
## directory

files = os.listdir("%s/%s" % (options.input, parseArgs(args)[0]))
#expr1  = r"(?P<ANALYSIS>v?htt)_^.*
expr   = r"(?P<ANALYSIS>v?htt)_(?P<CHANNEL>\w+)_(?P<CATEGORY>[a-z0-9]+)_(?P<PERIOD>[0-9][a-zA-Z]*).txt"
exprV  = r"(?P<CHANNEL>v?htt)_(?P<CATEGORY>[a-z0-9]+)_(?P<PERIOD>[0-9][a-zA-Z]*).txt"
exprB  = r"(?P<ANALYSIS>v?htt)_(?P<CHANNEL>\w+)_(?P<CATEGORY>[a-z0-9]+)_?(?P<PERIOD>[a-zA-Z0-9]*).txt"
for file in files :
    matcher = re.compile(exprB)
    if not ".txt" in file :
        continue
    if file == 'tmp.txt':
        # Ignore generated combined file - can't be parsed..
        continue
    an  = matcher.match(file).group('ANALYSIS')
    matcher = re.compile(exprV)
    if an != 'vhtt' :
        matcher = re.compile(expr)
Exemple #7
0
from HiggsAnalysis.HiggsToTauTau.summer13_analyses_cfg import htt_mt,htt_et,htt_em
for chn in config.channels:
    directories[chn] = locals()['htt_'+chn](config.inputs[chn])

## postfix pattern for input files
patterns = {
    'no-bbb'         : '',
    'bbb'            : '',
    }

if options.update_all :
    options.update_setup     = True
    options.update_aux       = True
    options.update_limits    = True

masspoints = parseArgs(args)
masspoints = [str(points) for points in masspoints]

print "# --------------------------------------------------------------------------------------"
print "# dobbA.py "
print "# --------------------------------------------------------------------------------------"
print "# You are using the following configuration: "
print "# --channels                :", ' '.join(config.channels)
print "# --periods                 :", ' '.join(config.periods)
print "# --analyses                :", options.analyses
print "# --label                   :", options.label
print "# --drop-list               :", options.drop_list
print "# --ignore-during-scaling   :", options.do_not_scales
print "# --new-merging             :", options.new_merging
print "# --new-merging-threshold   :", options.new_merging_threshold
print "# --drop-bbb-normalisation  :", options.drop_normalize_bbb
        "--args",
        default="--plot-modules PlotRootHtt",
        help="Additional Arguments for HarryPlotter. [Default: %(default)s]",
    )
    parser.add_argument(
        "-r", "--ratio", default=False, action="store_true", help="Add ratio subplot. [Default: %(default)s]"
    )
    parser.add_argument(
        "-n", "--n-processes", type=int, default=1, help="Number of (parallel) processes. [Default: %(default)s]"
    )
    parser.add_argument("-f", "--n-plots", type=int, help="Number of plots. [Default: all]")

    args = vars(parser.parse_args())
    logger.initLogger(args)

    args["higgs_masses"] = parseArgs(args["higgs_masses"])

    root_file = ROOT.TFile(args["input"], "READ")
    keys = root_file.GetListOfKeys()

    directories = [
        keys.At(index).GetName() for index in range(keys.GetSize()) if keys.At(index).GetClassName() == "TDirectoryFile"
    ]
    histograms = {}

    for directory in directories:
        root_dir = root_file.Get(directory)
        keys = root_dir.GetListOfKeys()
        histograms[directory] = [
            keys.At(index).GetName()
            for index in range(keys.GetSize())