import matplotlib.pyplot as plt
import numpy as np
from ROOT import *

# Binned efficiencies
eff_loose = np.array([
    [0.811966, 0.157915, 0.774224, 0.255651, 0.683, 0.673, 0.496, 0.549, 0.593],
    [0.848566, 0.181479, 0.826112, 0.288839, 0.660, 0.736, 0.447, 0.622, 0.650],
    [0.880800, 0.196373, 0.857302, 0.276088, 0.676, 0.783, 0.475, 0.704, 0.714],
    [0.911897, 0.203653, 0.886948, 0.294688, 0.624, 0.831, 0.482, 0.766, 0.766],
    [0.929496, 0.222480, 0.907982, 0.294609, 0.705, 0.851, 0.537, 0.808, 0.812],
    [0.942924, 0.240126, 0.924407, 0.273356, 0.649, 0.855, 0.702, 0.890, 0.800]
])
eff_med = np.array([
    [0.711072, 0.121269, 0.686265, 0.222915, 0.390, 0.494, 0.311, 0.343, 0.394],
    [0.770084, 0.149739, 0.738592, 0.246606, 0.476, 0.538, 0.298, 0.395, 0.470],
    [0.806082, 0.152595, 0.778103, 0.253627, 0.497, 0.598, 0.301, 0.467, 0.495],
    [0.837797, 0.174947, 0.817937, 0.281170, 0.478, 0.652, 0.311, 0.538, 0.556],
    [0.904484, 0.202508, 0.876919, 0.288759, 0.527, 0.689, 0.340, 0.594, 0.595],
    [0.932139, 0.224329, 0.913220, 0.273356, 0.514, 0.671, 0.421, 0.589, 0.600]
])
eff_high = np.array([
    [0.502564, 0.0865130, 0.511916, 0.179267, 0.390, 0.494, 0.311, 0.343, 0.394],
    [0.561509, 0.1045560, 0.549374, 0.172700, 0.476, 0.538, 0.298, 0.395, 0.470],
    [0.610466, 0.0885553, 0.575190, 0.182265, 0.497, 0.598, 0.301, 0.467, 0.495],
    [0.622935, 0.1266680, 0.625772, 0.221215, 0.478, 0.652, 0.311, 0.538, 0.556],
    [0.780432, 0.1690660, 0.752847, 0.250731, 0.527, 0.689, 0.340, 0.594, 0.595],
    [0.883690, 0.1974720, 0.850847, 0.242215, 0.514, 0.671, 0.421, 0.589, 0.600]
])

def main():

    # Bins
    bins_et = [7.0, 15.0, 20.0, 30.0, 50.0, 80.0, 120.0]
    bins_eta = [0.00, 1.37, 1.52, 2.37, 2.47, 2.50, 3.16, 3.35, 4.00, 4.90]

    makeplot(bins_et, bins_eta, eff_loose)
    #plt.savefig('eff_loose.png')


def makeplot(bins_x, bins_y, weights):

    tempcanvas = TCanvas('c', 'c')
    temphist = TH2D('temphist','temphist',len(bins_x), bins_x, len(bins_y), bins_y)



    



if __name__=='__main__':
    main()
    
