#!/usr/bin/python # April 2009 import os,sys # import getopt ##maybe it's supposed to be sys.argv[:] ... maybe tmpargv = sys.argv sys.argv = [ '-n' ] from michel_spectrum import * from ROOT import * sys.argv = tmpargv def call_eta(xc): x,c=xc[0],xc[1] return derivative_spectrum(x,c,'eta') def call_rho(xc): x,c=xc[0],xc[1] return derivative_spectrum(x,c,'rho') def call_xidelta(xc): x,c=xc[0],xc[1] return derivative_spectrum(x,c,'xidelta') def call_xixidelta(xc): x,c=xc[0],xc[1] return derivative_spectrum(x,c,'xixidelta') if __name__ == '__main__': # ================ Display (Canvas, pads ...) =================== # # Canvas gStyle.SetCanvasColor ( 10 ) # Background color (white) gStyle.SetCanvasDefH(500) # Default = 500 gStyle.SetCanvasDefW(700) # Default = 700 # Output size # gStyle.SetPaperSize ( 20., 24. ) # Default = 20.,26. # For eps: gStyle.SetPaperSize ( 12., 10. ) # Default = 20.,26. # Pads gStyle.SetPadBorderMode ( 0 ) gStyle.SetPadColor ( 10 ) # Background color (white) # gStyle.SetPadLeftMargin (0.13) # gStyle.SetPadBottomMargin (0.13) # gStyle.SetPadRightMargin (0.14) # gStyle.SetPadTopMargin (0.05) gStyle.SetPadLeftMargin (0.10) gStyle.SetPadBottomMargin (0.07) gStyle.SetPadRightMargin (0.08) gStyle.SetPadTopMargin (0.03) # Miscellaneous gStyle.SetFillColor ( 0 ) # Background color (white) gStyle.SetFrameFillColor ( 10 ) # Background color (white) # ================ Fonts variable ================= # Font = 132 # Times roman FontSize = 0.05 # ================ Plots =================== # gStyle.SetOptTitle ( 1 ) # Display histogram titles. gStyle.SetMarkerStyle ( 5 ) # Cross gStyle.SetMarkerSize ( 1 ) # size gStyle.SetPalette ( 1 ) # Nicer colour scale for 2D histograms. gStyle.SetHistLineWidth ( 2 ) # ================ Stat Box =================== # # Display name of the histogram, entries, mean, RMS, underflow, overflow gStyle.SetOptStat ( 111111 ) # Good standard stats display. gStyle.SetOptFit ( 1111 ) # Display fit info if available. gStyle.SetStatColor ( 10 ) # Background color (white) gStyle.SetStatX ( 0.99 ) # Statistic box X gStyle.SetStatY ( 0.98 ) # Statistic box Y gStyle.SetStatW ( 0.25 ) # Statistic box width gStyle.SetStatH ( 0.3 ) # Statistic box height gStyle.SetStatBorderSize ( 0 ) gStyle.SetStatFont(Font) # No Stat box ! # gStyle.SetOptStat ( 0 ) # Good standard stats display. # gStyle.SetOptFit ( 0 ) # Display fit info if available. # ================ Title =================== # gStyle.SetTitleFillColor ( 10 ) # Background color (white) gStyle.SetTitleX ( 0.10 ) # Title box Y gStyle.SetTitleY ( 0.10 ) # Title box Y gStyle.SetTitleW ( 0.50 ) # Title box width gStyle.SetTitleH ( 0.09 ) # Title box height gStyle.SetTitleBorderSize ( 0 ) gStyle.SetTitleFont(Font) gStyle.SetTitleFont(Font, "X") gStyle.SetTitleFont(Font, "Y") gStyle.SetTitleFont(Font, "Z") gStyle.SetTitleFont(Font, "T") gStyle.SetTitleSize(FontSize ) gStyle.SetTitleSize(FontSize,"X") gStyle.SetTitleSize(FontSize,"Y") gStyle.SetTitleSize(FontSize,"Z") gStyle.SetTitleSize(FontSize,"T") # ================ Labels =================== # gStyle.SetLabelFont(Font) gStyle.SetLabelFont(Font, "X") gStyle.SetLabelFont(Font, "Y") gStyle.SetLabelFont(Font, "Z") gStyle.SetLabelFont(Font, "T") gStyle.SetLabelSize(FontSize) gStyle.SetLabelSize(FontSize,"X") gStyle.SetLabelSize(FontSize,"Y") gStyle.SetLabelSize(FontSize,"Z") gStyle.SetLabelSize(FontSize,"T") gStyle.SetStripDecimals(kFALSE) # =============== Text & Legends ================== # gStyle.SetTextFont(Font) gStyle.SetLegendBorderSize ( 0 ) # ============================================= # # Do not display the canvas in a window, plot in a postscript gROOT.SetBatch() # Needed to make sure that all the gStyle parameters are passed to the plots gROOT.ForceStyle() # We can have many files in input # eps is preferable because one can change the size of the output OutputFile = 'Derivatives.eps' Canv = TCanvas() # Axis range MinX = 0.01 MaxX = 1.0 # MinY = -100. # MaxY = 100. gStyle.SetOptStat ( 0 ) gStyle.SetOptFit ( 0 ) Title = ';x;' # ms = TF2('MomAngSpectrum',call_ms, 0.0, 1.0, -1.0, 1.0, 4) eta = TF2('etaSpectrum',call_eta, 0.0, 1.0, -1.0, 1.0, 0) rho = TF2('rhoSpectrum',call_rho, 0.0, 1.0, -1.0, 1.0, 0) xidelta = TF2('xideltaSpectrum',call_xidelta, 0.0, 1.0, -1.0, 1.0, 0) xixidelta = TF2('xixideltaSpectrum',call_xixidelta, 0.0, 1.0, -1.0, 1.0, 0) # rho, eta, xi, delta = 0.75, 0.0, 0.0, 0.0 # ms.SetParameter(0,rho) # ms.SetParameter(1,eta) # ms.SetParameter(2,xi) # ms.SetParameter(3,delta) gStyle.SetTitleSize(FontSize+0.01, "X") gStyle.SetTitleSize(FontSize+0.01, "Y") # draw it # gStyle = makegstyle(gStyle) Heta = eta.GetHistogram() Hrho = rho.GetHistogram() Hxidelta = xidelta.GetHistogram() Hxixidelta = xixidelta.GetHistogram() HPeta = Heta.ProjectionX("HPeta",1,1) HPrho = Hrho.ProjectionX("HPrho",1,1) HPxidelta = Hxidelta.ProjectionX("HPxidelta",1,1) HPxixidelta = Hxixidelta.ProjectionX("HPxixidelta",1,1) HPeta.Scale(3) HPxidelta.Draw('C') HPxixidelta.Draw('SAMEC') HPeta.Draw('Csame') # HPrho.Draw('Csame') # Hms.SetTitleOffset( 1.25, 'X') # Hms.SetTitleOffset( 1.35, 'Y') HPxidelta.SetNdivisions(505) HPxidelta.SetNdivisions(505,'Y') # Hms.SetNdivisions(505,'Z') HPxidelta.GetXaxis().CenterTitle() HPxidelta.GetYaxis().CenterTitle() # Plots title HPxidelta.SetTitle(Title) # Change the axis range #ms.GetHistogram().SetAxisRange(MinX,MaxX,'X') # # For Postscript # # Canv.Print(OutputFile,"Landscape") # # For eps # gStyle.SetPadBorderMode ( 0 ) # Canv.SetTheta(30.0) # Canv.SetPhi(150.0) Canv.Print(OutputFile)