def post_creation_processing_for_1d_correlations( hist: Hist, normalization_factor: float, rebin_factor: int, title_label: str, axis_label: str, jet_pt: analysis_objects.JetPtBin, track_pt: analysis_objects.TrackPtBin) -> None: """ Basic post processing tasks for a new 1D correlation observable. """ # Rebin to decrease the fluctuations in the correlations # We don't scale by the rebin factor here because we will scale by bin width later. # Since we will handle it later, it doesn't make sense to try to preserve normalization here. hist.Rebin(rebin_factor) # Scale hist.Scale(1.0 / normalization_factor) # Set title, labels jet_pt_bins_title = labels.jet_pt_range_string(jet_pt) track_pt_bins_title = labels.track_pt_range_string(track_pt) # This won't look so good in ROOT, but that's just because their latex rendering is absolutely atrocious... hist.SetTitle( rf"{title_label} with {jet_pt_bins_title}, {track_pt_bins_title}") hist.GetXaxis().SetTitle(axis_label) hist.GetYaxis().SetTitle(fr"$\mathrm{{dN}}/\mathrm{{d}}{axis_label}$")
def scale_CPU_time(hist: Hist) -> None: """ Rebin the CPU time for improved presentation. Time is only reported in increments of 10 ms. So we rebin by those 10 bins (since each bin is 1 ms) and then scale them down to be on the same scale as the real time hist. We can perform this scaling in place. Note: This scaling appears to be the same as one would usually do for a rebin, but it is slightly more subtle, because it is as if the data was already binned. That being said, the end result is effectively the same. Args: hist: CPU time histogram to be scaled. Returns: None. """ logger.debug("Performing CPU time hist scaling.") timeIncrement = 10 hist.Rebin(timeIncrement) hist.Scale(1.0 / timeIncrement)