Skip to content

Commit 036ed78

Browse files
committed
fix Megalinter error Multiple statements on one line (colon)
1 parent 2296e31 commit 036ed78

1 file changed

Lines changed: 26 additions & 13 deletions

File tree

PWGHF/D2H/Macros/compute_fraction_cutvar.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,16 @@ def main(config):
205205
)
206206

207207
pt_bin_to_process_name_suffix = ""
208-
if pt_bin_to_process != -1: pt_bin_to_process_name_suffix = "_bin_" + str(pt_bin_to_process)
208+
if pt_bin_to_process != -1:
209+
pt_bin_to_process_name_suffix = "_bin_" + str(pt_bin_to_process)
209210

210211
output_name_template = cfg['output']['file'].replace(".root", "") + pt_bin_to_process_name_suffix + ".root"
211212
output = ROOT.TFile(os.path.join(cfg["output"]["directory"], output_name_template), "recreate")
212213
n_sets = len(hist_rawy)
213214
pt_axis_title = hist_rawy[0].GetXaxis().GetTitle()
214215
for ipt in range(hist_rawy[0].GetNbinsX()):
215-
if pt_bin_to_process !=-1 and ipt+1 != pt_bin_to_process: continue
216+
if pt_bin_to_process !=-1 and ipt+1 != pt_bin_to_process:
217+
continue
216218
all_vectors_monotonous = MinimisationStatus.Success
217219
pt_min = hist_rawy[0].GetXaxis().GetBinLowEdge(ipt + 1)
218220
pt_max = hist_rawy[0].GetXaxis().GetBinUpEdge(ipt + 1)
@@ -280,45 +282,56 @@ def main(config):
280282
hist_bin_title_rawy = hist_bin_title if is_draw_title[PlotType.Rawy] else ""
281283
canv_rawy, histos_rawy, leg_r = minimiser.plot_result(f"_pt_{pt_min}_to_{pt_max}", hist_bin_title_rawy)
282284
output.cd()
283-
if is_save_to_root_file[ObjectToSave.Canvas]: canv_rawy.Write()
285+
if is_save_to_root_file[ObjectToSave.Canvas]:
286+
canv_rawy.Write()
284287
if is_save_to_root_file[ObjectToSave.RawYield]:
285288
for _, hist in histos_rawy.items():
286289
hist.Write()
287-
if is_save_canvas_as_macro[PlotType.Rawy]: canv_rawy.SaveAs(f"canv_rawy_{ipt+1}.C")
290+
if is_save_canvas_as_macro[PlotType.Rawy]:
291+
canv_rawy.SaveAs(f"canv_rawy_{ipt+1}.C")
288292

289293
hist_bin_title_unc = hist_bin_title if is_draw_title[PlotType.Unc] else ""
290294
canv_unc, histos_unc, leg_unc = minimiser.plot_uncertainties(f"_pt_{pt_min}_to_{pt_max}", hist_bin_title_unc)
291295
output.cd()
292-
if is_save_to_root_file[ObjectToSave.Canvas]: canv_unc.Write()
296+
if is_save_to_root_file[ObjectToSave.Canvas]:
297+
canv_unc.Write()
293298
if is_save_to_root_file[ObjectToSave.Uncertainty]:
294299
for _, hist in histos_unc.items():
295300
hist.Write()
296-
if is_save_canvas_as_macro[PlotType.Unc]: canv_unc.SaveAs(f"canv_unc_{ipt+1}.C")
301+
if is_save_canvas_as_macro[PlotType.Unc]:
302+
canv_unc.SaveAs(f"canv_unc_{ipt+1}.C")
297303

298304
hist_bin_title_eff = hist_bin_title if is_draw_title[PlotType.Eff] else ""
299305
canv_eff, histos_eff, leg_e = minimiser.plot_efficiencies(f"_pt_{pt_min}_to_{pt_max}", hist_bin_title_eff)
300306
output.cd()
301-
if is_save_to_root_file[ObjectToSave.Canvas]: canv_eff.Write()
307+
if is_save_to_root_file[ObjectToSave.Canvas]:
308+
canv_eff.Write()
302309
if is_save_to_root_file[ObjectToSave.Efficiency]:
303310
for _, hist in histos_eff.items():
304311
hist.Write()
305-
if is_save_canvas_as_macro[PlotType.Eff]: canv_eff.SaveAs(f"canv_eff_{ipt+1}.C")
312+
if is_save_canvas_as_macro[PlotType.Eff]:
313+
canv_eff.SaveAs(f"canv_eff_{ipt+1}.C")
306314

307315
hist_bin_title_frac = hist_bin_title if is_draw_title[PlotType.Frac] else ""
308316
canv_frac, histos_frac, leg_f = minimiser.plot_fractions(f"_pt_{pt_min}_to_{pt_max}", hist_bin_title_frac)
309317
output.cd()
310-
if is_save_to_root_file[ObjectToSave.Canvas]: canv_frac.Write()
318+
if is_save_to_root_file[ObjectToSave.Canvas]:
319+
canv_frac.Write()
311320
if is_save_to_root_file[ObjectToSave.Fraction]:
312321
for _, hist in histos_frac.items():
313322
hist.Write()
314-
if is_save_canvas_as_macro[PlotType.Frac]: canv_frac.SaveAs(f"canv_frac_{ipt+1}.C")
323+
if is_save_canvas_as_macro[PlotType.Frac]:
324+
canv_frac.SaveAs(f"canv_frac_{ipt+1}.C")
315325

316326
hist_bin_title_cov = hist_bin_title if is_draw_title[PlotType.Cov] else ""
317327
canv_cov, histo_cov = minimiser.plot_cov_matrix(True, f"_pt_{pt_min}_to_{pt_max}", hist_bin_title_cov)
318328
output.cd()
319-
if is_save_to_root_file[ObjectToSave.Canvas]: canv_cov.Write()
320-
if is_save_to_root_file[ObjectToSave.CorrelationMatrix]: histo_cov.Write()
321-
if is_save_canvas_as_macro[PlotType.Cov]: canv_cov.SaveAs(f"canv_cov_{ipt+1}.C")
329+
if is_save_to_root_file[ObjectToSave.Canvas]:
330+
canv_cov.Write()
331+
if is_save_to_root_file[ObjectToSave.CorrelationMatrix]:
332+
histo_cov.Write()
333+
if is_save_canvas_as_macro[PlotType.Cov]:
334+
canv_cov.SaveAs(f"canv_cov_{ipt+1}.C")
322335
else:
323336
print(f"Minimization for pT {pt_min}, {pt_max} not successful")
324337
hist_minimisation_status.SetBinContent(ipt + 1, MinimisationStatus.Fail)

0 commit comments

Comments
 (0)