def main() : print "# --------------------------------------------------------------------------------------" print "# tanb_grid_new.py " print "# --------------------------------------------------------------------------------------" print "# You are using the following configuration: " print "# --tanb :", options.tanb print "# --parameter1 :", options.parameter1 #for the lowmH scenario this is the higgs/higgsino mass parameter; everywhere else its mass of A print "# --morphing-htt_ee : ", options.morphing_htt_ee print "# --morphing-htt_em : ", options.morphing_htt_em print "# --morphing-htt_mm : ", options.morphing_htt_mm print "# --morphing-htt_mt : ", options.morphing_htt_mt print "# --morphing-htt_et : ", options.morphing_htt_et print "# --morphing-htt_tt : ", options.morphing_htt_tt print "# --morphing-htaunu_had : ", options.morphing_htaunu_had print "# Check option --help in case of doubt about the meaning of one or more of these confi-" print "# guration parameters. " print "# --------------------------------------------------------------------------------------" ## directory that contains all datacards in question path = args[0] print "path = %s" % path label = '_{PARAMETER1}_{TANB}'.format(PARAMETER1=options.parameter1, TANB=options.tanb) ## mophing configuration morph = { 'htt_ee' : options.morphing_htt_ee, 'htt_em' : options.morphing_htt_em, 'htt_mm' : options.morphing_htt_mm, 'htt_mt' : options.morphing_htt_mt, 'htt_et' : options.morphing_htt_et, 'htt_tt' : options.morphing_htt_tt, 'htaunu_had' : options.morphing_htaunu_had, } ## complete model for given mass and tanb value (including uncertainties) models = {} ## adaptor of the datacard for given mass and tanb value adaptor = ModelDatacard(options, label, options.parameter1, False, options.ana_type) adaptor.cleanup('.' if not path.find('/')>0 else path[:path.rfind('/')], label) ## parse datacard (first go) old_file = open(path, 'r') card = parseCard(old_file, options) old_file.close() ##if ana_type=="Hhh" mH has to be translated into mA if options.ana_type=="Hhh" : #mH has to be translated into mA neededParameter = mX_to_mA(card) else : neededParameter = options.parameter1 ## determine MODEL for given datacard. model = MODEL(float(neededParameter), float(options.tanb), options.modelname) match = re.compile('(?P<CHN>[a-zA-Z0-9]+)_[a-zA-Z0-9]+_[0-9]+_(?P<PER>[a-zA-Z0-9]+)') for bin in card.list_of_bins() : print "processing bin = %s:" % bin ## a bin can be made up of different decay channels or different run periods. Pick decay channel (chn) and run period ## (per) either from bin or from from datacards name in case it is not accessible from bin. if match.match(bin) : chn = match.match(bin).group('CHN') per = match.match(bin).group('PER') else : chn = match.match(path[path.rfind('/')+1:]).group('CHN') per = match.match(path[path.rfind('/')+1:]).group('PER') ## check which processes are still missing for given decay channel and run period missing_procs = model.missing_procs(chn, per, card.list_of_signals()) if len(missing_procs)>0 : if options.ana_type=="Hplus": print "updating model to parameter set:", per, chn, missing_procs, ['mu'] model.setup_model(per, chn, missing_procs, ['mu']) else : print "updating model to parameter set:", per, chn, missing_procs, ['mu', 'pdf'] model.setup_model(per, chn, missing_procs, ['mu', 'pdf']) ## create new datacard new_name = path[:path.rfind('.txt')]+'_%.2f'%float(options.tanb)+'.txt' os.system("cp {SRC} {TARGET}".format(SRC=path, TARGET=new_name)) ## adapt datacards if options.MSSMvsSM : ## this options rejects the scaling of bbH and ggH by 1/tanb -> therefore at each mA/tanb point all signals (including SM) are xs*BR model.tanb = 1 adaptor.make_model_datacard(new_name, model, morph)
def main() : print "# --------------------------------------------------------------------------------------" print "# tangb_grid_new.py " print "# --------------------------------------------------------------------------------------" print "# You are using the following configuration: " print "# --tanb :", options.tanb print "# --mA :", options.mA print "# --morphing-htt_ee : ", options.morphing_htt_ee print "# --morphing-htt_em : ", options.morphing_htt_em print "# --morphing-htt_mm : ", options.morphing_htt_mm print "# --morphing-htt_mt : ", options.morphing_htt_mt print "# --morphing-htt_et : ", options.morphing_htt_et print "# --morphing-htt_tt : ", options.morphing_htt_tt print "# Check option --help in case of doubt about the meaning of one or more of these confi-" print "# guration parameters. " print "# --------------------------------------------------------------------------------------" ## directory that contains all datacards in question path = args[0] label = '_{MASS}_{TANB}'.format(MASS=options.mA, TANB=options.tanb) ## mophing configuration morph = { 'htt_ee' : options.morphing_htt_ee, 'htt_em' : options.morphing_htt_em, 'htt_mm' : options.morphing_htt_mm, 'htt_mt' : options.morphing_htt_mt, 'htt_et' : options.morphing_htt_et, 'htt_tt' : options.morphing_htt_tt, } ## complete model for given mass and tanb value (including uncertainties) models = {} ## adaptor of the datacard for given mass and tanb value adaptor = ModelDatacard(options, label, False) adaptor.cleanup('.' if not path.find('/')>0 else path[:path.rfind('/')], label) ## parse datacard (first go) old_file = open(path, 'r') card = parseCard(old_file, options) old_file.close() ## determine MODEL for given datacard. model = MODEL(float(options.mA), float(options.tanb), options.modelname) match = re.compile('(?P<CHN>\w*)_\w*_[0-9]?_(?P<PER>[0-9]*\w*)') for bin in card.list_of_bins() : ## a bin can be made up of different decay channels or different run periods. Pick decay channel (chn) and run period ## (per) either from bin or from from datacards name in case it is not accessible from bin. if match.match(bin) : chn = match.match(bin).group('CHN') per = match.match(bin).group('PER') else : chn = match.match(path[path.rfind('/')+1:]).group('CHN') per = match.match(path[path.rfind('/')+1:]).group('PER') ## check which processes are still missing for given decay channel and run period missing_procs = model.missing_procs(chn, per, card.list_of_signals()) if len(missing_procs)>0 : print "updating model to parameter set:", per, chn, missing_procs, ['mu', 'pdf'] model.setup_model(per, chn, missing_procs, ['mu', 'pdf']) ## create new datacard new_name = path[:path.rfind('.txt')]+'_%.2f'%float(options.tanb)+'.txt' os.system("cp {SRC} {TARGET}".format(SRC=path, TARGET=new_name)) ## adapt datacards if options.MSSMvsSM : ## this options rejects the scaling of bbH and ggH by 1/tanb -> therefore at each mA/tanb point all signals (including SM) are xs*BR model.tanb = 1 adaptor.make_model_datacard(new_name, model, morph)
def main(): print "# --------------------------------------------------------------------------------------" print "# tanb_grid_new.py " print "# --------------------------------------------------------------------------------------" print "# You are using the following configuration: " print "# --tanb :", options.tanb print "# --parameter1 :", options.parameter1 #for the lowmH scenario this is the higgs/higgsino mass parameter; everywhere else its mass of A print "# --ana_type :", options.ana_type print "# --morphing-htt_ee : ", options.morphing_htt_ee print "# --morphing-htt_em : ", options.morphing_htt_em print "# --morphing-htt_mm : ", options.morphing_htt_mm print "# --morphing-htt_mt : ", options.morphing_htt_mt print "# --morphing-htt_et : ", options.morphing_htt_et print "# --morphing-htt_tt : ", options.morphing_htt_tt print "# --morphing-htaunu_had : ", options.morphing_htaunu_had print "# --morphing-htt-AZh : ", options.morphing_htt_AZh print "# Check option --help in case of doubt about the meaning of one or more of these confi-" print "# guration parameters. " print "# --------------------------------------------------------------------------------------" ## directory that contains all datacards in question path = args[0] print "path = %s" % path label = '_{PARAMETER1}_{TANB}'.format(PARAMETER1=options.parameter1, TANB=options.tanb) ## mophing configuration } morph = { 'htt_ee': options.morphing_htt_ee, 'htt_em': options.morphing_htt_em, 'htt_mm': options.morphing_htt_mm, 'htt_mt': options.morphing_htt_mt, 'htt_et': options.morphing_htt_et, 'htt_tt': options.morphing_htt_tt, 'htaunu_had': options.morphing_htaunu_had, 'htt_AZh': options.morphing_htt_AZh, } ## complete model for given mass and tanb value (including uncertainties) models = {} ## adaptor of the datacard for given mass and tanb value adaptor = ModelDatacard(options, label, options.parameter1, False, options.ana_type) adaptor.cleanup('.' if not path.find('/') > 0 else path[:path.rfind('/')], label) ## parse datacard (first go) old_file = open(path, 'r') card = parseCard(old_file, options) old_file.close() if options.ana_type == "Hhh" and options.postfit: #mH has to be translated into mA to get the correct BR and xs from the model file when making postfit plots neededParameter = mX_to_mA(card) else: neededParameter = options.parameter1 print options.ana_type ## determine MODEL for given datacard. model = MODEL(float(neededParameter), float(options.tanb), options.modelname) match = re.compile( '(?P<CHN>[a-zA-Z0-9]+)_[a-zA-Z0-9]+_[0-9]+_(?P<PER>[a-zA-Z0-9]+)') for bin in card.list_of_bins(): print "processing bin = %s:" % bin ## a bin can be made up of different decay channels or different run periods. Pick decay channel (chn) and run period ## (per) either from bin or from from datacards name in case it is not accessible from bin. if match.match(bin): chn = match.match(bin).group('CHN') per = match.match(bin).group('PER') else: chn = match.match(path[path.rfind('/') + 1:]).group('CHN') per = match.match(path[path.rfind('/') + 1:]).group('PER') ## check which processes are still missing for given decay channel and run period missing_procs = model.missing_procs(chn, per, card.list_of_signals()) if len(missing_procs) > 0: if options.ana_type == "Htaunu": print "updating model to parameter set:", per, chn, missing_procs, [ 'mu' ] model.setup_model(per, chn, missing_procs, ['mu']) elif "2HDM" in options.modelname: print "updating model to parameter set:", per, chn, missing_procs model.setup_model(per, chn, missing_procs) else: print "updating model to parameter set:", per, chn, missing_procs, [ 'mu', 'pdf' ] model.setup_model(per, chn, missing_procs, ['mu', 'pdf']) ## create new datacard new_name = path[:path.rfind('.txt')] + '_%.2f' % float( options.tanb) + '.txt' os.system("cp {SRC} {TARGET}".format(SRC=path, TARGET=new_name)) ## adapt datacards if options.MSSMvsSM: ## this options rejects the scaling of bbH and ggH by 1/tanb -> therefore at each mA/tanb point all signals (including SM) are xs*BR model.tanb = 1 adaptor.make_model_datacard(new_name, model, morph)
def main(): print "# --------------------------------------------------------------------------------------" print "# tangb_grid_new.py " print "# --------------------------------------------------------------------------------------" print "# You are using the following configuration: " print "# --tanb :", options.tanb print "# --mA :", options.mA print "# --morphing-htt_ee : ", options.morphing_htt_ee print "# --morphing-htt_em : ", options.morphing_htt_em print "# --morphing-htt_mm : ", options.morphing_htt_mm print "# --morphing-htt_mt : ", options.morphing_htt_mt print "# --morphing-htt_et : ", options.morphing_htt_et print "# --morphing-htt_tt : ", options.morphing_htt_tt print "# Check option --help in case of doubt about the meaning of one or more of these confi-" print "# guration parameters. " print "# --------------------------------------------------------------------------------------" ## directory that contains all datacards in question path = args[0] label = '_{MASS}_{TANB}'.format(MASS=options.mA, TANB=options.tanb) ## mophing configuration morph = { 'htt_ee': options.morphing_htt_ee, 'htt_em': options.morphing_htt_em, 'htt_mm': options.morphing_htt_mm, 'htt_mt': options.morphing_htt_mt, 'htt_et': options.morphing_htt_et, 'htt_tt': options.morphing_htt_tt, } ## complete model for given mass and tanb value (including uncertainties) models = {} ## adaptor of the datacard for given mass and tanb value adaptor = ModelDatacard(options, label, False) adaptor.cleanup('.' if not path.find('/') > 0 else path[:path.rfind('/')], label) ## parse datacard (first go) old_file = open(path, 'r') card = parseCard(old_file, options) old_file.close() ## determine MODEL for given datacard. model = MODEL(float(options.mA), float(options.tanb), options.modelname) match = re.compile('(?P<CHN>\w*)_\w*_[0-9]?_(?P<PER>[0-9]*\w*)') for bin in card.list_of_bins(): ## a bin can be made up of different decay channels or different run periods. Pick decay channel (chn) and run period ## (per) either from bin or from from datacards name in case it is not accessible from bin. if match.match(bin): chn = match.match(bin).group('CHN') per = match.match(bin).group('PER') else: chn = match.match(path[path.rfind('/') + 1:]).group('CHN') per = match.match(path[path.rfind('/') + 1:]).group('PER') ## check which processes are still missing for given decay channel and run period missing_procs = model.missing_procs(chn, per, card.list_of_signals()) if len(missing_procs) > 0: print "updating model to parameter set:", per, chn, missing_procs, [ 'mu', 'pdf' ] model.setup_model(per, chn, missing_procs, ['mu', 'pdf']) ## create new datacard new_name = path[:path.rfind('.txt')] + '_%.2f' % float( options.tanb) + '.txt' os.system("cp {SRC} {TARGET}".format(SRC=path, TARGET=new_name)) ## adapt datacards adaptor.make_model_datacard(new_name, model, morph)