Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:02

0001 from builtins import range
0002 import ROOT
0003 
0004 masseb = []
0005 massee = []
0006 
0007 f1 = ROOT.TFile("plots_data.root")
0008 t1 = f1.Get("zeeUncalibTree/probe_tree")
0009 e = t1.GetEntries()
0010 
0011 masseb.append(ROOT.TH1F("masseb1", "", 80, 70, 110))
0012 massee.append(ROOT.TH1F("massee1", "", 80, 70, 110))
0013 for z in range(e):
0014     t1.GetEntry(z)
0015     if(abs(t1.l1eta)<1.479  and abs(t1.l2eta)<1.479):
0016         masseb[-1].Fill(t1.mass)
0017     else:
0018         massee[-1].Fill(t1.mass)
0019 
0020 f2 = ROOT.TFile("plots_data.root")
0021 t2 = f2.Get("zeeCalibTree/probe_tree")
0022 e = t2.GetEntries()
0023 
0024 masseb.append(ROOT.TH1F("masseb2", "", 80, 70, 110))
0025 massee.append(ROOT.TH1F("massee2", "", 80, 70, 110))
0026 
0027 for z in range(e):
0028     t2.GetEntry(z)
0029     if(abs(t2.l1eta)<1.479  and abs(t2.l2eta)<1.479):
0030         masseb[-1].Fill(t2.mass)
0031     else:
0032         massee[-1].Fill(t2.mass)
0033 
0034 f3 = ROOT.TFile("plots_mc.root")
0035 t3 = f3.Get("zeeUncalibTree/probe_tree")
0036 e = t3.GetEntries()
0037 
0038 masseb.append(ROOT.TH1F("masseb3", "", 80, 70, 110))
0039 massee.append(ROOT.TH1F("massee3", "", 80, 70, 110))
0040 
0041 for z in range(e):
0042     t3.GetEntry(z)
0043     if(abs(t3.l1eta)<1.479  and abs(t3.l2eta)<1.479):
0044         masseb[-1].Fill(t3.mass)
0045     else:
0046         massee[-1].Fill(t3.mass)
0047 
0048 f4 = ROOT.TFile("plots_mc.root")
0049 t4 = f4.Get("zeeCalibTree/probe_tree")
0050 e = t4.GetEntries()
0051 
0052 masseb.append(ROOT.TH1F("masseb4", "", 80, 70, 110))
0053 massee.append(ROOT.TH1F("massee4", "", 80, 70, 110))
0054 
0055 for z in range(e):
0056     t4.GetEntry(z)
0057     if(abs(t4.l1eta)<1.479  and abs(t4.l2eta)<1.479):
0058         masseb[-1].Fill(t4.mass)
0059     else:
0060         massee[-1].Fill(t4.mass)
0061 
0062 
0063 c = []
0064 ratio = []
0065 for i in range(2):
0066     c.append(ROOT.TCanvas("c"+str(i), "c"))
0067     c[-1].Divide(2,2)
0068     c[-1].cd(1)
0069     masseb[i+2].Scale(masseb[i].Integral()/masseb[i+2].Integral())
0070     masseb[i+2].Draw()
0071     masseb[i+2].SetFillColor(ROOT.kRed)
0072     masseb[i].Draw("PESAME")
0073     masseb[i].SetMarkerStyle(20)
0074     c[-1].cd(3)
0075     ratio.append(masseb[i+2].Clone())
0076     ratio[-1].Sumw2()
0077     ratio[-1].Divide(masseb[i])
0078     ratio[-1].Draw("PE")
0079     
0080     c[-1].cd(2)
0081     massee[i+2].Scale(massee[i].Integral()/massee[i+2].Integral())
0082     massee[i+2].Draw()
0083     massee[i+2].SetFillColor(ROOT.kRed)
0084     massee[i].Draw("PESAME")
0085     massee[i].SetMarkerStyle(20)
0086 raw_input()