#!/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.SetTitleBorderSize ( 1 ) gStyle.SetPadBorderMode ( 0 ) gStyle.SetOptStat ( 111111 ) # Good standard stats display. gStyle.SetOptFit ( 1111 ) # Display fit info if available. gStyle.SetMarkerStyle ( 24 ) # Open circle. 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.SetStatColor ( 10 ) # Background color (white) gStyle.SetTitleFillColor ( 10 ) # Background color (white) gStyle.SetTitleFontSize ( 0.08 ) # Title Font Size gStyle.SetTitleX ( 0.30 ) # Title box width gStyle.SetTitleW ( 0.50 ) # Title box width gStyle.SetTitleH ( 0.09 ) # Title box width gStyle.SetStatX ( 0.95 ) # Statistic box width gStyle.SetStatY ( 0.9 ) # Statistic box width gStyle.SetStatW ( 0.2 ) # Statistic box width gStyle.SetStatBorderSize ( 1 ) gStyle.SetLegendBorderSize ( 1 ) gStyle.SetPalette ( 1 ) # Nicer colour scale for 2D histograms. gStyle.SetPaperSize ( 20., 24. ) gStyle.SetHistLineWidth ( 2 ) 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) gStyle.SetPadLeftMargin (0.07) gStyle.SetPadBottomMargin (0.13) gStyle.SetPadRightMargin (0.02) gStyle.SetPadTopMargin (0.08) gROOT.SetBatch() # No Stats ! # gStyle.SetOptStat(1110) # gStyle.SetOptFit(111) gStyle.SetOptStat ( 0 ) # Good standard stats display. # gStyle.SetOptFit ( 0 ) # Display fit info if available. gStyle.SetTitleW ( 0.60 ) # Title box width gStyle.SetStatX ( 0.98 ) # Statistic box width gStyle.SetStatY ( 0.9 ) # Statistic box width gStyle.SetStatW ( 0.19 ) # Statistic box width gStyle.SetStatH ( 0.3 ) # Statistic box width # gStyle.SetPaperSize(7,15) # gStyle.SetCanvasDefH(700) # Defaults # gStyle.SetCanvasDefW(700) # Defaults gROOT.ForceStyle() # We can have many files in input FileList = ['../Clark/run/set84a7s4_clk_raw.root'] HistName = ['PairMatchingCut/cda_down_before', 'PairMatchingCut/cda_up_before'] OutputFile = '../Ps/BeamPositronCDA_Set84.eps' F=[] Canv = TCanvas() # Leg = TLegend(0.7, 0.7,0.9,0.9) MinX = 0.0 MaxX = 3.0 # MinY = -3.0 # MaxY = 3.0 # MinY = 3620 # MaxY = 3830 # Title = 'TDC hit time, wire 12;[ns]' Title = 'Beam positron CDA Set84' # LegName = ['Bla','Blabla'] F.append( TFile(FileList[0]) ) Hdn = F[0].Get(HistName[0]) HdnScale = F[0].Get('Mu_eVertexSel/mu_e_dv_vs_du_down_before') Hdn.Scale(1.0/HdnScale.Integral()) Hup = F[0].Get(HistName[1]) HupScale = F[0].Get('Mu_eVertexSel/mu_e_dv_vs_du_up_before') Hup.Scale(1.0/HupScale.Integral()) Hdiff = Hdn.Clone('BadTrk_cda_down-up') Hdiff.Add(Hup, -1.0) Hdiff.Draw() Hdiff.SetTitle(Title) Hdiff.SetAxisRange(MinX,MaxX,'X') Hdiff.SetAxisRange(-0.0001999,0.00095,'Y') CutApplied = TLine( 0.5, -0.0001999, 0.5, 0.00095); CutApplied.SetLineColor(2) CutApplied.SetLineWidth(3) CutApplied.SetLineStyle(2) CutApplied.Draw() TPT = TPaveText( ) TPT.SetX1NDC(0.39) TPT.SetX2NDC(0.49) TPT.SetY1NDC(0.45) TPT.SetY2NDC(0.47) TT = TPT.AddText('Current CDA cut in Clark') TPT.SetBorderSize(0) TT.SetTextColor(2) TT.SetTextAlign(22) TPT.Draw() #if ( i == 0): # # H.GetXaxis().SetLabelFont(132) # # H.GetYaxis().SetLabelFont(132) # H.Draw('colz') # H.SetTitle(Title) # H.SetAxisRange(MinX,MaxX,'X') # H.SetAxisRange(MinY,MaxY,'Y') # # H.SetLineWidth(1) # H.SetTitleOffset( 0.8, 'Y') # # H.Fit('gaus', "Q","", 3612.0, 3812.0) #else: # if ( i > 3 ): # H.SetLineColor(i+2) # else: # H.SetLineColor(i+1) # H.SetLineWidth(1) # H.Draw('same') # # Leg.AddEntry(H, LegName[i], 'l') ## Leg.Draw() # For Postscript # Canv.Print(OutputFile,"Landscape") # For eps Canv.Print(OutputFile)