Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Background/test/BiasStudy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ std::cout << "DEBUG LC 4 " <<std::endl;
if (!skipPlots) paulProfiler.plotNominalFits(it->second,mass,80,Form("%s/plots/toys/job%d_toy%d_fit_paul",outDir.c_str(),jobn,toy));
//continue;
// --------------------------------
// cout << "Fitting toy for truth model " << distance(toys.begin(),it) << "/" << toys.size() << " (" << it->first << ") " << endl;
cout << "Fitting toy for truth model " << distance(toys.begin(),it) << "/" << toys.size() << " (" << it->first << ") " << endl;
// get Fabian envelope
pair<double,map<string,TGraph*> > fabianMinNlls = fabianProfiler.profileLikelihood(it->second,mass,mu,mu_low,mu_high,mu_step);
pair<double,map<string,TGraph*> > fabianEnvelope = fabianProfiler.computeEnvelope(fabianMinNlls,Form("fabEnvelope_job%d_%s_cat%d_toy%d",jobn,it->first.c_str(),cat,toy),0.);
Expand Down
2 changes: 1 addition & 1 deletion Background/test/fTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "RooAbsPdf.h"
#include "RooArgSet.h"
#include "RooFitResult.h"
// #include "RooMinuit.h"
#include "RooMinuit.h"
#include "RooMinimizer.h"
#include "RooMsgService.h"
#include "RooDataHist.h"
Expand Down
182 changes: 112 additions & 70 deletions Background/test/fTest2D.cpp

Large diffs are not rendered by default.

116 changes: 66 additions & 50 deletions Background/test/fTest_2.cpp

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Background/test/pseudodataMaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "RooFitResult.h"
#include "RooPlot.h"
#include "RooMsgService.h"
// #include "RooMinuit.h"
#include "RooMinimizer.h"
#include "RooMinuit.h"
#include "RooPolynomial.h"
#include "RooRandom.h"

Expand Down
3 changes: 1 addition & 2 deletions Background/test/workspaceTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "RooFitResult.h"
#include "RooPlot.h"
#include "RooMsgService.h"
// #include "RooMinuit.h"
#include "RooMinimizer.h"
#include "RooMinuit.h"

#include "boost/program_options.hpp"
#include "boost/algorithm/string/split.hpp"
Expand Down
14 changes: 7 additions & 7 deletions Datacard/RunYields.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def get_options():
parser.add_option('--batch', dest='batch', default='IC', help='Batch')
parser.add_option('--queue', dest='queue', default='microcentury', help='Queue: should not take long (microcentury will do)')
parser.add_option('--jobOpts', dest='jobOpts', default='', help="Additional options to add to job submission. For Condor separate individual options with a colon (specify all within quotes e.g. \"option_xyz = abc+option_123 = 456\")")
parser.add_option('--printOnly', dest='printOnly', default=False, action="store_true", help="Dry run: print(submission files only")
parser.add_option('--printOnly', dest='printOnly', default=False, action="store_true", help="Dry run: print submission files only")
return parser.parse_args()
(opt,args) = get_options()

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RUNNING YIELDS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RUNNING YIELDS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
def leave():
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RUNNING YIELDS (END) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RUNNING YIELDS (END) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
sys.exit(1)

# Store all opts in orderedDict for submissionTools
Expand Down Expand Up @@ -76,25 +76,25 @@ def leave():
if( opt.doNOTAG )&( 'NOTAG' not in options['cats'] ):
if( containsNOTAG(WSFileNames) ): options['cats'] += ',NOTAG'
else:
print(" --> [WARNING] NOTAG dataset not present in input workspace. Skipping NOTAG" )
print " --> [WARNING] NOTAG dataset not present in input workspace. Skipping NOTAG"

options['nCats'] = len(options['cats'].split(","))

print(" --> Running yields for following cats: %s"%options['cats'])
print " --> Running yields for following cats: %s"%options['cats']

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Make directory to store job scripts and output
if not os.path.isdir("%s/yields_%s"%(dwd__,options['ext'])): os.system("mkdir %s/yields_%s"%(dwd__,options['ext']))

# Write submission files: style depends on batch system
writeSubFiles(options)
print(" --> Finished writing submission scripts")
print " --> Finished writing submission scripts"

# Submit scripts to batch system
if not options['printOnly']:
submitFiles(options)
else:
print(" --> Running with printOnly option. Will not submit scripts")
print " --> Running with printOnly option. Will not submit scripts"

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
leave()
2 changes: 1 addition & 1 deletion Datacard/addLineToDatacard.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_options():
(opt,args) = get_options()

if not os.path.exists( opt.inputDatacard ):
print(" --> [ERROR] Input datacard %s does not exist."%opt.inputDatacard)
print " --> [ERROR] Input datacard %s does not exist."%opt.inputDatacard
sys.exit(1)

catLine = ''
Expand Down
21 changes: 11 additions & 10 deletions Datacard/cleanDatacard.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ def isDiag( proc, cat):
#if line.count('pdfindex') and not line.count('_13TeV_2016'): line = line.replace('_13TeV','_13TeV_2016')
outFile.write('%s'%line)
continue
print(print('Processing line %s'%vals[0]))
print
print 'Processing line %s'%vals[0]
line = line.split('lnN')[0] + 'lnN '
for i,effect in enumerate(vals[2:]):
proc = procs[i]
cat = cats[i]
#print('proc = %s'%proc)
#print('cat = %s'%cat)
#print 'proc = %s'%proc
#print 'cat = %s'%cat
if opts.removeNonDiagonal and not isDiag(proc,cat):
line += '- '
continue
Expand All @@ -74,32 +75,32 @@ def isDiag( proc, cat):
if val < factorLo or val > factorHi:
line += '- '
if opts.verbose:
print('Symmetric: replacing value of %1.3f with -'%val)
print 'Symmetric: replacing value of %1.3f with -'%val
else:
line += '%1.3f '%val
elif len(vals) == 2:
valLo = float(vals[0])
valHi = float(vals[1])
if valLo < factorLo or valLo > factorHi:
if opts.verbose:
print('Asymmetric: replacing low value of %1.3f with 1'%valLo)
print 'Asymmetric: replacing low value of %1.3f with 1'%valLo
valLo = 1
if valHi <= factorLo or valHi > factorHi:
if opts.verbose:
print('Asymmetric: replacing high value of %1.3f with 1'%valHi)
print 'Asymmetric: replacing high value of %1.3f with 1'%valHi
valHi = 1
if opts.removeDoubleSided and valHi > 1.000001 and valLo > 1.000001:
#line += '%1.3f '%(0.5*(valHi+valLo))
line += '%1.3f '%(max(valHi,valLo))
if opts.verbose:
#print('DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, 0.5*(valHi+valLo)))
print('DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, max(valHi,valLo)))
#print 'DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, 0.5*(valHi+valLo))
print 'DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, max(valHi,valLo))
elif opts.removeDoubleSided and valHi < 0.999999 and valLo < 0.999999:
#line += '%1.3f '%(0.5*(valHi+valLo))
line += '%1.3f '%(min(valHi,valLo))
if opts.verbose:
#print('DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, 0.5*(valHi+valLo)))
print('DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, min(valHi,valLo)))
#print 'DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, 0.5*(valHi+valLo))
print 'DoubleSided: replacing %1.3f/%1.3f with %1.3f'%(valLo, valHi, min(valHi,valLo))
else:
line += '%1.3f/%1.3f '%(valLo,valHi)
else:
Expand Down
49 changes: 49 additions & 0 deletions Datacard/combineAll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import os.path
import shutil,subprocess

# MX
# 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2200 2400 2600 2800 3000 3500 4000 bbbb boosted
# 300 400 500 600 700 800 900 1000 1100 1200 1400 1600 1800 2000 bbbb
# 300 350 400 450 500 550 600 650 700 750 800 850 900 950 1000 1100 1200 1400 1600 1800 2000 bbgg
# 240 280 320 360 450 400 500 550 600 700 800 900 1000 1200 1400 1600 1800 2000 2500 3000 bbtt

# MX_to_combine = [240, 280, 300, 400, 500, 600, 700, 800, 900, 1000 ]
MX_to_combine = [1200]


# MY
# 60 70 80 90 100 125 150 200 250 300 350 400 450 500 600 bbbb boosted
# 60 70 80 90 100 125 150 200 250 300 400 500 600 700 800 900 1000 1200 1400 1600 1800 bbbb
# 60 70 80 90 100 150 250 300 400 500 600 650 700 800 900 1000 1100 1200 1300 1400 1600 1800 2000 2200 2400 2600 2800 bbtt
# 90 100 150 200 250 300 400 500 600 700 800 900 1000 1200 1400 1600 1800 bbgg

MY_to_combine = [ 80,100,300,400,500,600,700,900,1000 ]
# MY_to_combine = [100 ]


folders_to_combine = {
"bbbb_hy" : "/eos/user/z/zhjie/CMSSW_10_2_13/src/flashggFinalFit/Datacard/4b_res/datacard_mass_Xxx_Yyy.txt", # scalling all signals to 1 fb X BR (H)
"bbgg_hy" : "/eos/user/z/zhjie/CMSSW_10_2_13/src/flashggFinalFit/Datacard/bbgg/datacard_mass_Xxx_Yyy.txt", # scalling all signals to 1 fb X BR (H)
# "bbtt_hy" : "bbtt/HY/v3/datacard_mass_Xxx_Yyy.txt", # scalling all signals to 1 fb X BR (H)
"bbbb_boosted_hy" : "/eos/user/z/zhjie/CMSSW_10_2_13/src/flashggFinalFit/Datacard/4b_boost/datacard_mass_Xxx_Yyy.txt", # scalling all signals to 1 fb X BR (H)
"bbtt":"/eos/user/z/zhjie/CMSSW_10_2_13/src/flashggFinalFit/Datacard/bbtt/datacard_mass_Xxx_Yyy.txt",
}

for MX in MX_to_combine :
for MY in MY_to_combine :
command = "combineCards.py "
counter = 0
for channel in folders_to_combine.keys() :
file_to_test = "%s" % folders_to_combine[channel].replace("xx", str(MX)).replace("yy", str(MY))
print(file_to_test)
if os.path.isfile(file_to_test) :
command += "%s=%s " % (channel, file_to_test)
counter += 1
command += " > datacard_mass_X%s_Y%s.txt" % (str(MX), str(MY))

if counter > 0 :
print(MX, MY, command)
proc=subprocess.Popen([command],shell=True,stdout=subprocess.PIPE)
out = proc.stdout.read()


Loading