#!/usr/bin/python # -*- coding: iso-8859-15 -*- import os,sys # import getopt ##maybe it's supposed to be sys.argv[:] ... maybe tmpargv = sys.argv sys.argv = [ '-n' ] from ROOT import * sys.argv = tmpargv # import psyco # psyco.full() # from time import sleep # from optparse import OptionParser # from ROOT_Tools import RootHandler # from CommandLineMod import CommandLine if __name__ == "__main__": gStyle.SetTitleBorderSize ( 0 ) # duh gStyle.SetPadBorderMode ( 0 ) gStyle.SetOptStat ( 111111 ) # Good standard stats display. gStyle.SetOptFit ( 1111 ) # Display fit info if available. gStyle.SetMarkerStyle ( 3 ) # double cross. gStyle.SetMarkerSize ( 1.0 ) # double cross. gStyle.SetOptTitle ( 1 ) # Display histogram titles. gStyle.SetCanvasColor ( 10 ) # Background color (white) gStyle.SetPadColor ( 10 ) # Background color (white) gStyle.SetFillColor ( 10 ) # Background color (white) gStyle.SetHistFillColor ( 10 ) # Background color (white) gStyle.SetFrameFillColor ( 10 ) # Background color (white) # gStyle.SetFuncColor ( 10 ) # Background color (white) gStyle.SetStatColor ( 10 ) # Background color (white) gStyle.SetTextFont ( 132 ) gStyle.SetPadLeftMargin (0.11) gStyle.SetPadBottomMargin (0.13) gStyle.SetPadTopMargin (0.13) gStyle.SetPadRightMargin (0.05) gStyle.SetTitleFillColor ( 10 ) # Background color (white) gStyle.SetTitleFontSize ( 0.08 ) # Title Font Size gStyle.SetTitleX ( 0.05 ) # Title box width gStyle.SetTitleW ( 0.70 ) # Title box width gStyle.SetTitleH ( 0.09 ) # Title box width gStyle.SetTitleBorderSize ( 0 ) gStyle.SetStatW ( 0.2 ) # Statistic box width gStyle.SetStatH ( 0.25 ) # Statistic box width gStyle.SetStatX ( 0.65 ) # Statistic box width gStyle.SetStatY ( 0.95 ) # Statistic box width gStyle.SetStatBorderSize ( 1 ) gStyle.SetLegendBorderSize ( 1 ) gStyle.SetPalette ( 1 ) # Nicer colour scale for 2D histograms. gStyle.SetPaperSize ( 20., 24. ) gStyle.SetHistLineWidth ( 1 ) gStyle.SetLabelFont(132) gStyle.SetLabelFont(132,"X") gStyle.SetLabelFont(132,"Y") gStyle.SetLabelFont(132,"Z") gStyle.SetLabelFont(132,"T") gStyle.SetTitleFont(132) gStyle.SetTitleFont(132,"X") gStyle.SetTitleFont(132,"Y") gStyle.SetTitleFont(132,"Z") gStyle.SetTitleFont(132,"T") gStyle.SetLabelSize(0.06) gStyle.SetLabelSize(0.06,"X") gStyle.SetLabelSize(0.06,"Y") gStyle.SetLabelSize(0.06,"Z") gStyle.SetLabelSize(0.06,"T") gStyle.SetTitleSize(0.06 ) gStyle.SetTitleSize(0.06,"X") gStyle.SetTitleSize(0.06,"Y") gStyle.SetTitleSize(0.06,"Z") gStyle.SetTitleSize(0.06,"T") gStyle.SetTextFont(132) gStyle.SetStatFont(132) gROOT.SetBatch() gROOT.ForceStyle() # No Stats ! gStyle.SetOptStat ( 0 ) # Good standard stats display. gStyle.SetOptFit ( 1111 ) # Display fit info if available. gStyle.SetTitleW ( 0.70 ) # Title box width gStyle.SetPaperSize(15,7) # gStyle.SetCanvasDefH(500) # Defaults # gStyle.SetCanvasDefW(700) # Defaults gStyle.SetCanvasDefW(1000) # We can have many files in input # FileList = sys.argv[1].split(',') Filename = 'DecayParamVsResolution.dat' # HistName = sys.argv[2] # OutputFile = sys.argv[3] OutputFile = 'Test.eps' Canv = TCanvas() # Is it correlated or uncorrelated fit ? Correlated = True Correlated = False Title = '' # Leg = TLegend(0.7, 0.7,0.9,0.9) # MinY = 3620 # MaxY = 3830 # Title = [';Drift time [#mu s];Drift distance [ns]',';Drift time [#mu s];Residuals [#mu m]'] # LegName = ['Before','After'] # File.open('Filename') # # Line = File.readline(); # Line = File.readline(); # Rho = TGraphErrors(); Delta = TGraphErrors(); Eta = TGraphErrors(); # PmuXi = TGraphErrors(); i = 0 # PmuXiRemoveSets = [70,71,72,76,86] for line in open(Filename): if ( line[0] == "#" ): continue # testfloat = float(line.split("\t")) Col = line.split("\t") Col = map(float,Col) # Rho.SetPoint(i, Col[0], Col[1]+Col[12]) # Rho.SetPointError(i, 0, sqrt(Col[2]*Col[2]+Col[7]*Col[7])) Eta.SetPoint(i, Col[1], Col[5]) Eta.SetPointError(i, 0, Col[6]*Col[11]/Col[12]) Delta.SetPoint(i, Col[1], Col[7]) Delta.SetPointError(i, 0, Col[8]*Col[11]/Col[12]) # print Col[1],Col[5],Col[6],Col[7],Col[8],Col[11],Col[12] # Corrections applied for PmuXi # Remove sets # if ( not Col[0] in PmuXiRemoveSets): # PmuXi.SetPoint(p, Col[0], Col[5]+Col[10]+Col[14]) # PmuXi.SetPointError(p, 0, sqrt(Col[6]*Col[6]+Col[9]*Col[9]+Col[11]*Col[11])) # p = p + 1 i = i + 1 # gStyle.SetStatW ( 0.2 ) # Statistic box width # gStyle.SetStatH ( 0.25 ) # Statistic box width # gStyle.SetStatX ( 0.60 ) # Statistic box width # gStyle.SetStatY ( 0.45 ) # Statistic box width # Rho.Draw('AP') # Rho.SetTitle(Title+', #rho;Set #;#Delta#rho') # Rho.GetHistogram().SetTitleOffset(0.8, 'Y') # Rho.Fit('pol0') # Canv.Print('Rho.eps') Canv.Clear() gStyle.SetStatW ( 0.2 ) # Statistic box width gStyle.SetStatH ( 0.25 ) # Statistic box width gStyle.SetStatX ( 0.55 ) # Statistic box width gStyle.SetStatY ( 0.85 ) # Statistic box width Eta.Draw('AP') Eta.SetTitle(Title+';End-point resolution [keV/c] ;#Delta#eta') # Eta.GetHistogram().SetAxisRange(21, 70, 'Y') Eta.GetHistogram().SetTitleOffset(0.8, 'Y') Eta.Fit('pol1') b = Eta.GetFunction('pol1').GetParameter(0) a = Eta.GetFunction('pol1').GetParameter(1) LEta1 = TLine( 77.0, Eta.GetYaxis().GetXmin() , 77.0, a*77+b) LEta1.SetLineColor(4) LEta1.SetLineWidth(2) LEta1.SetLineStyle(2) LEta1.Draw() LEta2 = TLine( Eta.GetXaxis().GetXmin(), a*77+b, 77, a*77+b) LEta2.SetLineColor(4) LEta2.SetLineWidth(2) LEta2.SetLineStyle(2) LEta2.Draw() print "Correction for eta: ",a*77+b Canv.Print('../SystResCorrEta.eps') Canv.Clear() gStyle.SetStatW ( 0.2 ) # Statistic box width gStyle.SetStatH ( 0.25 ) # Statistic box width gStyle.SetStatX ( 0.95 ) # Statistic box width gStyle.SetStatY ( 0.95 ) # Statistic box width Delta.Draw('AP') Delta.SetTitle(Title+';End-point resolution [keV/c];#Delta#delta') # Delta.GetHistogram().SetAxisRange(21, 70, 'Y') Delta.GetHistogram().SetTitleOffset(0.8, 'Y') Delta.Fit('pol1') b = Delta.GetFunction('pol1').GetParameter(0) a = Delta.GetFunction('pol1').GetParameter(1) LDelta1 = TLine( 77.0, Delta.GetYaxis().GetXmin() , 77.0, a*77+b) LDelta1.SetLineColor(4) LDelta1.SetLineWidth(2) LDelta1.SetLineStyle(2) LDelta1.Draw() LDelta2 = TLine( Delta.GetXaxis().GetXmin(), a*77+b, 77, a*77+b) LDelta2.SetLineColor(4) LDelta2.SetLineWidth(2) LDelta2.SetLineStyle(2) LDelta2.Draw() print "Correction for delta: ",a*77+b Canv.Print('../SystResCorrDelta.eps') # Canv.Clear() # gStyle.SetStatW ( 0.2 ) # Statistic box width # gStyle.SetStatH ( 0.25 ) # Statistic box width # gStyle.SetStatX ( 0.55 ) # Statistic box width # gStyle.SetStatY ( 0.45 ) # Statistic box width # PmuXi.Draw('AP') # PmuXi.GetHistogram().SetTitleOffset(0.8, 'Y') # PmuXi.SetTitle(Title+', P_{#mu}#xi;Set #;#Delta P_{#mu}#xi') # PmuXi.Fit('pol0') # Canv.Print('PmuXi.eps')