Skip to content

Commit

Permalink
Fix for Run 3 efficiencies
Browse files Browse the repository at this point in the history
  • Loading branch information
qgp committed Aug 31, 2024
1 parent 3a26dfd commit b082eef
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions machine_learning_hep/analysis/analyzer_jets.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,10 @@ def calculate_efficiencies(self):
self._save_hist(eff, f'eff/h_ptjet-pthf_effnew_{cat}.png')
self.h_effnew_ptjet_pthf[cat] = eff

proj_range = (2, get_nbins(h_det[cat], 0))
eff_avg = project_hist(h_det[cat], [1], {0: proj_range})
eff_avg = project_hist(h_det[cat], [1], {0: bins_ptjet})
ensure_sumw2(eff_avg)
eff_avg.Divide(project_hist(h_out, [1], {0: proj_range}))
self._save_hist(eff, f'eff/h_pthf_effnew_{cat}.png')
eff_avg.Divide(project_hist(h_out, [1], {0: bins_ptjet}))
self._save_hist(eff_avg, f'eff/h_pthf_effnew_{cat}.png')
self.h_effnew_pthf[cat] = eff_avg

c = TCanvas()
Expand Down Expand Up @@ -285,8 +284,7 @@ def _correct_efficiency(self, hist, ipt):
if self.cfg('efficiency.correction_method') == 'run3':
eff = self.h_effnew_pthf['pr'].GetBinContent(ipt + 1)
eff_old = self.hcandeff['pr'].GetBinContent(ipt + 1)
self.logger.info('Using Run 3 efficiency %g instead of %g',
eff, eff_old)
self.logger.info('Using Run 3 efficiency %g instead of %g', eff, eff_old)
hist.Scale(1. / eff)
elif self.cfg('efficiency.correction_method') == 'run2_2d':
self.logger.info('using Run 2 efficiencies per jet pt bin')
Expand Down

0 comments on commit b082eef

Please sign in to comment.