Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5fe3616
Channel text not italic, legends on ratio plot on same line. Comment…
EmyrClement Oct 30, 2015
0130656
Change labels in plots.
EmyrClement Oct 30, 2015
726a8ea
Try to change x axis range of angle bl control plot.
EmyrClement Oct 30, 2015
7654d8a
Add more space between x axis and label of control plots. Don't use …
EmyrClement Oct 30, 2015
17932fe
Other similar changes for result plots.
EmyrClement Oct 30, 2015
90b0d49
Tweak some control plots.
EmyrClement Oct 30, 2015
ed031f7
Make lines more black and white friendly.
EmyrClement Nov 3, 2015
afcb219
Back porting some plot changes.
EmyrClement Dec 18, 2015
15ffddc
Add extra powheg samples. Modify plotting style.
EmyrClement Dec 18, 2015
c21c468
Add additional powheg samples to unfolding files. Add some debugging …
EmyrClement Dec 18, 2015
c025987
Add powheg files to config.
EmyrClement Dec 18, 2015
d9b0429
Update latex for variables and samples.
EmyrClement Dec 18, 2015
dd873a3
Comment out some stuff for debugging.
EmyrClement Dec 18, 2015
c84d581
Update path in plots2tdr.
EmyrClement Dec 18, 2015
597bc91
Small changes
EmyrClement Dec 18, 2015
26de561
Update latex labels.
EmyrClement Jan 11, 2016
0eebca8
Tweak control plots.
EmyrClement Jan 11, 2016
01fa299
Apply uncertainty on ttbar correctly. Tweak plots.
EmyrClement May 24, 2016
ab7ac16
Tweak overflow.
EmyrClement May 24, 2016
6a0a08a
Tweak font.
EmyrClement May 24, 2016
2df4289
Latex labels.
EmyrClement May 24, 2016
52253b9
Tweak bin names
EmyrClement May 24, 2016
698b17e
Set top masses for new samples. Option for com reweighted samples (n…
EmyrClement May 24, 2016
a877a6b
Changes to merging script.
EmyrClement May 24, 2016
d0055e6
Changes to merging script.
EmyrClement May 24, 2016
0db8749
Changes to condor scripts (BLT unfold).
EmyrClement May 24, 2016
a970139
Add functionality to apply weight from 8 to 7 TeV.
EmyrClement May 24, 2016
6e5003b
Fix MC uncertainty so it's only on the ttbar MC, not the sum of all MC.
EmyrClement May 24, 2016
c0c3616
Use correct region for QCD shape uncertainty.
EmyrClement May 24, 2016
a92fa67
Small changes to 01, 03. Mainly debug printing.
EmyrClement May 24, 2016
c28c5ee
Tweaking result plots.
EmyrClement May 24, 2016
00fb49c
Tweaking result and systematic tables.
EmyrClement May 24, 2016
44e9e3a
Changes to running scripts.
EmyrClement May 24, 2016
b0ec57f
Temp commit for Luke.
EmyrClement Jun 15, 2016
71dddff
After paper submission, before holiday.
EmyrClement Jul 19, 2016
b5769af
Final changes in legacy analysis.
EmyrClement Aug 18, 2016
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
61 changes: 60 additions & 1 deletion bin/plot
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ from tools.ROOT_utils import set_root_defaults
from tools.file_utilities import write_data_to_JSON, read_data_from_JSON
from tools.HistSet import HistSet
from copy import deepcopy
from tools.ROOT_utils import get_histogram_from_file
from math import sqrt

supported_commands = ['compare-files', 'compare-hists']

Expand All @@ -95,7 +97,7 @@ plot_options = {}
global_options = ['files', 'file-aliases', 'histograms', 'labels', 'plot_type', 'output_folder',
'output_format', 'command', 'data_index', 'normalise',
'show_ratio', 'show_stat_errors_on_mc', 'colours', 'name_prefix',
'fill_area', 'alpha']
'fill_area', 'alpha', 'subtractFiles']

def main():
options, input_values_sets, json_input_files = parse_options()
Expand Down Expand Up @@ -173,7 +175,63 @@ def _exit_( msg ):
def prepare_inputs( input_values ):
input_values = check_and_fix_inputs( input_values )
global files, histograms, global_options

subtractFiles = []
if input_values.has_key('subtractFiles'):
subtractFiles = input_values['subtractFiles']

sets = group_by_command( input_values['command'] )

for s in sets:
print s.histograms
# subtractFiles_sets = getBackgroundHists( subtractFiles, )

# if input_values['command'] == 'compare-hists' and len( input_values['subtractFiles'] ) > 0:

# subtract_background( input_values['subtractFiles'] )
if len( subtractFiles ) > 0:
hist_sets = []
i = 0

for h in input_values['histograms']:
print h
# name = h.replace( '/', '_' )
# name = name.replace( ' ', '' )

uncDict = {'VJets' : 0.3,
'TTJet' : 0.06,
'SingleTop' : 0.3 }

for f in subtractFiles:
hist = get_histogram_from_file( histogram_path = h,
input_file = f )
print f
print hist
unc = 0
if 'VJets' in f or 'SingleTop' in f:
unc = 0.3
elif 'TTJet' in f:
unc = 0.3

for bin in range(1,hist.GetNbinsX()):
binContent = hist.GetBinContent(bin)
binError = hist.GetBinError(bin)
newError = sqrt( binError ** 2 + ( binContent * unc ) ** 2 )
# print 'Errors :',binError,newError
hist.SetBinError( bin, newError )

sets[0].histograms[i] -= hist
i += 1
# hist_sets.append( HistSet( h, hist_inputs = hist_set, output_hist_labels = labels ) )


# print hist_sets
# print 'Looping sets'
# for s in sets:
# for h in s.histograms:
# print s.inputs
# print s.histograms

if input_values.has_key('name_prefix'):
for s in sets:
s.name = input_values['name_prefix'] + s.name
Expand Down Expand Up @@ -234,6 +292,7 @@ def group_by_file():
[{name:{f:h}, ...] where f = file and h = histogram path. The name is taken from the file name
'''
global files, file_aliases, histograms, labels

hist_sets = []
for f,name in zip(files, file_aliases):
hist_set = []
Expand Down
34 changes: 16 additions & 18 deletions bin/plots2tdr
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ from glob import glob
plot_map_common = {}

plot_map_paper = {
# <src relative to DPS plots folder> : <dst relative to TDR plots folder>,
# results 8 TeV
'7TeV/MET/central/normalised_xsection_combined_*.pdf': '7TeV/MET/',
'7TeV/HT/central/normalised_xsection_combined_*.pdf': '7TeV/HT/',
'7TeV/ST/central/normalised_xsection_combined_*.pdf': '7TeV/ST/',
'7TeV/WPT/central/normalised_xsection_combined_*.pdf': '7TeV/WPT/',
# results 8 TeV
'8TeV/MET/central/normalised_xsection_combined_*.pdf': '8TeV/MET/',
'8TeV/HT/central/normalised_xsection_combined_*.pdf': '8TeV/HT/',
'8TeV/ST/central/normalised_xsection_combined_*.pdf': '8TeV/ST/',
'8TeV/WPT/central/normalised_xsection_combined_*.pdf': '8TeV/WPT/',
# control plots 8 TeV
'control_plots/after_fit/8TeV/*_HT_2orMoreBtags_with_ratio.pdf': 'control/',
'control_plots/after_fit/8TeV/*_patType1CorrectedPFMet_2orMoreBtags_with_ratio.pdf': 'control/',
# fit variables 8 TeV
'control_plots/after_fit/8TeV/*_angle_bl_2orMoreBtags_with_ratio.pdf': 'control/fit_variables/8TeV/',
'control_plots/after_fit/8TeV/*_AbsEta_2orMoreBtags_with_ratio.pdf': 'control/fit_variables/8TeV/',
'control_plots/after_fit/8TeV/*_M3_2orMoreBtags_with_ratio.pdf': 'control/fit_variables/8TeV/',
# # <src relative to DPS plots folder> : <dst relative to TDR plots folder>,
# # results 8 TeV
# 'background_subtraction/7TeV/MET/central/normalised_xsection_combined_*.pdf': '7TeV/MET/',
# 'background_subtraction/7TeV/HT/central/normalised_xsection_combined_*.pdf': '7TeV/HT/',
# 'background_subtraction/7TeV/ST/central/normalised_xsection_combined_*.pdf': '7TeV/ST/',
# 'background_subtraction/7TeV/WPT/central/normalised_xsection_combined_*.pdf': '7TeV/WPT/',
# # # results 8 TeV
# 'background_subtraction/8TeV/MET/central/normalised_xsection_combined_*.pdf': '8TeV/MET/',
# 'background_subtraction/8TeV/HT/central/normalised_xsection_combined_*.pdf': '8TeV/HT/',
# 'background_subtraction/8TeV/ST/central/normalised_xsection_combined_*.pdf': '8TeV/ST/',
# 'background_subtraction/8TeV/WPT/central/normalised_xsection_combined_*.pdf': '8TeV/WPT/',
# # control plots 8 TeV
# 'control_plots/before_fit/8TeV/*_patType1CorrectedPFMet_2orMoreBtags_with_ratio.pdf': 'control/',
# 'control_plots/before_fit/8TeV/*_*T_2orMoreBtags_with_ratio.pdf': 'control/',

'../tables/background_subtraction/*/*/*_normalised_xsection_*combined.tex': '../tables/'
}

plot_map_AN = {}
Expand Down
7 changes: 5 additions & 2 deletions bin/x_01_all_vars
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/bash
echo "This will take a while ... grab a coffee/tea/water/cocktail"
mkdir -p logs
fit_var="absolute_eta,M3,angle_bl"
# fit_var="absolute_eta,M3,angle_bl"
# fit_var="absolute_eta"
# fit_var="M3"
fit_var="angle_bl"
nice_fit_var=`echo $fit_var | sed 's/,/_/g'`
N_JOBS=6

echo "Using the fit variable(s): $fit_var"

i=0
for var in MET HT ST WPT MT; do
for var in MET HT ST WPT; do
echo "Fitting distribution: $var"
nohup time python src/cross_section_measurement/01_get_fit_results.py -V -v $var --no_combined_signal -c 7 --fit-variables $fit_var --disable-constraints &> logs/01_${var}_fit_7TeV_${nice_fit_var}.log &
let i+=1
Expand Down
4 changes: 2 additions & 2 deletions bin/x_01b_all_vars
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
echo "This will take a while ... grab a coffee/tea/water/cocktail"
mkdir -p logs
N_JOBS=5
N_JOBS=4


i=0
for var in MET HT ST WPT MT; do
for var in MET HT ST WPT; do
echo "Fitting distribution: $var"
nohup time python src/cross_section_measurement/01_get_ttjet_normalisation.py -v $var -c 7 -i config/measurements/background_subtraction &> logs/01b_${var}_bgs_7TeV.log &
let i+=1
Expand Down
3 changes: 3 additions & 0 deletions bin/x_02_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
echo "This will take a while ... grab a coffee/tea/water"
mkdir -p logs
fit_var="absolute_eta,M3,angle_bl"
# fit_var="absolute_eta"
# fit_var="M3"
# fit_var="angle_bl"
nice_fit_var=`echo $fit_var | sed 's/,/_/g'`
N_JOBS=6

Expand Down
6 changes: 3 additions & 3 deletions bin/x_02b_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ N_JOBS=5

i=0

for var in MET HT ST WPT MT; do
for var in MET HT ST WPT; do
echo "Unfolding distribution: $var"
nohup time python src/cross_section_measurement/02_unfold_and_measure.py -v $var -c 7 -p data/normalisation/background_subtraction/ &> logs/02b_${var}_unfold_7TeV.log &
nohup time python src/cross_section_measurement/02_unfold_and_measure.py -v $var -c 7 -p data/normalisation/background_subtraction/ --test &> logs/02b_${var}_unfold_7TeV.log &
let i+=1
if (( $i % N_JOBS == 0 ))
then
Expand All @@ -16,7 +16,7 @@ for var in MET HT ST WPT MT; do
fi


nohup time python src/cross_section_measurement/02_unfold_and_measure.py -v $var -c 8 -p data/normalisation/background_subtraction/ &> logs/02b_${var}_unfold_8TeV.log &
nohup time python src/cross_section_measurement/02_unfold_and_measure.py -v $var -c 8 -p data/normalisation/background_subtraction/ --test &> logs/02b_${var}_unfold_8TeV.log &
let i+=1
if (( $i % N_JOBS == 0 ))
then
Expand Down
3 changes: 3 additions & 0 deletions bin/x_03_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
echo "This will take a while ... grab a coffee/tea/water"
mkdir -p logs
fit_var="absolute_eta,M3,angle_bl"
# fit_var="absolute_eta"
# fit_var="M3"
# fit_var="angle_bl"
nice_fit_var=`echo $fit_var | sed 's/,/_/g'`
N_JOBS=6

Expand Down
2 changes: 1 addition & 1 deletion bin/x_03b_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mkdir -p logs
N_JOBS=5

i=0
for var in MET HT ST WPT MT; do
for var in MET HT ST WPT; do
echo "Calculating diff. x-section for distribution: $var"
nohup time python src/cross_section_measurement/03_calculate_systematics.py -s -v $var -c 7 -p data/normalisation/background_subtraction/ &> logs/03b_${var}_calculate_7TeV.log &
let i+=1
Expand Down
7 changes: 5 additions & 2 deletions bin/x_04_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ echo "This will take a while ... grab a coffee/tea/water"
mkdir -p logs
mkdir -p plots
fit_var="absolute_eta,M3,angle_bl"
# fit_var="absolute_eta"
# fit_var="M3"
# fit_var="angle_bl"
nice_fit_var=`echo $fit_var | sed 's/,/_/g'`
N_JOBS=5

Expand All @@ -11,15 +14,15 @@ echo "Using the fit variable(s): $fit_var"
i=0
for var in MET HT ST MT WPT; do
echo "Plotting diff. x-section for distribution: $var"
nohup time python src/cross_section_measurement/04_make_plots_matplotlib.py -v $var -c 7 -p data/$nice_fit_var -o plots/fit &> logs/04_${var}_plot_7TeV_${nice_fit_var}.log & # -a -s <--add -a option for additional plots, -s option to include the final results from background subtraction as well as from fitting
nohup time python src/cross_section_measurement/04_make_plots_matplotlib.py -v $var -c 7 -p data/$nice_fit_var -o plots/fit/ &> logs/04_${var}_plot_7TeV_${nice_fit_var}.log & # -a -s <--add -a option for additional plots, -s option to include the final results from background subtraction as well as from fitting
let i+=1
if (( $i % N_JOBS == 0 ))
then
echo "Waiting on the above to finish."
wait;
fi

nohup time python src/cross_section_measurement/04_make_plots_matplotlib.py -v $var -c 8 -p data/$nice_fit_var -o plots/fit &> logs/04_${var}_plot_8TeV_${nice_fit_var}.log & # -a -s <--add -a option for additional plots, -s option to include the final results from background subtraction as well as from fitting
nohup time python src/cross_section_measurement/04_make_plots_matplotlib.py -v $var -c 8 -p data/$nice_fit_var -o plots/fit/ &> logs/04_${var}_plot_8TeV_${nice_fit_var}.log & # -a -s <--add -a option for additional plots, -s option to include the final results from background subtraction as well as from fitting
let i+=1
if (( $i % N_JOBS == 0 ))
then
Expand Down
2 changes: 1 addition & 1 deletion bin/x_04b_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ N_JOBS=5

i=0
echo "Visible phase space"
for var in MET HT ST WPT MT; do
for var in MET HT ST WPT; do
echo "Plotting diff. x-section for distribution: $var"
nohup time python src/cross_section_measurement/04_make_plots_matplotlib.py -v $var -c 7 -p data/normalisation/background_subtraction/ -o plots/background_subtraction &> logs/04b_${var}_plot_7TeV.log & # -a <--add this option for additional plots
let i+=1
Expand Down
14 changes: 7 additions & 7 deletions bin/x_05_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ for var in MET HT ST MT WPT; do
wait;
fi

nohup time python src/cross_section_measurement/05_make_tables.py -v $var -c 8 -p data/$nice_fit_var -a -o tables/fit &> logs/05_${var}_table_8TeV_${nice_fit_var}.log &
let i+=1
if (( $i % N_JOBS == 0 ))
then
echo "Waiting on the above to finish."
wait;
fi
# nohup time python src/cross_section_measurement/05_make_tables.py -v $var -c 8 -p data/$nice_fit_var -a -o tables/fit &> logs/05_${var}_table_8TeV_${nice_fit_var}.log &
# let i+=1
# if (( $i % N_JOBS == 0 ))
# then
# echo "Waiting on the above to finish."
# wait;
# fi
done

wait;
Expand Down
30 changes: 14 additions & 16 deletions bin/x_05b_all_vars
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@
echo "This will take a while ... grab a coffee/tea/water"
mkdir -p logs
mkdir -p plots
N_JOBS=5
N_JOBS=1

i=0
for var in MET HT ST WPT MT; do
for var in MET HT ST WPT; do
echo "Tabulating diff. x-section for distribution: $var"
nohup time python src/cross_section_measurement/05_make_tables.py -v $var -c 7 -p data/normalisation/background_subtraction/ -a -o tables/background_subtraction &> logs/05b_${var}_table_7TeV.log &
let i+=1
if (( $i % N_JOBS == 0 ))
then
echo "Waiting on the above to finish."
wait;
fi
# nohup time
echo $var
echo "7"
python src/cross_section_measurement/05_make_tables.py -v $var -c 7 -p data/normalisation/background_subtraction/ -a -o tables/background_subtraction
# &> logs/05b_${var}_table_7TeV.log &
# wait;

nohup time python src/cross_section_measurement/05_make_tables.py -v $var -c 8 -p data/normalisation/background_subtraction/ -a -o tables/background_subtraction &> logs/05b_${var}_table_8TeV.log &
let i+=1
if (( $i % N_JOBS == 0 ))
then
echo "Waiting on the above to finish."
wait;
fi
# nohup time
echo $var
echo "8"
python src/cross_section_measurement/05_make_tables.py -v $var -c 8 -p data/normalisation/background_subtraction/ -a -o tables/background_subtraction
# &> logs/05b_${var}_table_8TeV.log &
wait;
done

wait;
Expand Down
4 changes: 2 additions & 2 deletions config/CMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

y_axis_title = {
'fontsize':50,
'fontsize':40,
'position' : (0., 1.),
'verticalalignment': 'bottom',
'horizontalalignment': 'right'
Expand Down Expand Up @@ -43,7 +43,7 @@
'pad': 12
}

legend_properties = {'size':35}
legend_properties = {'size':33}

figsize = (16,16)
dpi = 400
Expand Down
Loading