Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in Combine/inputs.json and run_sequence + adding a directory with the impacts of ALT 0M #36

Open
wants to merge 132 commits into
base: dev_fggfinalfits_lite
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
f98ed36
start fitting
emanueledimarco Mar 15, 2022
10a1f9d
adding a custom xvar fitting to RunSignalScripts.py
emanueledimarco Mar 23, 2022
7e3efe9
adding a custom xvar fitting to RunSignalScripts.py
emanueledimarco Mar 23, 2022
10865da
updates for my files
emanueledimarco Mar 23, 2022
677dd44
my first fixes
emanueledimarco Mar 25, 2022
507b3f0
Merge pull request #1 from emanueledimarco/vbfac-dev
emanueledimarco Mar 25, 2022
9d1c54d
changes for the weighted roodatasets
emanueledimarco Mar 30, 2022
9e356dd
Merge pull request #2 from emanueledimarco/vbfac-dev
emanueledimarco Mar 30, 2022
c1aba68
now working up to signalFits
emanueledimarco Mar 30, 2022
be93cf4
Merge pull request #3 from emanueledimarco/vbfac-dev
emanueledimarco Mar 30, 2022
6a56bc3
fixes for the replacements
emanueledimarco Mar 30, 2022
8795507
missing conversion from fb to pb
emanueledimarco Mar 31, 2022
544c697
using 138 fb-1 for full Run2 lumi
emanueledimarco Mar 31, 2022
b2fce39
done with last steps
emanueledimarco Mar 31, 2022
8c1b4f2
fix background modeling
emanueledimarco Mar 31, 2022
35f892c
use norm Run2 when using 2017 for now
emanueledimarco Mar 31, 2022
0fcf8bb
Merge pull request #4 from emanueledimarco/vbfac-dev
emanueledimarco Mar 31, 2022
66384c6
fixes for datacards
emanueledimarco Apr 1, 2022
6358efd
updating config files for the new inputs
emanueledimarco Apr 13, 2022
a4a4036
setup scripts updated
emanueledimarco Apr 13, 2022
d72027a
add a script to run the signal steps
emanueledimarco Apr 13, 2022
d679e49
update the replacements for the lowstat categories
emanueledimarco Apr 13, 2022
f2c2c65
fixes: ALT samples only have the nominal MH
emanueledimarco Apr 13, 2022
0e3fd35
dryRun option added to signal sequence script
emanueledimarco Apr 13, 2022
3e970d2
take into account that for ALT models there is only 125 GeV
emanueledimarco Apr 13, 2022
fbef124
further developments for Signal for 3 years and ALT model
emanueledimarco Apr 14, 2022
dbc442a
add a script to merge multiple years RooDataSets
emanueledimarco Apr 14, 2022
95239fe
update bkg for multi years and new categorization
emanueledimarco Apr 14, 2022
ef62b16
add datacard sequence example
emanueledimarco Apr 14, 2022
639a418
update the datcard sequence
emanueledimarco Apr 14, 2022
4d94fee
merge Years necessary in the DC creation
emanueledimarco Apr 28, 2022
cf7084e
add the model for CP fit
emanueledimarco Apr 28, 2022
1b00f3f
add the combine commands, even if still WorkInProgress
emanueledimarco Apr 28, 2022
1fd719e
Update README.md
emanueledimarco May 9, 2022
e50492a
changes to run fits locally
emanueledimarco May 9, 2022
f4b8ca5
changes for cp fit
emanueledimarco May 9, 2022
458bd91
Merge pull request #5 from emanueledimarco/vbfac-dev
emanueledimarco May 9, 2022
0e8551f
readme update with the link of the local repo
emanueledimarco May 9, 2022
0f861ff
Merge pull request #6 from emanueledimarco/vbfac-dev
emanueledimarco May 9, 2022
f88e517
add a script to rename flashgg trees
emanueledimarco Jun 17, 2022
d0508e3
new names gymnastic
emanueledimarco Jun 17, 2022
fe89756
renaming improved
emanueledimarco Jun 17, 2022
42496e9
changes for the new VBF alt cateogory names
emanueledimarco Jun 17, 2022
34bb4a0
update for signal fit with systs
emanueledimarco Jun 17, 2022
498b4ab
Merge pull request #7 from emanueledimarco/vbfac-dev
emanueledimarco Jun 17, 2022
021b667
.q
Jun 22, 2022
4d97f76
miei cambi
Jun 22, 2022
345b13e
update of the fit variable in config files
emanueledimarco Jul 12, 2022
f5ed56f
update fit variable for background scripts
emanueledimarco Jul 12, 2022
f00e0eb
datacard step fixes for systematics
emanueledimarco Jul 12, 2022
fc4f53b
add the step calcPhotonSyst for the signal fit
emanueledimarco Jul 12, 2022
7a3c914
Merge pull request #8 from emanueledimarco/vbfac-dev
emanueledimarco Jul 12, 2022
d0917e0
updates
emanueledimarco Aug 31, 2022
bd5f263
updates
emanueledimarco Aug 31, 2022
dd8dc6a
updates to the fits
emanueledimarco Aug 31, 2022
93da878
exclude empty categories from datacard
emanueledimarco Aug 31, 2022
8701b39
update the plotting part
emanueledimarco Aug 31, 2022
1099f2d
Merge pull request #9 from emanueledimarco/vbfac-dev
emanueledimarco Aug 31, 2022
5086409
separate the different AC modes in the mapping
emanueledimarco Aug 31, 2022
bbdac65
separate the different AC modes in the mapping
emanueledimarco Aug 31, 2022
0532581
datacard making with only the populated categories
emanueledimarco Aug 31, 2022
934a3ae
include the alternative VBF signals
emanueledimarco Sep 1, 2022
b7b93a0
automatize datacards creation with run_sequence script
emanueledimarco Sep 1, 2022
3e9d9be
automatize the workspace creation and the fit part (not complete yet)
emanueledimarco Sep 1, 2022
1ea0d8d
Merge pull request #10 from emanueledimarco/vbfac-dev
emanueledimarco Sep 1, 2022
80e0652
updates for tables
emanueledimarco Sep 5, 2022
04f7e82
renamed pois_cp.json in the specific one for flambda1, fa3, etc. Need…
emanueledimarco Sep 5, 2022
e3e1d97
Merge pull request #11 from emanueledimarco/vbfac-dev
emanueledimarco Sep 5, 2022
85b66a0
fix the format of the table and run it directly from the directory wi…
emanueledimarco Sep 5, 2022
2ddde14
small fixes to yields tables
emanueledimarco Sep 6, 2022
155b40d
Merge pull request #12 from emanueledimarco/vbfac-dev
emanueledimarco Sep 6, 2022
1a264ec
add the f=0.5 samples to introduce the interference term, fix the sam…
emanueledimarco Sep 8, 2022
f1fbea3
further fixes to include additional BSM samples
emanueledimarco Sep 12, 2022
c320123
many updates needed to include the interference. Need a signal model …
emanueledimarco Sep 15, 2022
151f8bf
add the name of the alternative model at the end of the suffix
emanueledimarco Oct 21, 2022
fe68292
move to the UL samples (also dividing 2016 in pre- and post-VFP) and …
emanueledimarco Oct 28, 2022
f9e6bb5
stupid date change
emanueledimarco Oct 28, 2022
c39a7ed
updates for UL
emanueledimarco Dec 6, 2022
bbe5dcc
further UL updates
emanueledimarco Dec 6, 2022
080bd80
change names conventions for alt model suffixes
emanueledimarco Dec 13, 2022
f40c264
updates using the UL samples
emanueledimarco Jan 11, 2023
546af25
changes to allow VBF AC Trees2WS
emanueledimarco Feb 1, 2023
594ca8d
Merge pull request #13 from emanueledimarco/vbfac-dev
emanueledimarco Feb 1, 2023
e65cd46
changes to add systematics to the tree2ws scripts and add the possibi…
emanueledimarco Feb 3, 2023
3a363c5
fix the bash setup script
emanueledimarco Feb 3, 2023
22e56d2
add Rome Tier2 submission with LSF, with minimal modification to IC
emanueledimarco Feb 3, 2023
fb07146
fix the signalFromFileName for ALT models
emanueledimarco Feb 3, 2023
b718a00
fix for L1Zg file to proc name
emanueledimarco Feb 3, 2023
df1a593
change the WSRenamer script
emanueledimarco Feb 10, 2023
13a13f4
run all the three years together (tree2ws)
emanueledimarco Feb 10, 2023
6a93cac
fix the passing of the input mass to tree2ws
emanueledimarco Feb 10, 2023
f3ee507
reintroduce the mass in the name of the ws
emanueledimarco Feb 10, 2023
1b5f049
new process mapping
emanueledimarco Feb 10, 2023
1168979
back the mass in the RooDataSet name
emanueledimarco Feb 14, 2023
2e89d39
put back all the STXS cats (with modified VBF ones)
emanueledimarco Feb 14, 2023
66166a3
add Rome Tier2
emanueledimarco Feb 14, 2023
5fbecd0
add the possibility to select processes with regexp when submitting t…
emanueledimarco Feb 14, 2023
31c4c1f
fix again the proc2data map
emanueledimarco Feb 14, 2023
bb11962
can do all the 3 years together
emanueledimarco Feb 14, 2023
6c96515
Merge pull request #14 from emanueledimarco/vbfac-dev
emanueledimarco Feb 14, 2023
0376684
add a protection in rare cases of 0 sumweights in simultaneousFit.py
emanueledimarco Feb 14, 2023
0f77e06
update the signalFit
emanueledimarco Feb 15, 2023
69505e0
fix few problematic replacements
emanueledimarco Feb 17, 2023
2d1ea9d
fixes in the Signal run_sequences
emanueledimarco Feb 17, 2023
7bf78f7
further fixes to the replacements and XSBR maps
emanueledimarco Feb 17, 2023
4be5a91
yet another fix in the replacementMap
emanueledimarco Feb 18, 2023
cb304b7
fix a bug in RunPlotter making it crashing for one proc and multiple …
emanueledimarco Feb 24, 2023
d8d6c91
add a script to check that all the signal fits are done (useful for m…
emanueledimarco Feb 28, 2023
ab1b756
updates to the signal sequence of commands
emanueledimarco Feb 28, 2023
b90fab9
updates to the background scripts for all STXS categories
emanueledimarco Feb 28, 2023
b050f57
fix bkg submission script
emanueledimarco Feb 28, 2023
23e8fc5
update Datacard making for full STXS + AC
emanueledimarco Feb 28, 2023
c433e92
update the nominal dataset name back with mH in makeYields
emanueledimarco Feb 28, 2023
84549f3
fix for the cases with 0 signal yield
emanueledimarco Mar 1, 2023
563d307
add back some theory systematics and put a fix for alphaS syst in cal…
emanueledimarco Mar 2, 2023
9d34a41
fix for names in yields sequence
emanueledimarco Mar 2, 2023
c9df709
give the ext by argument to checkYields
emanueledimarco Mar 2, 2023
2e4e480
add a check if the systematic is actually in the ws (for case of samp…
emanueledimarco Mar 3, 2023
0d14bdf
add the possibility to remove one category at the level of makeDataca…
emanueledimarco Mar 3, 2023
b94e549
final fixes in the making of STXS AC datacards making
emanueledimarco Mar 3, 2023
12a6433
update in Combine for AC analysis
emanueledimarco Mar 3, 2023
45ae7e3
fix xsec models
emanueledimarco Mar 3, 2023
e2fc455
add specific translations for multipple mu fits and for AC fits
emanueledimarco Mar 14, 2023
c1a9756
big update for the AC fits (new models, new combine fit options for f…
emanueledimarco Mar 14, 2023
33a2710
big updates in plotting for new AC fits
emanueledimarco Mar 14, 2023
44fcb31
Merge pull request #15 from emanueledimarco/vbfac-dev
emanueledimarco Mar 14, 2023
0c6aacf
fixed bug in run_sequence
May 31, 2023
61a2d6a
Merge pull request #16 from raeubaen/vbfac-dev
emanueledimarco May 31, 2023
490be23
Merge remote-tracking branch 'origin/dev_fggfinalfits_lite' into dev_…
Nov 17, 2023
fb1752a
changes in inputs.json and run sequence.sh adding also dir runImpact…
Mar 28, 2024
1ce8b56
changes in TreeWS
Mar 28, 2024
9935bbd
changes in inputs.json and run sequence.sh adding also dir runImpact…
Mar 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions Background/RunBackgroundScripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def leave():
options['lumi'] = lumiMap[_cfg['year']]
options['batch'] = _cfg['batch']
options['queue'] = _cfg['queue']
options['xvar'] = _cfg['xvar']
options['plotdir'] = _cfg['plotdir'] if 'plotdir' in _cfg else swd__

# Options from command line
options['mode'] = opt.mode
Expand Down Expand Up @@ -82,6 +84,7 @@ def leave():
print " --> Categories: %s"%options['cats']
print " --> Extension: %s"%options['ext']
print " --> Category offset: %g"%options['catOffset']
print " --> Variable to fit: %s"%options['xvar']
print " --> Year: %s ::: Corresponds to intLumi = %s fb^-1"%(options['year'],options['lumi'])
print ""
print " --> Job information:"
Expand Down
20 changes: 11 additions & 9 deletions Background/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

backgroundScriptCfg = {

# Setup
'inputWSDir':'/vols/cms/jl2117/hgg/ws/UL/Sept20/merged_data', # location of 'allData.root' file
'cats':'auto', # auto: automatically inferred from input ws
'catOffset':0, # add offset to category numbers (useful for categories from different allData.root files)
'ext':'test', # extension to add to output directory
'year':'combined', # Use combined when merging all years in category (for plots)
# Setup
'inputWSDir':'cards/data_run2', # location of 'allData.root' file
'cats':'auto', # auto: automatically inferred from input ws
'catOffset':0, # add offset to category numbers (useful for categories from different allData.root files)
'ext':'2023-02-13', # extension to add to output directory
'year':'combined', # Use combined when merging all years in category (for plots)
'xvar': 'CMS_hgg_mass', # not yet used, should be passed to the C++ macros
'plotdir': 'plots',

# Job submission options
'batch':'IC', # [condor,SGE,IC,local]
'queue':'hep.q' # for condor e.g. microcentury
# Job submission options
'batch':'Rome', # [condor,SGE,IC,Rome,local]
'queue':'cmsan' # for condor e.g. espresso

}
24 changes: 19 additions & 5 deletions Background/runBackgroundScripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ BATCH=""
QUEUE=""
YEAR="2016"
CATOFFSET=0
PLOTDIR=""

usage(){
echo "The script runs background scripts:"
Expand All @@ -36,21 +37,22 @@ echo "--pseudoDataOnly) "
echo "--pseudoDataDat)"
echo "--sigFile) "
echo "--bkgPlotsOnly)"
echo "--seed) for pseudodata random number gen seed (default $SEED)"
echo "--seed) for pseudodata random number gen seed (default $SEED))"
echo "--intLumi) specified in fb^-{1} (default $INTLUMI)) "
echo "--year) dataset year (default $YEAR)) "
echo "--isData) specified in fb^-{1} (default $DATA)) "
echo "--unblind) specified in fb^-{1} (default $UNBLIND)) "
echo "--batch) which batch system to use (None (''),HTCONDOR,IC) (default '$BATCH')) "
echo "--queue) queue to submit jobs to (specific to batch))"
echo "--pdir) directory where to put the plots)"
}


#------------------------------ parsing


# options may be followed by one colon to indicate they have a required argument
if ! options=$(getopt -u -o hi:p:f: -l help,inputFile:,procs:,flashggCats:,ext:,catOffset:,fTestOnly,pseudoDataOnly,bkgPlotsOnly,pseudoDataDat:,sigFile:,seed:,intLumi:,year:,unblind,isData,batch:,queue: -- "$@")
if ! options=$(getopt -u -o hi:p:f: -l help,inputFile:,procs:,flashggCats:,ext:,catOffset:,fTestOnly,pseudoDataOnly,bkgPlotsOnly,pseudoDataDat:,sigFile:,seed:,intLumi:,year:,unblind,isData,batch:,queue:,pdir: -- "$@")
then
# something went wrong, getopt will put out an error message for us
exit 1
Expand Down Expand Up @@ -78,6 +80,7 @@ case $1 in
--unblind) UNBLIND=1;;
--batch) BATCH=$2; shift;;
--queue) QUEUE=$2; shift;;
--pdir) PLOTDIR=$2; shift;;

(--) shift; break;;
(-*) usage; echo "$0: error - unrecognized option $1" 1>&2; usage >> /dev/stderr; exit 1;;
Expand All @@ -88,7 +91,11 @@ done


OUTDIR="outdir_${EXT}"
echo "[INFO] outdir is $OUTDIR, INTLUMI $INTLUMI"
if [[ $PLOTDIR == "" ]]; then
PLOTDIR=$OUTDIR
fi

echo "[INFO] outdir is $OUTDIR, plotdir is $PLOTDIR INTLUMI $INTLUMI"

if [ $ISDATA == 1 ]; then
DATAEXT="-Data"
Expand All @@ -97,6 +104,7 @@ echo "INTLUMI is $INTLUMI, YEAR is $YEAR"
OUTDIR="outdir_${EXT}"

mkdir -p $OUTDIR
mkdir -p $PLOTDIR

if [ $FTESTONLY == 0 -a $PSEUDODATAONLY == 0 -a $BKGPLOTSONLY == 0 ]; then
#IF not particular script specified, run all!
Expand Down Expand Up @@ -147,7 +155,7 @@ if [ $FTESTONLY == 1 ]; then

echo "--------------------------------------"
echo "Running Background F-Test"
echo "-->Greate background model"
echo "-->Create background model"
echo "--------------------------------------"
if [ $UNBLIND == 1 ]; then
OPT=" --unblind"
Expand All @@ -159,8 +167,14 @@ if [ $ISDATA == 1 ]; then
OPT=" --isData 1"
fi

mkdir -p "${PLOTDIR}/bkgfTest${DATAEXT}"
if test -f "/afs/cern.ch/user/g/gpetrucc/php/index.php"; then
cp "/afs/cern.ch/user/g/gpetrucc/php/index.php" "${PLOTDIR}/bkgfTest${DATAEXT}"
elif test -f "/cmshome/dimarcoe/php/index.php"; then
cp "/cmshome/dimarcoe/php/index.php" "${PLOTDIR}/bkgfTest${DATAEXT}"
fi
echo " ./bin/fTest -i $FILE --saveMultiPdf $OUTDIR/CMS-HGG_multipdf_$EXT_$CATS.root -D $OUTDIR/bkgfTest$DATAEXT -f $CATS $OPT --year $YEAR --catOffset $CATOFFSET"
./bin/fTest -i $FILE --saveMultiPdf $OUTDIR/CMS-HGG_multipdf_$EXT_$CATS.root -D $OUTDIR/bkgfTest$DATAEXT -f $CATS $OPT --year $YEAR --catOffset $CATOFFSET
./bin/fTest -i $FILE --saveMultiPdf $OUTDIR/CMS-HGG_multipdf_$EXT_$CATS.root -D $OUTDIR/bkgfTest$DATAEXT -P $PLOTDIR/bkgfTest$DATAEXT -f $CATS $OPT --year $YEAR --catOffset $CATOFFSET

OPT=""
fi
Expand Down
2 changes: 2 additions & 0 deletions Background/run_sequence.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#python scripts/mergeMultiYearsData.py -i cards/cards_current -o cards/cards_current/data_Run2/allData.root
python RunBackgroundScripts.py --inputConfig config_test.py --mode fTestParallel
53 changes: 53 additions & 0 deletions Background/scripts/mergeMultiYearsData.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python

import sys
import glob
import ROOT
from optparse import OptionParser
from commonTools import *

def get_options():
parser = OptionParser()
parser.add_option("-i","--inputdir", dest="idir", default="cards/cards_current", help="Input directory")
parser.add_option("-o","--outfile", dest="outfile", default="allData.root", help="Outputfile")
parser.add_option("--years", dest="years", default="2016,2017,2018", help="Merge the datasets of the following years")
return parser.parse_args()
(opt,args) = get_options()

files = args[:]


#Extract all files to be merged
fNames = {}
for year in opt.years.split(","): fNames[year] = glob.glob("%s/data_%s/output_Data_13TeV.root"%(opt.idir,year))

cats = extractListOfCats(fNames[opt.years.split(",")[0]]).split(',')

# Define ouput merged workspace
print " --> Merging output workspaces"
mergedWS = ROOT.RooWorkspace("cms_hgg_13TeV","cms_hgg_13TeV")
mergedWS.imp = getattr(mergedWS,"import")

# Extract merged datasets
data_merged = {}
data_merged_names = []
for cat in cats:
data_merged["Data_13TeV_%s" % cat] = ROOT.TFile(fNames[opt.years.split(",")[0]][0]).Get("tagsDumper/cms_hgg_13TeV").data("Data_13TeV_%s" % cat).emptyClone("Data_13TeV_%s" % cat)
data_merged_names.append( data_merged["Data_13TeV_%s" % cat].GetName() )

for year, fNames in fNames.iteritems():
for fName in fNames:
for cat in cats:
d = ROOT.TFile(fName).Get("tagsDumper/cms_hgg_13TeV").data("Data_13TeV_%s" % cat)
print "YEAR = %-6s, CAT = %-30s, n = %d" % (year,cat,d.numEntries())
for i in range(d.numEntries()):
p = d.get(i)
data_merged["Data_13TeV_%s" % cat].add(p)

print " --> Writing to: %s"%(opt.outfile)
f = ROOT.TFile(opt.outfile,"RECREATE")
f.mkdir("tagsDumper")
f.cd("tagsDumper")
for _data in data_merged.itervalues(): mergedWS.imp(_data)
mergedWS.Write()
f.Close()
15 changes: 9 additions & 6 deletions Background/test/fTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ int main(int argc, char* argv[]){
int catOffset;
string datfile;
string outDir;
string plotDir;
string outfilename;
bool is2011=false;
bool verbose=false;
Expand All @@ -624,7 +625,8 @@ int main(int argc, char* argv[]){
("ncats,c", po::value<int>(&ncats)->default_value(5), "Number of categories")
("singleCat", po::value<int>(&singleCategory)->default_value(-1), "Run A single Category")
("datfile,d", po::value<string>(&datfile)->default_value("dat/fTest.dat"), "Right results to datfile for BiasStudy")
("outDir,D", po::value<string>(&outDir)->default_value("plots/fTest"), "Out directory for plots")
("outDir,D", po::value<string>(&outDir)->default_value("plots/fTest"), "Out directory for results")
("plotDir,P", po::value<string>(&plotDir)->default_value("plots/fTest"), "Out directory for plots")
("saveMultiPdf", po::value<string>(&outfilename), "Save a MultiPdf model with the appropriate pdfs")
("runFtestCheckWithToys", "When running the F-test, use toys to calculate pvals (and make plots) ")
("is2011", "Run 2011 config")
Expand Down Expand Up @@ -676,6 +678,7 @@ int main(int argc, char* argv[]){
}

system(Form("mkdir -p %s",outDir.c_str()));
system(Form("mkdir -p %s",plotDir.c_str()));
TFile *inFile = TFile::Open(fileName.c_str());
RooWorkspace *inWS;
if(isFlashgg_){
Expand Down Expand Up @@ -845,14 +848,14 @@ int main(int argc, char* argv[]){
if (chi2<0. && order>1) chi2=0.;
if (prev_pdf!=NULL){
prob = getProbabilityFtest(chi2,order-prev_order,prev_pdf,bkgPdf,mass,data
,Form("%s/Ftest_from_%s%d_cat%d.pdf",outDir.c_str(),funcType->c_str(),order,(cat+catOffset)));
,Form("%s/Ftest_from_%s%d_cat%d.pdf",plotDir.c_str(),funcType->c_str(),order,(cat+catOffset)));
std::cout << "[INFO] F-test Prob(chi2>chi2(data)) == " << prob << std::endl;
} else {
prob = 0;
}
double gofProb=0;
// otherwise we get it later ...
if (!saveMultiPdf) plot(mass,bkgPdf,data,Form("%s/%s%d_cat%d.pdf",outDir.c_str(),funcType->c_str(),order,(cat+catOffset)),flashggCats_,fitStatus,&gofProb);
if (!saveMultiPdf) plot(mass,bkgPdf,data,Form("%s/%s%d_cat%d.pdf",plotDir.c_str(),funcType->c_str(),order,(cat+catOffset)),flashggCats_,fitStatus,&gofProb);
cout << "[INFO]\t " << *funcType << " " << order << " " << prevNll << " " << thisNll << " " << chi2 << " " << prob << endl;
//fprintf(resFile,"%15s && %d && %10.2f && %10.2f && %10.2f \\\\\n",funcType->c_str(),order,thisNll,chi2,prob);
prevNll=thisNll;
Expand Down Expand Up @@ -908,7 +911,7 @@ int main(int argc, char* argv[]){

// Calculate goodness of fit for the thing to be included (will use toys for lowstats)!
double gofProb =0;
plot(mass,bkgPdf,data,Form("%s/%s%d_cat%d.pdf",outDir.c_str(),funcType->c_str(),order,(cat+catOffset)),flashggCats_,fitStatus,&gofProb);
plot(mass,bkgPdf,data,Form("%s/%s%d_cat%d.pdf",plotDir.c_str(),funcType->c_str(),order,(cat+catOffset)),flashggCats_,fitStatus,&gofProb);

if ((prob < upperEnvThreshold) ) { // Looser requirements for the envelope

Expand Down Expand Up @@ -944,7 +947,7 @@ int main(int argc, char* argv[]){
choices_envelope_vec.push_back(choices_envelope);
pdfs_vec.push_back(pdfs);

plot(mass,pdfs,data,Form("%s/truths_cat%d",outDir.c_str(),(cat+catOffset)),flashggCats_,cat);
plot(mass,pdfs,data,Form("%s/truths_cat%d",plotDir.c_str(),(cat+catOffset)),flashggCats_,cat);

if (saveMultiPdf){

Expand Down Expand Up @@ -983,7 +986,7 @@ int main(int argc, char* argv[]){
outputws->import(catIndex);
outputws->import(dataBinned);
outputws->import(*data);
plot(mass,pdf,&catIndex,data,Form("%s/multipdf_%s",outDir.c_str(),catname.c_str()),flashggCats_,cat,bestFitPdfIndex);
plot(mass,pdf,&catIndex,data,Form("%s/multipdf_%s",plotDir.c_str(),catname.c_str()),flashggCats_,cat,bestFitPdfIndex);

}

Expand Down
9 changes: 5 additions & 4 deletions Background/tools/submissionTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def writeSubFiles(_opts):
c = _opts['cats'].split(",")[cidx]
co = _opts['catOffset']+cidx
_f.write("if [ $1 -eq %g ]; then\n"%cidx)
_cmd = "%s/runBackgroundScripts.sh -i %s -p %s -f %s --ext %s --catOffset %g --intLumi %s --year %s --batch %s --queue %s --sigFile %s --isData --fTest"%(bwd__,_opts['dataFile'],_opts['procs'],c,_opts['ext'],co,_opts['lumi'],_opts['year'],_opts['batch'],_opts['queue'],_opts['signalFitWSFile'])
_cmd = "%s/runBackgroundScripts.sh -i %s -p %s -f %s --ext %s --catOffset %g --intLumi %s --year %s --batch %s --queue %s --sigFile %s --isData --fTest --pdir %s"%(bwd__,_opts['dataFile'],_opts['procs'],c,_opts['ext'],co,_opts['lumi'],_opts['year'],_opts['batch'],_opts['queue'],_opts['signalFitWSFile'],_opts['plotdir'])
_f.write(" %s\n"%_cmd)
_f.write("fi\n")

Expand All @@ -73,7 +73,7 @@ def writeSubFiles(_opts):
_fsub.close()

# SGE...
if (_opts['batch'] == "IC")|(_opts['batch'] == "SGE")|(_opts['batch'] == "local" ):
if (_opts['batch'] == "IC")|(_opts['batch'] == "SGE")|(_opts['batch'] == "Rome")|(_opts['batch'] == "local" ):
_executable = "sub_%s_%s"%(_opts['mode'],_opts['ext'])

# Write details depending on mode
Expand Down Expand Up @@ -102,8 +102,9 @@ def submitFiles(_opts):
print " --> Finished submitting files"

# SGE
elif _opts['batch'] in ['IC','SGE']:
elif _opts['batch'] in ['IC','SGE','Rome']:
_executable = "sub_%s_%s"%(_opts['mode'],_opts['ext'])
_subcmd = 'bsub' if _opts['batch']=='Rome' else 'qsub'

# Extract job opts
jobOptsStr = _opts['jobOpts']
Expand All @@ -113,7 +114,7 @@ def submitFiles(_opts):
for cidx in range(_opts['nCats']):
c = _opts['cats'].split(",")[cidx]
_subfile = "%s/%s_%s"%(_jobdir,_executable,c)
cmdLine = "qsub -q hep.q %s -o %s.log -e %s.err %s.sh"%(jobOptsStr,_subfile,_subfile,_subfile)
cmdLine = "%s -q %s %s -o %s.log -e %s.err %s.sh"%(_subcmd,_opts['queue'],jobOptsStr,_subfile,_subfile,_subfile)
run(cmdLine)
print " --> Finished submitting files"

Expand Down
21 changes: 19 additions & 2 deletions Combine/CollectFits.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ def run(cmd):
if _fit.split(":")[2] == "all": _fitpois = pois
else: _fitpois = _fit.split(":")[2].split(",")
_name = "%s_%s"%(_fit.split(":")[0],_fit.split(":")[1])
if opt.doObserved: _name += "_obs"
if opt.doObserved:
_name += "_obs"
mainlabel = "Observed"
else:
mainlabel = "Expected"
# add this to distinguish different fits with same POI
_name += "_"+opt.ext

if( _fit.split(":")[0] == "bestfit" ):
for poi in _fitpois:
Expand All @@ -56,9 +62,20 @@ def run(cmd):

elif( _fit.split(":")[0] == "profile1D")|( _fit.split(":")[0] == "scan1D" ):
for poi in _fitpois:
if poi in ["r_ggH","r_VBF","r_top","r_VH"]:
translate_json = "pois_mu.json"
elif poi=='CMS_zz4l_fai1':
if 'ALT_0M' in opt.ext: translate_json = "pois_fa3.json"
if 'ALT_0PH' in opt.ext: translate_json = "pois_fa2.json"
if 'ALT_L1' in opt.ext: translate_json = "pois_flambda1.json"
if 'ALT_L1Zg' in opt.ext: translate_json = "pois_flambda1zgamma.json"
else:
print "Warning: unknown poi. Use r as default"
translate_json = "pois_mu.json"
haddcmd = "cd runFits%s_%s; hadd -f %s_%s.root higgsCombine_%s_%s.POINTS.*.*.root; cd .."%(opt.ext,opt.mode,_name,poi,_name,poi)
run(haddcmd)
plotcmd = "cd runFits%s_%s; plot1DScan.py %s_%s.root --y-cut 20 --y-max 20 -o Plots/%s_%s%s --POI %s; cd .."%(opt.ext,opt.mode,_name,poi,_name,poi,opt.ext,poi)
plotcmd = "cd runFits%s_%s; plot1DScan.py %s_%s.root --y-cut 30 --y-max 30 -o Plots/%s_%s%s --POI %s --main-label %s --translate %s/src/flashggFinalFit/Plots/%s; cd .."%(opt.ext,opt.mode,_name,poi,_name,poi,opt.ext,poi,mainlabel,os.environ['CMSSW_BASE'],translate_json)
print "plotcmd = ",plotcmd
run(plotcmd)

elif( _fit.split(":")[0] == "scan2D")|( _fit.split(":")[0] == "profile2D" ):
Expand Down
Loading