diff --git a/TP_answers_referees/bg_rejection_with_IP.py b/TP_answers_referees/bg_rejection_with_IP.py index 649801a..ad2590b 100644 --- a/TP_answers_referees/bg_rejection_with_IP.py +++ b/TP_answers_referees/bg_rejection_with_IP.py @@ -18,9 +18,9 @@ cuts = [ tc.recoed()[0], tc.notVetoed(1000.)[0], tc.ip(250.)[0] ] print cuts cuts = [ tc.recoed()[0] ] -t.Draw('IP0>>bgreco', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts])+ ")", "norm") +t.Draw('NoB_IP0>>bgreco', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts])+ ")", "norm") cuts2 = [ tc.recoed()[0], tc.notVetoed(1000.)[0] ] -t.Draw('IP0>>bgreconv', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts2])+ ")", "normsame") +t.Draw('NoB_IP0>>bgreconv', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts2])+ ")", "normsame") bgreconv = r.gDirectory.Get('bgreconv') bgreconv.SetLineColor(r.kRed) bgreconv.SetMarkerColor(r.kRed) @@ -29,7 +29,7 @@ zmin = geo['Veto_5']['z']['pos']+geo['Veto_5']['z']['dim'] zmax = geo['Tr1_1']['z']['pos']-geo['Tr1_1']['z']['dim'] cuts3 = [ tc.recoed()[0], tc.notVetoed(1000.)[0], tc.redChi2(5.)[0], tc.ndf(25)[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.ecal()[0], tc.muon1(1)[0], tc.muon2(1)[0], tc.doca(30.)[0] ] -t.Draw('IP0>>bgreconvcuts', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts3])+ ")", "normsame") +t.Draw('NoB_IP0>>bgreconvcuts', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts3])+ ")", "normsame") bgreconvcuts = r.gDirectory.Get('bgreconvcuts') bgreconvcuts.SetMarkerColor(r.kGreen) bgreconvcuts.SetLineColor(r.kGreen) @@ -38,12 +38,12 @@ c2 = r.TCanvas() c2.cd() cuts = [ tc.recoed()[0]] -ntot = t.Draw('IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts])+ ")", "") +ntot = t.Draw('NoB_IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts])+ ")", "") print ntot w = t.GetHistogram().GetSumOfWeights() print w ccuts = [ tc.recoed()[0], tc.ip(250.)[0] ] -nc = t.Draw('IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in ccuts])+ ")", "") +nc = t.Draw('NoB_IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in ccuts])+ ")", "") print nc wc = t.GetHistogram().GetSumOfWeights() print wc @@ -51,14 +51,60 @@ print w print 1. - wc/w nvcuts = [ tc.recoed()[0], tc.notVetoed(1000.)[0] ] -nnv = t.Draw('IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in nvcuts])+ ")", "") +nnv = t.Draw('NoB_IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in nvcuts])+ ")", "") print nnv cnvcuts = [ tc.recoed()[0], tc.notVetoed(1000.)[0], tc.ip(250.)[0] ] nvw = t.GetHistogram().GetSumOfWeights() print nvw -cnnv = t.Draw('IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cnvcuts])+ ")", "") +cnnv = t.Draw('NoB_IP0>>bgtot', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cnvcuts])+ ")", "") print cnnv cnvw = t.GetHistogram().GetSumOfWeights() print cnvw print 1. - cnvw/nvw print tc.noB + +# Now without weights, after talking with Nico +print cuts +c3 = r.TCanvas() +c3.cd() +t.Draw('NoB_IP0>>bgreco(100,0.,1000.)', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +t.Draw('NoB_IP0>>bgreconv(100,0.,1000.)', "(weight*%s/%s)*("%(flux_nu, entries_nu)+"&&".join([c for c in cuts2])+ " && NoB_IP0 <= 1000.)", "normsame") +cuts3 = [ tc.recoed()[0], tc.notVetoed(1000.)[0], tc.redChi2(5.)[0], tc.ndf(25)[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.ecal()[0], tc.muon1(1)[0], tc.muon2(1)[0], tc.doca(30.)[0] ] +c4 = r.TCanvas() +c4.cd() +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +t.Draw('NoB_IP0>>bgreconvcuts2(100,0.,1000.)', "("+"&&".join([c for c in cuts3])+ "&& NoB_IP0 <= 1000.)", "normsame") +t.Draw('NoB_IP0>>bgreconv2(100,0.,1000.)', "("+"&&".join([c for c in cuts2])+ " && NoB_IP0 <= 1000.)", "normsame") +c5 = r.TCanvas() +c5.cd() +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0] ] +print cuts +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0] ] +t.Draw('NoB_IP0>>bgreco3(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "normsame") +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.doca(30.)[0] ] +c6 = r.TCanvas() +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.doca(30.)[0], tc.redChi2(5.)[0] ] +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.doca(30.)[0], tc.redChi2(5.)[0], tc.ndf(25)[0] ] +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.doca(30.)[0], tc.redChi2(5.)[0], tc.ndf(25)[0], tc.muon1(1)[0], tc.muon2(1)[0] ] +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.doca(30.)[0], tc.redChi2(5.)[0], tc.ndf(25)[0], tc.muon1(1)[0], tc.muon2(1)[0], tc.ecal()[0] ] +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +cuts = [ tc.recoed()[0], tc.fiducial(zmin, zmax, 250., 500.)[0], tc.goodtracks()[0], tc.doca(30.)[0], tc.redChi2(5.)[0], tc.ndf(25)[0], tc.muon1(1)[0], tc.muon2(1)[0], tc.ecal()[0], tc.notVetoed(1000.)[0] ] +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000. && nRecoed == 1)", "norm") +cuts = [tc.notVetoed(1000.)[0]] +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000. && nRecoed == 1)", "norm") +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 250. && nRecoed == 1)", "norm") +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && nRecoed == 1)", "norm") +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && nRecoed == 1)", "norm") +print 1.- 14./88 +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 250. && nRecoed == 1)", "norm") +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000. && nRecoed == 1)", "norm") +cuts = [tc.recoed()[0]] +t.Draw('NoB_IP0>>bgreco2(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000.)", "norm") +cuts = [tc.notVetoed(1000.)[0]] +t.Draw('NoB_IP0>>bgrecocut(100,0.,1000.)', "("+"&&".join([c for c in cuts])+ " && NoB_IP0 <= 1000. && nRecoed == 1)", "norm same")