Skip to content

Commit 552ec41

Browse files
committed
Hreco -> error_treatment and changed default 2 -> 3 (toy MC)
1 parent 1a88cde commit 552ec41

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

config/RooUnfold_template.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
SVD_k_value = 5
1616
SVD_tau_value = -1
1717
SVD_n_toy = 1000
18-
Hreco = 2
18+
# 0 = no error treatment: returns sqrt(N)
19+
# 1 = bin-by-bin errors (diagonal covariance matrix)
20+
# 2 = covariance matrix from unfolding
21+
# 3 = covariance matrix from toy MC
22+
Hreco = 3
1923
Bayes_n_repeat = 4
2024

2125
unfolded_markerStyle = 20

src/cross_section_measurement/02_unfold_and_measure.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def unfold_results( results, category, channel, tau_value, h_truth, h_measured,
2828

2929
# turning off the unfolding errors for systematic samples
3030
if not category == 'central':
31-
unfoldCfg.Hreco = 0
31+
unfoldCfg.error_treatment = 0
3232
else:
33-
unfoldCfg.Hreco = options.Hreco
33+
unfoldCfg.error_treatment = options.error_treatment
3434

3535
h_unfolded_data = unfolding.unfold( h_data )
3636
del unfolding
@@ -379,9 +379,9 @@ def calculate_normalised_xsections( normalisation, category, channel, normalise_
379379
help = "Load fakes histogram and perform manual fake subtraction in TSVDUnfold" )
380380
parser.add_option( "-u", "--unfolding_method", dest = "unfolding_method", default = 'RooUnfoldSvd',
381381
help = "Unfolding method: RooUnfoldSvd (default), TSVDUnfold, RooUnfoldTUnfold, RooUnfoldInvert, RooUnfoldBinByBin, RooUnfoldBayes" )
382-
parser.add_option( "-H", "--hreco", type = 'int',
383-
dest = "Hreco", default = 2,
384-
help = "Hreco parameter for error treatment in RooUnfold" )
382+
parser.add_option( "-e", "--error_treatment", type = 'int',
383+
dest = "error_treatment", default = unfoldCfg.error_treatment,
384+
help = "parameter for error treatment in RooUnfold" )
385385
parser.add_option( "-c", "--centre-of-mass-energy", dest = "CoM", default = 13,
386386
help = "set the centre of mass energy for analysis. Default = 13 [TeV]", type = int )
387387
parser.add_option( "-C", "--combine-before-unfolding", dest = "combine_before_unfolding", action = "store_true",
@@ -471,7 +471,7 @@ def calculate_normalised_xsections( normalisation, category, channel, normalise_
471471
phase_space = "VisiblePS"
472472

473473
load_fakes = options.load_fakes
474-
unfoldCfg.Hreco = options.Hreco
474+
unfoldCfg.error_treatment = options.error_treatment
475475
method = options.unfolding_method
476476
combine_before_unfolding = options.combine_before_unfolding
477477
met_type = translate_options[options.metType]

src/unfolding_tests/k_value_determination.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_k_from_d_i( h_truth, h_measured, h_response, h_fakes = None, h_data = No
4848
h_fakes,
4949
method = method,
5050
k_value = k_start,
51-
Hreco = 0,
51+
error_treatment = 0,
5252
verbose = 1 )
5353
unfolding.unfold( h_data )
5454
hist_d_i = None

src/unfolding_tests/k_value_optimisation_plots.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from tools.ROOT_utils import set_root_defaults
1818

1919
from tools.file_utilities import make_folder_if_not_exists
20-
from tools.hist_utilities import value_error_tuplelist_to_hist, get_fit_results_histogram
20+
from tools.hist_utilities import get_fit_results_histogram
2121
from tools.plotting import make_plot, Histogram_properties
2222
from tools.Unfolding import Unfolding, get_unfold_histogram_tuple
2323
from config.variable_binning import bin_edges
@@ -37,7 +37,7 @@ def draw_regularisation_histograms( h_truth, h_measured, h_response, h_fakes = N
3737
h_fakes,
3838
method = method,
3939
k_value = k_max,
40-
Hreco = 2,
40+
error_treatment = 4,
4141
verbose = 1 )
4242

4343
RMSerror, MeanResiduals, RMSresiduals, Chi2 = unfolding.test_regularisation ( h_data, k_max )

tools/Unfolding.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__( self,
2727
k_value = unfoldCfg.SVD_k_value,
2828
n_toy = unfoldCfg.SVD_n_toy,
2929
Bayes_n_repeat = unfoldCfg.Bayes_n_repeat,
30-
Hreco = unfoldCfg.Hreco,
30+
error_treatment = unfoldCfg.error_treatment,
3131
measured_truth_without_fakes = None,
3232
verbose = 0 ):
3333
if not method in unfoldCfg.availablemethods:
@@ -46,7 +46,7 @@ def __init__( self,
4646
self.k_value = int(k_value)
4747
self.n_toy = n_toy
4848
self.Bayes_n_repeat = Bayes_n_repeat
49-
self.Hreco = Hreco
49+
self.error_treatment = error_treatment
5050
self.measured_truth_without_fakes = measured_truth_without_fakes
5151

5252
def setup_unfolding ( self, data ):
@@ -100,7 +100,7 @@ def setup_unfolding ( self, data ):
100100
def test_regularisation ( self, data, k_max ):
101101
self.setup_unfolding( data )
102102
if self.method == 'RooUnfoldSvd':
103-
findingK = RooUnfoldParms( self.unfoldObject, self.Hreco, self.truth )
103+
findingK = RooUnfoldParms( self.unfoldObject, self.error_treatment, self.truth )
104104
findingK.SetMinParm( 1 )
105105
findingK.SetMaxParm( k_max )
106106
findingK.SetStepSizeParm( 1 )
@@ -124,7 +124,7 @@ def unfold( self, data ):
124124
else:
125125
# remove unfold reports (faster)
126126
self.unfoldObject.SetVerbose( self.verbose )
127-
self.unfolded_data = asrootpy( self.unfoldObject.Hreco( self.Hreco ) )
127+
self.unfolded_data = asrootpy( self.unfoldObject.Hreco( self.error_treatment ) )
128128
return self.unfolded_data
129129

130130
def closureTest( self ):

0 commit comments

Comments
 (0)