#!/usr/bin/python import os,sys from ROOT import * from clean_canvas import * from nice_colours import * gStyle = makegstyle(gStyle) gStyle = nice_colours(gStyle) gStyle.SetOptFit(1011) gStyle.SetErrorX(0) gStyle.SetStatX(0.88) gStyle.SetStatY(0.85) gStyle.SetStatW(0.4) gStyle.SetStatH(0.15) from robs_draw_fiducial import * ls = fiducial_lines() from accessories import * fid = [0.54, 0.96, 52.0, 10.0, 14.0, 38.0] ##intermediate fiducial #fn = '/home/e614/analysis_2006_2007/treesum/pass4/sum74-4-1_sum474-1_2_21-1_michel.root' fn = '/home/e614/analysis_2006_2007/treesum/pass8/sum87-3-1_sum587-1_21-1_michel.root' #used for plot #fn = '/home/e614/analysis_2006_2007/treesum/systematics_pass1/DistortedSTRs_ECal_AscaleBscale/sum584-3_4-1_sum584-1_2-1_michel.root' #distorted STRS #fn = '/home/e614/analysis_2006_2007/treesum/systematics_pass1/sum440-1-1_sum474-1_2_21_31-1_michel.root' #brem #fn = '/home/e614/analysis_2006_2007/treesum/systematics_pass1/sum445-1-1_sum474-1_2_21_31-1_michel.root' #foil pos #fn = '/home/e614/analysis_2006_2007/treesum/systematics_pass1/EtaCorrelation/sum84-9-4_sum584-1_2_21-1_etaup_michel.root' #eta up f = TFile(fn) nice_fn = fn.split('/')[-1].rstrip('.root') def zero_y_errors(h1): h2 = h1.Clone() h2.Reset() for ib in range(1,h1.GetNbinsX()+1): c = h1.GetBinCenter(ib) n = h1.GetBinContent(ib) e = h1.GetBinError(ib) if n!=0.0 and e!=0.0: h2.SetBinContent(ib,n) h2.SetBinError(ib,0.) else: h2.SetBinContent(ib,-1000.) #so embarrassing h2.SetBinError(ib,0.) return h2 h_all_residuals = f.Get('full_residuals2').Clone() h_resid_ptot = zero_y_errors(f.Get('full_residuals_ptot').Clone()) h_resid_costh = zero_y_errors(f.Get('full_residuals_costh').Clone()) for h in [h_resid_ptot,h_resid_costh]: h.SetMarkerStyle(20) h.SetMarkerColor(1) h.SetMarkerSize(1.) c1 = TCanvas('c1','c1',850,1100) #letter ratio c1.Divide(1,2) c1.cd(1) c1_1.Divide(2,1) c1_1.GetPad(1).SetLeftMargin(.12) c1_1.GetPad(1).SetRightMargin(.15) c1_1.GetPad(2).SetLogy() c1_1.cd(1) h_all_residuals.SetTitle('Normalised residuals; momentum (MeV/c); cos#theta') h_all_residuals.GetYaxis().SetDecimals() h_all_residuals.GetYaxis().CenterTitle() h_all_residuals.GetYaxis().SetTitleOffset(1.6) h_all_residuals.SetMinimum(-10.) h_all_residuals.SetMaximum(10.) h_all_residuals.Clone().Draw('colz') for l in ls: l.Draw('same') #c1.cd(2) c1_1.cd(2) #h_all_residuals.Rebin2D() #h_all_residuals.Rebin2D() #h_all_residuals.SetMaximum(3.) #h_all_residuals.SetMinimum(-3.) #h_all_residuals.Clone().Draw('colz') #for l in ls: l.Draw('same') def list_residuals(h,ctmin,ctmax): #DS = 0')