#!/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 def FuncFT0s( x, par ): if ( x[0] < 23): return ( par[0] + par[1] ) else: return ( par[0] ) 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.15) gStyle.SetPadRightMargin (0.03) gStyle.SetPadBottomMargin (0.13) gStyle.SetPadTopMargin (0.05) gStyle.SetTitleFillColor ( 10 ) # Background color (white) gStyle.SetTitleFontSize ( 0.08 ) # Title Font Size gStyle.SetTitleX ( 0.20 ) # Title box width gStyle.SetTitleW ( 0.50 ) # 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.05) gStyle.SetLabelSize(0.05,"X") gStyle.SetLabelSize(0.05,"Y") gStyle.SetLabelSize(0.05,"Z") gStyle.SetLabelSize(0.05,"T") gStyle.SetTitleSize(0.05 ) gStyle.SetTitleSize(0.05,"X") gStyle.SetTitleSize(0.05,"Y") gStyle.SetTitleSize(0.05,"Z") gStyle.SetTitleSize(0.05,"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(12,12) # gStyle.SetCanvasDefH(500) # Defaults # gStyle.SetCanvasDefW(900) # Defaults # gStyle.SetCanvasDefW(1000) # We can have many files in input # FileList = sys.argv[1].split(',') Filename = 'ScintillatorRelTime.dat' # HistName = sys.argv[2] # OutputFile = sys.argv[3] OutputFile = 'Test.eps' Canv = TCanvas() # 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(); Tzeros = TGraphErrors(); i = 0 FudgedErrors = 0.116 for line in open(Filename): i = i + 1 columns = line.split("\t\t") print columns[0],columns[1] Tzeros.SetPoint(i, float(columns[0]), float(columns[1])) Tzeros.SetPointError(i, 0, FudgedErrors) # Delta.SetPoint(i-2, float(columns[0]), float(columns[3])) # Delta.SetPointError(i-2, 0, FudgedErrors) # PmuXi.SetPoint(i-2, float(columns[0]), float(columns[5])) # PmuXi.SetPointError(i-2, 0, FudgedErrors) # while ( Line != '') # # H.Draw('AP') # H.GetHistogram().SetTitle( Title[i]) # # if ( i == 0): # # H.Draw() # # H.SetTitle(Title) # # H.SetAxisRange(MinY,MaxY,'Y') # # H.SetLineWidth(2) # # H.SetTitleOffset( 1.2, 'Y') # H.Fit("pol3", "Q","") # H.GetFunction('pol3').SetLineWidth(1) # else: # H.GetHistogram().SetTitleOffset( 1.2, 'Y') # # if ( i > 3 ): # # H.SetLineColor(i+2) # # else: # # H.SetLineColor(i+1) # # H.SetLineWidth(2) # # H.Draw('same') # # Leg.AddEntry(H, LegName[i], 'l') # # # Leg.Draw() # # # For Postscript # # Canv.Print(OutputFile,"Landscape") # # For eps FT0s = TF1("FuncFT0s", FuncFT0s,0,45,2) gStyle.SetStatW ( 0.2 ) # Statistic box width gStyle.SetStatH ( 0.2 ) # Statistic box width gStyle.SetStatX ( 0.98 ) # Statistic box width gStyle.SetStatY ( 0.98 ) # Statistic box width Tzeros.Fit("FuncFT0s") aup = FT0s.GetParameter(0) adn = FT0s.GetParameter(1) Tzeros.Draw('AP') Tzeros.SetTitle(';Plane # ;Wire time offsets difference[ns]') Tzeros.GetHistogram().SetAxisRange(0,45,'X') LD1 = TLine( 22.5, Tzeros.GetHistogram().GetYaxis().GetXmin(), 22.5, Tzeros.GetHistogram().GetYaxis().GetXmax()) LD1.SetLineWidth(2) LD1.SetLineStyle(2) LD1.Draw() # TPTUp = TPaveText( ) # TPTUp.SetX1NDC(0.3) # TPTUp.SetX2NDC(0.4) # TPTUp.SetY1NDC(0.20) # TPTUp.SetY2NDC(0.22) # TTUp = TPTUp.AddText('f(x) = %1.3f' % (aup)) # TPTUp.SetBorderSize(0) # # TTUp.SetTextColor(2) # TTUp.SetTextAlign(22) # TPTUp.Draw() # Tzeros.Fit('pol0') Canv.Print('../T0_Asymmetry.eps') # Canv.Clear() # gStyle.SetStatW ( 0.2 ) # Statistic box width # gStyle.SetStatH ( 0.25 ) # Statistic box width # gStyle.SetStatX ( 0.70 ) # Statistic box width # gStyle.SetStatY ( 0.4 ) # Statistic box width # Delta.Draw('AP') # Delta.SetTitle('#delta, with minus without PsPACT cut applied') # Delta.Fit('pol0') # Canv.Print('Delta.eps') # # Canv.Clear() # gStyle.SetStatW ( 0.2 ) # Statistic box width # gStyle.SetStatH ( 0.25 ) # Statistic box width # gStyle.SetStatX ( 0.80 ) # Statistic box width # gStyle.SetStatY ( 0.4 ) # Statistic box width # PmuXi.Draw('AP') # PmuXi.SetTitle('P_#mu#xi, with minus without PsPACT cut applied') # PmuXi.Fit('pol0') # Canv.Print('PmuXi.eps')