Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigi Dello Stritto committed Oct 28, 2024
1 parent 4a0d9c5 commit 477b8e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions machine_learning_hep/analysis/analyzer_jets.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,14 @@ def fit(self):
self.roo_ws_ptjet[level][jptjet][ipt] = roo_ws.Clone()
# TODO: take parameter names from DB
if level in ('data', 'mc'):
varname_mean = fitcfg.get('var_mean', param_names["gauss_mean"])
varname_sigma = fitcfg.get('var_sigma', param_names["gauss_sigma"])
varname_mean = fitcfg.get('var_mean', self.p_param_names["gauss_mean"])
varname_sigma = fitcfg.get('var_sigma', self.p_param_names["gauss_sigma"])
self.fit_mean[level][ipt] = roo_ws.var(varname_mean).getValV()
self.fit_sigma[level][ipt] = roo_ws.var(varname_sigma).getValV()
varname_m = fitcfg.get('var', param_names["mass"])
if roo_ws.pdf(self.p_pdfnames["pdf_bkg"]):
self.fit_func_bkg[level][ipt] = roo_ws.pdf(self.p_pdfnames["pdf_bkg"]).asTF(roo_ws.var(varname_m))
varname_m = fitcfg.get('var', self.p_param_names["mass"])
pdf_bkg = roo_ws.pdf(self.p_pdfnames["pdf_bkg"])
if pdf_bkg:
self.fit_func_bkg[level][ipt] = pdf_bkg.asTF(roo_ws.var(varname_m))
self.fit_range[level][ipt] = (roo_ws.var(varname_m).getMin('fit'),
roo_ws.var(varname_m).getMax('fit'))
self.logger.debug('fit range for %s-%i: %s', level, ipt, self.fit_range[level][ipt])
Expand Down
5 changes: 3 additions & 2 deletions machine_learning_hep/analysis/analyzerdhadrons.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ def fit(self):
self.fit_mean[level][ipt] = roo_ws.var('mean').getValV()
self.fit_sigma[level][ipt] = roo_ws.var('sigma_g1').getValV()
var_m = fitcfg.get('var', 'm')
if roo_ws.pdf(self.p_pdfnames["pdf_bkg"]):
self.fit_func_bkg[level][ipt] = roo_ws.pdf(self.p_pdfnames["pdf_bkg"]).asTF(roo_ws.var(var_m))
pdf_bkg = roo_ws.pdf(self.p_pdfnames["pdf_bkg"])
if pdf_bkg:
self.fit_func_bkg[level][ipt] = pdf_bkg.asTF(roo_ws.var(var_m))
self.fit_range[level][ipt] = (roo_ws.var(var_m).getMin(), roo_ws.var(var_m).getMax())
else:
self.logger.error('RooFit failed for %s bin %d', level, ipt)
Expand Down

0 comments on commit 477b8e9

Please sign in to comment.