#!/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.SetTextFont ( 132 ) gStyle.SetPadLeftMargin (0.15) gStyle.SetPadBottomMargin (0.13) gStyle.SetPadTopMargin (0.07) gStyle.SetPadRightMargin (0.05) 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.SetStatX ( 0.95 ) # 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 ( 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.04) gStyle.SetLabelSize(0.04,"X") gStyle.SetLabelSize(0.04,"Y") gStyle.SetLabelSize(0.04,"Z") gStyle.SetLabelSize(0.04,"T") gStyle.SetTitleSize(0.04 ) gStyle.SetTitleSize(0.04,"X") gStyle.SetTitleSize(0.04,"Y") gStyle.SetTitleSize(0.04,"Z") gStyle.SetTitleSize(0.04,"T") gStyle.SetTextFont(132) gStyle.SetStatFont(132) gROOT.SetBatch() gROOT.ForceStyle() # No Stats ! gStyle.SetOptStat ( 0 ) # Good standard stats display. gStyle.SetOptFit ( 0 ) # Display fit info if available. gStyle.SetTitleW ( 0.70 ) # Title box width gStyle.SetPaperSize(15,13) gStyle.SetCanvasDefW(1000) # Defaults gStyle.SetCanvasDefH(700) # Defaults # We can have many files in input # FileList = ['TCS2006B_Charac_Ph4_Pa3.root'] FileList = ['../../../4/pic/source/sum84-9-1_clk_raw.root','../../../5/pic/TargetStops_source/sum584-1_2_21-1_clk_raw.root'] HistName = 'ECalib/constinvcosth' OutputFile = ['../ECal_Edges.eps'] F=[] Canv = TCanvas() # Leg = TLegend(0.38, 0.35,0.72,0.5) Leg = TLegend(0.70, 0.80,0.90,0.95) # Leg2 = TLegend(0.36, 0.34,0.71,0.39) MinX = 52.3 MaxX = 53.3 # MinX = -0.049 # MaxX = 0.049 MinY = -2000 MaxY = 73000 # Title = 'TDC time versus TDC width, wire 12;Width [ns];Hit time [ns]' Title = ';Momentum [MeV/c];Count' LegName = ['Data','MC'] t=0 H = [] # H = [TH1D(),TH1D(),TH1D(),TH1D()] Canv.cd() # MainPad = TPad("MainPad","MainPad", 0., 0.4, 1., 1.) # # MainPad.SetLogy() # MainPad.Draw() # DiffPad = TPad("DiffPad", "DiffPad", 0., 0.0, 1., 0.4) # DiffPad.Draw() for i,f in enumerate(FileList): F.append( TFile(f) ) H2D = F[i].Get(HistName) H.append(H2D.ProjectionX(f+'Projx', 10,10)) # gPad.SetLogY() # print "here ",i," =>",H[i].GetMean(),H[i].GetMeanError() if ( i == 0): H[i].SetLineColor(4) H[i].SetLineWidth(1) H[i].SetMarkerColor(4) H[i].SetMarkerStyle(4) H[i].SetMarkerSize(0.6) H[i].Draw('E') # H[i].SetLabelSize(0) Norm = H[0].Integral() H[i].GetXaxis().SetDecimals() H[i].SetTitle(Title) H[i].SetAxisRange(MinX,MaxX,'X') # H[i].SetAxisRange(MinY,MaxY,'Y') # H.SetLineWidth(1) H[i].SetTitleSize(0.05,"Y") H[i].SetTitleOffset( 1.2, 'Y') # H[i].SetNdivisions(505) else: H[i].SetLineColor(2) H[i].SetMarkerColor(2) # Htmp[t].SetLineWidth(1) H[i].SetMarkerStyle(5) H[i].SetMarkerSize(0.6) H[i].Scale(Norm/H[i].Integral()) H[i].Draw('sameE') Leg.AddEntry(H[i], LegName[i], 'p') Canv.cd() Leg.Draw() # For eps Canv.Print(OutputFile[0]) # Canv[1].cd() # Leg.Draw() # # For eps # Canv[1].Print(OutputFile[1])