#!/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.10) gStyle.SetPadBottomMargin (0.15) gStyle.SetPadTopMargin (0.05) gStyle.SetPadRightMargin (0.03) gStyle.SetTitleFillColor ( 10 ) # Background color (white) gStyle.SetTitleFontSize ( 0.08 ) # Title Font Size gStyle.SetTitleX ( 0.10 ) # 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.07) gStyle.SetLabelSize(0.07,"X") gStyle.SetLabelSize(0.07,"Y") gStyle.SetLabelSize(0.07,"Z") gStyle.SetLabelSize(0.07,"T") gStyle.SetTitleSize(0.07 ) gStyle.SetTitleSize(0.07,"X") gStyle.SetTitleSize(0.07,"Y") gStyle.SetTitleSize(0.07,"Z") gStyle.SetTitleSize(0.07,"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(14,7) # gStyle.SetCanvasDefH(500) # Defaults # gStyle.SetCanvasDefW(700) # Defaults gStyle.SetCanvasDefH(450) # Defaults gStyle.SetCanvasDefW(1000) # We can have many files in input # FileList = sys.argv[1].split(',') Filename = 'DecayParameters.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 = 'ECal propagation: Shift-Shift, New TCAP (pass8), 10^{-4} unit' # 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(); Delta = TGraphErrors(); # Rho = TGraphErrors(); # Delta = TGraphErrors(); # PmuXi = TGraphErrors(); i = 0 p = 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) Delta.SetPoint(i, Col[0], (Col[3]+Col[13])) # average ECal stat from shift and scale Delta.SetPointError(i, 0, sqrt(Col[4]*Col[4]+Col[8]*Col[8])) # Rho.SetPoint(i, Col[0], Col[1]) # Rho.SetPointError(i, 0, Col[2]) # Delta.SetPoint(i, Col[0], Col[3]) # Delta.SetPointError(i, 0, Col[4]) # # Corrections applied for PmuXi # # Remove sets # if ( not Col[0] in PmuXiRemoveSets): # PmuXi.SetPoint(p, Col[0], Col[5]+Col[10]) # PmuXi.SetPointError(p, 0, Col[6]) # p = p + 1 i = i + 1 gStyle.SetStatW ( 0.2 ) # Statistic box width gStyle.SetStatH ( 0.25 ) # Statistic box width gStyle.SetStatX ( 0.70 ) # Statistic box width gStyle.SetStatY ( 0.41 ) # Statistic box width Delta.Draw('AP') Delta.SetTitle(';Set number;#Delta#delta (10^{-4} units)') # Delta.GetHistogram().SetTitleOffset(0.8, 'Y') Delta.GetHistogram().SetTitleOffset(0.6, 'Y') Delta.GetHistogram().SetAxisRange(17,70,'Y') Delta.GetXaxis().CenterTitle() Delta.GetYaxis().CenterTitle() Delta.Fit('pol0') Canv.Print('../Delta_Scale.eps')