# Compute the fake rate with soft ID method if computeFR: print("") print("Computing fake rate with softId...") data_fr = data.copy() #already with ID selection on jpsi muons inv_mass(data_fr) var=[] var.append(variable("inv_mass","m(3#mu) with softId=1","m(3#mu)","[GeV]", 30, 5., 5.45 )) var.append(variable("inv_mass","m(3#mu)","m(3#mu)", "[GeV]",30, 5, 5.45 )) var.append(variable("inv_mass","m(3#mu) with softId=0","m(3#mu)", "[GeV]",60, 3., 8. )) var.append(variable("inv_mass","m(3#mu) with softId=0","m(3#mu)", "[GeV]",60, 5, 5.45 )) sampleColl[-1].df = selSoftID(data_fr,1).copy() histo_soft1, t1_int = createHisto(sampleColl[-1],var[0]) makeSinglePlot(histo_soft1,var[0],sampleColl[-1],"soft1_" + flag) soft1_gaus_int=gaus_fit(histo_soft1,var[0],"soft1_" + flag,[None,5.28,0.07,None,None,None],pol="pol2") sampleColl[-1].df = data_fr histo_softAll, tAll_int = createHisto(sampleColl[-1],var[1] ) makeSinglePlot(histo_softAll,var[1],sampleColl[-1],"softAll_" + flag) softall_gaus_int=gaus_fit(histo_softAll,var[1],"softAll_" + flag,[None,5.29,0.07,None,None,None]) fr_softId = soft1_gaus_int/softall_gaus_int print("Fake rate computed with softId: %s"%fr_softId) else: print("")
# Compute the fake rate with soft ID method if computeFR: print("") print("Computing fake rate with mediumId...") data_fr = sample_all["data"].copy() #already with ID selection on jpsi muons inv_mass(data_fr) var=[] var.append(variable("inv_mass","m(3#mu) with mediumId=1","m(3#mu)","[GeV]", 40, 5., 5.45 )) var.append(variable("inv_mass","m(3#mu)","m(3#mu)", "[GeV]",40, 5, 5.45 )) sample_dic["data"].df = selMediumID(data_fr,1).copy() histo_medium1, t1_int = createHisto(sample_dic["data"],var[0],over = False) makeSinglePlot(histo_medium1,var[0],sample_dic["data"],"medium1_" + flag) medium1_gaus_int=gaus_fit(histo_medium1,var[0],"medium1_" + flag,[None,5.28,0.07,None,None,None],pol="pol1") sample_dic["data"].df = data_fr histo_mediumAll, tAll_int = createHisto(sample_dic["data"],var[1] ,over = False) makeSinglePlot(histo_mediumAll,var[1],sample_dic["data"],"mediumAll_" + flag) mediumall_gaus_int=gaus_fit(histo_mediumAll,var[1],"mediumAll_" + flag,[None,5.29,0.07,None,None,None]) fr_mediumId = medium1_gaus_int/mediumall_gaus_int print("Fake rate computed with mediumId: %s"%fr_mediumId) else: print("")
#var = variable("pt_miss", "pt_miss", "p_{T}^{miss}", "[GeV]", 15, 0, 20) #var = variable("tau", "tau", "prob_{#tau}", "", 10, 0, 0.7) #var = variable("BE_mu_star","E_{#mu}^{*}","E_{#mu}^{*}","[GeV]",12,0.2,2.2) #var = variable("m_miss_sq", "m_miss_sq", "m_{miss}^2", "[GeV^{2}]",10,0,9) #var = variable("toy", "toy", "toy", "", 2, 0, 2) #var = variable("Bmass","m(3#mu)","m(3#mu)","[GeV]",10,3,7) #var = variable("Bmass","m(3#mu)","m(3#mu)","[GeV]",10,3,13) if not PassFail: his_m = f.Get("shapes_fit_s/control/mc_mu") histo_m = ROOT.TH1F("mc_mu","mc_mu", var.nbins, var.xmin, var.xmax) for i in range(1,his_m.GetNbinsX()+1): histo_m.SetBinContent(i,his_m.GetBinContent(i)) histo_m.SetBinError(i,his_m.GetBinError(i)) print("mu",histo_m.Integral()) makeSinglePlot(histo_m, var, sample_coll[0]) his_t = f.Get("shapes_fit_s/control/mc_tau") histo_t = ROOT.TH1F("mc_tau","mc_tau", var.nbins, var.xmin, var.xmax) for i in range(1,his_t.GetNbinsX()+1): histo_t.SetBinContent(i,his_t.GetBinContent(i)) histo_t.SetBinError(i,his_t.GetBinError(i)) print("tau",histo_t.Integral()) makeSinglePlot(histo_t, var, sample_coll[1]) his_x = f.Get("shapes_fit_s/control/mis_id") histo_x = ROOT.TH1F("mis_id","mis_id", var.nbins,var.xmin, var.xmax) for i in range(1,his_x.GetNbinsX()+1): histo_x.SetBinContent(i,his_x.GetBinContent(i))