def plotscripts::addToTestResults | ( | c, | |
res | |||
) |
Definition at line 959 of file plotscripts.py.
def plotscripts::availableCellsCSC | ( | reports | ) |
Definition at line 903 of file plotscripts.py.
00904 : 00905 cscs = [] 00906 # CSC station & ring 00907 for endcap in CSC_TYPES: 00908 for station in endcap[2]: 00909 for ring in station[2]: 00910 if ring[1]=="ALL": continue 00911 #label = "CSCvsphi_me%s%s%s" % (endcap[1], station[1], ring[1]) 00912 cscs.append("%s%s/%s" % (endcap[0], station[1],ring[1])) 00913 # CSC station and chamber 00914 for endcap in CSC_TYPES: 00915 for station in endcap[2]: 00916 for ring in station[2]: 00917 if ring[1]!="ALL": continue 00918 for chamber in range(1,ring[2]+1): 00919 #label = "CSCvsr_me%s%sch%02d" % (endcap[1], station[1], chamber) 00920 cscs.append("%s%s/ALL/%02d" % (endcap[0], station[1],chamber)) 00921 # CSC chambers 00922 for endcap in CSC_TYPES: 00923 for station in endcap[2]: 00924 for ring in station[2]: 00925 if ring[1]=="ALL": continue 00926 for chamber in range(1,ring[2]+1): 00927 # exclude non instrumented ME4/2 00928 if station[1]=="4" and ring[1]=="2": 00929 if endcap[1]=="m": continue 00930 if chamber<9 or chamber>13: continue 00931 schamber = "%02d" % chamber 00932 label = "ME%s%s%s_%s" % (endcap[1], station[1], ring[1], schamber) 00933 if len(reports)==0: 00934 # no reports case: do not include chambers 00935 #cscs.append(endcap[0]+station[1]+'/'+ring[1]+'/'+schamber) 00936 continue 00937 found = False 00938 for r in reports: 00939 if r.name == label: 00940 found = True 00941 break 00942 if not found: continue 00943 if r.status == "TOOFEWHITS" and r.posNum+r.negNum==0: continue 00944 if r.status == "NOFIT": continue 00945 cscs.append(endcap[0]+station[1]+'/'+ring[1]+'/'+schamber) 00946 return cscs 00947
def plotscripts::availableCellsDT | ( | reports | ) |
Definition at line 862 of file plotscripts.py.
00863 : 00864 dts = [] 00865 # DT wheels 00866 for iwheel in DT_TYPES: 00867 if iwheel[1]=="ALL": continue 00868 dts.append(iwheel[0]) 00869 # DT wheel & station 00870 for wheel in DT_TYPES: 00871 if wheel[1]=="ALL": continue 00872 for station in wheel[2]: 00873 dts.append(wheel[0]+'/'+station[1]) 00874 # DT station & sector 00875 for wheel in DT_TYPES: 00876 if wheel[1]!="ALL": continue 00877 for station in wheel[2]: 00878 for sector in range(1,station[2]+1): 00879 ssector = "%02d" % sector 00880 dts.append(wheel[0]+'/'+station[1]+'/'+ssector) 00881 # DT chambers 00882 for wheel in DT_TYPES: 00883 if wheel[1]=="ALL": continue 00884 for station in wheel[2]: 00885 for sector in range(1,station[2]+1): 00886 ssector = "%02d" % sector 00887 label = "MBwh%sst%ssec%s" % (wheelLetter(int(wheel[1])),station[1],ssector) 00888 if len(reports)==0: 00889 # no reports case: do not include chambers 00890 #dts.append(wheel[0]+'/'+station[1]+'/'+ssector) 00891 continue 00892 found = False 00893 for r in reports: 00894 if r.name == label: 00895 found = True 00896 break 00897 if not found: continue 00898 if r.status == "TOOFEWHITS" and r.posNum+r.negNum==0: continue 00899 if r.status == "NOFIT": continue 00900 dts.append(wheel[0]+'/'+station[1]+'/'+ssector) 00901 return dts 00902
def plotscripts::bellcurves | ( | tfile, | |
reports, | |||
name, | |||
twobin = True , |
|||
suppressblue = False |
|||
) |
Definition at line 1852 of file plotscripts.py.
01853 : 01854 t1 = time.time() 01855 ddt[0] += 1 01856 tdrStyle.SetOptTitle(1) 01857 tdrStyle.SetTitleBorderSize(1) 01858 tdrStyle.SetTitleFontSize(0.1) 01859 tdrStyle.SetOptStat(0) 01860 tdrStyle.SetHistMinimumZero() 01861 01862 c1.Clear() 01863 c1.ResetAttPad() 01864 01865 found = False 01866 for r in reports: 01867 if r.name == name: 01868 found = True 01869 break 01870 if not found: raise Exception, "Not a valid name" 01871 if r.status == "FAIL": 01872 #raise Exception, "Fit failed" 01873 print "Fit failed" 01874 c1.Clear() 01875 return 01876 01877 Pos = "Pos"; Neg = "Neg" 01878 if not twobin: 01879 Pos = ""; Neg = "" 01880 01881 pdirPos = "MuonAlignmentFromReference/%s%s" % (name, Pos) 01882 pdirNeg = "MuonAlignmentFromReference/%s%s" % (name, Neg) 01883 01884 t2 = time.time() 01885 ddt[1] = 1./ddt[0]*((ddt[0]-1)*ddt[1] + t2-t1) 01886 01887 chamber_x = tfile.Get(pdirPos+"_x") 01888 chamber_x_fit = tfile.Get(pdirPos+"_x_fit") 01889 chamber_y = tfile.Get(pdirPos+"_y") 01890 chamber_y_fit = tfile.Get(pdirPos+"_y_fit") 01891 chamber_dxdz = tfile.Get(pdirPos+"_dxdz") 01892 chamber_dxdz_fit = tfile.Get(pdirPos+"_dxdz_fit") 01893 chamber_dydz = tfile.Get(pdirPos+"_dydz") 01894 chamber_dydz_fit = tfile.Get(pdirPos+"_dydz_fit") 01895 chamber_alphax = tfile.Get(pdirPos+"_alphax") 01896 chamber_alphax_fit = tfile.Get(pdirPos+"_alphax_fit") 01897 chamber_alphay = tfile.Get(pdirPos+"_alphay") 01898 chamber_alphay_fit = tfile.Get(pdirPos+"_alphay_fit") 01899 chamber_x_fit2 = tfile.Get(pdirNeg+"_x_fit") 01900 chamber_y_fit2 = tfile.Get(pdirNeg+"_y_fit") 01901 chamber_dxdz_fit2 = tfile.Get(pdirNeg+"_dxdz_fit") 01902 chamber_dydz_fit2 = tfile.Get(pdirNeg+"_dydz_fit") 01903 chamber_alphax_fit2 = tfile.Get(pdirNeg+"_alphax_fit") 01904 chamber_alphay_fit2 = tfile.Get(pdirNeg+"_alphay_fit") 01905 01906 if not chamber_x: 01907 chamber_x = tfile.Get(pdirPos+"_residual") 01908 chamber_x_fit = tfile.Get(pdirPos+"_residual_fit") 01909 chamber_dxdz = tfile.Get(pdirPos+"_resslope") 01910 chamber_dxdz_fit = tfile.Get(pdirPos+"_resslope_fit") 01911 chamber_alphax = tfile.Get(pdirPos+"_alpha") 01912 chamber_alphax_fit = tfile.Get(pdirPos+"_alpha_fit") 01913 chamber_x_fit2 = tfile.Get(pdirNeg+"_residual_fit") 01914 chamber_dxdz_fit2 = tfile.Get(pdirNeg+"_resslope_fit") 01915 chamber_alphax_fit2 = tfile.Get(pdirNeg+"_alpha_fit") 01916 01917 if not chamber_x: 01918 print "Can't find neither "+pdirPos+"_x nor "+pdirPos+"_residual" 01919 return 01920 01921 t3 = time.time() 01922 ddt[2] = 1./ddt[0]*((ddt[0]-1)*ddt[2] + t3-t2) 01923 01924 #### 01925 chamber_x.SetAxisRange(-30., 30., "X") 01926 chamber_dxdz.SetAxisRange(-50., 50., "X") 01927 if not not chamber_y: 01928 chamber_y.SetAxisRange(-150., 150., "X") 01929 chamber_dydz.SetAxisRange(-200., 200., "X") 01930 #### 01931 01932 chamber_x.SetXTitle("Local x residual (mm)") 01933 chamber_dxdz.SetXTitle("Local dx/dz residual (mrad)") 01934 chamber_alphax.SetXTitle("Local dx/dz residual (mrad)") 01935 chamber_alphax.SetYTitle("Local x residual (mm)") 01936 if not not chamber_y: 01937 chamber_y.SetXTitle("Local y residual (mm)") 01938 chamber_dydz.SetXTitle("Local dy/dz residual (mrad)") 01939 chamber_alphay.SetXTitle("Local dy/dz residual (mrad)") 01940 chamber_alphay.SetYTitle("Local y residual (mm)") 01941 if name[0:2] == "ME": 01942 chamber_x.SetXTitle("Local r#phi residual (mm)") 01943 chamber_dxdz.SetXTitle("Local d(r#phi)/dz residual (mrad)") 01944 chamber_alphax.SetXTitle("Local d(r#phi)/dz residual (mrad)") 01945 chamber_alphax.SetYTitle("Local r#phi residual (mm)") 01946 01947 t4 = time.time() 01948 ddt[3] = 1./ddt[0]*((ddt[0]-1)*ddt[3] + t4-t3) 01949 01950 for h in chamber_x, chamber_dxdz, chamber_alphax, chamber_alphax, \ 01951 chamber_y, chamber_dydz, chamber_alphay, chamber_alphay: 01952 if not not h: 01953 h.GetXaxis().CenterTitle() 01954 h.GetYaxis().CenterTitle() 01955 h.GetXaxis().SetLabelSize(0.05) 01956 h.GetYaxis().SetLabelSize(0.05) 01957 h.GetXaxis().SetTitleSize(0.07) 01958 h.GetYaxis().SetTitleSize(0.07) 01959 h.GetXaxis().SetTitleOffset(0.9) 01960 h.GetYaxis().SetTitleOffset(0.9) 01961 01962 for f in chamber_x_fit2, chamber_y_fit2, chamber_dxdz_fit2, chamber_dydz_fit2, \ 01963 chamber_alphax_fit2, chamber_alphay_fit2: 01964 if not not f: 01965 f.SetLineColor(4) 01966 01967 t5 = time.time() 01968 ddt[4] = 1./ddt[0]*((ddt[0]-1)*ddt[4] + t5-t4) 01969 01970 if not not chamber_y: 01971 c1.Clear() 01972 c1.Divide(3, 2) 01973 chamber_x.SetTitle(getname(r)) 01974 01975 c1.GetPad(1).cd() 01976 chamber_x.Draw() 01977 if not suppressblue: chamber_x_fit2.Draw("same") 01978 chamber_x_fit.Draw("same") 01979 01980 c1.GetPad(2).cd() 01981 chamber_dxdz.Draw() 01982 if not suppressblue: chamber_dxdz_fit2.Draw("same") 01983 chamber_dxdz_fit.Draw("same") 01984 01985 c1.GetPad(3).cd() 01986 chamber_alphax.Draw() 01987 if not suppressblue: chamber_alphax_fit2.Draw("same") 01988 chamber_alphax_fit.Draw("same") 01989 01990 c1.GetPad(4).cd() 01991 chamber_y.Draw() 01992 if not suppressblue: chamber_y_fit2.Draw("same") 01993 chamber_y_fit.Draw("same") 01994 01995 c1.GetPad(5).cd() 01996 chamber_dydz.Draw() 01997 if not suppressblue: chamber_dydz_fit2.Draw("same") 01998 chamber_dydz_fit.Draw("same") 01999 02000 c1.GetPad(6).cd() 02001 chamber_alphay.Draw() 02002 if not suppressblue: chamber_alphay_fit2.Draw("same") 02003 chamber_alphay_fit.Draw("same") 02004 02005 else: 02006 c1.Clear() 02007 c1.Divide(3, 1) 02008 chamber_x.SetTitle(getname(r)) 02009 02010 c1.GetPad(1).cd() 02011 chamber_x.Draw() 02012 if not suppressblue: chamber_x_fit2.Draw("same") 02013 chamber_x_fit.Draw("same") 02014 02015 c1.GetPad(2).cd() 02016 chamber_dxdz.Draw() 02017 if not suppressblue: chamber_dxdz_fit2.Draw("same") 02018 chamber_dxdz_fit.Draw("same") 02019 02020 c1.GetPad(3).cd() 02021 chamber_alphax.Draw() 02022 if not suppressblue: chamber_alphax_fit2.Draw("same") 02023 chamber_alphax_fit.Draw("same") 02024 02025 t6 = time.time() 02026 ddt[5] = 1./ddt[0]*((ddt[0]-1)*ddt[5] + t6-t5) 02027 ddt[6] = 1./ddt[0]*((ddt[0]-1)*ddt[6] + t6-t1) 02028
def plotscripts::clearDDT | ( | ) |
Definition at line 1841 of file plotscripts.py.
def plotscripts::curvatureDTsummary | ( | tfiles, | |
window = 15. , |
|||
pdgSfactor = False |
|||
) |
Definition at line 1770 of file plotscripts.py.
01771 : 01772 global h, gm2, gm1, gz, gp1, gp2, tlegend 01773 01774 set_palette("blues") 01775 phis = {-2: [], -1: [], 0: [], 1: [], 2: []} 01776 diffs = {-2: [], -1: [], 0: [], 1: [], 2: []} 01777 differrs = {-2: [], -1: [], 0: [], 1: [], 2: []} 01778 for wheelstr, wheel in ("m2", "-2"), ("m1", "-1"), ("z", "0"), ("p1", "+1"), ("p2", "+2"): 01779 for sector in "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12": 01780 curvatureplot(tfiles, "wheel%s_sector%s" % (wheelstr, sector), "deltax", 01781 title="Wheel %s, sector %s" % (wheel, sector), fitgauss=True, reset_palette=False) 01782 if fitgauss_diff[1] < window: 01783 uncertainty = fitgauss_diff[1] 01784 if pdgSfactor and (fitgauss_chi2/fitgauss_ndf) > 1.: uncertainty *= sqrt(fitgauss_chi2/fitgauss_ndf) 01785 01786 phis[int(wheel)].append(signConventions["DT", int(wheel), 1, int(sector)][4]) 01787 diffs[int(wheel)].append(fitgauss_diff[0]) 01788 differrs[int(wheel)].append(uncertainty) 01789 01790 h = ROOT.TH1F("h", "", 1, -pi, pi) 01791 h.SetAxisRange(-window, window, "Y") 01792 h.SetXTitle("#phi (rad)") 01793 h.SetYTitle("#Deltax(p_{T} #rightarrow #infty) - #Deltax(p_{T} #rightarrow 0) (mm)") 01794 h.GetXaxis().CenterTitle() 01795 h.GetYaxis().CenterTitle() 01796 01797 gm2 = ROOT.TGraphErrors(len(phis[-2]), array.array("d", phis[-2]), array.array("d", diffs[-2]), 01798 array.array("d", [0.]*len(phis[-2])), array.array("d", differrs[-2])) 01799 gm1 = ROOT.TGraphErrors(len(phis[-1]), array.array("d", phis[-1]), array.array("d", diffs[-1]), 01800 array.array("d", [0.]*len(phis[-1])), array.array("d", differrs[-1])) 01801 gz = ROOT.TGraphErrors(len(phis[0]), array.array("d", phis[0]), array.array("d", diffs[0]), 01802 array.array("d", [0.]*len(phis[0])), array.array("d", differrs[0])) 01803 gp1 = ROOT.TGraphErrors(len(phis[1]), array.array("d", phis[1]), array.array("d", diffs[1]), 01804 array.array("d", [0.]*len(phis[1])), array.array("d", differrs[1])) 01805 gp2 = ROOT.TGraphErrors(len(phis[2]), array.array("d", phis[2]), array.array("d", diffs[2]), 01806 array.array("d", [0.]*len(phis[2])), array.array("d", differrs[2])) 01807 01808 gm2.SetMarkerStyle(21); gm2.SetMarkerColor(ROOT.kRed); gm2.SetLineColor(ROOT.kRed) 01809 gm1.SetMarkerStyle(22); gm1.SetMarkerColor(ROOT.kBlue); gm1.SetLineColor(ROOT.kBlue) 01810 gz.SetMarkerStyle(3); gz.SetMarkerColor(ROOT.kBlack); gz.SetLineColor(ROOT.kBlack) 01811 gp1.SetMarkerStyle(26); gp1.SetMarkerColor(ROOT.kBlue); gp1.SetLineColor(ROOT.kBlue) 01812 gp2.SetMarkerStyle(25); gp2.SetMarkerColor(ROOT.kRed); gp2.SetLineColor(ROOT.kRed) 01813 01814 h.Draw() 01815 tlegend = ROOT.TLegend(0.25, 0.2, 0.85, 0.5) 01816 tlegend.SetFillColor(ROOT.kWhite) 01817 tlegend.SetBorderSize(0) 01818 tlegend.AddEntry(gm2, "Wheel -2", "p") 01819 tlegend.AddEntry(gm1, "Wheel -1", "p") 01820 tlegend.AddEntry(gz, "Wheel 0", "p") 01821 tlegend.AddEntry(gp1, "Wheel +1", "p") 01822 tlegend.AddEntry(gp2, "Wheel +2", "p") 01823 tlegend.Draw() 01824 01825 gm2.Draw("p") 01826 gm1.Draw("p") 01827 gz.Draw("p") 01828 gp1.Draw("p") 01829 gp2.Draw("p") 01830
def plotscripts::curvatureplot | ( | tfiles, | |
name, | |||
param, | |||
mode = "from2d" , |
|||
window = 15. , |
|||
widebins = False , |
|||
title = "" , |
|||
fitgauss = False , |
|||
fitconst = False , |
|||
fitline = False , |
|||
reset_palette = False |
|||
) |
Definition at line 1620 of file plotscripts.py.
01621 : 01622 # "param" may be one of "deltax" (Delta x position residuals), "deltadxdz" (Delta (dx/dz) angular residuals), "curverr" (Delta x * d(Delta q/pT)/d(Delta x) = Delta q/pT in the absence of misalignment) 01623 tdrStyle.SetOptTitle(1) 01624 tdrStyle.SetTitleBorderSize(0) 01625 tdrStyle.SetOptStat(0) 01626 tdrStyle.SetOptFit(0) 01627 tdrStyle.SetTitleFontSize(0.05) 01628 01629 c1.Clear() 01630 if reset_palette: set_palette("blues") 01631 global hist, histCOPY, hist2d, tline1, tline2, tline3, tline4, tline5 01632 01633 hdir = "AlignmentMonitorMuonVsCurvature/iter1/" 01634 01635 if name not in ("all", "top", "bottom"): 01636 hsuffix = "_%s_%s" % (name, param) 01637 prof = tfiles[0].Get(hdir+"tprofile"+hsuffix).Clone("tprofile_"+hsuffix) 01638 hist2d = tfiles[0].Get(hdir+"th2f"+hsuffix).Clone("th2f_"+hsuffix) 01639 for tfile in tfiles[1:]: 01640 prof.Add(tfile.Get(hdir+"tprofile"+hsuffix)) 01641 hist2d.Add(tfile.Get(hdir+"th2f"+hsuffix)) 01642 else: 01643 prof = None 01644 hist2d = None 01645 for wheel in "m2", "m1", "z", "p1", "p2": 01646 if name == "all": sectors = "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" 01647 elif name == "top": sectors = "01", "02", "03", "04", "05", "06" 01648 elif name == "bottom": sectors = "07", "08", "09", "10", "11", "12" 01649 else: raise Exception 01650 01651 for sector in sectors: 01652 hsuffix = "_%s_%s" % ("wheel%s_sector%s" % (wheel, sector), param) 01653 for tfile in tfiles: 01654 if prof is None: 01655 prof = tfiles[0].Get(hdir+"tprofile"+hsuffix).Clone("tprofile_"+hsuffix) 01656 hist2d = tfiles[0].Get(hdir+"th2f"+hsuffix).Clone("tprofile_"+hsuffix) 01657 else: 01658 prof.Add(tfile.Get(hdir+"tprofile"+hsuffix)) 01659 hist2d.Add(tfile.Get(hdir+"th2f"+hsuffix)) 01660 01661 hist = ROOT.TH1F("hist", "", prof.GetNbinsX(), prof.GetBinLowEdge(1), -prof.GetBinLowEdge(1)) 01662 for i in xrange(1, prof.GetNbinsX()+1): 01663 hist.SetBinContent(i, prof.GetBinContent(i)) 01664 hist.SetBinError(i, prof.GetBinError(i)) 01665 01666 if mode == "plain": 01667 hist = prof 01668 elif mode == "from2d": 01669 skip = 1 01670 if widebins: 01671 hist.Rebin(5) 01672 skip = 5 01673 for i in xrange(0, int(prof.GetNbinsX()), skip): 01674 tmp = hist2d.ProjectionY("tmp", i+1, i + skip) 01675 if tmp.GetEntries() > 1: 01676 hist.SetBinContent(i/skip+1, tmp.GetMean()) 01677 hist.SetBinError(i/skip+1, ROOT.TMath.StudentQuantile(0.841345,tmp.GetEntries()) * tmp.GetRMS() / sqrt(tmp.GetEntries())) 01678 #hist.SetBinError(i/skip+1, tmp.GetRMS() / sqrt(tmp.GetEntries())) 01679 else: 01680 #hist.SetBinContent(i/skip+1, 2000.) 01681 #hist.SetBinError(i/skip+1, 1000.) 01682 hist.SetBinContent(i/skip+1, 0.) 01683 hist.SetBinError(i/skip+1, 0.) 01684 else: 01685 raise Exception 01686 01687 01688 if fitgauss: 01689 f = ROOT.TF1("f", "[0] + [1]*exp(-x**2/2/0.01**2)", hist.GetBinLowEdge(1), -hist.GetBinLowEdge(1)) 01690 f.SetParameters(0, 0., 0.01) 01691 hist.Fit(f, "q") 01692 f.SetLineColor(ROOT.kRed) 01693 global fitgauss_diff, fitgauss_chi2, fitgauss_ndf 01694 # fitter = ROOT.TVirtualFitter.GetFitter() 01695 # fitgauss_diff = f.GetParameter(0) - f.GetParameter(1), \ 01696 # sqrt(f.GetParError(0)**2 + f.GetParError(1)**2 + 2.*fitter.GetCovarianceMatrixElement(0, 1)) 01697 fitgauss_diff = f.GetParameter(1), f.GetParError(1) 01698 fitgauss_chi2 = f.GetChisquare() 01699 fitgauss_ndf = f.GetNDF() 01700 01701 global fitline_intercept, fitline_slope 01702 if fitconst: 01703 f = ROOT.TF1("f", "[0]", hist.GetBinLowEdge(1), -hist.GetBinLowEdge(1)) 01704 hist.Fit(f, "q") 01705 f.SetLineColor(ROOT.kRed) 01706 fitline_intercept = f.GetParameter(0), f.GetParError(0) 01707 01708 if fitline: 01709 f = ROOT.TF1("f", "[0] + [1]*x", hist.GetBinLowEdge(1), -hist.GetBinLowEdge(1)) 01710 hist.Fit(f, "qNE") 01711 f.SetLineColor(ROOT.kRed) 01712 global f2, f3 01713 f2 = ROOT.TF1("2", "[0] + [1]*x", hist.GetBinLowEdge(1), -hist.GetBinLowEdge(1)) 01714 f3 = ROOT.TF1("2", "[0] + [1]*x", hist.GetBinLowEdge(1), -hist.GetBinLowEdge(1)) 01715 f2.SetParameters(f.GetParameter(0), f.GetParameter(1) + f.GetParError(1)) 01716 f3.SetParameters(f.GetParameter(0), f.GetParameter(1) - f.GetParError(1)) 01717 f2.SetLineColor(ROOT.kRed) 01718 f3.SetLineColor(ROOT.kRed) 01719 f2.SetLineStyle(2) 01720 f3.SetLineStyle(2) 01721 fitline_intercept = f.GetParameter(0), f.GetParError(0) 01722 fitline_slope = f.GetParameter(1), f.GetParError(1) 01723 01724 hist.SetAxisRange(-window, window, "Y") 01725 hist.SetMarkerStyle(20) 01726 hist.SetMarkerSize(0.75) 01727 hist.GetXaxis().CenterTitle() 01728 hist.GetYaxis().CenterTitle() 01729 if param == "curverr": 01730 hist.GetYaxis().SetTitleOffset(1.35) 01731 else: 01732 hist.GetYaxis().SetTitleOffset(0.75) 01733 hist.GetXaxis().SetTitleOffset(1.2) 01734 hist.GetXaxis().SetTitleSize(0.05) 01735 hist.GetYaxis().SetTitleSize(0.05) 01736 hist.SetTitle(title) 01737 if param == "pterr": hist.SetXTitle("qp_{T} (GeV/c)") 01738 else: hist.SetXTitle("q/p_{T} (c/GeV)") 01739 if param == "deltax": hist.SetYTitle("#Deltax' (mm)") 01740 if param == "deltadxdz": hist.SetYTitle("#Deltadx'/dz (mrad)") 01741 if param == "pterr": hist.SetYTitle("#Deltap_{T}/p_{T} (%)") 01742 if param == "curverr": hist.SetYTitle("#Deltaq/p_{T} (c/GeV)") 01743 hist.SetMarkerColor(ROOT.kBlack) 01744 hist.SetLineColor(ROOT.kBlack) 01745 hist.Draw() 01746 hist2d.Draw("colzsame") 01747 histCOPY = hist.Clone() 01748 histCOPY.SetXTitle("") 01749 histCOPY.SetYTitle("") 01750 01751 if widebins: 01752 histCOPY.Draw("samee1") 01753 histCOPY.Draw("sameaxis") 01754 else: 01755 histCOPY.Draw("same") 01756 histCOPY.Draw("sameaxis") 01757 01758 if fitline: 01759 f.Draw("same") 01760 #f2.Draw("same") 01761 #f3.Draw("same") 01762 01763 tline1 = ROOT.TLine(hist.GetBinLowEdge(1), -window, hist.GetBinLowEdge(1), window) 01764 tline2 = ROOT.TLine(hist.GetBinLowEdge(1), window, -hist.GetBinLowEdge(1), window) 01765 tline3 = ROOT.TLine(-hist.GetBinLowEdge(1), window, -hist.GetBinLowEdge(1), -window) 01766 tline4 = ROOT.TLine(-hist.GetBinLowEdge(1), -window, hist.GetBinLowEdge(1), -window) 01767 tline5 = ROOT.TLine(-hist.GetBinLowEdge(1), 0., hist.GetBinLowEdge(1), 0.) 01768 for t in tline1, tline2, tline3, tline4, tline5: t.Draw() 01769
def plotscripts::DBdiff | ( | database1, | |
database2, | |||
reports1, | |||
reports2, | |||
window = 10. , |
|||
selection = None , |
|||
phi = False , |
|||
color = ROOT.kBlue-8 , |
|||
style = 1 , |
|||
bins = 50 , |
|||
normalized = False , |
|||
getvalues = False , |
|||
name = "tmp" |
|||
) |
Definition at line 486 of file plotscripts.py.
00488 : 00489 tdrStyle.SetOptStat("emrou") 00490 tdrStyle.SetStatW(0.40) 00491 00492 if phi: 00493 hx = ROOT.TH1F("%s_phi" % name, "", bins, -window, window) 00494 else: 00495 hx = ROOT.TH1F("%s_x" % name, "", bins, -window, window) 00496 hy = ROOT.TH1F("%s_y" % name, "", bins, -window, window) 00497 hz = ROOT.TH1F("%s_z" % name, "", bins, -window, window) 00498 hphix = ROOT.TH1F("%s_phix" % name, "", bins, -window, window) 00499 hphiy = ROOT.TH1F("%s_phiy" % name, "", bins, -window, window) 00500 hphiz = ROOT.TH1F("%s_phiz" % name, "", bins, -window, window) 00501 00502 for r1 in reports1: 00503 if selection is None or (selection.func_code.co_argcount == len(r1.postal_address) and selection(*r1.postal_address)): 00504 if reports2 is None: 00505 r2 = Report(r1.chamberId, r1.postal_address, r1.name) 00506 r2.add_parameters(ValErr(0., 0., 0.), ValErr(0., 0., 0.), ValErr(0., 0., 0.), 00507 ValErr(0., 0., 0.), ValErr(0., 0., 0.), ValErr(0., 0., 0.), 0., 0., 0., 0.) 00508 else: 00509 found = False 00510 for r2 in reports2: 00511 if r1.postal_address == r2.postal_address: 00512 found = True 00513 break 00514 if not found: continue 00515 00516 found = False 00517 if r1.postal_address[0] == "DT": 00518 if r1.postal_address[1:] in database1.dt: 00519 found = True 00520 db1 = database1.dt[r1.postal_address[1:]] 00521 if database2 is None: 00522 db2 = DTAlignable() 00523 db2.x = db2.y = db2.z = db2.phix = db2.phiy = db2.phiz = 0. 00524 db2.xx = db2.xy = db2.xz = db2.yx = db2.yy = db2.yz = db2.zx = db2.zy = db2.zz = 0. 00525 else: 00526 db2 = database2.dt[r1.postal_address[1:]] 00527 else: 00528 if r1.postal_address[1:] in database1.csc: 00529 found = True 00530 db1 = database1.csc[r1.postal_address[1:]] 00531 if database2 is None: 00532 db2 = CSCAlignable() 00533 db2.x = db2.y = db2.z = db2.phix = db2.phiy = db2.phiz = 0. 00534 db2.xx = db2.xy = db2.xz = db2.yx = db2.yy = db2.yz = db2.zx = db2.zy = db2.zz = 0. 00535 else: 00536 db2 = database2.csc[r1.postal_address[1:]] 00537 00538 if found and r1.status == "PASS" and r2.status == "PASS": 00539 if r1.deltax is not None and r2.deltax is not None and r1.deltax.error is not None and \ 00540 r2.deltax.error is not None and (r1.deltax.error**2 + r2.deltax.error**2) > 0.: 00541 if normalized: 00542 fill = (db1.x - db2.x)/sqrt(r1.deltax.error**2 + r2.deltax.error**2) * signConventions[r1.postal_address][0] 00543 else: 00544 if phi: 00545 fill = (db1.x - db2.x)/signConventions[r1.postal_address][3] * 1000. * signConventions[r1.postal_address][0] 00546 else: 00547 fill = (db1.x - db2.x) * 10. * signConventions[r1.postal_address][0] 00548 hx.Fill(fill) 00549 if getvalues not in (False, None): 00550 getvalues["x"].append((fill, 10. * sqrt(r1.deltax.error**2 + r2.deltax.error**2))) 00551 00552 if r1.deltay is not None and r2.deltay is not None and r1.deltay.error is not None and \ 00553 r2.deltay.error is not None and (r1.deltay.error**2 + r2.deltay.error**2) > 0.: 00554 if normalized: 00555 fill = (db1.y - db2.y)/sqrt(r1.deltay.error**2 + r2.deltay.error**2) * signConventions[r1.postal_address][1] 00556 else: 00557 fill = (db1.y - db2.y) * 10. * signConventions[r1.postal_address][1] 00558 hy.Fill(fill) 00559 if getvalues not in (False, None): 00560 getvalues["y"].append((fill, 10. * sqrt(r1.deltay.error**2 + r2.deltay.error**2))) 00561 00562 if r1.deltaz is not None and r2.deltaz is not None and r1.deltaz.error is not None and \ 00563 r2.deltaz.error is not None and (r1.deltaz.error**2 + r2.deltaz.error**2) > 0.: 00564 if normalized: 00565 fill = (db1.z - db2.z)/sqrt(r1.deltaz.error**2 + r2.deltaz.error**2) * signConventions[r1.postal_address][2] 00566 else: 00567 fill = (db1.z - db2.z) * 10. * signConventions[r1.postal_address][2] 00568 hz.Fill(fill) 00569 if getvalues not in (False, None): 00570 getvalues["z"].append((fill, 10. * sqrt(r1.deltaz.error**2 + r2.deltaz.error**2))) 00571 00572 if r1.deltaphix is not None and r2.deltaphix is not None and r1.deltaphix.error is not None and \ 00573 r2.deltaphix.error is not None and (r1.deltaphix.error**2 + r2.deltaphix.error**2) > 0.: 00574 if normalized: 00575 fill = (db1.phix - db2.phix)/sqrt(r1.deltaphix.error**2 + r2.deltaphix.error**2) 00576 else: 00577 fill = (db1.phix - db2.phix) * 1000. 00578 hphix.Fill(fill) 00579 if getvalues not in (False, None): 00580 getvalues["phix"].append((fill, 10. * sqrt(r1.deltaphix.error**2 + r2.deltaphix.error**2))) 00581 00582 if r1.deltaphiy is not None and r2.deltaphiy is not None and r1.deltaphiy.error is not None and \ 00583 r2.deltaphiy.error is not None and (r1.deltaphiy.error**2 + r2.deltaphiy.error**2) > 0.: 00584 if normalized: 00585 fill = (db1.phiy - db2.phiy)/sqrt(r1.deltaphiy.error**2 + r2.deltaphiy.error**2) 00586 else: 00587 fill = (db1.phiy - db2.phiy) * 1000. 00588 hphiy.Fill(fill) 00589 if getvalues not in (False, None): 00590 getvalues["phiy"].append((fill, 10. * sqrt(r1.deltaphiy.error**2 + r2.deltaphiy.error**2))) 00591 00592 if r1.deltaphiz is not None and r2.deltaphiz is not None and r1.deltaphiz.error is not None and \ 00593 r2.deltaphiz.error is not None and (r1.deltaphiz.error**2 + r2.deltaphiz.error**2) > 0.: 00594 if normalized: 00595 fill = (db1.phiz - db2.phiz)/sqrt(r1.deltaphiz.error**2 + r2.deltaphiz.error**2) 00596 else: 00597 fill = (db1.phiz - db2.phiz) * 1000. 00598 hphiz.Fill(fill) 00599 if getvalues not in (False, None): 00600 getvalues["phiz"].append((fill, 10. * sqrt(r1.deltaphiz.error**2 + r2.deltaphiz.error**2))) 00601 00602 if not normalized: 00603 if phi: 00604 hx.SetXTitle("#delta_{#phi} position (mrad)") 00605 else: 00606 hx.SetXTitle("#delta_{x'} (mm)") 00607 hy.SetXTitle("#delta_{y'} (mm)") 00608 hz.SetXTitle("#delta_{z'} (mm)") 00609 hphix.SetXTitle("#delta_{#phi_{x}} (mrad)") 00610 hphiy.SetXTitle("#delta_{#phi_{y}} (mrad)") 00611 hphiz.SetXTitle("#delta_{#phi_{z}} (mrad)") 00612 else: 00613 if phi: 00614 hx.SetXTitle("#delta_{#phi}/#sigma_{#phi} position") 00615 else: 00616 hx.SetXTitle("#delta_{x'}/#sigma_{x'}") 00617 hy.SetXTitle("#delta_{y'}/#sigma_{y'}") 00618 hz.SetXTitle("#delta_{z'}/#sigma_{z'}") 00619 hphix.SetXTitle("#delta_{#phi_{x}}/#sigma_{#phi_{x}}") 00620 hphiy.SetXTitle("#delta_{#phi_{y}}/#sigma_{#phi_{y}}") 00621 hphiz.SetXTitle("#delta_{#phi_{z}}/#sigma_{#phi_{z}}") 00622 00623 for h in hx, hy, hz, hphix, hphiy, hphiz: 00624 h.GetXaxis().CenterTitle() 00625 h.GetYaxis().CenterTitle() 00626 h.SetFillColor(color) 00627 h.SetLineStyle(style) 00628 00629 if normalized: 00630 fx = ROOT.TF1("fx", "%g * exp(-x**2/2.)/sqrt(2.*3.1415926)" % (hx.GetEntries()*2.*window/bins), -window, window) 00631 fy = ROOT.TF1("fy", "%g * exp(-x**2/2.)/sqrt(2.*3.1415926)" % (hy.GetEntries()*2.*window/bins), -window, window) 00632 fz = ROOT.TF1("fz", "%g * exp(-x**2/2.)/sqrt(2.*3.1415926)" % (hz.GetEntries()*2.*window/bins), -window, window) 00633 fphix = ROOT.TF1("fphix", "%g * exp(-x**2/2.)/sqrt(2.*3.1415926)" % (hphix.GetEntries()*2.*window/bins), -window, window) 00634 fphiy = ROOT.TF1("fphiy", "%g * exp(-x**2/2.)/sqrt(2.*3.1415926)" % (hphiy.GetEntries()*2.*window/bins), -window, window) 00635 fphiz = ROOT.TF1("fphiz", "%g * exp(-x**2/2.)/sqrt(2.*3.1415926)" % (hphiz.GetEntries()*2.*window/bins), -window, window) 00636 for f in fx, fy, fz, fphix, fphiy, fphiz: 00637 f.SetLineWidth(2) 00638 f.SetLineColor(ROOT.kBlue) 00639 for h, f in (hx, fx), (hy, fy), (hz, fz), (hphix, fphix), (hphiy, fphiy), (hphiz, fphiz): 00640 h.SetAxisRange(0, 1.1*max(h.GetMaximum(), f.GetMaximum()), "Y") 00641 c1.Clear() 00642 c1.Divide(3, 2) 00643 c1.GetPad(1).cd(); hx.Draw(); fx.Draw("same") 00644 c1.GetPad(2).cd(); hy.Draw(); fy.Draw("same") 00645 c1.GetPad(3).cd(); hz.Draw(); fz.Draw("same") 00646 c1.GetPad(4).cd(); hphix.Draw(); fphix.Draw("same") 00647 c1.GetPad(5).cd(); hphiy.Draw(); fphiy.Draw("same") 00648 c1.GetPad(6).cd(); hphiz.Draw(); fphiz.Draw("same") 00649 return hx, hy, hz, hphix, hphiy, hphiz, fx, fy, fz, fphix, fphiy, fphiz 00650 else: 00651 c1.Clear() 00652 c1.Divide(3, 2) 00653 c1.GetPad(1).cd(); hx.Draw() 00654 c1.GetPad(2).cd(); hy.Draw() 00655 c1.GetPad(3).cd(); hz.Draw() 00656 c1.GetPad(4).cd(); hphix.Draw() 00657 c1.GetPad(5).cd(); hphiy.Draw() 00658 c1.GetPad(6).cd(); hphiz.Draw() 00659 return hx, hy, hz, hphix, hphiy, hphiz
def plotscripts::DBdiffVersus | ( | quantity, | |
versus, | |||
database1, | |||
database2, | |||
reports1, | |||
reports2, | |||
windwselection = None , |
|||
color = ROOT.kBlack |
|||
) |
Definition at line 663 of file plotscripts.py.
00664 : 00665 tdrStyle.SetOptStat("") 00666 00667 domain = [] 00668 values = [] 00669 errors = [] 00670 00671 for r1 in reports1: 00672 if selection is None or (selection.func_code.co_argcount == len(r1.postal_address) and selection(*r1.postal_address)): 00673 if reports2 is None: 00674 r2 = Report(r1.chamberId, r1.postal_address, r1.name) 00675 r2.add_parameters(ValErr(0., 0., 0.), ValErr(0., 0., 0.), ValErr(0., 0., 0.), 00676 ValErr(0., 0., 0.), ValErr(0., 0., 0.), ValErr(0., 0., 0.), 0., 0., 0.) 00677 else: 00678 found = False 00679 for r2 in reports2: 00680 if r1.postal_address == r2.postal_address: 00681 found = True 00682 break 00683 if not found: continue 00684 00685 found = False 00686 if r1.postal_address[0] == "DT": 00687 if r1.postal_address[1:] in database1.dt: 00688 found = True 00689 db1 = database1.dt[r1.postal_address[1:]] 00690 if database2 is None: 00691 db2 = DTAlignable() 00692 db2.x = db2.y = db2.z = db2.phix = db2.phiy = db2.phiz = 0. 00693 db2.xx = db2.xy = db2.xz = db2.yx = db2.yy = db2.yz = db2.zx = db2.zy = db2.zz = 0. 00694 else: 00695 db2 = database2.dt[r1.postal_address[1:]] 00696 else: 00697 if r1.postal_address[1:] in database1.csc: 00698 found = True 00699 db1 = database1.csc[r1.postal_address[1:]] 00700 if database2 is None: 00701 db2 = CSCAlignable() 00702 db2.x = db2.y = db2.z = db2.phix = db2.phiy = db2.phiz = 0. 00703 db2.xx = db2.xy = db2.xz = db2.yx = db2.yy = db2.yz = db2.zx = db2.zy = db2.zz = 0. 00704 else: 00705 db2 = database2.csc[r1.postal_address[1:]] 00706 00707 if found and r1.status == "PASS" and r2.status == "PASS": 00708 okay = False 00709 00710 if quantity == "phi": 00711 if r1.deltax is not None and r2.deltax is not None and r1.deltax.error is not None and \ 00712 r2.deltax.error is not None and (r1.deltax.error**2 + r2.deltax.error**2) > 0.: 00713 okay = True 00714 values.append((db1.x - db2.x)/ 00715 signConventions[r1.postal_address][3] * 1000. * signConventions[r1.postal_address][0]) 00716 errors.append((r1.deltax.error**2 + r2.deltax.error**2)/ 00717 signConventions[r1.postal_address][3] * 1000. * signConventions[r1.postal_address][0]) 00718 00719 elif quantity == "x": 00720 if r1.deltax is not None and r2.deltax is not None and r1.deltax.error is not None and \ 00721 r2.deltax.error is not None and (r1.deltax.error**2 + r2.deltax.error**2) > 0.: 00722 okay = True 00723 values.append((db1.x - db2.x) * 10. * signConventions[r1.postal_address][0]) 00724 errors.append((r1.deltax.error**2 + r2.deltax.error**2) * 10. * signConventions[r1.postal_address][0]) 00725 00726 elif quantity == "y": 00727 if r1.deltay is not None and r2.deltay is not None and r1.deltay.error is not None and \ 00728 r2.deltay.error is not None and (r1.deltay.error**2 + r2.deltay.error**2) > 0.: 00729 okay = True 00730 values.append((db1.y - db2.y) * 10. * signConventions[r1.postal_address][1]) 00731 errors.append((r1.deltay.error**2 + r2.deltay.error**2) * 10. * signConventions[r1.postal_address][1]) 00732 00733 elif quantity == "z": 00734 if r1.deltaz is not None and r2.deltaz is not None and r1.deltaz.error is not None and \ 00735 r2.deltaz.error is not None and (r1.deltaz.error**2 + r2.deltaz.error**2) > 0.: 00736 okay = True 00737 values.append((db1.z - db2.z) * 10. * signConventions[r1.postal_address][2]) 00738 errors.append((r1.deltaz.error**2 + r2.deltaz.error**2) * 10. * signConventions[r1.postal_address][2]) 00739 00740 elif quantity == "phix": 00741 if r1.deltaphix is not None and r2.deltaphix is not None and r1.deltaphix.error is not None and \ 00742 r2.deltaphix.error is not None and (r1.deltaphix.error**2 + r2.deltaphix.error**2) > 0.: 00743 okay = True 00744 values.append((db1.phix - db2.phix) * 1000.) 00745 errors.append((r1.deltaphix.error**2 + r2.deltaphix.error**2) * 1000.) 00746 00747 elif quantity == "phiy": 00748 if r1.deltaphiy is not None and r2.deltaphiy is not None and r1.deltaphiy.error is not None and \ 00749 r2.deltaphiy.error is not None and (r1.deltaphiy.error**2 + r2.deltaphiy.error**2) > 0.: 00750 okay = True 00751 values.append((db1.phiy - db2.phiy) * 1000.) 00752 errors.append((r1.deltaphiy.error**2 + r2.deltaphiy.error**2) * 1000.) 00753 00754 elif quantity == "phiz": 00755 if r1.deltaphiz is not None and r2.deltaphiz is not None and r1.deltaphiz.error is not None and \ 00756 r2.deltaphiz.error is not None and (r1.deltaphiz.error**2 + r2.deltaphiz.error**2) > 0.: 00757 okay = True 00758 values.append((db1.phiz - db2.phiz) * 1000.) 00759 errors.append((r1.deltaphiz.error**2 + r2.deltaphiz.error**2) * 1000.) 00760 00761 else: raise Exception 00762 00763 if okay: 00764 if versus == "r": domain.append(signConventions[r1.postal_address][3]) 00765 elif versus == "phi": domain.append(signConventions[r1.postal_address][4]) 00766 elif versus == "z": domain.append(signConventions[r1.postal_address][5]) 00767 else: raise Exception 00768 00769 if versus == "r": 00770 bkgndhist = ROOT.TH1F("bkgndhist", "", 100, 0., 800.) 00771 bkgndhist.SetXTitle("R (cm)") 00772 elif versus == "phi": 00773 bkgndhist = ROOT.TH1F("bkgndhist", "", 100, -pi, pi) 00774 bkgndhist.SetXTitle("#phi (rad)") 00775 elif versus == "z": 00776 bkgndhist = ROOT.TH1F("bkgndhist", "", 100, -1100., 1100.) 00777 bkgndhist.SetXTitle("z (cm)") 00778 bkgndhist.GetXaxis().CenterTitle() 00779 00780 bkgndhist.SetAxisRange(-window, window, "Y") 00781 if quantity == "phi": bkgndhist.SetYTitle("#delta_{#phi} position (mrad)") 00782 elif quantity == "x": bkgndhist.SetYTitle("#delta_{x'} (mm)") 00783 elif quantity == "y": bkgndhist.SetYTitle("#delta_{y'} (mm)") 00784 elif quantity == "z": bkgndhist.SetYTitle("#delta_{z'} (mm)") 00785 elif quantity == "phix": bkgndhist.SetYTitle("#delta_{#phi_{x}} (mrad)") 00786 elif quantity == "phiy": bkgndhist.SetYTitle("#delta_{#phi_{y}} (mrad)") 00787 elif quantity == "phiz": bkgndhist.SetYTitle("#delta_{#phi_{z}} (mrad)") 00788 else: raise Exception 00789 bkgndhist.GetYaxis().CenterTitle() 00790 00791 if len(domain) == 0: 00792 tgraph = ROOT.TGraphErrors(0) 00793 else: 00794 tgraph = ROOT.TGraphErrors(len(domain), array.array("d", domain), array.array("d", values), 00795 array.array("d", [0.]*len(domain)), array.array("d", errors)) 00796 tgraph.SetMarkerColor(color) 00797 tgraph.SetLineColor(color) 00798 00799 bkgndhist.Draw() 00800 if tgraph.GetN() > 0: tgraph.Draw("p") 00801 return bkgndhist, tgraph, domain, values, errors
def plotscripts::DBMC | ( | database, | |
reports, | |||
window = 10. , |
|||
selection = None , |
|||
phi = False , |
|||
color = ROOT.kBlue-8 , |
|||
style = 1 , |
|||
bins = 50 , |
|||
normalized = False , |
|||
getvalues = False , |
|||
name = "" |
|||
) |
Definition at line 482 of file plotscripts.py.
def plotscripts::DBMCVersus | ( | quantity, | |
versus, | |||
database, | |||
reports, | |||
window = 10. , |
|||
selection = None , |
|||
color = ROOT.kBlack |
|||
) |
Definition at line 660 of file plotscripts.py.
def plotscripts::doTests | ( | reports, | |
fname_base, | |||
fname_dqm, | |||
run_name | |||
) |
Definition at line 1142 of file plotscripts.py.
01143 : 01144 # find available baseline 01145 dts = availableCellsDT(reports) 01146 cscs = availableCellsCSC(reports) 01147 mulist = ['Run: '+run_name,['ALL',['MU']],['DT',dts],['CSC',cscs]] 01148 ff = open(fname_base,mode="w") 01149 print >>ff, "var MU_LIST = [" 01150 json.dump(mulist,ff) 01151 print >>ff, "];" 01152 ff.close() 01153 01154 doTestsForReport(dts,reports) 01155 doTestsForReport(cscs,reports) 01156 01157 loadTestResultsMap(run_name) 01158 doTestsForMapPlots(dts) 01159 doTestsForMapPlots(cscs) 01160 01161 writeDQMReport(fname_dqm, run_name) 01162
def plotscripts::doTestsForMapPlots | ( | cells | ) |
Definition at line 1069 of file plotscripts.py.
01070 : 01071 for c in cells: 01072 res = [] 01073 01074 scope = "zzz" 01075 if c[0:2]=="MB": scope = "DT" 01076 if c[0:2]=="ME": scope = "CSC" 01077 if scope == "zzz": 01078 print "strange cell ID: ", c 01079 return None 01080 01081 if MAP_RESULTS_FITSIN.has_key(c): 01082 t = MAP_RESULTS_FITSIN[c] 01083 t_a = testZeroWithin5Sigma(t['a']) 01084 t_s = testZeroWithin5Sigma(t['sin']) 01085 t_c = testZeroWithin5Sigma(t['cos']) 01086 if t_a+t_s+t_c >0: 01087 descr = "map fitsin 5 sigma away from 0; pulls : a=%.2f sin=%.2f, cos=%.2f" % (t_a,t_s,t_c) 01088 res.append(testEntry("MAP_FITSIN",scope,descr,"SEVERE")) 01089 01090 if MAP_RESULTS_SAWTOOTH.has_key(c): 01091 t = MAP_RESULTS_SAWTOOTH[c] 01092 01093 t_a = testDeltaWithin5Sigma(t['a'],t['da']) 01094 if len(t_a)>0: 01095 descr = "map discontinuities: %s" % ",".join(map(str,t_a)) 01096 res.append(testEntry("MAP_DISCONTIN",scope,descr,"SEVERE")) 01097 01098 t_b = map(testZeroWithin5Sigma, t['b']) 01099 t_bi = [] 01100 for i in range(0,len(t_b)): 01101 if t_b[i]>0: t_bi.append(i+1) 01102 if len(t_bi)>0: 01103 descr = "map sawteeth: %s" % ",".join(map(str,t_bi)) 01104 res.append(testEntry("MAP_SAWTEETH",scope,descr,"TOLERABLE")) 01105 01106 addToTestResults(c,res) 01107
def plotscripts::doTestsForReport | ( | cells, | |
reports | |||
) |
Definition at line 1005 of file plotscripts.py.
01006 : 01007 for c in cells: 01008 # can a cell be converted to a chamber postal address? 01009 postal_address = idToPostalAddress(c) 01010 if not postal_address: continue 01011 01012 # is this chamber in _report? 01013 found = False 01014 for r in reports: 01015 if r.postal_address == postal_address: 01016 found = True 01017 break 01018 if not found: continue 01019 01020 # chamber's tests result 01021 res = [] 01022 scope = postal_address[0] 01023 01024 # noting could be done if fitting fails 01025 if r.status == "FAIL" or r.status == "MINUITFAIL": 01026 res.append(testEntry("FAILURE",scope,r.status+" failure","CRITICAL")) 01027 addToTestResults(c,res) 01028 continue 01029 01030 # noting could be done if TOOFEWHITS 01031 nseg = r.posNum + r.negNum 01032 if r.status == "TOOFEWHITS" and nseg>0: 01033 res.append(testEntry("LOW_STAT",scope,"low stat, #segments=%d"%nseg,"LOWSTAT")) 01034 addToTestResults(c,res) 01035 continue 01036 01037 # set shades of light green according to sidma(dx) 01038 sdx = 10.*r.deltax.error 01039 if sdx>0.5: 01040 if sdx<0.75: res.append(testEntry("LOW_STAT_DDX05",scope,"low stat, delta(dx)=%f #segments=%d" % (sdx,nseg),"LOWSTAT05")) 01041 elif sdx<1.: res.append(testEntry("LOW_STAT_DDX075",scope,"low stat, delta(dx)=%f #segments=%d" % (sdx,nseg),"LOWSTAT075")) 01042 else: res.append(testEntry("LOW_STAT_DDX1",scope,"low stat, delta(dx)=%f #segments=%d" % (sdx,nseg),"LOWSTAT1")) 01043 01044 # check chi2 01045 if r.redchi2 > 2.5: 01046 res.append(testEntry("BIG_CHI2",scope,"chi2=%f>2.5" % r.redchi2,"TOLERABLE")) 01047 01048 # check medians 01049 medx, meddx = 10.*r.median_x, 1000.*r.median_dxdz 01050 #medy, meddy = 10.*r.median_y, 1000.*r.median_dydz 01051 if medx>2: res.append(testEntry("BIG_MED_X",scope,"median dx=%f>2 mm"%medx,"SEVERE")) 01052 #if medy>3: res.append(testEntry("BIG_MED_Y",scope,"median dy=%f>3 mm"%medy,"SEVERE")) 01053 if meddx>2: res.append(testEntry("BIG_MED_DXDZ",scope,"median d(dx/dz)=%f>2 mrad"%meddx,"SEVERE")) 01054 #if meddy>3: res.append(testEntry("BIG_MED_DYDZ",scope,"median d(dy/dz)=%f>3 mrad"%meddy,"SEVERE")) 01055 01056 # check residuals far from zero 01057 isDTst4 = False 01058 if postal_address[0] == "DT" and postal_address[2]==4: isDTst4 = True 01059 dx, dy, dpy, dpz = 10.*r.deltax.value, 0., 1000.*r.deltaphiy.value, 1000.*r.deltaphiz.value 01060 if not isDTst4: dy = 10.*r.deltay.value 01061 if dx>0.2: res.append(testEntry("BIG_LAST_ITR_DX",scope,"dx=%f>0.2 mm"%dx,"CRITICAL")) 01062 if dy>0.2: res.append(testEntry("BIG_LAST_ITR_DY",scope,"dy=%f>0.2 mm"%dy,"CRITICAL")) 01063 if dpy>0.2: res.append(testEntry("BIG_LAST_ITR_DPHIY",scope,"dphiy=%f>0.2 mrad"%dpy,"CRITICAL")) 01064 if dpz>0.2: res.append(testEntry("BIG_LAST_ITR_DPHIZ",scope,"dphiz=%f>0.2 mrad"%dpz,"CRITICAL")) 01065 #if ddx>0.03: res.append(testEntry("BIG_DX",scope,"dphix=%f>0.03 mrad"%ddx,"CRITICAL")) 01066 01067 addToTestResults(c,res) 01068
def plotscripts::getname | ( | r | ) |
Definition at line 1831 of file plotscripts.py.
01832 : 01833 if r.postal_address[0] == "DT": 01834 wheel, station, sector = r.postal_address[1:] 01835 return "DT wheel %d, station %d, sector %d" % (wheel, station, sector) 01836 elif r.postal_address[0] == "CSC": 01837 endcap, station, ring, chamber = r.postal_address[1:] 01838 if endcap != 1: station = -1 * abs(station) 01839 return "CSC ME%d/%d chamber %d" % (station, ring, chamber) 01840 ddt=[0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
def plotscripts::idToPostalAddress | ( | id | ) |
Definition at line 804 of file plotscripts.py.
00805 : 00806 # only len==9 ids can correspond to valid postal address 00807 if len(id)!=9: return None 00808 if id[0:2]=="MB": 00809 #print id 00810 pa = ("DT", int(id[2:4]), int(id[5]), int(id[7:9])) 00811 #print pa 00812 if pa[1]<-2 or pa[1]>2: return None 00813 if pa[2]>4: return None 00814 if pa[3]<1 or pa[3]>14 or (pa[3]==4 and pa[3]>12): return None 00815 return pa 00816 elif id[0:2]=="ME": 00817 if id[2]=="+": ec=1 00818 elif id[2]=="-": ec=2 00819 else: return None 00820 pa = ("CSC", ec, int(id[3]), int(id[5]), int(id[7:9])) 00821 if pa[2]<1 or pa[2]>4: return None 00822 if pa[3]<1 or pa[3]>4 or (pa[2]>1 and pa[3]>2): return None 00823 if pa[4]<1 or pa[4]>36 or (pa[2]>1 and pa[3]==1 and pa[4]>18): return None 00824 return pa 00825 else: return None 00826
def plotscripts::loadTestResultsMap | ( | run_name | ) |
Definition at line 1116 of file plotscripts.py.
01117 : 01118 print "tmp_test_results_map__%s.pkl" % run_name, os.access("tmp_test_results_map__%s.pkl" % run_name,os.F_OK) 01119 if not os.access("tmp_test_results_map__%s.pkl" % run_name,os.F_OK): return None 01120 global MAP_RESULTS_FITSIN, MAP_RESULTS_SAWTOOTH 01121 ff = open("tmp_test_results_map__%s.pkl" % run_name, "rb") 01122 MAP_RESULTS_SAWTOOTH = pickle.load(ff) 01123 MAP_RESULTS_FITSIN = pickle.load(ff) 01124 ff.close() 01125 #execfile("tmp_test_results_map__%s.py" % run_name) 01126 #print 'asasas', MAP_RESULTS_FITSIN 01127 return True
def plotscripts::mapNameToId | ( | name | ) |
Definition at line 1582 of file plotscripts.py.
01583 : 01584 if "DT" in name: 01585 wh = "-ALL" 01586 if name.find('wh')>1: wh = name[name.find('wh')+2] 01587 if wh == "A": w = "-2" 01588 elif wh == "B": w = "-1" 01589 elif wh == "C": w = "-0" 01590 elif wh == "D": w = "+1" 01591 elif wh == "E": w = "+2" 01592 elif wh == "-ALL": w = "-ALL" 01593 else: return None 01594 station='' 01595 if wh == "-ALL": 01596 if name.find('sec')<0: return None 01597 station = name[name.find('sec')-1] 01598 sector = '' 01599 sector = name[name.find('sec')+3:name.find('sec')+5] 01600 return "MB%s/%s/%s" % (w, station, sector) 01601 if name.find('st')>1: station = name[name.find('st')+2] 01602 else: return None 01603 return "MB%s/%s" % (w, station) 01604 elif "CSC" in name: 01605 p = name.find('me') 01606 if p<0: return None 01607 if name[p+2]=="p": endcap = "+" 01608 elif name[p+2]=="m": endcap = "-" 01609 else: return None 01610 station = name[p+3] 01611 pch = name.find('ch') 01612 if pch<0: 01613 ring = name[p+4] 01614 return "ME%s%s/%s" % (endcap, station, ring) 01615 ring = 'ALL' 01616 chamber = name[pch+2:pch+4] 01617 return "ME%s%s/%s/%s" % (endcap, station, ring, chamber) 01618 return None 01619
def plotscripts::mapplot | ( | tfiles, | |
name, | |||
param, | |||
mode = "from2d" , |
|||
window = 40. , |
|||
abscissa = None , |
|||
title = "" , |
|||
widebins = False , |
|||
fitsine = False , |
|||
fitline = False , |
|||
reset_palette = False , |
|||
fitsawteeth = False |
|||
) |
Definition at line 1332 of file plotscripts.py.
01334 : 01335 tdrStyle.SetOptTitle(1) 01336 tdrStyle.SetTitleBorderSize(0) 01337 tdrStyle.SetOptStat(0) 01338 #tdrStyle.SetOptStat("emrou") 01339 tdrStyle.SetOptFit(0) 01340 tdrStyle.SetTitleFontSize(0.05) 01341 tdrStyle.SetPadRightMargin(0.1) # to see the pallete labels on the left 01342 01343 c1.Clear() 01344 c1.ResetAttPad() 01345 01346 if reset_palette: set_palette("blues") 01347 global hist, hist2d, hist2dweight, tline1, tline2, tline3 01348 01349 if fitsine or fitsawteeth: 01350 id = mapNameToId(name) 01351 if not id: 01352 print "bad id for ", name 01353 raise Exception 01354 01355 hdir = "AlignmentMonitorMuonSystemMap1D/iter1/" 01356 hpref= "%s_%s" % (name, param) 01357 hhh = hdir+hpref 01358 01359 prof = tfiles[0].Get(hhh+"_prof").Clone(hpref+"_prof_") 01360 profPos = tfiles[0].Get(hhh+"_profPos").Clone(hpref+"_profPos_") 01361 profNeg = tfiles[0].Get(hhh+"_profNeg").Clone(hpref+"_profNeg_") 01362 weights = tfiles[0].Get(hhh+"_weights").Clone(hpref+"_weights_") 01363 valweights = tfiles[0].Get(hhh+"_valweights").Clone(hpref+"_valweights_") 01364 hist2d = tfiles[0].Get(hhh+"_2d").Clone(hpref+"_2d_") 01365 hist2dweight = tfiles[0].Get(hhh+"_2dweight").Clone(hpref+"_2dweight_") 01366 01367 for tfile in tfiles[1:]: 01368 prof.Add(tfile.Get(hhh+"_prof")) 01369 profPos.Add(tfile.Get(hhh+"_profPos")) 01370 profNeg.Add(tfile.Get(hhh+"_profNeg")) 01371 weights.Add(tfile.Get(hhh+"_weights")) 01372 valweights.Add(tfile.Get(hhh+"_valweights")) 01373 hist2d.Add(tfile.Get(hhh+"_2d")) 01374 hist2dweight.Add(tfile.Get(hhh+"_2dweight")) 01375 01376 if mode == "plain": 01377 hist = prof 01378 01379 elif mode in ("from2d", "from2dweight"): 01380 if mode == "from2d": the2d = hist2d 01381 else: the2d = hist2dweight 01382 01383 hist = weights.Clone() 01384 hist.Reset() 01385 skip = 1 01386 if widebins: 01387 hist.Rebin(10) 01388 skip = 10 01389 01390 #f = ROOT.TF1("g", "gaus", -40., 40) 01391 for i in xrange(0, int(weights.GetNbinsX()), skip): 01392 tmp = the2d.ProjectionY("tmp", i+1, i + skip) 01393 if tmp.GetEntries() > 1: 01394 #tmp.Fit("g","LNq") 01395 hist.SetBinContent(i/skip+1, tmp.GetMean()) 01396 hist.SetBinError(i/skip+1, ROOT.TMath.StudentQuantile(0.841345,tmp.GetEntries()) * tmp.GetRMS() / sqrt(tmp.GetEntries())) 01397 #hist.SetBinError(i/skip+1, tmp.GetRMS() / sqrt(tmp.GetEntries())) 01398 #hist.SetBinError(i/skip+1, f.GetParameter(2)) 01399 else: 01400 #hist.SetBinContent(i/skip+1, 2000.) 01401 #hist.SetBinError(i/skip+1, 1000.) 01402 hist.SetBinContent(i/skip+1, 0.) 01403 hist.SetBinError(i/skip+1, 0.) 01404 01405 elif mode == "weighted": 01406 if weights.GetEntries() == 0: 01407 averageweight = 0. 01408 else: 01409 sumofweights = 0. 01410 for i in xrange(0, int(weights.GetNbinsX())+2): 01411 sumofweights += weights.GetBinContent(i) 01412 averageweight = sumofweights / weights.GetEntries() 01413 hist = weights.Clone() 01414 for i in xrange(1, int(weights.GetNbinsX())+1): 01415 if weights.GetBinContent(i) > 0: 01416 thisweight = weights.GetBinContent(i) / averageweight 01417 hist.SetBinContent(i, valweights.GetBinContent(i) / thisweight) 01418 hist.SetBinError(i, sqrt(1. / thisweight)) 01419 else: 01420 hist.SetBinContent(i, 2000.) 01421 hist.SetBinError(i, 1000.) 01422 01423 else: 01424 raise Exception 01425 01426 hist.SetAxisRange(-window, window, "Y") 01427 if abscissa is not None: hist.SetAxisRange(abscissa[0], abscissa[1], "X") 01428 hist.SetMarkerStyle(20) 01429 hist.SetMarkerSize(0.75) 01430 hist.GetXaxis().CenterTitle() 01431 hist.GetYaxis().CenterTitle() 01432 hist.GetYaxis().SetTitleOffset(0.75) 01433 hist.GetXaxis().SetTitleSize(0.05) 01434 hist.GetYaxis().SetTitleSize(0.05) 01435 hist.SetTitle(title) 01436 if "vsphi" in name: hist.SetXTitle("Global #phi position (rad)") 01437 elif "vsz" in name: hist.SetXTitle("Global z position (cm)") 01438 elif "vsr" in name: hist.SetXTitle("Global R position (cm)") 01439 if "DT" in name: 01440 if param == "x": hist.SetYTitle("x' residual (mm)") 01441 if param == "dxdz": hist.SetYTitle("dx'/dz residual (mrad)") 01442 if param == "y": hist.SetYTitle("y' residual (mm)") 01443 if param == "dydz": hist.SetYTitle("dy'/dz residual (mm)") 01444 if "CSC" in name: 01445 if param == "x": hist.SetYTitle("r#phi residual (mm)") 01446 if param == "dxdz": hist.SetYTitle("d(r#phi)/dz residual (mrad)") 01447 hist.SetMarkerColor(ROOT.kBlack) 01448 hist.SetLineColor(ROOT.kBlack) 01449 hist.Draw() 01450 hist2d.Draw("colzsame") 01451 if widebins: hist.Draw("samee1") 01452 else: hist.Draw("same") 01453 01454 if fitsine and "vsphi" in name: 01455 global fitsine_const, fitsine_sin, fitsine_cos, fitsine_chi2, fitsine_ndf 01456 f = ROOT.TF1("f", "[0] + [1]*sin(x) + [2]*cos(x)", -pi, pi) 01457 #hist.Fit(f,"N") 01458 hist.Fit(f,"NE") 01459 f.SetLineColor(ROOT.kRed) 01460 fitsine_const = f.GetParameter(0), f.GetParError(0) 01461 fitsine_sin = f.GetParameter(1), f.GetParError(1) 01462 fitsine_cos = f.GetParameter(2), f.GetParError(2) 01463 fitsine_chi2 = f.GetChisquare() 01464 fitsine_ndf = f.GetNDF() 01465 global MAP_RESULTS_FITSIN 01466 MAP_RESULTS_FITSIN[id] = {'a':fitsine_const, 'sin': fitsine_sin, 'cos': fitsine_cos, 'chi2': fitsine_chi2, 'ndf': fitsine_ndf} 01467 f.Draw("same") 01468 global fitsine_ttext 01469 fitsine_ttext = ROOT.TLatex(-1., 0.8*window, 01470 "%.3g %+.3g sin(#phi) %+.3g cos(#phi)" % (fitsine_const[0], fitsine_sin[0], fitsine_cos[0])) 01471 fitsine_ttext.SetTextColor(ROOT.kRed) 01472 fitsine_ttext.Draw() 01473 01474 if fitline: 01475 f = ROOT.TF1("f", "[0] + [1]*x", -1000., 1000.) 01476 hist2d.Fit(f, "q") 01477 hist2d.GetFunction("f").SetLineColor(ROOT.kRed) 01478 global fitline_const, fitline_linear, fitline_chi2, fitline_ndf 01479 fitline_const = hist2d.GetFunction("f").GetParameter(0), hist2d.GetFunction("f").GetParError(0) 01480 fitline_linear = hist2d.GetFunction("f").GetParameter(1), hist2d.GetFunction("f").GetParError(1) 01481 fitline_chi2 = hist2d.GetFunction("f").GetChisquare() 01482 fitline_ndf = hist2d.GetFunction("f").GetNDF() 01483 hist2d.GetFunction("f").Draw("same") 01484 global fitline_ttext 01485 if "vsz" in name: which = "Z" 01486 elif "vsr" in name: which = "R" 01487 fitline_ttext = ROOT.TText(hist.GetBinCenter(hist.GetNbinsX()/4), 01488 0.8*window, "%.3g %+.3g %s" % (fitline_const[0], fitline_linear[0], which)) 01489 fitline_ttext.SetTextColor(ROOT.kRed) 01490 fitline_ttext.Draw() 01491 01492 ROOT.gPad.RedrawAxis() 01493 01494 if "vsphi" in name: 01495 if not widebins: philines(name, window, abscissa) 01496 if abscissa is None: 01497 tline1 = ROOT.TLine(-pi, 0, pi, 0); tline1.Draw() 01498 tline2 = ROOT.TLine(-pi, -window, pi, -window); tline2.SetLineWidth(2); tline2.Draw() 01499 tline3 = ROOT.TLine(-pi, window, pi, window); tline3.Draw() 01500 else: 01501 tline1 = ROOT.TLine(abscissa[0], 0, abscissa[1], 0); tline1.Draw() 01502 tline2 = ROOT.TLine(abscissa[0], -window, abscissa[1], -window); tline2.SetLineWidth(2); tline2.Draw() 01503 tline3 = ROOT.TLine(abscissa[0], window, abscissa[1], window); tline3.Draw() 01504 elif "vsz" in name: 01505 if not widebins: zlines(window, abscissa) 01506 if abscissa is None: 01507 tline1 = ROOT.TLine(-660, 0, 660, 0); tline1.Draw() 01508 tline2 = ROOT.TLine(-660, -window, 660, -window); tline2.SetLineWidth(2); tline2.Draw() 01509 tline3 = ROOT.TLine(-660, window, 660, window); tline3.Draw() 01510 else: 01511 tline1 = ROOT.TLine(abscissa[0], 0, abscissa[1], 0); tline1.Draw() 01512 tline2 = ROOT.TLine(abscissa[0], -window, abscissa[1], -window); tline2.SetLineWidth(2); tline2.Draw() 01513 tline3 = ROOT.TLine(abscissa[0], window, abscissa[1], window); tline3.Draw() 01514 elif "vsr" in name: 01515 if "mem1" in name or "mep1" in name and not widebins: rlines(1, window, abscissa) 01516 if "mem2" in name or "mep2" in name and not widebins: rlines(2, window, abscissa) 01517 if "mem3" in name or "mep3" in name and not widebins: rlines(3, window, abscissa) 01518 if "mem4" in name or "mep4" in name and not widebins: rlines(4, window, abscissa) 01519 if abscissa is None: 01520 tline1 = ROOT.TLine(100, 0, 700, 0); tline1.Draw() 01521 tline2 = ROOT.TLine(100, -window, 700, -window); tline2.SetLineWidth(2); tline2.Draw() 01522 tline3 = ROOT.TLine(100, window, 700, window); tline3.Draw() 01523 else: 01524 tline1 = ROOT.TLine(abscissa[0], 0, abscissa[1], 0); tline1.Draw() 01525 tline2 = ROOT.TLine(abscissa[0], -window, abscissa[1], -window); tline2.SetLineWidth(2); tline2.Draw() 01526 tline3 = ROOT.TLine(abscissa[0], window, abscissa[1], window); tline3.Draw() 01527 01528 if "vsphi" in name and fitsawteeth: 01529 global CPP_LOADED 01530 if not CPP_LOADED: 01531 phiedges2c() 01532 ROOT.gROOT.ProcessLine(".L phiedges_fitfunctions.C++") 01533 CPP_LOADED = True 01534 fn={0: ROOT.fitf0, 01535 1: ROOT.fitf2, 01536 2: ROOT.fitf2, 01537 3: ROOT.fitf3, 01538 4: ROOT.fitf4, 01539 5: ROOT.fitf5, 01540 6: ROOT.fitf6, 01541 7: ROOT.fitf7, 01542 8: ROOT.fitf8, 01543 9: ROOT.fitf9, 01544 10: ROOT.fitf10, 01545 11: ROOT.fitf11, 01546 12: ROOT.fitf12, 01547 13: ROOT.fitf13 01548 } [stationIndex(name)] 01549 fn.SetNpx(5000) 01550 fn.SetLineColor(ROOT.kYellow) 01551 hist.Fit(fn,"N") 01552 fn.Draw("same") 01553 01554 # get properly arranged phi edges 01555 edges = (phiedges[stationIndex(name)])[:] 01556 ed = sorted(edges) 01557 # add some padding to the end 01558 ed.append(pi+abs(ed[0])) 01559 01560 global sawtooth_a, sawtooth_b 01561 sawtooth_a = [] 01562 sawtooth_da = [] 01563 sawtooth_b = [] 01564 for pr in range(0,fn.GetNpar(),2): 01565 sawtooth_a.append( (fn.GetParameter(pr), fn.GetParError(pr)) ) 01566 sawtooth_b.append( (fn.GetParameter(pr+1), fn.GetParError(pr+1)) ) 01567 sawtooth_da.append( (fn.Eval(ed[pr/2]+0.01), fn.Eval(ed[pr/2+1]-0.01)) ) 01568 global MAP_RESULTS_SAWTOOTH 01569 MAP_RESULTS_SAWTOOTH[id] = {'a': sawtooth_a, 'da': sawtooth_da, 'b': sawtooth_b, 'chi2': fn.GetChisquare(), 'ndf': fn.GetNDF()} 01570 01571 # fill number of contributiong bins 01572 01573 01574 #ROOT.SetOwnership(hist,False) 01575 ROOT.SetOwnership(hist2d,False) 01576 ROOT.SetOwnership(hist2dweight,False) 01577 ROOT.SetOwnership(tline1,False) 01578 ROOT.SetOwnership(tline2,False) 01579 ROOT.SetOwnership(tline3,False) 01580 return hist 01581
def plotscripts::mean | ( | xlist | ) |
Definition at line 50 of file plotscripts.py.
Referenced by ParameterMgr::addRandomFlatParameter(), ParameterMgr::addRandomGaussParameter(), ApvTimingAlgorithm::analyse(), FedTimingAlgorithm::analyse(), DTT0CalibrationNew::analyze(), EcalTrigPrimAnalyzerMIPs::analyze(), DTClusterer::buildClusters(), MultiTrajectoryStateCombiner::combine(), GsfBetheHeitlerUpdator::correctedFirstMean(), DTTTrigResidualCorrection::correction(), PFClient::createResolutionPlots(), TwoTrackMinimumDistance::crossingPoint(), MuonTestSummary::doResidualsTests(), QTestConfigure::EnableMeanWithinExpectedTest(), DTTPAnalyzer::endJob(), HFLightCalRand::endJob(), HOCalibAnalyzer::endJob(), SiStripCMMonitorPlugin::endJob(), HFLightCal::endJob(), DTResolutionTest::endLuminosityBlock(), ZeeCalibration::endOfJob(), DTResolutionAnalysisTest::endRun(), RPCBxTest::endRun(), MuonTrackResidualsTest::endRun(), DTMeanTimerFitter::evaluateVDriftAndReso(), RPCMultiplicityTest::fillGlobalME(), LA_Filler_Fitter::find_rebin(), SiPixelLorentzAngle::findMean(), MuonResidualsPositionFitter::fit(), MuonResidualsBfieldAngleFitter::fit(), MuonResidualsAngleFitter::fit(), BeamMonitor::FitAndFill(), TrackerOfflineValidation::fitResiduals(), TrackerOfflineValidationSummary::fitResiduals(), DTTimeBoxFitter::fitTimeBox(), fnc_gaussalpha(), fnc_gaussalpha1alpha2(), RandomEngine::gaussShoot(), DTMuonMillepede::getbqcMatrix(), DTTimeBoxFitter::getInteractiveFitSeeds(), pftools::CaloEllipse::getMajorMinorAxes(), TMom::getMean(), SiStripCorrelateNoise::getMeanNoise(), SiStripCorrelateBadStripAndNoise::getMeanNoise(), GetMPV(), pftools::CaloEllipse::getTheta(), CSCOfflineMonitor::harvestChamberMeans(), HcalSiPM::hitCells(), EcalEndcapRecHitsMaker::init(), EcalBarrelRecHitsMaker::init(), TMom::init(), MLP_PrintInputStat(), evf::FUResourceBroker::monitoring(), evf::BU::monitoring(), HcalRecHitsMaker::noisifySubdet(), EcalPreshowerRecHitsMaker::noisifySubdet(), NormalizeInputs(), reco::tau::RecoTauDiscriminantInvariantWidth::operator()(), jpt::Efficiency::outOfConeCorr(), DQMClientExample::performClient(), PhiBorderFinder::PhiBorderFinder(), CSCCrosstalkConditions::prefillCrosstalk(), CSCFakeDBCrosstalk::prefillDBCrosstalk(), CSCFakeDBGains::prefillDBGains(), CSCFakeDBNoiseMatrix::prefillDBNoiseMatrix(), CSCGainsConditions::prefillGains(), RPCLinkSynchroStat::SynchroCounts::print(), SiStripNoises::printSummary(), TH2Analyzer::ProcessSlices(), CastorFastTowerProducer::produce(), EcalEndcapRecHitsMaker::randomNoisifier(), EcalBarrelRecHitsMaker::randomNoisifier(), hcaltb::HcalTBTDCUnpacker::reconstructWC(), MuonTestSummary::ResidualCheck(), RPCLinkSynchroStat::SynchroCounts::rms(), SiPixelDQMRocLevelAnalyzer::RocSumOneModule(), DTFineDelayCorr::runClientDiagnostic(), ContentsWithinExpected::runTest(), MeanWithinExpected::runTest(), MonPNMGPADat::setADCMeanG1(), MonPNIRedDat::setADCMeanG1(), MonPNLed1Dat::setADCMeanG1(), MonTestPulseDat::setADCMeanG1(), MonPNLed2Dat::setADCMeanG1(), MonPNBlueDat::setADCMeanG1(), MonPNGreenDat::setADCMeanG1(), MonPNRedDat::setADCMeanG1(), MonPedestalsOnlineDat::setADCMeanG12(), MonTestPulseDat::setADCMeanG12(), MonPNMGPADat::setADCMeanG16(), MonPNLed1Dat::setADCMeanG16(), MonPNBlueDat::setADCMeanG16(), MonPNIRedDat::setADCMeanG16(), MonPNRedDat::setADCMeanG16(), MonPNGreenDat::setADCMeanG16(), MonPNLed2Dat::setADCMeanG16(), MonTestPulseDat::setADCMeanG6(), MonPNIRedDat::setADCRMSG1(), MonPNRedDat::setADCRMSG1(), MonPNMGPADat::setADCRMSG1(), MonPNGreenDat::setADCRMSG1(), MonPNBlueDat::setADCRMSG1(), MonPNLed2Dat::setADCRMSG1(), MonPNLed1Dat::setADCRMSG1(), MonPNGreenDat::setADCRMSG16(), MonPNBlueDat::setADCRMSG16(), MonPNRedDat::setADCRMSG16(), MonPNIRedDat::setADCRMSG16(), MonPNMGPADat::setADCRMSG16(), MonPNLed1Dat::setADCRMSG16(), MonPNLed2Dat::setADCRMSG16(), MonLaserBlueDat::setAPDMean(), MonLaserIRedDat::setAPDMean(), MonLaserRedDat::setAPDMean(), MonLaserGreenDat::setAPDMean(), MonLaserIRedDat::setAPDOverPNMean(), MonLaserRedDat::setAPDOverPNMean(), MonLaserBlueDat::setAPDOverPNMean(), MonLaserGreenDat::setAPDOverPNMean(), UpdateTProfile::setBinContents(), MonDelaysTTDat::setDelayMean(), MeanWithinExpected::setExpectedMean(), FEConfigFgrEEStripDat::setLutFg(), FEConfigFgrEEStripDat::setLUTFgr(), FEConfigFgrEEStripDat::setLutFgr(), FEConfigFgrEETowerDat::setLutValue(), FEConfigFgrEETowerDat::setLUTValue(), function::ZMuTrackFunction::setParameters(), function::ZMuStandaloneScaledFunction::setParameters(), function::ZMuTrackScaledFunction::setParameters(), MonPNLed2Dat::setPedMeanG1(), MonPNRedDat::setPedMeanG1(), MonPNIRedDat::setPedMeanG1(), MonPNBlueDat::setPedMeanG1(), MonPNGreenDat::setPedMeanG1(), MonPedestalsDat::setPedMeanG1(), FEConfigPedDat::setPedMeanG1(), MonPNMGPADat::setPedMeanG1(), MonPNLed1Dat::setPedMeanG1(), MonPNPedDat::setPedMeanG1(), MonPedestalsDat::setPedMeanG12(), FEConfigPedDat::setPedMeanG12(), MonPNBlueDat::setPedMeanG16(), MonPNIRedDat::setPedMeanG16(), MonPNGreenDat::setPedMeanG16(), MonPNRedDat::setPedMeanG16(), MonPNPedDat::setPedMeanG16(), MonPNMGPADat::setPedMeanG16(), MonPNLed2Dat::setPedMeanG16(), MonPNLed1Dat::setPedMeanG16(), MonPedestalsDat::setPedMeanG6(), FEConfigPedDat::setPedMeanG6(), MonPNIRedDat::setPedRMSG1(), MonPNRedDat::setPedRMSG1(), MonPNPedDat::setPedRMSG1(), MonPNMGPADat::setPedRMSG1(), MonPNLed2Dat::setPedRMSG1(), MonPNLed1Dat::setPedRMSG1(), MonPNGreenDat::setPedRMSG1(), MonPNBlueDat::setPedRMSG1(), MonPNRedDat::setPedRMSG16(), MonPNMGPADat::setPedRMSG16(), MonPNIRedDat::setPedRMSG16(), MonPNPedDat::setPedRMSG16(), MonPNBlueDat::setPedRMSG16(), MonPNLed1Dat::setPedRMSG16(), MonPNGreenDat::setPedRMSG16(), MonPNLed2Dat::setPedRMSG16(), FEConfigSlidingDat::setSliding(), FEConfigFgrEEStripDat::setThreshold(), ITimingDat::setTimingMean(), MonLed1Dat::setVPTMean(), MonLed2Dat::setVPTMean(), MonLed1Dat::setVPTOverPNMean(), MonLed2Dat::setVPTOverPNMean(), MonitorElement::ShiftFillLast(), QcdLowPtDQM::trackletVertexUnbinned(), PedestalsTask::update(), and PedsFullNoiseTask::update().
def plotscripts::nameToId | ( | name | ) |
Definition at line 839 of file plotscripts.py.
00840 : 00841 if name[0:2] == "MB": 00842 wh = name[4] 00843 if wh == "A": w = "-2" 00844 elif wh == "B": w = "-1" 00845 elif wh == "C": w = "-0" 00846 elif wh == "D": w = "+1" 00847 elif wh == "E": w = "+2" 00848 else: return "" 00849 station = name[7] 00850 sector = name[11:13] 00851 return "MB%s/%s/%s" % (w, station, sector) 00852 elif name[0:2] == "ME": 00853 if name[2]=="p": endcap = "+" 00854 elif name[2]=="m": endcap = "-" 00855 else: return "" 00856 station = name[3] 00857 ring = name[4] 00858 chamber = name[6:8] 00859 return "ME%s%s/%s/%s" % (endcap, station, ring, chamber) 00860 return None 00861
def plotscripts::phiedges2c | ( | ) |
Definition at line 349 of file plotscripts.py.
00350 : 00351 lines = [] 00352 for ed in phiedges[:]: 00353 ed.sort() 00354 #print ed 00355 ed.extend([999 for n in range(0,37-len(ed))]) 00356 lines.append('{' + ', '.join(map(str, ed)) + '}') 00357 #print lines 00358 res = ', '.join(lines) 00359 ff = open("phiedges_export.h",mode="w") 00360 print>>ff,'double phiedges[14][37] = {' + res + '};' 00361 ff.close()
def plotscripts::philines | ( | name, | |
window, | |||
abscissa | |||
) |
Definition at line 425 of file plotscripts.py.
00426 : 00427 global philine_tlines, philine_labels 00428 philine_tlines = [] 00429 edges = phiedges[stationIndex(name)] 00430 #print name, len(edges) 00431 for phi in edges: 00432 if abscissa is None or abscissa[0] < phi < abscissa[1]: 00433 philine_tlines.append(ROOT.TLine(phi, -window, phi, window)) 00434 philine_tlines[-1].SetLineStyle(2) 00435 philine_tlines[-1].Draw() 00436 if "st" in name: # DT labels 00437 philine_labels = [] 00438 edges = edges[:] 00439 edges.sort() 00440 if "st4" in name: 00441 labels = [" 7", " 8", " 9", "14", "10", "11", "12", " 1", " 2", " 3", "13", " 4", " 5", " 6"] 00442 else: 00443 labels = [" 8", " 9", "10", "11", "12", " 1", " 2", " 3", " 4", " 5", " 6"] 00444 edges = edges[1:] 00445 for phi, label in zip(edges, labels): 00446 littlebit = 0. 00447 if label in (" 7", " 9", "14", "10", "11"): littlebit = 0.05 00448 philine_labels.append(ROOT.TText(phi-0.35+littlebit, -0.9*window, label)) 00449 philine_labels[-1].Draw() 00450 philine_labels.append(ROOT.TText(-2.9, -0.75*window, "Sector:")) 00451 philine_labels[-1].Draw()
def plotscripts::plotmedians | ( | reports1, | |
reports2, | |||
selection = None , |
|||
binsx = 50 , |
|||
windowx = 3. , |
|||
ceilingx = None , |
|||
binsy = 50 , |
|||
windowy = 3. , |
|||
ceilingy = None , |
|||
binsdxdz = 50 , |
|||
windowdxdz = 3. , |
|||
ceilingdxdz = None , |
|||
binsdydz = 50 , |
|||
windowdydz = 3. , |
|||
ceilingdydz = None , |
|||
r1text = " before" , |
|||
r2text = " after" , |
|||
which = "median" |
|||
) |
Definition at line 1165 of file plotscripts.py.
01168 : 01169 tdrStyle.SetOptStat("emrou") 01170 tdrStyle.SetStatW(0.40) 01171 tdrStyle.SetStatFontSize(0.05) 01172 01173 global hmediandxdz_after, hmediandxdz_aftercopy, hmediandxdz_before, hmediandxdz_beforecopy, \ 01174 hmediandydz_after, hmediandydz_aftercopy, hmediandydz_before, hmediandydz_beforecopy, \ 01175 hmedianx_after, hmedianx_aftercopy, hmedianx_before, hmedianx_beforecopy, \ 01176 hmediany_after, hmediany_aftercopy, hmediany_before, hmediany_beforecopy, tlegend 01177 01178 hmedianx_before = ROOT.TH1F("hmedianx_before", "", binsx, -windowx, windowx) 01179 hmediany_before = ROOT.TH1F("hmediany_before", "", binsy, -windowy, windowy) 01180 hmediandxdz_before = ROOT.TH1F("hmediandxdz_before", "", binsdxdz, -windowdxdz, windowdxdz) 01181 hmediandydz_before = ROOT.TH1F("hmediandydz_before", "", binsdydz, -windowdydz, windowdydz) 01182 hmedianx_after = ROOT.TH1F("hmedianx_after", "", binsx, -windowx, windowx) 01183 hmediany_after = ROOT.TH1F("hmediany_after", "", binsy, -windowy, windowy) 01184 hmediandxdz_after = ROOT.TH1F("hmediandxdz_after", "", binsdxdz, -windowdxdz, windowdxdz) 01185 hmediandydz_after = ROOT.TH1F("hmediandydz_after", "", binsdydz, -windowdydz, windowdydz) 01186 01187 if which == "median": 01188 whichx = whichy = whichdxdz = whichdydz = "median" 01189 elif which == "bigmean": 01190 whichx = "mean30" 01191 whichy = "mean30" 01192 whichdxdz = "mean20" 01193 whichdydz = "mean50" 01194 elif which == "mean": 01195 whichx = "mean15" 01196 whichy = "mean15" 01197 whichdxdz = "mean10" 01198 whichdydz = "mean25" 01199 elif which == "bigwmean": 01200 whichx = "wmean30" 01201 whichy = "wmean30" 01202 whichdxdz = "wmean20" 01203 whichdydz = "wmean50" 01204 elif which == "wmean": 01205 whichx = "wmean15" 01206 whichy = "wmean15" 01207 whichdxdz = "wmean10" 01208 whichdydz = "wmean25" 01209 elif which == "bigstdev": 01210 whichx = "stdev30" 01211 whichy = "stdev30" 01212 whichdxdz = "stdev20" 01213 whichdydz = "stdev50" 01214 elif which == "stdev": 01215 whichx = "stdev15" 01216 whichy = "stdev15" 01217 whichdxdz = "stdev10" 01218 whichdydz = "stdev25" 01219 else: 01220 raise Exception, which + " not recognized" 01221 01222 for r1 in reports1: 01223 if selection is None or (selection.func_code.co_argcount == len(r1.postal_address) and selection(*r1.postal_address)): 01224 found = False 01225 for r2 in reports2: 01226 if r1.postal_address == r2.postal_address: 01227 found = True 01228 break 01229 if not found: continue 01230 01231 if r1.status == "PASS" and r2.status == "PASS": 01232 hmedianx_before.Fill(10.*eval("r1.%s_x" % whichx)) 01233 hmediandxdz_before.Fill(1000.*eval("r1.%s_dxdz" % whichdxdz)) 01234 hmedianx_after.Fill(10.*eval("r2.%s_x" % whichx)) 01235 hmediandxdz_after.Fill(1000.*eval("r2.%s_dxdz" % whichdxdz)) 01236 01237 if r1.median_y is not None: 01238 hmediany_before.Fill(10.*eval("r1.%s_y" % whichy)) 01239 hmediandydz_before.Fill(1000.*eval("r1.%s_dydz" % whichdydz)) 01240 hmediany_after.Fill(10.*eval("r2.%s_y" % whichy)) 01241 hmediandydz_after.Fill(1000.*eval("r2.%s_dydz" % whichdydz)) 01242 01243 hmedianx_beforecopy = hmedianx_before.Clone() 01244 hmediany_beforecopy = hmediany_before.Clone() 01245 hmediandxdz_beforecopy = hmediandxdz_before.Clone() 01246 hmediandydz_beforecopy = hmediandydz_before.Clone() 01247 hmedianx_beforecopy.SetLineStyle(2) 01248 hmediany_beforecopy.SetLineStyle(2) 01249 hmediandxdz_beforecopy.SetLineStyle(2) 01250 hmediandydz_beforecopy.SetLineStyle(2) 01251 01252 hmedianx_before.SetFillColor(ROOT.kMagenta+2) 01253 hmediany_before.SetFillColor(ROOT.kMagenta+2) 01254 hmediandxdz_before.SetFillColor(ROOT.kMagenta+2) 01255 hmediandydz_before.SetFillColor(ROOT.kMagenta+2) 01256 hmedianx_after.SetFillColor(ROOT.kYellow) 01257 hmediany_after.SetFillColor(ROOT.kYellow) 01258 hmediandxdz_after.SetFillColor(ROOT.kYellow) 01259 hmediandydz_after.SetFillColor(ROOT.kYellow) 01260 01261 hmedianx_aftercopy = hmedianx_after.Clone() 01262 hmediany_aftercopy = hmediany_after.Clone() 01263 hmediandxdz_aftercopy = hmediandxdz_after.Clone() 01264 hmediandydz_aftercopy = hmediandydz_after.Clone() 01265 hmedianx_aftercopy.GetXaxis().SetLabelColor(ROOT.kWhite) 01266 hmediany_aftercopy.GetXaxis().SetLabelColor(ROOT.kWhite) 01267 hmediandxdz_aftercopy.GetXaxis().SetLabelColor(ROOT.kWhite) 01268 hmediandydz_aftercopy.GetXaxis().SetLabelColor(ROOT.kWhite) 01269 hmedianx_aftercopy.GetYaxis().SetLabelColor(ROOT.kWhite) 01270 hmediany_aftercopy.GetYaxis().SetLabelColor(ROOT.kWhite) 01271 hmediandxdz_aftercopy.GetYaxis().SetLabelColor(ROOT.kWhite) 01272 hmediandydz_aftercopy.GetYaxis().SetLabelColor(ROOT.kWhite) 01273 01274 hmedianx_after.SetXTitle("median(#Deltax) (mm)") 01275 hmediany_after.SetXTitle("median(#Deltay) (mm)") 01276 hmediandxdz_after.SetXTitle("median(#Deltadx/dz) (mrad)") 01277 hmediandydz_after.SetXTitle("median(#Deltadydz) (mrad)") 01278 hmedianx_after.GetXaxis().CenterTitle() 01279 hmediany_after.GetXaxis().CenterTitle() 01280 hmediandxdz_after.GetXaxis().CenterTitle() 01281 hmediandydz_after.GetXaxis().CenterTitle() 01282 01283 if ceilingx is not None: hmedianx_aftercopy.SetAxisRange(0., ceilingx, "Y") 01284 if ceilingy is not None: hmediany_aftercopy.SetAxisRange(0., ceilingy, "Y") 01285 if ceilingdxdz is not None: hmediandxdz_aftercopy.SetAxisRange(0., ceilingdxdz, "Y") 01286 if ceilingdydz is not None: hmediandydz_aftercopy.SetAxisRange(0., ceilingdydz, "Y") 01287 01288 c1.Clear() 01289 c1.Divide(2, 2) 01290 01291 c1.GetPad(1).cd() 01292 hmedianx_aftercopy.Draw() 01293 hmedianx_before.Draw("same") 01294 hmedianx_after.Draw("same") 01295 hmedianx_beforecopy.Draw("same") 01296 hmedianx_after.Draw("axissame") 01297 01298 tlegend = ROOT.TLegend(0.17, 0.75-0.05, 0.45+0.05, 0.9) 01299 tlegend.SetFillColor(ROOT.kWhite) 01300 tlegend.SetBorderSize(0) 01301 tlegend.AddEntry(hmedianx_after, r2text, "f") 01302 tlegend.AddEntry(hmedianx_before, r1text, "f") 01303 tlegend.Draw() 01304 01305 c1.GetPad(2).cd() 01306 hmediandxdz_aftercopy.Draw() 01307 hmediandxdz_before.Draw("same") 01308 hmediandxdz_after.Draw("same") 01309 hmediandxdz_beforecopy.Draw("same") 01310 hmediandxdz_after.Draw("axissame") 01311 01312 c1.GetPad(3).cd() 01313 hmediany_aftercopy.Draw() 01314 hmediany_before.Draw("same") 01315 hmediany_after.Draw("same") 01316 hmediany_beforecopy.Draw("same") 01317 hmediany_after.Draw("axissame") 01318 01319 c1.GetPad(4).cd() 01320 hmediandydz_aftercopy.Draw() 01321 hmediandydz_before.Draw("same") 01322 hmediandydz_after.Draw("same") 01323 hmediandydz_beforecopy.Draw("same") 01324 hmediandydz_after.Draw("axissame") 01325 01326 return hmediandxdz_after, hmediandxdz_aftercopy, hmediandxdz_before, hmediandxdz_beforecopy, \ 01327 hmediandydz_after, hmediandydz_aftercopy, hmediandydz_before, hmediandydz_beforecopy, \ 01328 hmedianx_after, hmedianx_aftercopy, hmedianx_before, hmedianx_beforecopy, \ 01329 hmediany_after, hmediany_aftercopy, hmediany_before, hmediany_beforecopy, tlegend
def plotscripts::polynomials | ( | tfile, | |
reports, | |||
name, | |||
twobin = True , |
|||
suppressblue = False |
|||
) |
Definition at line 2029 of file plotscripts.py.
02030 : 02031 t1 = time.time() 02032 ddt[7] += 1 02033 global label1, label2, label3, label4, label5, label6, label7, label8, label9 02034 plotDirectory = "MuonAlignmentFromReference" 02035 tdrStyle.SetOptTitle(1) 02036 tdrStyle.SetTitleBorderSize(1) 02037 tdrStyle.SetTitleFontSize(0.1) 02038 tdrStyle.SetOptStat(0) 02039 02040 c1.Clear() 02041 c1.ResetAttPad() 02042 02043 found = False 02044 for r in reports: 02045 if r.name == name: 02046 found = True 02047 break 02048 if not found: raise Exception, "Not a valid name" 02049 02050 if r.status == "FAIL": 02051 #raise Exception, "Fit failed" 02052 print "Fit failed" 02053 c1.Clear() 02054 return 02055 02056 Pos = "Pos"; Neg = "Neg" 02057 if not twobin: 02058 Pos = ""; Neg = "" 02059 02060 pdirPos = "MuonAlignmentFromReference/%s%s" % (name, Pos) 02061 pdirNeg = "MuonAlignmentFromReference/%s%s" % (name, Neg) 02062 02063 global chamber_x_trackx, chamber_x_trackx_fit, chamber_y_trackx, chamber_y_trackx_fit, \ 02064 chamber_dxdz_trackx, chamber_dxdz_trackx_fit, chamber_dydz_trackx, chamber_dydz_trackx_fit, \ 02065 chamber_x_trackx_fit2, chamber_y_trackx_fit2, chamber_dxdz_trackx_fit2, chamber_dydz_trackx_fit2 02066 global chamber_x_tracky, chamber_x_tracky_fit, chamber_y_tracky, chamber_y_tracky_fit, \ 02067 chamber_dxdz_tracky, chamber_dxdz_tracky_fit, chamber_dydz_tracky, chamber_dydz_tracky_fit, \ 02068 chamber_x_tracky_fit2, chamber_y_tracky_fit2, chamber_dxdz_tracky_fit2, chamber_dydz_tracky_fit2 02069 global chamber_x_trackdxdz, chamber_x_trackdxdz_fit, chamber_y_trackdxdz, chamber_y_trackdxdz_fit, \ 02070 chamber_dxdz_trackdxdz, chamber_dxdz_trackdxdz_fit, chamber_dydz_trackdxdz, chamber_dydz_trackdxdz_fit, \ 02071 chamber_x_trackdxdz_fit2, chamber_y_trackdxdz_fit2, chamber_dxdz_trackdxdz_fit2, chamber_dydz_trackdxdz_fit2 02072 global chamber_x_trackdydz, chamber_x_trackdydz_fit, chamber_y_trackdydz, chamber_y_trackdydz_fit, \ 02073 chamber_dxdz_trackdydz, chamber_dxdz_trackdydz_fit, chamber_dydz_trackdydz, chamber_dydz_trackdydz_fit, \ 02074 chamber_x_trackdydz_fit2, chamber_y_trackdydz_fit2, chamber_dxdz_trackdydz_fit2, chamber_dydz_trackdydz_fit2 02075 02076 chamber_x_trackx = tfile.Get(pdirPos+"_x_trackx") 02077 chamber_x_trackx_fit = tfile.Get(pdirPos+"_x_trackx_fitline") 02078 chamber_y_trackx = tfile.Get(pdirPos+"_y_trackx") 02079 chamber_y_trackx_fit = tfile.Get(pdirPos+"_y_trackx_fitline") 02080 chamber_dxdz_trackx = tfile.Get(pdirPos+"_dxdz_trackx") 02081 chamber_dxdz_trackx_fit = tfile.Get(pdirPos+"_dxdz_trackx_fitline") 02082 chamber_dydz_trackx = tfile.Get(pdirPos+"_dydz_trackx") 02083 chamber_dydz_trackx_fit = tfile.Get(pdirPos+"_dydz_trackx_fitline") 02084 chamber_x_trackx_fit2 = tfile.Get(pdirNeg+"_x_trackx_fitline") 02085 chamber_y_trackx_fit2 = tfile.Get(pdirNeg+"_y_trackx_fitline") 02086 chamber_dxdz_trackx_fit2 = tfile.Get(pdirNeg+"_dxdz_trackx_fitline") 02087 chamber_dydz_trackx_fit2 = tfile.Get(pdirNeg+"_dydz_trackx_fitline") 02088 02089 chamber_x_tracky = tfile.Get(pdirPos+"_x_tracky") 02090 chamber_x_tracky_fit = tfile.Get(pdirPos+"_x_tracky_fitline") 02091 chamber_y_tracky = tfile.Get(pdirPos+"_y_tracky") 02092 chamber_y_tracky_fit = tfile.Get(pdirPos+"_y_tracky_fitline") 02093 chamber_dxdz_tracky = tfile.Get(pdirPos+"_dxdz_tracky") 02094 chamber_dxdz_tracky_fit = tfile.Get(pdirPos+"_dxdz_tracky_fitline") 02095 chamber_dydz_tracky = tfile.Get(pdirPos+"_dydz_tracky") 02096 chamber_dydz_tracky_fit = tfile.Get(pdirPos+"_dydz_tracky_fitline") 02097 chamber_x_tracky_fit2 = tfile.Get(pdirNeg+"_x_tracky_fitline") 02098 chamber_y_tracky_fit2 = tfile.Get(pdirNeg+"_y_tracky_fitline") 02099 chamber_dxdz_tracky_fit2 = tfile.Get(pdirNeg+"_dxdz_tracky_fitline") 02100 chamber_dydz_tracky_fit2 = tfile.Get(pdirNeg+"_dydz_tracky_fitline") 02101 02102 chamber_x_trackdxdz = tfile.Get(pdirPos+"_x_trackdxdz") 02103 chamber_x_trackdxdz_fit = tfile.Get(pdirPos+"_x_trackdxdz_fitline") 02104 chamber_y_trackdxdz = tfile.Get(pdirPos+"_y_trackdxdz") 02105 chamber_y_trackdxdz_fit = tfile.Get(pdirPos+"_y_trackdxdz_fitline") 02106 chamber_dxdz_trackdxdz = tfile.Get(pdirPos+"_dxdz_trackdxdz") 02107 chamber_dxdz_trackdxdz_fit = tfile.Get(pdirPos+"_dxdz_trackdxdz_fitline") 02108 chamber_dydz_trackdxdz = tfile.Get(pdirPos+"_dydz_trackdxdz") 02109 chamber_dydz_trackdxdz_fit = tfile.Get(pdirPos+"_dydz_trackdxdz_fitline") 02110 chamber_x_trackdxdz_fit2 = tfile.Get(pdirNeg+"_x_trackdxdz_fitline") 02111 chamber_y_trackdxdz_fit2 = tfile.Get(pdirNeg+"_y_trackdxdz_fitline") 02112 chamber_dxdz_trackdxdz_fit2 = tfile.Get(pdirNeg+"_dxdz_trackdxdz_fitline") 02113 chamber_dydz_trackdxdz_fit2 = tfile.Get(pdirNeg+"_dydz_trackdxdz_fitline") 02114 02115 chamber_x_trackdydz = tfile.Get(pdirPos+"_x_trackdydz") 02116 chamber_x_trackdydz_fit = tfile.Get(pdirPos+"_x_trackdydz_fitline") 02117 chamber_y_trackdydz = tfile.Get(pdirPos+"_y_trackdydz") 02118 chamber_y_trackdydz_fit = tfile.Get(pdirPos+"_y_trackdydz_fitline") 02119 chamber_dxdz_trackdydz = tfile.Get(pdirPos+"_dxdz_trackdydz") 02120 chamber_dxdz_trackdydz_fit = tfile.Get(pdirPos+"_dxdz_trackdydz_fitline") 02121 chamber_dydz_trackdydz = tfile.Get(pdirPos+"_dydz_trackdydz") 02122 chamber_dydz_trackdydz_fit = tfile.Get(pdirPos+"_dydz_trackdydz_fitline") 02123 chamber_x_trackdydz_fit2 = tfile.Get(pdirNeg+"_x_trackdydz_fitline") 02124 chamber_y_trackdydz_fit2 = tfile.Get(pdirNeg+"_y_trackdydz_fitline") 02125 chamber_dxdz_trackdydz_fit2 = tfile.Get(pdirNeg+"_dxdz_trackdydz_fitline") 02126 chamber_dydz_trackdydz_fit2 = tfile.Get(pdirNeg+"_dydz_trackdydz_fitline") 02127 02128 if not chamber_x_trackx: 02129 chamber_x_trackx = tfile.Get(pdirPos+"_residual_trackx") 02130 chamber_x_trackx_fit = tfile.Get(pdirPos+"_residual_trackx_fitline") 02131 chamber_dxdz_trackx = tfile.Get(pdirPos+"_resslope_trackx") 02132 chamber_dxdz_trackx_fit = tfile.Get(pdirPos+"_resslope_trackx_fitline") 02133 chamber_x_trackx_fit2 = tfile.Get(pdirNeg+"_residual_trackx_fitline") 02134 chamber_dxdz_trackx_fit2 = tfile.Get(pdirNeg+"_resslope_trackx_fitline") 02135 02136 chamber_x_tracky = tfile.Get(pdirPos+"_residual_tracky") 02137 chamber_x_tracky_fit = tfile.Get(pdirPos+"_residual_tracky_fitline") 02138 chamber_dxdz_tracky = tfile.Get(pdirPos+"_resslope_tracky") 02139 chamber_dxdz_tracky_fit = tfile.Get(pdirPos+"_resslope_tracky_fitline") 02140 chamber_x_tracky_fit2 = tfile.Get(pdirNeg+"_residual_tracky_fitline") 02141 chamber_dxdz_tracky_fit2 = tfile.Get(pdirNeg+"_resslope_tracky_fitline") 02142 02143 chamber_x_trackdxdz = tfile.Get(pdirPos+"_residual_trackdxdz") 02144 chamber_x_trackdxdz_fit = tfile.Get(pdirPos+"_residual_trackdxdz_fitline") 02145 chamber_dxdz_trackdxdz = tfile.Get(pdirPos+"_resslope_trackdxdz") 02146 chamber_dxdz_trackdxdz_fit = tfile.Get(pdirPos+"_resslope_trackdxdz_fitline") 02147 chamber_x_trackdxdz_fit2 = tfile.Get(pdirNeg+"_residual_trackdxdz_fitline") 02148 chamber_dxdz_trackdxdz_fit2 = tfile.Get(pdirNeg+"_resslope_trackdxdz_fitline") 02149 02150 chamber_x_trackdydz = tfile.Get(pdirPos+"_residual_trackdydz") 02151 chamber_x_trackdydz_fit = tfile.Get(pdirPos+"_residual_trackdydz_fitline") 02152 chamber_dxdz_trackdydz = tfile.Get(pdirPos+"_resslope_trackdydz") 02153 chamber_dxdz_trackdydz_fit = tfile.Get(pdirPos+"_resslope_trackdydz_fitline") 02154 chamber_x_trackdydz_fit2 = tfile.Get(pdirNeg+"_residual_trackdydz_fitline") 02155 chamber_dxdz_trackdydz_fit2 = tfile.Get(pdirNeg+"_resslope_trackdydz_fitline") 02156 02157 if not chamber_x_trackx: 02158 print "Can't find neither "+pdirPos+"_residual nor "+pdirPos+"_residual_trackx" 02159 return 02160 02161 chamber_x_trackx = chamber_x_trackx.Clone() 02162 chamber_dxdz_trackx = chamber_dxdz_trackx.Clone() 02163 chamber_x_tracky = chamber_x_tracky.Clone() 02164 chamber_dxdz_tracky = chamber_dxdz_tracky.Clone() 02165 chamber_x_trackdxdz = chamber_x_trackdxdz.Clone() 02166 chamber_dxdz_trackdxdz = chamber_dxdz_trackdxdz.Clone() 02167 chamber_x_trackdydz = chamber_x_trackdydz.Clone() 02168 chamber_dxdz_trackdydz = chamber_dxdz_trackdydz.Clone() 02169 02170 if not not chamber_y_trackx: 02171 chamber_y_trackx = chamber_y_trackx.Clone() 02172 chamber_dydz_trackx = chamber_dydz_trackx.Clone() 02173 chamber_y_tracky = chamber_y_tracky.Clone() 02174 chamber_dydz_tracky = chamber_dydz_tracky.Clone() 02175 chamber_y_trackdxdz = chamber_y_trackdxdz.Clone() 02176 chamber_dydz_trackdxdz = chamber_dydz_trackdxdz.Clone() 02177 chamber_y_trackdydz = chamber_y_trackdydz.Clone() 02178 chamber_dydz_trackdydz = chamber_dydz_trackdydz.Clone() 02179 02180 if not not chamber_y_trackx: 02181 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_x_trackx")); chamber_x_trackx.Merge(tlist) 02182 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dxdz_trackx")); chamber_dxdz_trackx.Merge(tlist) 02183 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_x_tracky")); chamber_x_tracky.Merge(tlist) 02184 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dxdz_tracky")); chamber_dxdz_tracky.Merge(tlist) 02185 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_x_trackdxdz")); chamber_x_trackdxdz.Merge(tlist) 02186 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dxdz_trackdxdz")); chamber_dxdz_trackdxdz.Merge(tlist) 02187 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_x_trackdydz")); chamber_x_trackdydz.Merge(tlist) 02188 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dxdz_trackdydz")); chamber_dxdz_trackdydz.Merge(tlist) 02189 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_y_trackx")); chamber_y_trackx.Merge(tlist) 02190 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dydz_trackx")); chamber_dydz_trackx.Merge(tlist) 02191 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_y_tracky")); chamber_y_tracky.Merge(tlist) 02192 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dydz_tracky")); chamber_dydz_tracky.Merge(tlist) 02193 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_y_trackdxdz")); chamber_y_trackdxdz.Merge(tlist) 02194 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dydz_trackdxdz")); chamber_dydz_trackdxdz.Merge(tlist) 02195 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_y_trackdydz")); chamber_y_trackdydz.Merge(tlist) 02196 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_dydz_trackdydz")); chamber_dydz_trackdydz.Merge(tlist) 02197 else: 02198 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_residual_trackx")); chamber_x_trackx.Merge(tlist) 02199 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_resslope_trackx")); chamber_dxdz_trackx.Merge(tlist) 02200 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_residual_tracky")); chamber_x_tracky.Merge(tlist) 02201 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_resslope_tracky")); chamber_dxdz_tracky.Merge(tlist) 02202 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_residual_trackdxdz")); chamber_x_trackdxdz.Merge(tlist) 02203 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_resslope_trackdxdz")); chamber_dxdz_trackdxdz.Merge(tlist) 02204 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_residual_trackdydz")); chamber_x_trackdydz.Merge(tlist) 02205 tlist = ROOT.TList(); tlist.Add(tfile.Get(pdirNeg+"_resslope_trackdydz")); chamber_dxdz_trackdydz.Merge(tlist) 02206 02207 rr1=19.99 02208 rr2=9.99 02209 chamber_x_trackx.SetAxisRange(-rr1, rr1, "Y") 02210 chamber_dxdz_trackx.SetAxisRange(-rr2, rr2, "Y") 02211 chamber_x_tracky.SetAxisRange(-rr1, rr1, "Y") 02212 chamber_dxdz_tracky.SetAxisRange(-rr2, rr2, "Y") 02213 chamber_x_trackdxdz.SetAxisRange(-rr1, rr1, "Y") 02214 chamber_dxdz_trackdxdz.SetAxisRange(-rr2, rr2, "Y") 02215 chamber_x_trackdydz.SetAxisRange(-rr1, rr1, "Y") 02216 chamber_dxdz_trackdydz.SetAxisRange(-rr2, rr2, "Y") 02217 02218 rr3=49.99 02219 if not not chamber_y_trackx: 02220 chamber_y_trackx.SetAxisRange(-rr3, rr3, "Y") 02221 chamber_dydz_trackx.SetAxisRange(-rr3, rr3, "Y") 02222 chamber_y_tracky.SetAxisRange(-rr3, rr3, "Y") 02223 chamber_dydz_tracky.SetAxisRange(-rr3, rr3, "Y") 02224 chamber_y_trackdxdz.SetAxisRange(-rr3, rr3, "Y") 02225 chamber_dydz_trackdxdz.SetAxisRange(-rr3, rr3, "Y") 02226 chamber_y_trackdydz.SetAxisRange(-rr3, rr3, "Y") 02227 chamber_dydz_trackdydz.SetAxisRange(-rr3, rr3, "Y") 02228 02229 for h in chamber_x_trackx, chamber_y_trackx, chamber_dxdz_trackx, chamber_dydz_trackx, \ 02230 chamber_x_tracky, chamber_y_tracky, chamber_dxdz_tracky, chamber_dydz_tracky, \ 02231 chamber_x_trackdxdz, chamber_y_trackdxdz, chamber_dxdz_trackdxdz, chamber_dydz_trackdxdz, \ 02232 chamber_x_trackdydz, chamber_y_trackdydz, chamber_dxdz_trackdydz, chamber_dydz_trackdydz: 02233 if not not h: 02234 h.SetMarkerStyle(20) 02235 h.SetMarkerSize(0.5) 02236 h.GetXaxis().SetLabelSize(0.12) 02237 h.GetYaxis().SetLabelSize(0.12) 02238 h.GetXaxis().SetNdivisions(505) 02239 h.GetYaxis().SetNdivisions(505) 02240 h.GetXaxis().SetLabelOffset(0.03) 02241 h.GetYaxis().SetLabelOffset(0.03) 02242 02243 trackdxdz_minimum, trackdxdz_maximum = None, None 02244 for h in chamber_x_trackdxdz, chamber_y_trackdxdz, chamber_dxdz_trackdxdz, chamber_dydz_trackdxdz: 02245 if not not h: 02246 for i in xrange(1, h.GetNbinsX()+1): 02247 if h.GetBinError(i) > 0.01 and h.GetBinContent(i) - h.GetBinError(i) < 10. and \ 02248 h.GetBinContent(i) + h.GetBinError(i) > -10.: 02249 if not trackdxdz_minimum or trackdxdz_minimum > h.GetBinCenter(i): 02250 trackdxdz_minimum = h.GetBinCenter(i) 02251 if trackdxdz_maximum < h.GetBinCenter(i): 02252 trackdxdz_maximum = h.GetBinCenter(i) 02253 if not not trackdxdz_minimum and not not trackdxdz_maximum: 02254 for h in chamber_x_trackdxdz, chamber_y_trackdxdz, chamber_dxdz_trackdxdz, chamber_dydz_trackdxdz: 02255 if not not h: 02256 h.SetAxisRange(trackdxdz_minimum, trackdxdz_maximum, "X") 02257 02258 trackdydz_minimum, trackdydz_maximum = None, None 02259 for h in chamber_x_trackdydz, chamber_y_trackdydz, chamber_dxdz_trackdydz, chamber_dydz_trackdydz: 02260 if not not h: 02261 for i in xrange(1, h.GetNbinsX()+1): 02262 if h.GetBinError(i) > 0.01 and h.GetBinContent(i) - h.GetBinError(i) < 10. and \ 02263 h.GetBinContent(i) + h.GetBinError(i) > -10.: 02264 if not trackdydz_minimum or trackdydz_minimum > h.GetBinCenter(i): 02265 trackdydz_minimum = h.GetBinCenter(i) 02266 if trackdydz_maximum < h.GetBinCenter(i): 02267 trackdydz_maximum = h.GetBinCenter(i) 02268 if not not trackdydz_minimum and not not trackdydz_maximum: 02269 for h in chamber_x_trackdydz, chamber_y_trackdydz, chamber_dxdz_trackdydz, chamber_dydz_trackdydz: 02270 if not not h: 02271 h.SetAxisRange(trackdydz_minimum, trackdydz_maximum, "X") 02272 02273 for f in chamber_x_trackx_fit2, chamber_y_trackx_fit2, chamber_dxdz_trackx_fit2, chamber_dydz_trackx_fit2, \ 02274 chamber_x_tracky_fit2, chamber_y_tracky_fit2, chamber_dxdz_tracky_fit2, chamber_dydz_tracky_fit2, \ 02275 chamber_x_trackdxdz_fit2, chamber_y_trackdxdz_fit2, chamber_dxdz_trackdxdz_fit2, chamber_dydz_trackdxdz_fit2, \ 02276 chamber_x_trackdydz_fit2, chamber_y_trackdydz_fit2, chamber_dxdz_trackdydz_fit2, chamber_dydz_trackdydz_fit2: 02277 if not not f: 02278 f.SetLineColor(4) 02279 02280 if not not chamber_y_trackx: 02281 c1.Clear() 02282 #c1.Divide(5, 5, 1e-5, 1e-5) 02283 pads = [None] 02284 pads.append(ROOT.TPad("p1" ,"",0.00,0.78,0.07,1.00,0,0,0)) 02285 pads.append(ROOT.TPad("p2" ,"",0.07,0.78,0.34,1.00,0,0,0)) 02286 pads.append(ROOT.TPad("p3" ,"",0.34,0.78,0.56,1.00,0,0,0)) 02287 pads.append(ROOT.TPad("p4" ,"",0.56,0.78,0.78,1.00,0,0,0)) 02288 pads.append(ROOT.TPad("p5" ,"",0.78,0.78,1.00,1.00,0,0,0)) 02289 pads.append(ROOT.TPad("p6" ,"",0.00,0.56,0.07,0.78,0,0,0)) 02290 pads.append(ROOT.TPad("p7" ,"",0.07,0.56,0.34,0.78,0,0,0)) 02291 pads.append(ROOT.TPad("p8" ,"",0.34,0.56,0.56,0.78,0,0,0)) 02292 pads.append(ROOT.TPad("p9" ,"",0.56,0.56,0.78,0.78,0,0,0)) 02293 pads.append(ROOT.TPad("p10","",0.78,0.56,1.00,0.78,0,0,0)) 02294 pads.append(ROOT.TPad("p11","",0.00,0.34,0.07,0.56,0,0,0)) 02295 pads.append(ROOT.TPad("p12","",0.07,0.34,0.34,0.56,0,0,0)) 02296 pads.append(ROOT.TPad("p13","",0.34,0.34,0.56,0.56,0,0,0)) 02297 pads.append(ROOT.TPad("p14","",0.56,0.34,0.78,0.56,0,0,0)) 02298 pads.append(ROOT.TPad("p15","",0.78,0.34,1.00,0.56,0,0,0)) 02299 pads.append(ROOT.TPad("p16","",0.00,0.07,0.07,0.34,0,0,0)) 02300 pads.append(ROOT.TPad("p17","",0.07,0.07,0.34,0.34,0,0,0)) 02301 pads.append(ROOT.TPad("p18","",0.34,0.07,0.56,0.34,0,0,0)) 02302 pads.append(ROOT.TPad("p19","",0.56,0.07,0.78,0.34,0,0,0)) 02303 pads.append(ROOT.TPad("p20","",0.78,0.07,1.00,0.34,0,0,0)) 02304 pads.append(ROOT.TPad("p21","",0.00,0.00,0.07,0.07,0,0,0)) 02305 pads.append(ROOT.TPad("p22","",0.07,0.00,0.34,0.07,0,0,0)) 02306 pads.append(ROOT.TPad("p23","",0.34,0.00,0.56,0.07,0,0,0)) 02307 pads.append(ROOT.TPad("p24","",0.56,0.00,0.78,0.07,0,0,0)) 02308 pads.append(ROOT.TPad("p25","",0.78,0.00,1.00,0.07,0,0,0)) 02309 for p in pads: 02310 if not not p: 02311 p.Draw() 02312 ROOT.SetOwnership(p,False) 02313 02314 label1 = ROOT.TPaveLabel(0, 0, 1, 1, "x residuals (mm)","") 02315 label2 = ROOT.TPaveLabel(0, 0, 1, 1, "y residuals (mm)","") 02316 label3 = ROOT.TPaveLabel(0, 0, 1, 1, "dx/dz residuals (mrad)","") 02317 label4 = ROOT.TPaveLabel(0, 0, 1, 1, "dy/dz residuals (mrad)","") 02318 label5 = ROOT.TPaveLabel(0, 0, 1, 1, "x position (cm)","") 02319 label6 = ROOT.TPaveLabel(0, 0, 1, 1, "y position (cm)","") 02320 label7 = ROOT.TPaveLabel(0, 0, 1, 1, "dx/dz angle (rad)","") 02321 label8 = ROOT.TPaveLabel(0, 0, 1, 1, "dy/dz angle (rad)","") 02322 label9 = ROOT.TPaveLabel(0, 0.85, 1, 1, getname(r),"NDC") 02323 02324 for l in label1, label2, label3, label4, label5, label6, label7, label8, label9: 02325 l.SetBorderSize(0) 02326 l.SetFillColor(ROOT.kWhite) 02327 02328 for l in label1, label2, label3, label4: 02329 l.SetTextAngle(90) 02330 l.SetTextSize(0.09) 02331 02332 #label9.SetTextAngle(30) 02333 label9.SetTextSize(0.59) 02334 02335 pads[1].cd(); label1.Draw() 02336 pads[6].cd(); label2.Draw() 02337 pads[11].cd(); label3.Draw() 02338 pads[16].cd(); label4.Draw() 02339 pads[22].cd(); label5.Draw() 02340 pads[23].cd(); label6.Draw() 02341 pads[24].cd(); label7.Draw() 02342 pads[25].cd(); label8.Draw() 02343 02344 pads[2].SetRightMargin(1e-5) 02345 pads[2].SetBottomMargin(1e-5) 02346 pads[2].SetLeftMargin(0.17) 02347 pads[3].SetLeftMargin(1e-5) 02348 pads[3].SetRightMargin(1e-5) 02349 pads[3].SetBottomMargin(1e-5) 02350 pads[4].SetLeftMargin(1e-5) 02351 pads[4].SetRightMargin(1e-5) 02352 pads[4].SetBottomMargin(1e-5) 02353 pads[5].SetLeftMargin(1e-5) 02354 pads[5].SetBottomMargin(1e-5) 02355 02356 pads[7].SetRightMargin(1e-5) 02357 pads[7].SetBottomMargin(1e-5) 02358 pads[7].SetTopMargin(1e-5) 02359 pads[7].SetLeftMargin(0.17) 02360 pads[8].SetLeftMargin(1e-5) 02361 pads[8].SetRightMargin(1e-5) 02362 pads[8].SetBottomMargin(1e-5) 02363 pads[8].SetTopMargin(1e-5) 02364 pads[9].SetLeftMargin(1e-5) 02365 pads[9].SetRightMargin(1e-5) 02366 pads[9].SetBottomMargin(1e-5) 02367 pads[9].SetTopMargin(1e-5) 02368 pads[10].SetLeftMargin(1e-5) 02369 pads[10].SetBottomMargin(1e-5) 02370 pads[10].SetTopMargin(1e-5) 02371 02372 pads[12].SetRightMargin(1e-5) 02373 pads[12].SetBottomMargin(1e-5) 02374 pads[12].SetTopMargin(1e-5) 02375 pads[12].SetLeftMargin(0.17) 02376 pads[13].SetLeftMargin(1e-5) 02377 pads[13].SetRightMargin(1e-5) 02378 pads[13].SetBottomMargin(1e-5) 02379 pads[13].SetTopMargin(1e-5) 02380 pads[14].SetLeftMargin(1e-5) 02381 pads[14].SetRightMargin(1e-5) 02382 pads[14].SetBottomMargin(1e-5) 02383 pads[14].SetTopMargin(1e-5) 02384 pads[15].SetLeftMargin(1e-5) 02385 pads[15].SetBottomMargin(1e-5) 02386 pads[15].SetTopMargin(1e-5) 02387 02388 pads[17].SetRightMargin(1e-5) 02389 pads[17].SetTopMargin(1e-5) 02390 pads[17].SetLeftMargin(0.17) 02391 pads[18].SetLeftMargin(1e-5) 02392 pads[18].SetRightMargin(1e-5) 02393 pads[18].SetTopMargin(1e-5) 02394 pads[19].SetLeftMargin(1e-5) 02395 pads[19].SetRightMargin(1e-5) 02396 pads[19].SetTopMargin(1e-5) 02397 pads[20].SetLeftMargin(1e-5) 02398 pads[20].SetTopMargin(1e-5) 02399 02400 chamber_x_trackx.GetXaxis().SetLabelColor(ROOT.kWhite) 02401 chamber_x_tracky.GetXaxis().SetLabelColor(ROOT.kWhite) 02402 chamber_x_tracky.GetYaxis().SetLabelColor(ROOT.kWhite) 02403 chamber_x_trackdxdz.GetXaxis().SetLabelColor(ROOT.kWhite) 02404 chamber_x_trackdxdz.GetYaxis().SetLabelColor(ROOT.kWhite) 02405 chamber_x_trackdydz.GetXaxis().SetLabelColor(ROOT.kWhite) 02406 chamber_x_trackdydz.GetYaxis().SetLabelColor(ROOT.kWhite) 02407 chamber_y_trackx.GetXaxis().SetLabelColor(ROOT.kWhite) 02408 chamber_y_tracky.GetXaxis().SetLabelColor(ROOT.kWhite) 02409 chamber_y_tracky.GetYaxis().SetLabelColor(ROOT.kWhite) 02410 chamber_y_trackdxdz.GetXaxis().SetLabelColor(ROOT.kWhite) 02411 chamber_y_trackdxdz.GetYaxis().SetLabelColor(ROOT.kWhite) 02412 chamber_y_trackdydz.GetXaxis().SetLabelColor(ROOT.kWhite) 02413 chamber_y_trackdydz.GetYaxis().SetLabelColor(ROOT.kWhite) 02414 chamber_dxdz_trackx.GetXaxis().SetLabelColor(ROOT.kWhite) 02415 chamber_dxdz_tracky.GetXaxis().SetLabelColor(ROOT.kWhite) 02416 chamber_dxdz_tracky.GetYaxis().SetLabelColor(ROOT.kWhite) 02417 chamber_dxdz_trackdxdz.GetXaxis().SetLabelColor(ROOT.kWhite) 02418 chamber_dxdz_trackdxdz.GetYaxis().SetLabelColor(ROOT.kWhite) 02419 chamber_dxdz_trackdydz.GetXaxis().SetLabelColor(ROOT.kWhite) 02420 chamber_dxdz_trackdydz.GetYaxis().SetLabelColor(ROOT.kWhite) 02421 02422 # chamber_dydz_trackx 02423 chamber_dydz_tracky.GetYaxis().SetLabelColor(ROOT.kWhite) 02424 chamber_dydz_trackdxdz.GetYaxis().SetLabelColor(ROOT.kWhite) 02425 chamber_dydz_trackdydz.GetYaxis().SetLabelColor(ROOT.kWhite) 02426 02427 pads[2].cd() 02428 chamber_x_trackx.Draw("e1") 02429 if not suppressblue: chamber_x_trackx_fit2.Draw("samel") 02430 chamber_x_trackx_fit.Draw("samel") 02431 #label99 = ROOT.TPaveLabel(0, 0.8, 1, 1, getname(r),"NDC") 02432 print getname(r) 02433 #label99 = ROOT.TPaveLabel(0, 0.8, 1, 1, "aaa","NDC") 02434 label9.Draw() 02435 #pads[2].Modified() 02436 02437 pads[3].cd() 02438 chamber_x_tracky.Draw("e1") 02439 if not suppressblue: chamber_x_tracky_fit2.Draw("samel") 02440 chamber_x_tracky_fit.Draw("samel") 02441 02442 pads[4].cd() 02443 chamber_x_trackdxdz.Draw("e1") 02444 if not suppressblue: chamber_x_trackdxdz_fit2.Draw("samel") 02445 chamber_x_trackdxdz_fit.Draw("samel") 02446 02447 pads[5].cd() 02448 chamber_x_trackdydz.Draw("e1") 02449 if not suppressblue: chamber_x_trackdydz_fit2.Draw("samel") 02450 chamber_x_trackdydz_fit.Draw("samel") 02451 02452 pads[7].cd() 02453 chamber_y_trackx.Draw("e1") 02454 if not suppressblue: chamber_y_trackx_fit2.Draw("samel") 02455 chamber_y_trackx_fit.Draw("samel") 02456 02457 pads[8].cd() 02458 chamber_y_tracky.Draw("e1") 02459 if not suppressblue: chamber_y_tracky_fit2.Draw("samel") 02460 chamber_y_tracky_fit.Draw("samel") 02461 02462 pads[9].cd() 02463 chamber_y_trackdxdz.Draw("e1") 02464 if not suppressblue: chamber_y_trackdxdz_fit2.Draw("samel") 02465 chamber_y_trackdxdz_fit.Draw("samel") 02466 02467 pads[10].cd() 02468 chamber_y_trackdydz.Draw("e1") 02469 if not suppressblue: chamber_y_trackdydz_fit2.Draw("samel") 02470 chamber_y_trackdydz_fit.Draw("samel") 02471 02472 pads[12].cd() 02473 chamber_dxdz_trackx.Draw("e1") 02474 if not suppressblue: chamber_dxdz_trackx_fit2.Draw("samel") 02475 chamber_dxdz_trackx_fit.Draw("samel") 02476 02477 pads[13].cd() 02478 chamber_dxdz_tracky.Draw("e1") 02479 if not suppressblue: chamber_dxdz_tracky_fit2.Draw("samel") 02480 chamber_dxdz_tracky_fit.Draw("samel") 02481 02482 pads[14].cd() 02483 chamber_dxdz_trackdxdz.Draw("e1") 02484 if not suppressblue: chamber_dxdz_trackdxdz_fit2.Draw("samel") 02485 chamber_dxdz_trackdxdz_fit.Draw("samel") 02486 02487 pads[15].cd() 02488 chamber_dxdz_trackdydz.Draw("e1") 02489 if not suppressblue: chamber_dxdz_trackdydz_fit2.Draw("samel") 02490 chamber_dxdz_trackdydz_fit.Draw("samel") 02491 02492 pads[17].cd() 02493 chamber_dydz_trackx.Draw("e1") 02494 if not suppressblue: chamber_dydz_trackx_fit2.Draw("samel") 02495 chamber_dydz_trackx_fit.Draw("samel") 02496 02497 pads[18].cd() 02498 chamber_dydz_tracky.Draw("e1") 02499 if not suppressblue: chamber_dydz_tracky_fit2.Draw("samel") 02500 chamber_dydz_tracky_fit.Draw("samel") 02501 02502 pads[19].cd() 02503 chamber_dydz_trackdxdz.Draw("e1") 02504 if not suppressblue: chamber_dydz_trackdxdz_fit2.Draw("samel") 02505 chamber_dydz_trackdxdz_fit.Draw("samel") 02506 02507 pads[20].cd() 02508 chamber_dydz_trackdydz.Draw("e1") 02509 if not suppressblue: chamber_dydz_trackdydz_fit2.Draw("samel") 02510 chamber_dydz_trackdydz_fit.Draw("samel") 02511 02512 else: 02513 c1.Clear() 02514 #c1.Divide(5, 3, 1e-5, 1e-5) 02515 pads = [None] 02516 pads.append(ROOT.TPad("p1" ,"",0.00,0.55,0.07,1.00,0,0,0)) 02517 pads.append(ROOT.TPad("p2" ,"",0.07,0.55,0.34,1.00,0,0,0)) 02518 pads.append(ROOT.TPad("p3" ,"",0.34,0.55,0.56,1.00,0,0,0)) 02519 pads.append(ROOT.TPad("p4" ,"",0.56,0.55,0.78,1.00,0,0,0)) 02520 pads.append(ROOT.TPad("p5" ,"",0.78,0.55,1.00,1.00,0,0,0)) 02521 pads.append(ROOT.TPad("p6" ,"",0.00,0.1,0.07,0.55,0,0,0)) 02522 pads.append(ROOT.TPad("p7" ,"",0.07,0.1,0.34,0.55,0,0,0)) 02523 pads.append(ROOT.TPad("p8" ,"",0.34,0.1,0.56,0.55,0,0,0)) 02524 pads.append(ROOT.TPad("p9" ,"",0.56,0.1,0.78,0.55,0,0,0)) 02525 pads.append(ROOT.TPad("p10","",0.78,0.1,1.00,0.55,0,0,0)) 02526 pads.append(ROOT.TPad("p11","",0.00,0.,0.07,0.1,0,0,0)) 02527 pads.append(ROOT.TPad("p12","",0.07,0.,0.34,0.1,0,0,0)) 02528 pads.append(ROOT.TPad("p13","",0.34,0.,0.56,0.1,0,0,0)) 02529 pads.append(ROOT.TPad("p14","",0.56,0.,0.78,0.1,0,0,0)) 02530 pads.append(ROOT.TPad("p15","",0.78,0.,1.00,0.1,0,0,0)) 02531 for p in pads: 02532 if not not p: 02533 p.Draw() 02534 ROOT.SetOwnership(p,False) 02535 02536 label1 = ROOT.TPaveLabel(0, 0, 1, 1, "x residuals (mm)") 02537 label2 = ROOT.TPaveLabel(0, 0, 1, 1, "dx/dz residuals (mrad)") 02538 label3 = ROOT.TPaveLabel(0, 0.3, 1, 1, "x position (cm)") 02539 label4 = ROOT.TPaveLabel(0, 0.3, 1, 1, "y position (cm)") 02540 label5 = ROOT.TPaveLabel(0, 0.3, 1, 1, "dx/dz angle (rad)") 02541 label6 = ROOT.TPaveLabel(0, 0.3, 1, 1, "dy/dz angle (rad)") 02542 label9 = ROOT.TPaveLabel(0, 0.85, 1, 1, getname(r),"NDC") 02543 02544 if name[0:2] == "ME": 02545 label1 = ROOT.TPaveLabel(0, 0, 1, 1, "r#phi residuals (mm)") 02546 label2 = ROOT.TPaveLabel(0, 0, 1, 1, "d(r#phi)/dz residuals (mrad)") 02547 02548 for l in label1, label2, label3, label4, label5, label6, label9: 02549 l.SetBorderSize(0) 02550 l.SetFillColor(ROOT.kWhite) 02551 02552 for l in label1, label2: 02553 l.SetTextAngle(90) 02554 l.SetTextSize(0.09) 02555 02556 #label9.SetTextAngle(30) 02557 label9.SetTextSize(0.29) 02558 02559 pads[1].cd(); label1.Draw() 02560 pads[6].cd(); label2.Draw() 02561 pads[12].cd(); label3.Draw() 02562 pads[13].cd(); label4.Draw() 02563 pads[14].cd(); label5.Draw() 02564 pads[15].cd(); label6.Draw() 02565 #pads[11].cd(); label9.Draw() 02566 02567 pads[2].SetRightMargin(1e-5) 02568 pads[2].SetBottomMargin(1e-5) 02569 pads[3].SetLeftMargin(1e-5) 02570 pads[3].SetRightMargin(1e-5) 02571 pads[3].SetBottomMargin(1e-5) 02572 pads[4].SetLeftMargin(1e-5) 02573 pads[4].SetRightMargin(1e-5) 02574 pads[4].SetBottomMargin(1e-5) 02575 pads[5].SetLeftMargin(1e-5) 02576 pads[5].SetBottomMargin(1e-5) 02577 02578 pads[7].SetRightMargin(1e-5) 02579 pads[7].SetTopMargin(1e-5) 02580 pads[8].SetLeftMargin(1e-5) 02581 pads[8].SetRightMargin(1e-5) 02582 pads[8].SetTopMargin(1e-5) 02583 pads[9].SetLeftMargin(1e-5) 02584 pads[9].SetRightMargin(1e-5) 02585 pads[9].SetTopMargin(1e-5) 02586 pads[10].SetLeftMargin(1e-5) 02587 pads[10].SetTopMargin(1e-5) 02588 02589 chamber_x_trackx.GetXaxis().SetLabelColor(ROOT.kWhite) 02590 chamber_x_tracky.GetXaxis().SetLabelColor(ROOT.kWhite) 02591 chamber_x_tracky.GetYaxis().SetLabelColor(ROOT.kWhite) 02592 chamber_x_trackdxdz.GetXaxis().SetLabelColor(ROOT.kWhite) 02593 chamber_x_trackdxdz.GetYaxis().SetLabelColor(ROOT.kWhite) 02594 chamber_x_trackdydz.GetXaxis().SetLabelColor(ROOT.kWhite) 02595 chamber_x_trackdydz.GetYaxis().SetLabelColor(ROOT.kWhite) 02596 # chamber_dxdz_trackx 02597 chamber_dxdz_tracky.GetYaxis().SetLabelColor(ROOT.kWhite) 02598 chamber_dxdz_trackdxdz.GetYaxis().SetLabelColor(ROOT.kWhite) 02599 chamber_dxdz_trackdydz.GetYaxis().SetLabelColor(ROOT.kWhite) 02600 02601 pads[2].cd() 02602 chamber_x_trackx.Draw("e1") 02603 if not suppressblue: chamber_x_trackx_fit2.Draw("samel") 02604 chamber_x_trackx_fit.Draw("samel") 02605 label9.Draw() 02606 02607 pads[3].cd() 02608 chamber_x_tracky.Draw("e1") 02609 if not suppressblue: chamber_x_tracky_fit2.Draw("samel") 02610 chamber_x_tracky_fit.Draw("samel") 02611 02612 pads[4].cd() 02613 chamber_x_trackdxdz.Draw("e1") 02614 if not suppressblue: chamber_x_trackdxdz_fit2.Draw("samel") 02615 chamber_x_trackdxdz_fit.Draw("samel") 02616 02617 pads[5].cd() 02618 chamber_x_trackdydz.Draw("e1") 02619 if not suppressblue: chamber_x_trackdydz_fit2.Draw("samel") 02620 chamber_x_trackdydz_fit.Draw("samel") 02621 02622 pads[7].cd() 02623 chamber_dxdz_trackx.Draw("e1") 02624 if not suppressblue: chamber_dxdz_trackx_fit2.Draw("samel") 02625 chamber_dxdz_trackx_fit.Draw("samel") 02626 02627 pads[8].cd() 02628 chamber_dxdz_tracky.Draw("e1") 02629 if not suppressblue: chamber_dxdz_tracky_fit2.Draw("samel") 02630 chamber_dxdz_tracky_fit.Draw("samel") 02631 02632 pads[9].cd() 02633 chamber_dxdz_trackdxdz.Draw("e1") 02634 if not suppressblue: chamber_dxdz_trackdxdz_fit2.Draw("samel") 02635 chamber_dxdz_trackdxdz_fit.Draw("samel") 02636 02637 pads[10].cd() 02638 chamber_dxdz_trackdydz.Draw("e1") 02639 if not suppressblue: chamber_dxdz_trackdydz_fit2.Draw("samel") 02640 chamber_dxdz_trackdydz_fit.Draw("samel") 02641 02642 tn = time.time() 02643 ddt[8] = 1./ddt[7]*((ddt[7]-1)*ddt[8] + tn-t1)
def plotscripts::postalAddressToId | ( | postal_address | ) |
Definition at line 827 of file plotscripts.py.
00828 : 00829 if postal_address[0] == "DT": 00830 wheel, station, sector = postal_address[1:] 00831 w = "%+d"%wheel 00832 if w=="+0": w = "-0" 00833 return "MB%s/%d/%02d" % (w, station, sector) 00834 elif postal_address[0] == "CSC": 00835 endcap, station, ring, chamber = postal_address[1:] 00836 if endcap != 1: station = -1 * abs(station) 00837 return "ME%+d/%d/%02d" % (station, ring, chamber) 00838
def plotscripts::printDeltaTs | ( | ) |
Definition at line 1845 of file plotscripts.py.
def plotscripts::rlines | ( | disk, | |
window, | |||
abscissa | |||
) |
Definition at line 469 of file plotscripts.py.
00470 : 00471 global rline_tlines 00472 rline_tlines = [] 00473 if disk == 1: rl = [150., 270., 480.] 00474 else: rl = [350.] 00475 for r in rl: 00476 if abscissa is None or abscissa[0] < r < abscissa[1]: 00477 rline_tlines.append(ROOT.TLine(r, -window, r, window)) 00478 rline_tlines[-1].SetLineStyle(2) 00479 rline_tlines[-1].Draw()
def plotscripts::rms | ( | xlist | ) |
Definition at line 57 of file plotscripts.py.
Referenced by HcalDetDiagLEDMonitor::CheckStatus(), HcalDetDiagPedestalMonitor::CheckStatus(), PFClient::createResolutionPlots(), HcalHitCorrection::delay(), DQMChannel::DQMChannel(), HFLightCalRand::endJob(), DTTPAnalyzer::endJob(), HOCalibAnalyzer::endJob(), DTTTrigCorrectionFirst::endJob(), SiStripCMMonitorPlugin::endJob(), HFLightCal::endJob(), ZeeCalibration::endOfJob(), RPCBxTest::endRun(), PedsFullNoiseSummaryFactory::extract(), RPCLinkSynchroHistoMaker::fill(), HcalDetDiagLEDMonitor::fillHistos(), HcalDetDiagPedestalMonitor::fillHistos(), HcalDetDiagLaserMonitor::fillHistos(), HcalDetDiagLaserMonitor::fillProblems(), LA_Filler_Fitter::find_rebin(), HcalDetDiagLaserMonitor::get_ave_rbx(), HcalDetDiagLaserMonitor::get_ave_subdet(), GetMPV(), DTMtimeHandler::getNewObjects(), DTTtrigHandler::getNewObjects(), TMom::getRMS(), EcalEndcapRecHitsMaker::init(), EcalBarrelRecHitsMaker::init(), TMom::init(), HcalDetDiagLaserMonitor::LoadDataset(), HcalDetDiagPedestalMonitor::LoadDataset(), HcalDetDiagLEDMonitor::LoadReference(), HcalDetDiagLaserMonitor::LoadReference(), HcalDetDiagPedestalMonitor::LoadReference(), TPedValues::makePlots(), reco::tau::RecoTauDiscriminantInvariantWidth::operator()(), DQMClientExample::performClient(), PhiBorderFinder::PhiBorderFinder(), cond::PayLoadInspector< DataT >::plot(), SiStripDetSummary::print(), SiPixelDetSummary::print(), RPCLinkSynchroStat::SynchroCounts::print(), SiStripNoises::printSummary(), TH2Analyzer::ProcessSlice(), TH2Analyzer::ProcessSlices(), RBorderFinder::RBorderFinder(), DTSurvey::ReadChambers(), LA_Filler_Fitter::rms_profile(), DTOccupancyTest::runOccupancyTest(), ContentsWithinExpected::runTest(), HcalDetDiagPedestalMonitor::SaveReference(), HcalDetDiagLEDMonitor::SaveReference(), HcalDetDiagLaserMonitor::SaveReference(), HcalDetDiagPedestalData::set_data(), HcalDetDiagLaserData::set_data(), HcalDetDiagPedestalData::set_reference(), HcalDetDiagLEDData::set_reference(), HcalDetDiagLaserData::set_reference(), MonTestPulseDat::setADCRMSG1(), MonTestPulseDat::setADCRMSG12(), MonPedestalsOnlineDat::setADCRMSG12(), MonTestPulseDat::setADCRMSG6(), MonLaserRedDat::setAPDOverPNRMS(), MonLaserBlueDat::setAPDOverPNRMS(), MonLaserGreenDat::setAPDOverPNRMS(), MonLaserIRedDat::setAPDOverPNRMS(), MonLaserIRedDat::setAPDRMS(), MonLaserRedDat::setAPDRMS(), MonLaserBlueDat::setAPDRMS(), MonLaserGreenDat::setAPDRMS(), DCUCapsuleTempRawDat::setCapsuleTempRMS(), MonDelaysTTDat::setDelayRMS(), MonPedestalsDat::setPedRMSG1(), MonPedestalsDat::setPedRMSG12(), MonPedestalsDat::setPedRMSG6(), ITimingDat::setTimingRMS(), MonLed2Dat::setVPTOverPNRMS(), MonLed1Dat::setVPTOverPNRMS(), MonLed1Dat::setVPTRMS(), MonLed2Dat::setVPTRMS(), and L25TauAnalyzer::trackDrRMS().
def plotscripts::saveTestResultsMap | ( | run_name | ) |
Definition at line 1108 of file plotscripts.py.
def plotscripts::segdiff | ( | tfiles, | |
component, | |||
pair, | |||
args | |||
) |
Definition at line 2646 of file plotscripts.py.
02647 : 02648 tdrStyle.SetOptFit(1) 02649 tdrStyle.SetOptTitle(1) 02650 tdrStyle.SetTitleBorderSize(1) 02651 tdrStyle.SetTitleFontSize(0.05) 02652 tdrStyle.SetStatW(0.2) 02653 tdrStyle.SetStatY(0.9) 02654 tdrStyle.SetStatFontSize(0.06) 02655 02656 if component[0:2] == "dt": 02657 wheel = args["wheel"] 02658 wheelletter = wheelLetter(wheel) 02659 sector = args["sector"] 02660 profname = "%s_%s_%02d_%s" % (component, wheelletter, sector, str(pair)) 02661 posname = "pos" + profname 02662 negname = "neg" + profname 02663 #print profname 02664 02665 station1 = int(str(pair)[0]) 02666 station2 = int(str(pair)[1]) 02667 phi1 = signConventions["DT", wheel, station1, sector][4] 02668 phi2 = signConventions["DT", wheel, station2, sector][4] 02669 if abs(phi1 - phi2) > 1.: 02670 if phi1 > phi2: phi1 -= 2.*pi 02671 else: phi1 += 2.*pi 02672 phi = (phi1 + phi2) / 2. 02673 while (phi < -pi): phi += 2.*pi 02674 while (phi > pi): phi -= 2.*pi 02675 02676 elif component[0:3] == "csc": 02677 endcap = args["endcap"] 02678 if endcap=="m": 02679 endcapnum=2 02680 endcapsign="-" 02681 elif endcap=="p": 02682 endcapnum=1 02683 endcapsign="+" 02684 else: raise Exception 02685 02686 ring = args["ring"] 02687 if ring>2 or ring<1: raise Exception 02688 station1 = int(str(pair)[0]) 02689 station2 = int(str(pair)[1]) 02690 if ring==1: ringname="inner" 02691 elif ring==2: ringname="outer" 02692 else: raise Exception 02693 02694 chamber = args["chamber"] 02695 if (ring==1 and chamber>18) or (ring==2 and chamber>36): raise Exception 02696 02697 profname = "csc%s_%s_%s_%02d_%s" % (ringname,component[4:], endcap, chamber, str(pair)) 02698 posname = "pos" + profname 02699 negname = "neg" + profname 02700 #print profname 02701 02702 station1 = int(str(pair)[0]) 02703 station2 = int(str(pair)[1]) 02704 phi1 = signConventions["CSC", endcapnum, station1, ring, chamber][4] 02705 phi2 = signConventions["CSC", endcapnum, station1, ring, chamber][4] 02706 if abs(phi1 - phi2) > 1.: 02707 if phi1 > phi2: phi1 -= 2.*pi 02708 else: phi1 += 2.*pi 02709 phi = (phi1 + phi2) / 2. 02710 while (phi < -pi): phi += 2.*pi 02711 while (phi > pi): phi -= 2.*pi 02712 02713 else: raise Exception 02714 02715 if "window" in args: window = args["window"] 02716 else: window = 5. 02717 02718 global tmpprof, tmppos, tmpneg 02719 pdir = "AlignmentMonitorSegmentDifferences/iter1/" 02720 tmpprof = tfiles[0].Get(pdir + profname).Clone() 02721 tmpprof.SetMarkerStyle(8) 02722 tmppos = tfiles[0].Get(pdir + posname).Clone() 02723 tmpneg = tfiles[0].Get(pdir + negname).Clone() 02724 for tfile in tfiles[1:]: 02725 tmpprof.Add(tfile.Get(pdir + profname)) 02726 tmppos.Add(tfile.Get(pdir + posname)) 02727 tmpneg.Add(tfile.Get(pdir + negname)) 02728 02729 for i in xrange(1, tmpprof.GetNbinsX()+1): 02730 if tmpprof.GetBinError(i) < 1e-5: 02731 tmpprof.SetBinError(i, 100.) 02732 tmpprof.SetAxisRange(-window, window, "Y") 02733 02734 f = ROOT.TF1("p1", "[0] + [1]*x", tmpprof.GetBinLowEdge(1), -tmpprof.GetBinLowEdge(1)) 02735 f.SetParameters((tmppos.GetMean() + tmpneg.GetMean())/2., 0.) 02736 02737 tmpprof.SetXTitle("q/p_{T} (c/GeV)") 02738 if component == "dt13_resid": 02739 tmpprof.SetYTitle("#Deltax^{local} (mm)") 02740 tmppos.SetXTitle("#Deltax^{local} (mm)") 02741 tmpneg.SetXTitle("#Deltax^{local} (mm)") 02742 f.SetParNames("#Deltax^{local}_{0}", "Slope") 02743 if component == "dt13_slope": 02744 tmpprof.SetYTitle("#Deltadx/dz^{local} (mrad)") 02745 tmppos.SetXTitle("#Deltadx/dz^{local} (mrad)") 02746 tmpneg.SetXTitle("#Deltadx/dz^{local} (mrad)") 02747 f.SetParNames("#Deltadx/dz^{local}_{0}", "Slope") 02748 if component == "dt2_resid": 02749 tmpprof.SetYTitle("#Deltay^{local} (mm)") 02750 tmppos.SetXTitle("#Deltay^{local} (mm)") 02751 tmpneg.SetXTitle("#Deltay^{local} (mm)") 02752 f.SetParNames("#Deltay^{local}_{0}", "Slope") 02753 if component == "dt2_slope": 02754 tmpprof.SetYTitle("#Deltady/dz^{local} (mrad)") 02755 tmppos.SetXTitle("#Deltady/dz^{local} (mrad)") 02756 tmpneg.SetXTitle("#Deltady/dz^{local} (mrad)") 02757 f.SetParNames("#Deltady/dz^{local}_{0}", "Slope") 02758 if component == "csc_resid": 02759 tmpprof.SetYTitle("#Delta(r#phi)^{local} (mm)") 02760 tmppos.SetXTitle("#Delta(r#phi)^{local} (mm)") 02761 tmpneg.SetXTitle("#Delta(r#phi)^{local} (mm)") 02762 f.SetParNames("#Delta(r#phi)^{local}_{0}", "Slope") 02763 if component == "csc_slope": 02764 tmpprof.SetYTitle("#Deltad(r#phi)/dz^{local} (mrad)") 02765 tmppos.SetXTitle("#Deltad(r#phi)/dz^{local} (mrad)") 02766 tmpneg.SetXTitle("#Deltad(r#phi)/dz^{local} (mrad)") 02767 f.SetParNames("#Deltad(r#phi)/dz^{local}_{0}", "Slope") 02768 02769 tmpprof.GetXaxis().CenterTitle() 02770 tmpprof.GetYaxis().CenterTitle() 02771 tmppos.GetXaxis().CenterTitle() 02772 tmpneg.GetXaxis().CenterTitle() 02773 if component[0:2] == "dt": 02774 tmpprof.SetTitle("MB%d - MB%d, wheel %d, sector %02d" % (station1, station2, int(wheel), int(sector))) 02775 elif component[0:3] == "csc": 02776 tmpprof.SetTitle("ME%d - ME%d, for ME%s%d/%d/%d" % (station1, station2, endcapsign, station2, ring, chamber)) 02777 else: raise Exception 02778 02779 tmppos.SetTitle("Positive muons") 02780 tmpneg.SetTitle("Negative muons") 02781 02782 c1.Clear() 02783 c1.Divide(2, 1) 02784 c1.GetPad(1).cd() 02785 fit1 = tmpprof.Fit("p1", "q") 02786 tmpprof.Draw("e1") 02787 c1.GetPad(2).cd() 02788 c1.GetPad(2).Divide(1, 2) 02789 c1.GetPad(2).GetPad(1).cd() 02790 tmppos.Draw() 02791 f = ROOT.TF1("gausR", "[0]*exp(-(x - [1])**2 / 2. / [2]**2) / sqrt(2.*3.1415926) / [2]", 02792 tmppos.GetMean() - tmppos.GetRMS(), tmppos.GetMean() + tmppos.GetRMS()) 02793 f.SetParameters(tmppos.GetEntries() * ((10. - -10.)/100.), tmppos.GetMean(), tmppos.GetRMS()) 02794 f.SetParNames("Constant", "Mean", "Sigma") 02795 fit2 = tmppos.Fit("gausR", "qR") 02796 c1.GetPad(2).GetPad(2).cd() 02797 tmpneg.Draw() 02798 f = ROOT.TF1("gausR", "[0]*exp(-(x - [1])**2 / 2. / [2]**2) / sqrt(2.*3.1415926) / [2]", 02799 tmpneg.GetMean() - tmpneg.GetRMS(), tmpneg.GetMean() + tmpneg.GetRMS()) 02800 f.SetParameters(tmpneg.GetEntries() * ((10. - -10.)/100.), tmpneg.GetMean(), tmpneg.GetRMS()) 02801 f.SetParNames("Constant", "Mean", "Sigma") 02802 fit3 = tmpneg.Fit("gausR", "qR") 02803 02804 fitresult1 = None, None 02805 if fit1 == 0: 02806 fitresult1 = tmpprof.GetFunction("p1").GetParameter(0), tmpprof.GetFunction("p1").GetParError(0) 02807 fitresult2 = None, None 02808 if fit2 == 0 and fit3 == 0: 02809 fitresult2 = (tmppos.GetFunction("gausR").GetParameter(1) + tmpneg.GetFunction("gausR").GetParameter(1)) / 2., \ 02810 sqrt(tmppos.GetFunction("gausR").GetParError(1)**2 + tmpneg.GetFunction("gausR").GetParError(1)**2) / 2. 02811 return phi, fitresult1[0], fitresult1[1], fitresult2[0], fitresult2[1], fit1, fit2, fit3
def plotscripts::segdiffvsphi | ( | tfiles, | |
reports, | |||
component, | |||
wheel, | |||
window = 5. , |
|||
excludesectors = () |
|||
) |
Definition at line 2812 of file plotscripts.py.
02813 : 02814 tdrStyle.SetOptTitle(1) 02815 tdrStyle.SetTitleBorderSize(1) 02816 tdrStyle.SetTitleFontSize(0.05) 02817 02818 global htemp, gtemp_12, gtemp2_12, gtemp_23, gtemp2_23, gtemp_34, gtemp2_34, tlegend 02819 htemp = ROOT.TH1F("htemp", "", 1, -pi, pi) 02820 gtemp_12_phi, gtemp_12_val, gtemp_12_err, gtemp_12_val2, gtemp_12_err2 = [], [], [], [], [] 02821 gtemp_23_phi, gtemp_23_val, gtemp_23_err, gtemp_23_val2, gtemp_23_err2 = [], [], [], [], [] 02822 gtemp_34_phi, gtemp_34_val, gtemp_34_err, gtemp_34_val2, gtemp_34_err2 = [], [], [], [], [] 02823 for sector in xrange(1, 12+1): 02824 #print sector 02825 r1_found, r2_found, r3_found, r4_found = False, False, False, False 02826 for r1 in reports: 02827 if r1.postal_address == ("DT", wheel, 1, sector): 02828 r1_found = True 02829 break 02830 for r2 in reports: 02831 if r2.postal_address == ("DT", wheel, 2, sector): 02832 r2_found = True 02833 break 02834 for r3 in reports: 02835 if r3.postal_address == ("DT", wheel, 3, sector): 02836 r3_found = True 02837 break 02838 for r4 in reports: 02839 if r4.postal_address == ("DT", wheel, 4, sector): 02840 r4_found = True 02841 break 02842 #print "rfounds: ", r1_found, r2_found, r3_found, r4_found 02843 02844 if sector not in excludesectors: 02845 if r1_found and r2_found and r1.status == "PASS" and r2.status == "PASS": 02846 phi, val, err, val2, err2, fit1, fit2, fit3 = segdiff(tfiles, component, 12, wheel=wheel, sector=sector) 02847 #print "segdif 12", phi, val, err, val2, err2, fit1, fit2, fit3 02848 if fit1 == 0 and fit2 == 0 and fit3 == 0: 02849 #if fit1 == 0 and fit2 == 0: 02850 gtemp_12_phi.append(phi) 02851 gtemp_12_val.append(val) 02852 gtemp_12_err.append(err) 02853 gtemp_12_val2.append(val2) 02854 gtemp_12_err2.append(err2) 02855 if r2_found and r3_found and r2.status == "PASS" and r3.status == "PASS": 02856 phi, val, err, val2, err2, fit1, fit2, fit3 = segdiff(tfiles, component, 23, wheel=wheel, sector=sector) 02857 #print "segdif 23", phi, val, err, val2, err2, fit1, fit2, fit3 02858 if fit1 == 0 and fit2 == 0 and fit3 == 0: 02859 #if fit1 == 0 and fit2 == 0: 02860 gtemp_23_phi.append(phi) 02861 gtemp_23_val.append(val) 02862 gtemp_23_err.append(err) 02863 gtemp_23_val2.append(val2) 02864 gtemp_23_err2.append(err2) 02865 if component[:4] == "dt13": 02866 if r3_found and r4_found and r3.status == "PASS" and r4.status == "PASS": 02867 phi, val, err, val2, err2, fit1, fit2, fit3 = segdiff(tfiles, component, 34, wheel=wheel, sector=sector) 02868 #print "segdif 34", phi, val, err, val2, err2, fit1, fit2, fit3 02869 if fit1 == 0 and fit2 == 0 and fit3 == 0: 02870 #if fit1 == 0 and fit2 == 0: 02871 gtemp_34_phi.append(phi) 02872 gtemp_34_val.append(val) 02873 gtemp_34_err.append(err) 02874 gtemp_34_val2.append(val2) 02875 gtemp_34_err2.append(err2) 02876 02877 #print "len(gtemp_12_phi) ", len(gtemp_12_phi) 02878 #print "len(gtemp_23_phi) ",len(gtemp_23_phi) 02879 #print "len(gtemp_34_phi) ",len(gtemp_34_phi) 02880 if len(gtemp_12_phi) > 0: 02881 gtemp_12 = ROOT.TGraphErrors(len(gtemp_12_phi), array.array("d", gtemp_12_phi), array.array("d", gtemp_12_val), 02882 array.array("d", [0.] * len(gtemp_12_phi)), array.array("d", gtemp_12_err)) 02883 gtemp2_12 = ROOT.TGraphErrors(len(gtemp_12_phi), array.array("d", gtemp_12_phi), array.array("d", gtemp_12_val2), 02884 array.array("d", [0.] * len(gtemp_12_phi)), array.array("d", gtemp_12_err2)) 02885 if len(gtemp_23_phi) > 0: 02886 gtemp_23 = ROOT.TGraphErrors(len(gtemp_23_phi), array.array("d", gtemp_23_phi), array.array("d", gtemp_23_val), 02887 array.array("d", [0.] * len(gtemp_23_phi)), array.array("d", gtemp_23_err)) 02888 gtemp2_23 = ROOT.TGraphErrors(len(gtemp_23_phi), array.array("d", gtemp_23_phi), array.array("d", gtemp_23_val2), 02889 array.array("d", [0.] * len(gtemp_23_phi)), array.array("d", gtemp_23_err2)) 02890 if len(gtemp_34_phi) > 0: 02891 gtemp_34 = ROOT.TGraphErrors(len(gtemp_34_phi), array.array("d", gtemp_34_phi), array.array("d", gtemp_34_val), 02892 array.array("d", [0.] * len(gtemp_34_phi)), array.array("d", gtemp_34_err)) 02893 gtemp2_34 = ROOT.TGraphErrors(len(gtemp_34_phi), array.array("d", gtemp_34_phi), array.array("d", gtemp_34_val2), 02894 array.array("d", [0.] * len(gtemp_34_phi)), array.array("d", gtemp_34_err2)) 02895 02896 if len(gtemp_12_phi) > 0: 02897 gtemp_12.SetMarkerStyle(20); gtemp_12.SetMarkerSize(1.); 02898 gtemp_12.SetMarkerColor(ROOT.kBlue); gtemp_12.SetLineColor(ROOT.kBlue) 02899 gtemp2_12.SetMarkerStyle(24); gtemp2_12.SetMarkerSize(1.); 02900 gtemp2_12.SetMarkerColor(ROOT.kBlue); gtemp2_12.SetLineColor(ROOT.kBlue) 02901 if len(gtemp_23_phi) > 0: 02902 gtemp_23.SetMarkerStyle(21); gtemp_23.SetMarkerSize(1.); 02903 gtemp_23.SetMarkerColor(ROOT.kRed); gtemp_23.SetLineColor(ROOT.kRed) 02904 gtemp2_23.SetMarkerStyle(25); gtemp2_23.SetMarkerSize(1.); 02905 gtemp2_23.SetMarkerColor(ROOT.kRed); gtemp2_23.SetLineColor(ROOT.kRed) 02906 if len(gtemp_34_phi) > 0 and component[:4] == "dt13": 02907 gtemp_34.SetMarkerStyle(22); gtemp_34.SetMarkerSize(1.25); 02908 gtemp_34.SetMarkerColor(ROOT.kGreen+2); gtemp_34.SetLineColor(ROOT.kGreen+2) 02909 gtemp2_34.SetMarkerStyle(26); gtemp2_34.SetMarkerSize(1.25); 02910 gtemp2_34.SetMarkerColor(ROOT.kGreen+2); gtemp2_34.SetLineColor(ROOT.kGreen+2) 02911 02912 if wheel == 0: htemp.SetTitle("Wheel %d" % wheel) 02913 else: htemp.SetTitle("Wheel %+d" % wheel) 02914 htemp.SetAxisRange(-window, window, "Y") 02915 htemp.SetXTitle("Average #phi of pair (rad)") 02916 if component == "dt13_resid": htemp.SetYTitle("#Deltax^{local} (mm)") 02917 if component == "dt13_slope": htemp.SetYTitle("#Deltadx/dz^{local} (mrad)") 02918 if component == "dt2_resid": htemp.SetYTitle("#Deltay^{local} (mm)") 02919 if component == "dt2_slope": htemp.SetYTitle("#Deltady/dz^{local} (mrad)") 02920 htemp.GetXaxis().CenterTitle() 02921 htemp.GetYaxis().CenterTitle() 02922 htemp.GetYaxis().SetTitleOffset(0.75) 02923 02924 c1.Clear() 02925 htemp.Draw() 02926 if len(gtemp_12_phi) > 0: 02927 gtemp_12.Draw("p") 02928 gtemp2_12.Draw("p") 02929 if len(gtemp_23_phi) > 0: 02930 gtemp_23.Draw("p") 02931 gtemp2_23.Draw("p") 02932 if len(gtemp_34_phi) > 0: 02933 gtemp_34.Draw("p") 02934 gtemp2_34.Draw("p") 02935 02936 tlegend = ROOT.TLegend(0.5, 0.72, 0.9, 0.92) 02937 tlegend.SetBorderSize(0) 02938 tlegend.SetFillColor(ROOT.kWhite) 02939 if len(gtemp_12_phi) > 0: 02940 tlegend.AddEntry(gtemp_12, "MB1 - MB2 (mean: %4.2f, RMS: %4.2f)" % (mean(gtemp_12_val), stdev(gtemp_12_val)), "pl") 02941 if len(gtemp_23_phi) > 0: 02942 tlegend.AddEntry(gtemp_23, "MB2 - MB3 (mean: %4.2f, RMS: %4.2f)" % (mean(gtemp_23_val), stdev(gtemp_23_val)), "pl") 02943 if len(gtemp_34_phi) > 0: 02944 tlegend.AddEntry(gtemp_34, "MB3 - MB4 (mean: %4.2f, RMS: %4.2f)" % (mean(gtemp_34_val), stdev(gtemp_34_val)), "pl") 02945 if len(gtemp_12_phi) > 0: 02946 tlegend.AddEntry(gtemp_12, "total mean: %4.2f, total RMS: %4.2f" % \ 02947 (mean(gtemp_12_val + gtemp_23_val + gtemp_34_val), 02948 stdev(gtemp_12_val + gtemp_23_val + gtemp_34_val)), "") 02949 tlegend.Draw() 02950 02951
def plotscripts::set_palette | ( | name = None , |
|
ncontours = 999 |
|||
) |
Set a color palette from a given RGB list stops, red, green and blue should all be lists of the same length see set_decent_colors for an example
Definition at line 223 of file plotscripts.py.
00224 : 00225 """Set a color palette from a given RGB list 00226 stops, red, green and blue should all be lists of the same length 00227 see set_decent_colors for an example""" 00228 00229 if name == "halfgray": 00230 stops = [0.00, 0.34, 0.61, 0.84, 1.00] 00231 red = map(lambda x: 1. - (1.-x)/2., [1.00, 0.84, 0.61, 0.34, 0.00]) 00232 green = map(lambda x: 1. - (1.-x)/2., [1.00, 0.84, 0.61, 0.34, 0.00]) 00233 blue = map(lambda x: 1. - (1.-x)/2., [1.00, 0.84, 0.61, 0.34, 0.00]) 00234 elif name == "gray": 00235 stops = [0.00, 0.34, 0.61, 0.84, 1.00] 00236 red = [1.00, 0.84, 0.61, 0.34, 0.00] 00237 green = [1.00, 0.84, 0.61, 0.34, 0.00] 00238 blue = [1.00, 0.84, 0.61, 0.34, 0.00] 00239 elif name == "blues": 00240 stops = [0.00, 0.34, 0.61, 0.84, 1.00] 00241 red = [1.00, 0.84, 0.61, 0.34, 0.00] 00242 green = [1.00, 0.84, 0.61, 0.34, 0.00] 00243 blue = [1.00, 1.00, 1.00, 1.00, 1.00] 00244 elif name == "reds": 00245 stops = [0.00, 0.34, 0.61, 0.84, 1.00] 00246 red = [1.00, 1.00, 1.00, 1.00, 1.00] 00247 green = [1.00, 0.84, 0.61, 0.34, 0.00] 00248 blue = [1.00, 0.84, 0.61, 0.34, 0.00] 00249 elif name == "antigray": 00250 stops = [0.00, 0.34, 0.61, 0.84, 1.00] 00251 red = [1.00, 0.84, 0.61, 0.34, 0.00] 00252 green = [1.00, 0.84, 0.61, 0.34, 0.00] 00253 blue = [1.00, 0.84, 0.61, 0.34, 0.00] 00254 red.reverse() 00255 green.reverse() 00256 blue.reverse() 00257 elif name == "fire": 00258 stops = [0.00, 0.20, 0.80, 1.00] 00259 red = [1.00, 1.00, 1.00, 0.50] 00260 green = [1.00, 1.00, 0.00, 0.00] 00261 blue = [0.20, 0.00, 0.00, 0.00] 00262 elif name == "antifire": 00263 stops = [0.00, 0.20, 0.80, 1.00] 00264 red = [0.50, 1.00, 1.00, 1.00] 00265 green = [0.00, 0.00, 1.00, 1.00] 00266 blue = [0.00, 0.00, 0.00, 0.20] 00267 else: 00268 # default palette, looks cool 00269 stops = [0.00, 0.34, 0.61, 0.84, 1.00] 00270 red = [0.00, 0.00, 0.87, 1.00, 0.51] 00271 green = [0.00, 0.81, 1.00, 0.20, 0.00] 00272 blue = [0.51, 1.00, 0.12, 0.00, 0.00] 00273 00274 s = array.array('d', stops) 00275 r = array.array('d', red) 00276 g = array.array('d', green) 00277 b = array.array('d', blue) 00278 00279 npoints = len(s) 00280 ROOT.TColor.CreateGradientColorTable(npoints, s, r, g, b, ncontours) 00281 ROOT.gStyle.SetNumberContours(ncontours) 00282 00283 set_palette()
def plotscripts::setTDRStyle | ( | ) |
Definition at line 84 of file plotscripts.py.
References tdrStyle.
Referenced by BTagPerformanceAnalyzerOnData::bookHistos(), BTagPerformanceAnalyzerMC::endJob(), BTagPerformanceAnalyzerOnData::endRun(), LRHelpFunctions::LRHelpFunctions(), FlavourHistograms< T >::plot(), EffPurFromHistos::plot(), SoftLeptonTagPlotter::psPlot(), JetTagPlotter::psPlot(), TrackCountingTagPlotter::psPlot(), TrackIPTagPlotter::psPlot(), TrackProbabilityTagPlotter::psPlot(), and RecoBTag::tdrGrid().
00085 : 00086 global tdrStyle 00087 tdrStyle = ROOT.TStyle("tdrStyle","Style for P-TDR") 00088 # For the canvas: 00089 tdrStyle.SetCanvasBorderMode(0) 00090 tdrStyle.SetCanvasColor(ROOT.kWhite) 00091 tdrStyle.SetCanvasDefH(600) #Height of canvas 00092 tdrStyle.SetCanvasDefW(600) #Width of canvas 00093 tdrStyle.SetCanvasDefX(0) #POsition on screen 00094 tdrStyle.SetCanvasDefY(0) 00095 00096 # For the Pad: 00097 tdrStyle.SetPadBorderMode(0) 00098 # tdrStyle.SetPadBorderSize(Width_t size = 1) 00099 tdrStyle.SetPadColor(ROOT.kWhite) 00100 tdrStyle.SetPadGridX(False) 00101 tdrStyle.SetPadGridY(False) 00102 tdrStyle.SetGridColor(0) 00103 tdrStyle.SetGridStyle(3) 00104 tdrStyle.SetGridWidth(1) 00105 00106 # For the frame: 00107 tdrStyle.SetFrameBorderMode(0) 00108 tdrStyle.SetFrameBorderSize(1) 00109 tdrStyle.SetFrameFillColor(0) 00110 tdrStyle.SetFrameFillStyle(0) 00111 tdrStyle.SetFrameLineColor(1) 00112 tdrStyle.SetFrameLineStyle(1) 00113 tdrStyle.SetFrameLineWidth(1) 00114 00115 # For the histo: 00116 # tdrStyle.SetHistFillColor(1) 00117 # tdrStyle.SetHistFillStyle(0) 00118 tdrStyle.SetHistLineColor(1) 00119 tdrStyle.SetHistLineStyle(0) 00120 tdrStyle.SetHistLineWidth(1) 00121 # tdrStyle.SetLegoInnerR(Float_t rad = 0.5) 00122 # tdrStyle.SetNumberContours(Int_t number = 20) 00123 00124 tdrStyle.SetEndErrorSize(2) 00125 # tdrStyle.SetErrorMarker(20) 00126 tdrStyle.SetErrorX(0.) 00127 00128 tdrStyle.SetMarkerStyle(20) 00129 00130 #For the fit/function: 00131 tdrStyle.SetOptFit(1) 00132 tdrStyle.SetFitFormat("5.4g") 00133 tdrStyle.SetFuncColor(2) 00134 tdrStyle.SetFuncStyle(1) 00135 tdrStyle.SetFuncWidth(1) 00136 00137 #For the date: 00138 tdrStyle.SetOptDate(0) 00139 # tdrStyle.SetDateX(Float_t x = 0.01) 00140 # tdrStyle.SetDateY(Float_t y = 0.01) 00141 00142 # For the statistics box: 00143 tdrStyle.SetOptFile(0) 00144 tdrStyle.SetOptStat(0) # To display the mean and RMS: SetOptStat("mr") 00145 tdrStyle.SetStatColor(ROOT.kWhite) 00146 tdrStyle.SetStatFont(42) 00147 tdrStyle.SetStatFontSize(0.025) 00148 tdrStyle.SetStatTextColor(1) 00149 tdrStyle.SetStatFormat("6.4g") 00150 tdrStyle.SetStatBorderSize(1) 00151 tdrStyle.SetStatH(0.1) 00152 tdrStyle.SetStatW(0.15) 00153 # tdrStyle.SetStatStyle(Style_t style = 1001) 00154 # tdrStyle.SetStatX(Float_t x = 0) 00155 # tdrStyle.SetStatY(Float_t y = 0) 00156 00157 # Margins: 00158 tdrStyle.SetPadTopMargin(0.05) 00159 tdrStyle.SetPadBottomMargin(0.13) 00160 tdrStyle.SetPadLeftMargin(0.13) 00161 tdrStyle.SetPadRightMargin(0.05) 00162 00163 # For the Global title: 00164 tdrStyle.SetOptTitle(0) 00165 tdrStyle.SetTitleFont(42) 00166 tdrStyle.SetTitleColor(1) 00167 tdrStyle.SetTitleTextColor(1) 00168 tdrStyle.SetTitleFillColor(10) 00169 tdrStyle.SetTitleFontSize(0.05) 00170 # tdrStyle.SetTitleH(0) # Set the height of the title box 00171 # tdrStyle.SetTitleW(0) # Set the width of the title box 00172 # tdrStyle.SetTitleX(0) # Set the position of the title box 00173 # tdrStyle.SetTitleY(0.985) # Set the position of the title box 00174 # tdrStyle.SetTitleStyle(Style_t style = 1001) 00175 # tdrStyle.SetTitleBorderSize(2) 00176 00177 # For the axis titles: 00178 tdrStyle.SetTitleColor(1, "XYZ") 00179 tdrStyle.SetTitleFont(42, "XYZ") 00180 tdrStyle.SetTitleSize(0.06, "XYZ") 00181 # tdrStyle.SetTitleXSize(Float_t size = 0.02) # Another way to set the size? 00182 # tdrStyle.SetTitleYSize(Float_t size = 0.02) 00183 tdrStyle.SetTitleXOffset(0.9) 00184 tdrStyle.SetTitleYOffset(1.05) 00185 # tdrStyle.SetTitleOffset(1.1, "Y") # Another way to set the Offset 00186 00187 # For the axis labels: 00188 tdrStyle.SetLabelColor(1, "XYZ") 00189 tdrStyle.SetLabelFont(42, "XYZ") 00190 tdrStyle.SetLabelOffset(0.007, "XYZ") 00191 tdrStyle.SetLabelSize(0.05, "XYZ") 00192 00193 # For the axis: 00194 tdrStyle.SetAxisColor(1, "XYZ") 00195 tdrStyle.SetStripDecimals(True) 00196 tdrStyle.SetTickLength(0.03, "XYZ") 00197 tdrStyle.SetNdivisions(510, "XYZ") 00198 tdrStyle.SetPadTickX(1) # To get tick marks on the opposite side of the frame 00199 tdrStyle.SetPadTickY(1) 00200 00201 # Change for log plots: 00202 tdrStyle.SetOptLogx(0) 00203 tdrStyle.SetOptLogy(0) 00204 tdrStyle.SetOptLogz(0) 00205 00206 # Postscript options: 00207 tdrStyle.SetPaperSize(20.,20.) 00208 # tdrStyle.SetLineScalePS(Float_t scale = 3) 00209 # tdrStyle.SetLineStyleString(Int_t i, const char* text) 00210 # tdrStyle.SetHeaderPS(const char* header) 00211 # tdrStyle.SetTitlePS(const char* pstitle) 00212 00213 # tdrStyle.SetBarOffset(Float_t baroff = 0.5) 00214 # tdrStyle.SetBarWidth(Float_t barwidth = 0.5) 00215 # tdrStyle.SetPaintTextFormat(const char* format = "g") 00216 # tdrStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0) 00217 # tdrStyle.SetTimeOffset(Double_t toffset) 00218 # tdrStyle.SetHistMinimumZero(True) 00219 00220 tdrStyle.cd() 00221 00222 setTDRStyle()
def plotscripts::stationIndex | ( | name | ) |
Definition at line 386 of file plotscripts.py.
Referenced by MuonIdProducer::fillArbitrationInfo(), reco::Muon::stationGapMaskDistance(), and reco::Muon::stationGapMaskPull().
00387 : 00388 if ("MB" in name or "ME" in name): 00389 # assume the name is ID 00390 pa = idToPostalAddress(name) 00391 if pa is None: return None 00392 if pa[0]=="CSC": 00393 if pa[2]==1 and pa[3]==1: return 0 00394 if pa[2]==1 and pa[3]==1: return 1 00395 if pa[2]==1 and pa[3]==1: return 2 00396 if pa[2]==1 and pa[3]==1: return 3 00397 if pa[2]==1 and pa[3]==1: return 4 00398 if pa[2]==1 and pa[3]==1: return 5 00399 if pa[2]==1 and pa[3]==1: return 6 00400 if pa[2]==1 and pa[3]==1: return 7 00401 if pa[2]==1 and pa[3]==1: return 8 00402 if pa[2]==1 and pa[3]==1: return 9 00403 if pa[0]=="DT": 00404 if pa[2]==1: return 10 00405 if pa[2]==2: return 11 00406 if pa[2]==3: return 12 00407 if pa[2]==2: return 13 00408 else: 00409 if ("mem11" in name or "mep11" in name): return 0 00410 if ("mem12" in name or "mep12" in name): return 1 00411 if ("mem13" in name or "mep13" in name): return 2 00412 if ("mem14" in name or "mep14" in name): return 3 00413 if ("mem21" in name or "mep21" in name): return 4 00414 if ("mem22" in name or "mep22" in name): return 5 00415 if ("mem31" in name or "mep31" in name): return 6 00416 if ("mem32" in name or "mep32" in name): return 7 00417 if ("mem41" in name or "mep41" in name): return 8 00418 if ("mem42" in name or "mep42" in name): return 9 00419 if ("st1" in name): return 10 00420 if ("st2" in name): return 11 00421 if ("st3" in name): return 12 00422 if ("st4" in name): return 13 00423 00424
def plotscripts::stdev | ( | xlist | ) |
Definition at line 64 of file plotscripts.py.
Referenced by MuonResidualsPositionFitter::fit(), MuonResidualsBfieldAngleFitter::fit(), and MuonResidualsAngleFitter::fit().
def plotscripts::testDeltaWithin5Sigma | ( | x, | |
sx | |||
) |
Definition at line 979 of file plotscripts.py.
00980 : 00981 n = len(x) 00982 res = [] 00983 dr = [] 00984 #print x 00985 #print sx 00986 for i in range(1,n+1): 00987 x1 = x[i-1] 00988 sx1 = sx[i-1] 00989 x2 = x[0] 00990 sx2 = sx[0] 00991 if i<n: 00992 x2 = x[i] 00993 sx2 = sx[i] 00994 sig1 = sqrt( (sx1[0]-sx1[1])**2 + x1[1]**2 ) 00995 sig2 = sqrt( (sx2[0]-sx2[1])**2 + x2[1]**2 ) 00996 df = abs(x1[0]-x2[0]) - 3*( sig1 + sig2 ) 00997 #df = abs(sx1[1]-sx2[0]) - 5*(abs(x1[1]) + abs(x2[1])) 00998 #print i, df, '= abs(',sx1[1],'-',sx2[0],')-5*(abs(',x1[1],')+abs(',x2[1],'))' 00999 dr.append(df) 01000 if df > 0: res.append(i) 01001 #print dr 01002 #print res 01003 return res 01004
def plotscripts::testEntry | ( | testID, | |
scope, | |||
descr, | |||
severity | |||
) |
Definition at line 965 of file plotscripts.py.
def plotscripts::testZeroWithin5Sigma | ( | x | ) |
Definition at line 972 of file plotscripts.py.
def plotscripts::wheel0only | ( | dt, | |
wheel, | |||
station, | |||
sector | |||
) |
Definition at line 30 of file plotscripts.py.
00030 : return dt == "DT" and wheel == 0
def plotscripts::wheelLetter | ( | wheel | ) |
Definition at line 34 of file plotscripts.py.
def plotscripts::wheelm1only | ( | dt, | |
wheel, | |||
station, | |||
sector | |||
) |
Definition at line 29 of file plotscripts.py.
00029 : return dt == "DT" and wheel == -1
def plotscripts::wheelm2only | ( | dt, | |
wheel, | |||
station, | |||
sector | |||
) |
Convenience functions.
Definition at line 28 of file plotscripts.py.
00028 : return dt == "DT" and wheel == -2
def plotscripts::wheelNumber | ( | wheell | ) |
Definition at line 42 of file plotscripts.py.
Referenced by DTDataIntegrityTest::endLuminosityBlock().
def plotscripts::wheelp1only | ( | dt, | |
wheel, | |||
station, | |||
sector | |||
) |
Definition at line 31 of file plotscripts.py.
00031 : return dt == "DT" and wheel == 1
def plotscripts::wheelp2only | ( | dt, | |
wheel, | |||
station, | |||
sector | |||
) |
Definition at line 32 of file plotscripts.py.
00032 : return dt == "DT" and wheel == 2 00033
def plotscripts::wmean | ( | xlist | ) |
Definition at line 72 of file plotscripts.py.
def plotscripts::writeDQMReport | ( | fname_dqm, | |
run_name | |||
) |
Definition at line 1128 of file plotscripts.py.
01129 : 01130 tests = [] 01131 for c in TEST_RESULTS: 01132 tests.append({"objID":c, "name":c, "list":TEST_RESULTS[c]}) 01133 lt = time.localtime(time.time()) 01134 lts = "%04d-%02d-%02d %02d:%02d:%02d %s" % (lt[0], lt[1], lt[2], lt[3], lt[4], lt[5], time.tzname[1]) 01135 dqm_report = {"run":run_name, "genDate": lts, "report":tests} 01136 ff = open(fname_dqm,mode="w") 01137 print >>ff, "var DQM_REPORT = " 01138 json.dump(dqm_report,ff) 01139 #print >>ff, "];" 01140 ff.close() 01141
def plotscripts::zlines | ( | window, | |
abscissa | |||
) |
Definition at line 452 of file plotscripts.py.
00453 : 00454 global zline_tlines 00455 zline_tlines = [] 00456 for z in -401.625, -133.875, 133.875, 401.625: 00457 if abscissa is None or abscissa[0] < z < abscissa[1]: 00458 zline_tlines.append(ROOT.TLine(z, -window, z, window)) 00459 zline_tlines[-1].SetLineStyle(2) 00460 zline_tlines[-1].Draw() 00461 zline_labels = [] 00462 zline_labels.append(ROOT.TText(-550, -0.9*window, "-2")) 00463 zline_labels.append(ROOT.TText(-300, -0.9*window, "-1")) 00464 zline_labels.append(ROOT.TText(-10, -0.9*window, "0")) 00465 zline_labels.append(ROOT.TText(250, -0.9*window, "+1")) 00466 zline_labels.append(ROOT.TText(500, -0.9*window, "+2")) 00467 for z in zline_labels: z.Draw() 00468 zline_labels.append(ROOT.TText(-600, -0.75*window, "Wheel:")); zline_labels[-1].Draw()
plotscripts::CPP_LOADED = False |
Definition at line 15 of file plotscripts.py.
00001 [ 00002 {"idx":0, "name": "NONE", "color": "lightgreen", "hex":"#90EE90"}, 00003 {"idx":1, "name": "LOWSTAT05", "color": "lightgreen", "hex":"#96D953"}, 00004 {"idx":2, "name": "LOWSTAT075", "color": "lightgreen", "hex":"#94E26F"}, 00005 {"idx":3, "name": "LOWSTAT1", "color": "yellowgreen", "hex":"#9ACD32"}, 00006 {"idx":4, "name": "LOWSTAT", "color": "yellow", "hex":"#FFFF00"}, 00007 {"idx":5, "name": "TOLERABLE", "color": "lightpink", "hex":"#FFB6C1"}, 00008 {"idx":6, "name": "SEVERE", "color": "orange", "hex":"#FFA500"}, 00009 {"idx":7, "name": "CRITICAL", "color": "red", "hex":"#FF0000"}]
Definition at line 948 of file plotscripts.py.
dictionary plotscripts::MAP_RESULTS_BINS = {} |
Definition at line 20 of file plotscripts.py.
dictionary plotscripts::MAP_RESULTS_FITSIN = {} |
Definition at line 19 of file plotscripts.py.
dictionary plotscripts::MAP_RESULTS_SAWTOOTH = {} |
Definition at line 18 of file plotscripts.py.
sector phi edges in: me11 me12 me13 me14 me21 me22 me31 me32 me41 me42 mb1 mb2 mb3 mb4 index: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
Definition at line 287 of file plotscripts.py.
plotscripts::tdrStyle = None |
Definition at line 83 of file plotscripts.py.
Referenced by LRHelpFunctions::purityPlot(), RecoBTag::setTDRStyle(), LRHelpFunctions::singlePlot(), RecoBTag::tdrGrid(), and tdrstyle().
dictionary plotscripts::TEST_RESULTS = {} |
Definition at line 23 of file plotscripts.py.