import matplotlib.pyplot as plt
import mplhep


mplhep.style.use("LHCb2")

def reweight_comparing_plot(original_feature: list, target_feature: list, weights: list, n_bins: int, suptitle: str, titles: list[str], save: str) -> None:
    if len(original_feature) != len(weights):
        raise ValueError(f"original_feature and weights need to have the same dimension!")

    fig, ax = plt.subplots(nrows = 1, ncols = 3, figsize = (30, 12.5))

    ax[0].hist(original_feature, bins = n_bins)
    ax[0].set_ylabel("counts/a.u.")
    ax[0].set_title(titles[0])
    ax[1].hist(original_feature, bins = n_bins, weights = weights)
    ax[1].set_title(titles[1])
    ax[2].hist(target_feature, bins = n_bins)
    ax[2].set_title(titles[2])

    fig.suptitle(suptitle)
    fig.savefig(f"{save}")