def TopMassStyle(): """Set the style plot in order to create fancier plots!""" gStyle.SetPadTickX(1); gStyle.SetPadTickY(1); gStyle.SetHistLineWidth(3); gStyle.SetMarkerStyle(1); gStyle.SetTextSize(0.065); gStyle.SetOptFit(1111); gStyle.SetTitleSize(.05,"X");#.055 gStyle.SetTitleOffset(1.1,"X");#1.2,0.9 gStyle.SetLabelSize(.05,"X"); gStyle.SetTitleSize(.05,"Y");#.055 gStyle.SetTitleOffset(1.1,"Y"); gStyle.SetLabelSize(.05,"Y"); gStyle.SetPadLeftMargin(.16); gStyle.SetPadBottomMargin(.12); gStyle.SetTitleSize(.05,"Z"); gStyle.SetTitleOffset(1.8,"Z"); gStyle.SetLabelSize(0.06,"Z"); gStyle.SetLegendTextSize(0.04); gStyle.SetOptStat(112210); gStyle.SetPadLeftMargin(.12); gStyle.SetPadRightMargin(.02); gStyle.SetPadBottomMargin(.12); gStyle.SetPadTopMargin(.07); gStyle.SetPadGridX(1); gStyle.SetPadGridY(1);
def testIthr(): lines = get_lines('DAC_scan_ithr_0x40to0xf0.dat') gr1 = TGraphErrors() gr2 = TGraphErrors() fUnit = 1000. / 0.7 yUnit = 'e^{-}' for line in lines: if len(line) == 0: continue if line[0] in ['#', '\n']: continue fs = line.rstrip().split() ix = int(fs[0]) gr1.SetPoint(ix, float(fs[1]), float(fs[2]) * fUnit) gr1.SetPointError(ix, 0, float(fs[3]) * fUnit) gr2.SetPoint(ix, float(fs[1]), float(fs[4]) * fUnit) gr2.SetPointError(ix, 0, float(fs[5]) * fUnit) useAtlasStyle() gStyle.SetMarkerStyle(20) gr1.SetMarkerStyle(20) gr1.Draw('AP') h1 = gr1.GetHistogram() h1.GetYaxis().SetTitle("Threshold [" + yUnit + "]") h1.GetXaxis().SetTitle("I_{Thre} code") # h1.GetYaxis().SetRangeUser(0,0.2) gPad.SetTicks(1, 0) gPad.SetRightMargin(0.16) y1b = 0 y2b = 15 x1 = h1.GetXaxis().GetXmax() y1 = h1.GetYaxis().GetXmin() y2 = h1.GetYaxis().GetXmax() raxis = TGaxis(x1, y1, x1, y2, y1b, y2b, 506, "+L") raxis.SetLineColor(2) raxis.SetLabelColor(2) raxis.SetTitleColor(2) raxis.SetTitle("ENC [" + yUnit + "]") raxis.Draw() nP = gr2.GetN() Ys = gr2.GetY() EYs = gr2.GetEY() Y = array( 'd', [y1 + (y2 - y1) / (y2b - y1b) * (Ys[i] - y1b) for i in range(nP)]) EY = array('d', [(y2 - y1) / (y2b - y1b) * EYs[i] for i in range(nP)]) gr2x = TGraphErrors(nP, gr2.GetX(), Y, gr2.GetEX(), EY) gr2x.SetMarkerStyle(24) gr2x.SetLineColor(2) gr2x.SetMarkerColor(2) gr2x.Draw('Psame') waitRootCmdX()
def Styling(): # Center title gStyle.SetTitleAlign(22) gStyle.SetTitleX(.5) gStyle.SetTitleY(.95) gStyle.SetTitleBorderSize(0) # Remove stats box gStyle.SetOptStat(0) # Set background color to white gStyle.SetFillColor(10) gStyle.SetFrameFillColor(10) gStyle.SetCanvasColor(10) gStyle.SetPadColor(10) gStyle.SetTitleFillColor(0) gStyle.SetStatColor(10) # No colored frames around plots gStyle.SetFrameBorderMode(0) gStyle.SetCanvasBorderMode(0) gStyle.SetPadBorderMode(0) # Set the default line color for a fit function to be red gStyle.SetFuncColor(2) # Marker settings gStyle.SetMarkerStyle(20) # No border on legends gStyle.SetLegendBorderSize(0) # Disabled for violating NOvA style guidelines # Scientific notation on axes TGaxis.SetMaxDigits(3) # Axis titles gStyle.SetTitleSize(.055, "xyz") gStyle.SetTitleOffset(2.2, "xyz") gStyle.SetTitleOffset(2.2, "y") gStyle.SetTitleSize(.05, "") gStyle.SetTitleOffset(2.2, "") # Axis labels (numbering) gStyle.SetLabelSize(.05, "xyz") gStyle.SetLabelOffset(.005, "xyz") # Thicker lines gStyle.SetHistLineWidth(2) gStyle.SetFrameLineWidth(2) gStyle.SetFuncWidth(2) # Set the number of tick marks gStyle.SetNdivisions(506, "xyz") # Set tick marks on all sides gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) # Fonts kNovaFont = 42 gStyle.SetStatFont(kNovaFont) gStyle.SetLabelFont(kNovaFont, "xyz") gStyle.SetTitleFont(kNovaFont, "xyz") gStyle.SetTitleFont(kNovaFont, "") # Apply same settings to titles gStyle.SetTextFont(kNovaFont) gStyle.SetLegendFont(kNovaFont)
def setStyle(): gROOT.Reset() icol = 0 # WHITE font = 42 # Helvetica tsize = 0.05 gStyle.SetFrameBorderMode(icol) gStyle.SetFrameFillColor(icol) gStyle.SetCanvasBorderMode(icol) gStyle.SetCanvasColor(icol) gStyle.SetPadBorderMode(icol) gStyle.SetPadColor(icol) gStyle.SetStatColor(icol) gStyle.SetPaperSize(20, 26) gStyle.SetPadTopMargin(0.05) gStyle.SetPadRightMargin(0.08) gStyle.SetPadBottomMargin(0.15) gStyle.SetPadLeftMargin(0.12) gStyle.SetTitleXOffset(1.05) gStyle.SetTitleYOffset(0.95) gStyle.SetTextFont(font) gStyle.SetTextSize(tsize) gStyle.SetLabelFont(font, "x") gStyle.SetTitleFont(font, "x") gStyle.SetLabelFont(font, "y") gStyle.SetTitleFont(font, "y") gStyle.SetLabelFont(font, "z") gStyle.SetTitleFont(font, "z") gStyle.SetLabelSize(tsize * 0.85, "x") gStyle.SetTitleSize(tsize * 1.10, "x") gStyle.SetLabelSize(tsize * 0.85, "y") gStyle.SetTitleSize(tsize * 1.10, "y") gStyle.SetLabelSize(tsize * 0.85, "z") gStyle.SetTitleSize(tsize * 1.10, "z") gStyle.SetMarkerStyle(20) gStyle.SetMarkerSize(1.) gStyle.SetHistLineWidth(2) gStyle.SetLineStyleString(2, "[12 12]") # postscript dashes gStyle.SetEndErrorSize(0.) # gStyle.SetOptTitle(0); gStyle.SetOptStat(0) gStyle.SetOptFit(0) gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) gStyle.SetPaintTextFormat("4.1f")
def setStyle(): TColor.InitializeColors() stops = array('d', [ 0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000 ]) red = array('d', [ 0.9764, 0.9956, 0.8186, 0.5301, 0.1802, 0.0232, 0.0780, 0.0592, 0.2082 ]) green = array('d', [ 0.9832, 0.7862, 0.7328, 0.7492, 0.7178, 0.6419, 0.5041, 0.3599, 0.1664 ]) blue = array('d', [ 0.0539, 0.1968, 0.3499, 0.4662, 0.6425, 0.7914, 0.8385, 0.8684, 0.5293 ]) TColor.CreateGradientColorTable(9, stops, red, green, blue, 255, 1.0) gStyle.SetHatchesLineWidth(1) gStyle.SetNumberContours(255) gStyle.SetNdivisions(505, "xyz") gStyle.SetTitleBorderSize(0) gStyle.SetTitleColor(1) gStyle.SetTitleStyle(3013) gStyle.SetTitleFillColor(0) gStyle.SetTitleX(0.05) gStyle.SetTitleW(0.4) gStyle.SetTitleY(0.965) gStyle.SetTitleH(0.065) gStyle.SetCanvasBorderMode(0) gStyle.SetCanvasBorderSize(3) gStyle.SetCanvasColor(0) gStyle.SetPadColor(0) gStyle.SetPadBorderMode(0) gStyle.SetFuncWidth(3) gStyle.SetPadGridY(False) gStyle.SetPadGridX(False) gStyle.SetFrameLineWidth(1) gStyle.SetMarkerSize(5) gStyle.SetPadTickX(True) gStyle.SetPadTickY(True) #gStyle.SetPalette(1) gStyle.SetHistLineWidth(3) gStyle.SetHistLineColor(1) gStyle.SetOptStat(0) gStyle.SetOptFit(0) gStyle.SetStatW(0.25) gStyle.SetStatH(0.25) gStyle.SetStatX(0.9) gStyle.SetStatY(0.9) gStyle.SetStatColor(0) gStyle.SetStatFormat("6.4g") gStyle.SetPadTopMargin(0.05) gStyle.SetPadRightMargin(0.05) gStyle.SetPadBottomMargin(0.16) gStyle.SetPadLeftMargin(0.12) font = 42 gStyle.SetTextSize(.055) gStyle.SetTextFont(font) gStyle.SetLabelFont(font, "x") gStyle.SetTitleFont(font, "x") gStyle.SetLabelFont(font, "y") gStyle.SetTitleFont(font, "y") gStyle.SetLabelFont(font, "z") gStyle.SetTitleFont(font, "z") gStyle.SetTitleSize(.055, "x") gStyle.SetTitleSize(.055, "y") gStyle.SetTitleSize(.05, "z") gStyle.SetLabelSize(.05, "x") gStyle.SetLabelSize(.05, "y") gStyle.SetLabelSize(.05, "z") gStyle.SetLabelOffset(0.014, "x") gStyle.SetLabelOffset(0.006, "y") gStyle.SetLabelOffset(0.008, "z") gStyle.SetTitleOffset(1, "y") gStyle.SetTitleXOffset(1.2) # use bold lines and markers gStyle.SetMarkerStyle(20) gStyle.SetMarkerColor(1) gStyle.SetMarkerSize(1.2) gStyle.SetLineStyleString(2, "[12 12]") # postscript dashes gStyle.SetPadTickX(1) gStyle.SetPadTickY(1)
def applyRootStyle(): from ROOT import gROOT, gStyle, kWhite, kBlack, TColor # Start from a plain default gROOT.SetStyle("Plain") lhcbMarkerType = 8 lhcbMarkerSize = 0.8 lhcbFont = 62 lhcbStatFontSize = 0.02 lhcbStatBoxWidth = 0.12 lhcbStatBoxHeight = 0.12 lhcbWidth = 1 lhcbTextSize = 0.05 lhcbLabelSize = 0.035 lhcbAxisLabelSize = 0.035 lhcbForeColour = kBlack gStyle.SetFrameBorderMode(0) gStyle.SetPadBorderMode(0) # canvas options gStyle.SetCanvasBorderSize(0) gStyle.SetCanvasBorderMode(0) # fonts gStyle.SetTextFont(lhcbFont) gStyle.SetTextSize(lhcbTextSize) gStyle.SetLabelFont(lhcbFont, "x") gStyle.SetLabelFont(lhcbFont, "y") gStyle.SetLabelFont(lhcbFont, "z") gStyle.SetLabelSize(lhcbLabelSize, "x") gStyle.SetLabelSize(lhcbLabelSize, "y") gStyle.SetLabelSize(lhcbLabelSize, "z") gStyle.SetTitleFont(lhcbFont) gStyle.SetTitleSize(lhcbAxisLabelSize, "x") gStyle.SetTitleSize(lhcbAxisLabelSize, "y") gStyle.SetTitleSize(lhcbAxisLabelSize, "z") gStyle.SetTitleColor(kWhite) gStyle.SetTitleFillColor(kWhite) gStyle.SetTitleColor(kBlack) gStyle.SetTitleBorderSize(0) gStyle.SetTitleTextColor(kBlack) # set title position gStyle.SetTitleX(0.15) gStyle.SetTitleY(0.97) # turn off Title box gStyle.SetTitleBorderSize(0) gStyle.SetTitleTextColor(lhcbForeColour) gStyle.SetTitleColor(lhcbForeColour) # use bold lines and markers gStyle.SetLineWidth(lhcbWidth) gStyle.SetFrameLineWidth(lhcbWidth) gStyle.SetHistLineWidth(lhcbWidth) gStyle.SetFuncWidth(lhcbWidth) gStyle.SetGridWidth(lhcbWidth) gStyle.SetLineStyleString(2, "[12 12]") gStyle.SetMarkerStyle(lhcbMarkerType) gStyle.SetMarkerSize(lhcbMarkerSize) # Grid # gStyle.SetGridStyle(3) # label offsets gStyle.SetLabelOffset(0.015) # by default, do not display histogram decorations: gStyle.SetOptStat(1111) # show probability, parameters and errors gStyle.SetOptFit(1011) # look of the statistics box: gStyle.SetStatBorderSize(1) gStyle.SetStatFont(lhcbFont) gStyle.SetStatFontSize(lhcbStatFontSize) gStyle.SetStatX(0.9) gStyle.SetStatY(0.9) gStyle.SetStatW(lhcbStatBoxWidth) gStyle.SetStatH(lhcbStatBoxHeight) # put tick marks on top and RHS of plots gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) # histogram divisions gStyle.SetNdivisions(505, "x") gStyle.SetNdivisions(510, "y") # Style for 2D zcol plots NRGBs = 5 NCont = 255 from array import array stops = array('d', [0.00, 0.34, 0.61, 0.84, 1.00]) red = array('d', [0.00, 0.00, 0.87, 1.00, 0.51]) green = array('d', [0.00, 0.81, 1.00, 0.20, 0.00]) blue = array('d', [0.51, 1.00, 0.12, 0.00, 0.00]) TColor().CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont) gStyle.SetNumberContours(NCont) # Force the style gROOT.ForceStyle()
def rootStyle(batchMode=True): from ROOT import gROOT, gStyle, kWhite, kBlack # No info messages gROOT.ProcessLine("gErrorIgnoreLevel = kWarning;") # Batch mode (no TCanvas) gROOT.SetBatch(batchMode) # Start from a plain default gROOT.SetStyle("Plain") lhcbMarkerType = 8 lhcbMarkerSize = 0.8 lhcbFont = 62 lhcbStatFontSize = 0.02 lhcbStatBoxWidth = 0.12 lhcbStatBoxHeight = 0.12 lhcbWidth = 1 lhcbTextSize = 0.05 lhcbLabelSize = 0.035 lhcbAxisLabelSize = 0.035 lhcbForeColour = kBlack gStyle.SetFrameBorderMode(0) gStyle.SetPadBorderMode(0) # canvas options gStyle.SetCanvasBorderSize(0) gStyle.SetCanvasBorderMode(0) # fonts gStyle.SetTextFont(lhcbFont) gStyle.SetTextSize(lhcbTextSize) gStyle.SetLabelFont(lhcbFont, "x") gStyle.SetLabelFont(lhcbFont, "y") gStyle.SetLabelFont(lhcbFont, "z") gStyle.SetLabelSize(lhcbLabelSize, "x") gStyle.SetLabelSize(lhcbLabelSize, "y") gStyle.SetLabelSize(lhcbLabelSize, "z") gStyle.SetTitleFont(lhcbFont) gStyle.SetTitleSize(lhcbAxisLabelSize, "x") gStyle.SetTitleSize(lhcbAxisLabelSize, "y") gStyle.SetTitleSize(lhcbAxisLabelSize, "z") gStyle.SetTitleColor(kWhite) gStyle.SetTitleFillColor(kWhite) gStyle.SetTitleColor(kBlack) gStyle.SetTitleBorderSize(0) gStyle.SetTitleTextColor(kBlack) # set title position gStyle.SetTitleX(0.15) gStyle.SetTitleY(0.97) # turn off Title box gStyle.SetTitleBorderSize(0) gStyle.SetTitleTextColor(lhcbForeColour) gStyle.SetTitleColor(lhcbForeColour) # use bold lines and markers gStyle.SetLineWidth(lhcbWidth) gStyle.SetFrameLineWidth(lhcbWidth) gStyle.SetHistLineWidth(lhcbWidth) gStyle.SetFuncWidth(lhcbWidth) gStyle.SetGridWidth(lhcbWidth) gStyle.SetLineStyleString(2, "[12 12]") gStyle.SetMarkerStyle(lhcbMarkerType) gStyle.SetMarkerSize(lhcbMarkerSize) # label offsets gStyle.SetLabelOffset(0.015) # by default, do not display histogram decorations: gStyle.SetOptStat(1111) # show probability, parameters and errors gStyle.SetOptFit(1011) # look of the statistics box: gStyle.SetStatBorderSize(1) gStyle.SetStatFont(lhcbFont) gStyle.SetStatFontSize(lhcbStatFontSize) gStyle.SetStatX(0.9) gStyle.SetStatY(0.9) gStyle.SetStatW(lhcbStatBoxWidth) gStyle.SetStatH(lhcbStatBoxHeight) # put tick marks on top and RHS of plots gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) # histogram divisions gStyle.SetNdivisions(505, "x") gStyle.SetNdivisions(510, "y") # Force the style gROOT.ForceStyle()
def setTDRStyle(force): gStyle.SetCanvasBorderMode(0) gStyle.SetCanvasColor(kWhite) gStyle.SetCanvasDefH(600) gStyle.SetCanvasDefW(600) gStyle.SetCanvasDefX(0) gStyle.SetCanvasDefY(0) gStyle.SetPadBorderMode(0) gStyle.SetPadColor(kWhite) gStyle.SetPadGridX(False) gStyle.SetPadGridY(False) gStyle.SetGridColor(0) gStyle.SetGridStyle(3) gStyle.SetGridWidth(1) gStyle.SetFrameBorderMode(0) gStyle.SetFrameBorderSize(1) gStyle.SetFrameFillColor(0) gStyle.SetFrameFillStyle(0) gStyle.SetFrameLineColor(1) gStyle.SetFrameLineStyle(1) gStyle.SetFrameLineWidth(1) if force: gStyle.SetHistLineColor(1) gStyle.SetHistLineStyle(0) gStyle.SetHistLineWidth(1) gStyle.SetEndErrorSize(2) gStyle.SetErrorX(0.) gStyle.SetMarkerStyle(20) gStyle.SetOptFit(1) gStyle.SetFitFormat("5.4g") gStyle.SetFuncColor(2) gStyle.SetFuncStyle(1) gStyle.SetFuncWidth(1) gStyle.SetOptDate(0) gStyle.SetOptFile(0) gStyle.SetOptStat(0) gStyle.SetStatColor(kWhite) gStyle.SetStatFont(42) gStyle.SetStatFontSize(0.04) gStyle.SetStatTextColor(1) gStyle.SetStatFormat("6.4g") gStyle.SetStatBorderSize(1) gStyle.SetStatH(0.1) gStyle.SetStatW(0.2) gStyle.SetPadTopMargin(0.05) gStyle.SetPadBottomMargin(0.13) gStyle.SetPadLeftMargin(0.16) gStyle.SetPadRightMargin(0.04) gStyle.SetOptTitle(0) gStyle.SetTitleFont(42) gStyle.SetTitleColor(1) gStyle.SetTitleTextColor(1) gStyle.SetTitleFillColor(10) gStyle.SetTitleFontSize(0.05) gStyle.SetTitleColor(1, "XYZ") gStyle.SetTitleFont(42, "XYZ") gStyle.SetTitleSize(0.06, "XYZ") gStyle.SetTitleXOffset(0.9) gStyle.SetTitleYOffset(1.25) gStyle.SetLabelColor(1, "XYZ") gStyle.SetLabelFont(42, "XYZ") gStyle.SetLabelOffset(0.007, "XYZ") gStyle.SetLabelSize(0.05, "XYZ") gStyle.SetAxisColor(1, "XYZ") gStyle.SetStripDecimals(True) gStyle.SetTickLength(0.03, "XYZ") gStyle.SetNdivisions(510, "XYZ") gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) gStyle.SetOptLogx(0) gStyle.SetOptLogy(0) gStyle.SetOptLogz(0) gStyle.SetPaperSize(20.,20.) gROOT.ForceStyle()
def analyzeMeshes(self, dictOfMeshes, doCull=False, cullCut=0.90): """ analyzeMeshes takes a dictionary with meshes as input, and fits it to the references output dictionary includes a deepcopy of the input meshes note: this fits to zDiff = dictOfMeshes - interpolation of self.meshDict ie. the sign is defined as (other guy) - (me) """ # deepcopy the meshes! no longer adjusts in place dictOfMeshesCopy = {} for key in list(dictOfMeshes.keys()): theMesh = copy.deepcopy(dictOfMeshes[key]) dictOfMeshesCopy[key] = theMesh # then we analyze the Zernike polynomials by comparing them to stored references # analyzeDonuts returns a dictionary containing deltas and rotation angles for focus, astigmatism and coma # as well as the hexapod adjustments # it also makes a Canvas of plots for study dictOfResults = {} # loop over keys, fitting References for key in list(dictOfMeshesCopy.keys()): # some special cases resultsKeyName = "%sResultDict" % (key.replace("Mesh", "")) meshName = key if key == "z4Mesh": print("Python 3 debugging: %r" % self.meshDict) dictOfResults[resultsKeyName] = self.fitToRefMesh( self.meshDict[meshName], dictOfMeshesCopy[meshName], self.zangleconv) elif key == "rzeroMesh": dictOfResults[resultsKeyName] = self.analyzeRzero( dictOfMeshesCopy["rzeroMesh"], dictOfMeshesCopy["chi2Mesh"], dictOfMeshesCopy["neleMesh"]) elif key == "chi2Mesh": continue elif key == "neleMesh": continue else: # check that meshDict has the appropriate mesh if meshName in self.meshDict: dictOfResults[resultsKeyName] = self.fitToRefMesh( self.meshDict[meshName], dictOfMeshesCopy[meshName]) # if we want to cull, cull and refit! # use the fitted weight to cull - culltype="fit" if doCull: # this will take the wgt's from the fit and take their product # for each point, and cull at a product of cullCut self.cullAllMeshes(dictOfMeshesCopy, cullCut=cullCut) for key in list(dictOfMeshesCopy.keys()): # some special cases resultsKeyName = "%sResultDict" % (key.replace("Mesh", "")) meshName = key if key == "z4Mesh": dictOfResults[resultsKeyName] = self.fitToRefMesh( self.meshDict[meshName], dictOfMeshesCopy[meshName], self.zangleconv) elif key == "rzeroMesh": dictOfResults[resultsKeyName] = self.analyzeRzero( dictOfMeshesCopy["rzeroMesh"], dictOfMeshesCopy["chi2Mesh"], dictOfMeshesCopy["neleMesh"]) elif key == "chi2Mesh": continue elif key == "neleMesh": continue else: # check that meshDict has the appropriate mesh if meshName in self.meshDict: dictOfResults[resultsKeyName] = self.fitToRefMesh( self.meshDict[meshName], dictOfMeshesCopy[meshName]) # analyze this data and extract the hexapod coefficients donutDict = self.calcHexapod(dictOfResults) if len(donutDict) == 0: goodCalc = False else: goodCalc = True # add the individual fit results here too for key in list(dictOfResults.keys()): donutDict[key] = dictOfResults[key] # and add the meshes too for key in list(dictOfMeshesCopy.keys()): donutDict[key] = dictOfMeshesCopy[key] # cmr add X and Y coords keylist = list(dictOfResults.keys()) key0 = keylist[0] dict0 = dictOfResults[key0] donutDict['deltaArrayX'] = dict0['deltaArrayX'] donutDict['deltaArrayY'] = dict0['deltaArrayY'] # make a Canvas of plots for this image # plot Histogram of Difference before fit, after fit, and after fit vs. X,Y position if self.paramDict["histFlag"] and "deltaArrayBefore" in dictOfResults[ "z4ResultDict"] and goodCalc: # setup plots gStyle.SetStatH(0.32) gStyle.SetStatW(0.4) gStyle.SetOptStat(1111111) gStyle.SetMarkerStyle(20) gStyle.SetMarkerSize(0.5) gStyle.SetPalette(1) gROOT.ForceStyle() # loop over results, making plots for each nplots = 0 plotDict = {} for key in list(dictOfResults.keys()): theResultDict = dictOfResults[key] keyId = key.replace("ResultDict", "") # special cases if keyId == "z4": nWavesBefore = 200.0 nWavesAfter = 200.0 else: nWavesBefore = 2.0 nWavesAfter = 0.2 if keyId != "rzero": nplots = nplots + 1 hBefore = hfillhist(key + "Before", "Delta " + key + ", Before Fit", theResultDict["deltaArrayBefore"], 200, -nWavesBefore, nWavesBefore) hAfter = hfillhist(key + "zAfter", "Delta " + key + ", After Fit", theResultDict["deltaArrayAfter"], 200, -nWavesAfter, nWavesAfter) hBefore2D = TGraph2D( key + "Before2D", "Delta " + key + ", Before Fit, vs. Position;X[mm];Y[mm]", theResultDict["deltaArrayBefore"].shape[0], theResultDict["deltaArrayX"], theResultDict["deltaArrayY"], theResultDict["deltaArrayBefore"]) hAfter2D = TGraph2D( key + "After2D", "Delta " + key + ", After Fit, vs. Position;X[mm];Y[mm]", theResultDict["deltaArrayAfter"].shape[0], theResultDict["deltaArrayX"], theResultDict["deltaArrayY"], theResultDict["deltaArrayAfter"]) plotList = [hBefore, hAfter, hBefore2D, hAfter2D] plotDict[keyId] = plotList # the Canvas # unique name for our canvas # might be that # gROOT.SetBatch(kTRUE) # will prevent the Canvas from appearing, but will still get made in output pickle tstr = "canvas" + str(time.time()) canvas = TCanvas(tstr, tstr, 300 * nplots, 1000) canvas.Divide(nplots, 4) # plot em jZ = 0 for iZ in range(4, 15 + 1): key = "z%d" % (iZ) if key in plotDict: jZ = jZ + 1 plotList = plotDict[key] icanvas = jZ + 0 * nplots canvas.cd(icanvas) plotList[0].Draw() icanvas = jZ + 1 * nplots canvas.cd(icanvas) plotList[1].Draw() icanvas = jZ + 2 * nplots canvas.cd(icanvas) plotList[2].Draw("zcolpcol") icanvas = jZ + 3 * nplots canvas.cd(icanvas) plotList[3].Draw("zcolpcol") # set it so that python doesn't own these ROOT object for key in list(plotDict.keys()): for plot in plotDict[key]: SetOwnership(plot, False) # save canvas in the output Dictionary donutDict["canvas"] = canvas # all done return donutDict
def CLICdpStyle(): gROOT.SetStyle("Plain") gStyle.SetCanvasColor(root.kWhite) gStyle.SetFrameFillColor(root.kWhite) gStyle.SetStatColor(root.kWhite) gStyle.SetPadColor(root.kWhite) gStyle.SetFillColor(10) gStyle.SetTitleFillColor(root.kWhite) gStyle.SetPaperSize(20, 26) gStyle.SetDrawBorder(0) gStyle.SetCanvasBorderMode(0) gStyle.SetPadBorderMode(0) gStyle.SetFrameBorderMode(0) gStyle.SetLegendBorderSize(0) gStyle.SetTextSize(0.05) gStyle.SetTitleSize(0.06, "xyz") gStyle.SetLabelSize(0.06, "xyz") gStyle.SetLabelOffset(0.015, "xyz") gStyle.SetTitleOffset(1.2, "yz") gStyle.SetTitleOffset(1.17, "x") font = 42 gStyle.SetTitleFont(font) gStyle.SetTitleFontSize(0.06) gStyle.SetStatFont(font) gStyle.SetStatFontSize(0.07) gStyle.SetTextFont(font) gStyle.SetLabelFont(font, "xyz") gStyle.SetTitleFont(font, "xyz") gStyle.SetTitleBorderSize(0) gStyle.SetStatBorderSize(1) gStyle.SetMarkerStyle(1) gStyle.SetLineWidth(2) gStyle.SetMarkerSize(1.2) gStyle.SetPalette(1) gStyle.SetOptTitle(0) gStyle.SetOptStat(0) gStyle.SetOptFit(0) gStyle.SetEndErrorSize(5) gStyle.SetHistLineWidth(2) gStyle.SetFrameLineWidth(2) gStyle.SetFuncWidth(2) gStyle.SetHistLineColor(root.kBlack) gStyle.SetFuncColor(root.kBlack) gStyle.SetLabelColor(root.kBlack, "xyz") gStyle.SetPadBottomMargin(0.18) gStyle.SetPadTopMargin(0.11) gStyle.SetPadRightMargin(0.08) gStyle.SetPadLeftMargin(0.17) gStyle.SetNdivisions(506, "xy") gStyle.SetPadGridX(0) gStyle.SetPadGridY(0) gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) gStyle.SetCanvasDefW(800) gStyle.SetCanvasDefH(700) gROOT.ForceStyle()
def initStyle(): gROOT.SetStyle("Plain") # For the canvas: gStyle.SetCanvasBorderMode(0) gStyle.SetCanvasColor(kWhite) gStyle.SetCanvasDefH(700) #Height of canvas gStyle.SetCanvasDefW(700) #Width of canvas gStyle.SetCanvasDefX(0) #Position on screen gStyle.SetCanvasDefY(0) # For the line: gStyle.SetLineWidth(2) # For the Pad: gStyle.SetPadBorderMode(0) # gStyle.SetPadBorderSize(Width_t size = 1) gStyle.SetPadColor(kWhite) gStyle.SetPadGridX(True) gStyle.SetPadGridY(True) gStyle.SetGridColor(0) gStyle.SetGridStyle(3) gStyle.SetGridWidth(1) # For the frame: gStyle.SetFrameBorderMode(0) gStyle.SetFrameBorderSize(1) gStyle.SetFrameFillColor(0) gStyle.SetFrameFillStyle(0) gStyle.SetFrameLineColor(1) gStyle.SetFrameLineStyle(1) gStyle.SetFrameLineWidth(1) # For the histo: # gStyle.SetHistFillColor(1) # gStyle.SetHistFillStyle(0) gStyle.SetHistLineColor(1) gStyle.SetHistLineStyle(0) gStyle.SetHistLineWidth(2) # gStyle.SetLegoInnerR(Float_t rad = 0.5) # gStyle.SetNumberContours(Int_t number = 20) gStyle.SetEndErrorSize(2) #gStyle.SetErrorMarker(20) gStyle.SetErrorX(0.) gStyle.SetMarkerStyle(8) gStyle.SetMarkerSize(1) #For the fit/function: gStyle.SetOptFit(0) gStyle.SetFitFormat("5.4g") gStyle.SetFuncColor(2) gStyle.SetFuncStyle(1) gStyle.SetFuncWidth(1) #For the date: gStyle.SetOptDate(0) # gStyle.SetDateX(Float_t x = 0.01) # gStyle.SetDateY(Float_t y = 0.01) # For the statistics box: gStyle.SetOptFile(0) gStyle.SetOptStat(0) # To display the mean and RMS: SetOptStat("mr") gStyle.SetStatColor(kWhite) gStyle.SetStatFont(42) gStyle.SetStatFontSize(0.025) gStyle.SetStatTextColor(1) gStyle.SetStatFormat("6.4g") gStyle.SetStatBorderSize(1) gStyle.SetStatH(0.1) gStyle.SetStatW(0.15) # gStyle.SetStatStyle(Style_t style = 1001) # gStyle.SetStatX(Float_t x = 0) # gStyle.SetStatY(Float_t y = 0) # Margins: gStyle.SetPadTopMargin(0.11) gStyle.SetPadBottomMargin(0.13) gStyle.SetPadLeftMargin(0.17) gStyle.SetPadRightMargin(0.07) # For the Global title: gStyle.SetOptTitle(0) gStyle.SetTitleFont(42) gStyle.SetTitleColor(1) gStyle.SetTitleTextColor(1) gStyle.SetTitleFillColor(10) gStyle.SetTitleFontSize(0.04) # gStyle.SetTitleH(0) # Set the height of the title box # gStyle.SetTitleW(0) # Set the width of the title box #gStyle.SetTitleX(0.35) # Set the position of the title box #gStyle.SetTitleY(0.986) # Set the position of the title box # gStyle.SetTitleStyle(Style_t style = 1001) #gStyle.SetTitleBorderSize(0) # For the axis titles: gStyle.SetTitleColor(1, "XYZ") gStyle.SetTitleFont(42, "XYZ") gStyle.SetTitleSize(0.05, "XYZ") # gStyle.SetTitleXSize(Float_t size = 0.02) # Another way to set the size? # gStyle.SetTitleYSize(Float_t size = 0.02) gStyle.SetTitleXOffset(1.) gStyle.SetTitleYOffset(1.3) #gStyle.SetTitleOffset(1.1, "Y") # Another way to set the Offset # For the axis labels: gStyle.SetLabelColor(1, "XYZ") gStyle.SetLabelFont(42, "XYZ") gStyle.SetLabelOffset(0.007, "XYZ") gStyle.SetLabelSize(0.035, "XYZ") # For the axis: gStyle.SetAxisColor(1, "XYZ") gStyle.SetStripDecimals(True) gStyle.SetTickLength(0.03, "XYZ") gStyle.SetNdivisions(510, "XYZ") gStyle.SetPadTickX( 1) # To get tick marks on the opposite side of the frame gStyle.SetPadTickY(1) # Change for log plots: gStyle.SetOptLogx(0) gStyle.SetOptLogy(0) gStyle.SetOptLogz(0) gStyle.SetPalette(1) #(1,0) # another top group addition gStyle.SetHatchesSpacing(1.0) # Postscript options: gStyle.SetPaperSize(20., 20.) #gStyle.SetPaperSize(TStyle.kA4) #gStyle.SetPaperSize(27., 29.7) #TGaxis.SetMaxDigits(3) # gStyle.SetLineScalePS(Float_t scale = 3) # gStyle.SetLineStyleString(Int_t i, const char* text) # gStyle.SetHeaderPS(const char* header) # gStyle.SetTitlePS(const char* pstitle) #gStyle.SetColorModelPS(1) # gStyle.SetBarOffset(Float_t baroff = 0.5) # gStyle.SetBarWidth(Float_t barwidth = 0.5) # gStyle.SetPaintTextFormat(const char* format = "g") # gStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0) # gStyle.SetTimeOffset(Double_t toffset) # gStyle.SetHistMinimumZero(kTRUE) #gStyle.cd() print "TDR Style initialized"
def initialize(fitresults=True, grid=False): gROOT.SetStyle("Plain") gStyle.SetOptFit() gStyle.SetOptStat(0) # For the canvas: gStyle.SetCanvasBorderMode(0) gStyle.SetCanvasColor(kWhite) gStyle.SetCanvasDefH(600) #Height of canvas gStyle.SetCanvasDefW(600) #Width of canvas gStyle.SetCanvasDefX(0) #POsition on screen gStyle.SetCanvasDefY(0) # For the Pad: gStyle.SetPadBorderMode(0) gStyle.SetPadColor(kWhite) gStyle.SetPadGridX(False) gStyle.SetPadGridY(False) gStyle.SetGridColor(0) gStyle.SetGridStyle(3) gStyle.SetGridWidth(1) # For the frame: gStyle.SetFrameBorderMode(0) gStyle.SetFrameBorderSize(1) gStyle.SetFrameFillColor(kWhite) gStyle.SetFrameFillStyle(1000) gStyle.SetFrameLineColor(1) gStyle.SetFrameLineStyle(1) gStyle.SetFrameLineWidth(1) # For the histo: gStyle.SetHistLineColor(1) gStyle.SetHistLineStyle(0) gStyle.SetHistLineWidth(2) gStyle.SetEndErrorSize(2) gStyle.SetErrorX(0.) gStyle.SetMarkerStyle(20) #For the fit/function: gStyle.SetOptFit(1) gStyle.SetFitFormat("5.4g") gStyle.SetFuncColor(2) gStyle.SetFuncStyle(1) gStyle.SetFuncWidth(1) #For the date: gStyle.SetOptDate(0) # For the statistics box: gStyle.SetOptFile(0) gStyle.SetOptStat(0) # To display the mean and RMS: SetOptStat("mr") gStyle.SetStatColor(kWhite) gStyle.SetStatFont(42) gStyle.SetStatFontSize(0.025) gStyle.SetStatTextColor(1) gStyle.SetStatFormat("6.4g") gStyle.SetStatBorderSize(1) gStyle.SetStatH(0.1) gStyle.SetStatW(0.15) # Margins: gStyle.SetPadTopMargin(0.05) gStyle.SetPadLeftMargin(0.16) gStyle.SetPadRightMargin(0.04) # top group adaption, original is 0.02 gStyle.SetPadBottomMargin(0.13) # For the Global title: gStyle.SetOptTitle(0) gStyle.SetTitleFont(42) gStyle.SetTitleColor(1) gStyle.SetTitleTextColor(1) gStyle.SetTitleFillColor(10) gStyle.SetTitleFontSize(0.05) # For the axis titles: gStyle.SetTitleColor(1, "XYZ") gStyle.SetTitleFont(42, "XYZ") gStyle.SetTitleSize(0.06, "XYZ") gStyle.SetTitleXOffset(0.9) gStyle.SetTitleYOffset(1.25) # For the axis labels: gStyle.SetLabelColor(1, "XYZ") gStyle.SetLabelFont(42, "XYZ") gStyle.SetLabelOffset(0.007, "XYZ") gStyle.SetLabelSize(0.05, "XYZ") #gStyle.SetLabelSize(0.04, "XYZ") # For the axis: gStyle.SetAxisColor(1, "XYZ") gStyle.SetStripDecimals(True) gStyle.SetTickLength(0.03, "XYZ") gStyle.SetNdivisions(510, "XYZ") gStyle.SetPadTickX(1) # To get tick marks on the opposite side of the frame gStyle.SetPadTickY(1) # Change for log plots: gStyle.SetOptLogx(0) gStyle.SetOptLogy(0) gStyle.SetOptLogz(0) gStyle.SetPalette(1) #(1,0) # another top group addition gStyle.SetHatchesSpacing(1.0) # Postscript options: gStyle.SetPaperSize(20., 20.) # For graphs gStyle.SetErrorX(0) # suppress error along x if grid: gStyle.SetPadGridX(gridOn) gStyle.SetPadGridY(gridOn) gStyle.SetGridColor(kGray)
def tdrstyle(): gROOT.SetStyle("Plain") gStyle.SetAxisColor(1, "XYZ") gStyle.SetCanvasColor(0) #gStyle.SetCanvasBorderSize(10) gStyle.SetCanvasBorderMode(0) gStyle.SetCanvasDefH(700) gStyle.SetCanvasDefW(700) gStyle.SetCanvasDefX(0) gStyle.SetCanvasDefY(0) gStyle.SetFitFormat("5.4g") gStyle.SetFuncColor(2) gStyle.SetFuncStyle(1) gStyle.SetFuncWidth(1) gStyle.SetFrameBorderMode(0) gStyle.SetFrameBorderSize(1) gStyle.SetFrameFillStyle(0) gStyle.SetFrameFillColor(0) gStyle.SetFrameLineColor(1) gStyle.SetFrameLineStyle(1) # 0? gStyle.SetFrameLineWidth(1) # 1? gStyle.SetGridColor(0) gStyle.SetGridStyle(3) gStyle.SetGridWidth(1) #gStyle.SetHistFillColor(1) #gStyle.SetHistFillStyle(0) gStyle.SetHistLineColor(1) gStyle.SetHistLineStyle(0) gStyle.SetHistLineWidth(1) gStyle.SetLabelColor(1, "XYZ") gStyle.SetLabelFont(42,"XYZ") gStyle.SetLabelOffset(0.007,"XYZ") # 0.010? gStyle.SetLabelSize(0.05,"XYZ") # 0.04? gStyle.SetLegendBorderSize(0) gStyle.SetLegendFillColor(0) gStyle.SetLegendFont(42) gStyle.SetMarkerSize(1.0) gStyle.SetMarkerStyle(20) gStyle.SetLineColor(1) gStyle.SetLineWidth(2) #gStyle.SetLineScalePS(2) gStyle.SetOptDate(0) gStyle.SetOptFile(0) gStyle.SetOptFit(1) gStyle.SetOptStat(0) gStyle.SetOptTitle(0) #gStyle.SetOptLogx(0) #gStyle.SetOptLogy(0) #gStyle.SetOptLogz(0) gStyle.SetPadColor(0) gStyle.SetPadBorderMode(0) gStyle.SetPadBorderSize(10) gStyle.SetPadTopMargin(0.05) # 0.08? gStyle.SetPadBottomMargin(0.13) gStyle.SetPadLeftMargin(0.16) gStyle.SetPadRightMargin(0.03) # 0.05? gStyle.SetPadGridX(0) gStyle.SetPadGridY(0) gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) gStyle.SetStatColor(0) gStyle.SetStatFont(42) gStyle.SetStatFontSize(0.025) gStyle.SetStatTextColor(1) gStyle.SetStatFormat("6.4g") gStyle.SetStatBorderSize(1) gStyle.SetStatH(0.1) gStyle.SetStatW(0.15) #gStyle.SetStatX(0) #gStyle.SetStatY(0) #gStyle.SetTextSize(0.055) gStyle.SetTextFont(42) gStyle.SetTitleBorderSize(0) gStyle.SetTitleColor(1) gStyle.SetTitleFont(42) gStyle.SetTitleColor(1,"XYZ") gStyle.SetTitleFont(42,"XYZ") gStyle.SetTitleSize(0.06,"XYZ") # 0.05? #gStyle.SetTitleOffset(1.4,"XYZ") gStyle.SetTitleOffset(0.9,"X") gStyle.SetTitleOffset(1.20,"Y") gStyle.SetTitleFillColor(10) gStyle.SetTitleFontSize(0.05) gStyle.SetTitleTextColor(1) #gStyle.SetTitleH(0) #gStyle.SetTitleW(0) #gStyle.SetTitleX(0) #gStyle.SetTitleY(0.985) #gStyle.SetTitleStyle(1001) gStyle.SetPalette(1) #gStyle.SetNdivisions(510, "XYZ") # 505? gStyle.SetNdivisions(505, "XYZ") gStyle.SetEndErrorSize(2) # 2? #gStyle.SetErrorMarker(20) #gStyle.SetErrorX(0.) #gStyle.SetPaperSize(20.,20.) gStyle.SetStripDecimals(1) gStyle.SetTickLength(0.03, "XYZ") return 1
donotdelete = [] infile = "histos_tbc_omtf_add.27.root" # ______________________________________________________________________________ if __name__ == '__main__': from ROOT import gROOT, gPad, gStyle, TFile, TCanvas, TH1F, TH2F, TPolyLine, TLatex, TColor, TEfficiency, TLine, TLatex, TGraph, TGraphAsymmErrors # ____________________________________________________________________________ # Setup basic drawer gROOT.LoadMacro("tdrstyle.C") gROOT.ProcessLine("setTDRStyle();") #gROOT.SetBatch(True) gStyle.SetPadGridX(True) gStyle.SetPadGridY(True) gStyle.SetMarkerStyle(1) gStyle.SetEndErrorSize(0) gROOT.ForceStyle() tline = TLine() tline.SetLineColor(920 + 2) # kGray+2 tline.SetLineStyle(2) tlatexCMS1 = TLatex() tlatexCMS1.SetNDC() tlatexCMS1.SetTextFont(61) tlatexCMS1.SetTextSize(0.75 * 0.05) tlatexCMS2 = TLatex() tlatexCMS2.SetNDC() tlatexCMS2.SetTextFont(52)
def cebefo_style(): #TStyle *gStyle = new TStyle("gStyle","gStyle"); #our settings, maybe in the future we could create a more personal style gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) gStyle.SetHistLineWidth(3) gStyle.SetMarkerStyle(1) gStyle.SetTextSize(0.065) gStyle.SetOptFit(1111) # axis gStyle.SetTitleSize(.05, "X") #.055 gStyle.SetTitleOffset(1.1, "X") #1.2,0.9 #gStyle.SetLabelOffset(0.003,"X"); gStyle.SetLabelSize(.05, "X") #gStyle.SetLabelFont(42,"X"); gStyle.SetTitleSize(.05, "Y") #.055 gStyle.SetTitleOffset(1.1, "Y") #gStyle.SetLabelOffset(0.008,"Y"); gStyle.SetLabelSize(.05, "Y") #gStyle.SetLabelFont(42,"Y"); gStyle.SetPadLeftMargin(.16) gStyle.SetPadBottomMargin(.12) gStyle.SetTitleSize(.05, "Z") gStyle.SetTitleOffset(1.1, "Z") #gStyle.SetLabelOffset(0.008,"Z"); gStyle.SetLabelSize(0.05, "Z") #gStyle.SetLabelFont(42,"Z"); # gStyle.SetLegendTextSize(0.04); #gStyle.SetStatFontSize(0.2); #histograms properties gStyle.SetOptStat(112210) #gStyle.SetStripDecimals(False) #gStyle.SetLineStyleString(11,"20 10") # canvas #gStyle.SetCanvasColor(0); #gStyle.SetCanvasBorderSize(10); #gStyle.SetCanvasBorderMode(0); #gStyle.SetCanvasDefW(600); #gStyle.SetCanvasDefH(600); # pads # gStyle.SetPadColor(0); # gStyle.SetPadBorderSize(10); # gStyle.SetPadBorderMode(0); gStyle.SetPadLeftMargin(.12) gStyle.SetPadRightMargin(.02) gStyle.SetPadBottomMargin(.12) gStyle.SetPadTopMargin(.07) gStyle.SetPadGridX(1) gStyle.SetPadGridY(1)
def setStyle(): gStyle.SetCanvasColor(0) gStyle.SetCanvasBorderSize(10) gStyle.SetCanvasBorderMode(0) gStyle.SetCanvasDefH(700) gStyle.SetCanvasDefW(700) gStyle.SetPadColor(0) gStyle.SetPadBorderSize(10) gStyle.SetPadBorderMode(0) gStyle.SetPadBottomMargin(0.13) gStyle.SetPadTopMargin(0.08) gStyle.SetPadLeftMargin(0.15) gStyle.SetPadRightMargin(0.05) gStyle.SetPadGridX(0) gStyle.SetPadGridY(0) gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) gStyle.SetFrameFillStyle(0) gStyle.SetFrameFillColor(0) gStyle.SetFrameLineColor(1) gStyle.SetFrameLineStyle(0) gStyle.SetFrameLineWidth(1) gStyle.SetFrameBorderSize(10) gStyle.SetFrameBorderMode(0) gStyle.SetNdivisions(505) gStyle.SetLineWidth(2) gStyle.SetHistLineWidth(2) gStyle.SetFrameLineWidth(2) gStyle.SetLegendFillColor(root.kWhite) gStyle.SetLegendFont(42) gStyle.SetMarkerSize(1.2) gStyle.SetMarkerStyle(20) gStyle.SetLabelSize(0.040, "X") gStyle.SetLabelSize(0.040, "Y") gStyle.SetLabelOffset(0.010, "X") gStyle.SetLabelOffset(0.010, "Y") gStyle.SetLabelFont(42, "X") gStyle.SetLabelFont(42, "Y") gStyle.SetTitleBorderSize(0) gStyle.SetTitleFont(42) gStyle.SetTitleFont(42, "X") gStyle.SetTitleFont(42, "Y") gStyle.SetTitleSize(0.045, "X") gStyle.SetTitleSize(0.045, "Y") gStyle.SetTitleOffset(1.4, "X") gStyle.SetTitleOffset(1.4, "Y") gStyle.SetTextSize(0.055) gStyle.SetTextFont(42) gStyle.SetOptStat(0)
#Load User Classes from ROOT import DmtpcDataset, DmtpcEvent from ROOT import DmtpcSkimDataset, DmtpcSkimEvent gROOT.SetStyle("Pub") #Reset color palette stops = array('d', [0, 0.34, 0.61, 0.84, 1.0]) red = array('d', [0.0, 0.0, 0.87, 1.0, 0.51]) green = array('d', [0.0, 0.81, 1.00, 0.2, 0.0]) blue = array('d', [0.51, 1.0, 0.12, 0.0, 0.0]) ROOT.TColor.CreateGradientColorTable(5, stops, red, green, blue, 255) gStyle.SetNumberContours(255) stops = None red = None green = None blue = None gStyle.SetMarkerStyle(20) gStyle.SetMarkerSize(0.5) gStyle.SetTextSize(0.04) gStyle.SetLabelSize(0.03, "x") gStyle.SetTitleSize(0.04, "x") gStyle.SetLabelSize(0.03, "y") gStyle.SetTitleSize(0.04, "y") gStyle.SetLabelSize(0.03, "z") gStyle.SetTitleSize(0.04, "z") gStyle.SetTitleOffset(1, "y") gStyle.SetFuncColor(ROOT.kBlack) gStyle.SetHistLineColor(ROOT.kBlack)
def initialize2(self): # For the canvas: gStyle.SetCanvasBorderMode(0) gStyle.SetCanvasColor(kWhite) gStyle.SetCanvasDefH(600) #Height of canvas gStyle.SetCanvasDefW(600) #Width of canvas gStyle.SetCanvasDefX(0) #POsition on screen gStyle.SetCanvasDefY(0) # For the Pad: gStyle.SetPadBorderMode(0) # gStyle.SetPadBorderSize(Width_t size = 1) gStyle.SetPadColor(kWhite) gStyle.SetPadGridX(False) gStyle.SetPadGridY(False) gStyle.SetGridColor(0) gStyle.SetGridStyle(3) gStyle.SetGridWidth(1) # For the frame: gStyle.SetFrameBorderMode(0) gStyle.SetFrameBorderSize(1) gStyle.SetFrameFillStyle(1000) gStyle.SetFrameFillColor(0) gStyle.SetFrameFillStyle(0) gStyle.SetFrameLineColor(1) gStyle.SetFrameLineStyle(1) gStyle.SetFrameLineWidth(1) # For the histo: # gStyle.SetHistFillColor(1) # gStyle.SetHistFillStyle(0) gStyle.SetHistLineColor(1) gStyle.SetHistLineStyle(0) gStyle.SetHistLineWidth(1) # gStyle.SetLegoInnerR(Float_t rad = 0.5) # gStyle.SetNumberContours(Int_t number = 20) gStyle.SetEndErrorSize(2) # gStyle.SetErrorMarker(20) gStyle.SetErrorX(0.) gStyle.SetMarkerStyle(20) #For the fit/function: gStyle.SetOptFit(1) gStyle.SetFitFormat("5.4g") gStyle.SetFuncColor(2) gStyle.SetFuncStyle(1) gStyle.SetFuncWidth(1) #For the date: gStyle.SetOptDate(0) # gStyle.SetDateX(Float_t x = 0.01) # gStyle.SetDateY(Float_t y = 0.01) # For the statistics box: gStyle.SetOptFile(0) gStyle.SetOptStat( 0) # To display the mean and RMS: SetOptStat("mr") gStyle.SetStatColor(kWhite) gStyle.SetStatFont(42) gStyle.SetStatFontSize(0.025) gStyle.SetStatTextColor(1) gStyle.SetStatFormat("6.4g") gStyle.SetStatBorderSize(1) gStyle.SetStatH(0.1) gStyle.SetStatW(0.15) # gStyle.SetStatStyle(Style_t style = 1001) # gStyle.SetStatX(Float_t x = 0) # gStyle.SetStatY(Float_t y = 0) # Margins: gStyle.SetPadTopMargin(0.05) gStyle.SetPadBottomMargin(0.13) gStyle.SetPadLeftMargin(0.16) gStyle.SetPadRightMargin(0.02) # For the Global title: gStyle.SetOptTitle(0) gStyle.SetTitleFont(42) gStyle.SetTitleColor(1) gStyle.SetTitleTextColor(1) gStyle.SetTitleFillColor(10) gStyle.SetTitleFontSize(0.05) # gStyle.SetTitleH(0) # Set the height of the title box # gStyle.SetTitleW(0) # Set the width of the title box # gStyle.SetTitleX(0) # Set the position of the title box # gStyle.SetTitleY(0.985) # Set the position of the title box # gStyle.SetTitleStyle(Style_t style = 1001) # gStyle.SetTitleBorderSize(2) # For the axis titles: gStyle.SetTitleColor(1, "XYZ") gStyle.SetTitleFont(42, "XYZ") gStyle.SetTitleSize(0.06, "XYZ") # gStyle.SetTitleXSize(Float_t size = 0.02) # Another way to set the size? # gStyle.SetTitleYSize(Float_t size = 0.02) gStyle.SetTitleXOffset(0.9) gStyle.SetTitleYOffset(1.25) # gStyle.SetTitleOffset(1.1, "Y") # Another way to set the Offset # For the axis labels: gStyle.SetLabelColor(1, "XYZ") gStyle.SetLabelFont(42, "XYZ") gStyle.SetLabelOffset(0.007, "XYZ") gStyle.SetLabelSize(0.05, "XYZ") # For the axis: gStyle.SetAxisColor(1, "XYZ") gStyle.SetStripDecimals(True) gStyle.SetTickLength(0.03, "XYZ") gStyle.SetNdivisions(510, "XYZ") gStyle.SetPadTickX( 1) # To get tick marks on the opposite side of the frame gStyle.SetPadTickY(1) # Change for log plots: gStyle.SetOptLogx(0) gStyle.SetOptLogy(0) gStyle.SetOptLogz(0) # Postscript options: gStyle.SetPaperSize(20., 20.)
def cebefo_style(): #TStyle *gStyle = new TStyle("gStyle","gStyle"); gStyle.SetPadTickX(1) gStyle.SetPadTickY(1) gStyle.SetLineWidth(2) gStyle.SetFuncWidth(2) gStyle.SetHistLineWidth(3) gStyle.SetMarkerStyle(1) gStyle.SetTextSize(0.065) gStyle.SetOptFit(1111) # axis gStyle.SetTitleSize(.05, "X") #.055 gStyle.SetTitleOffset(1.1, "X") #1.2,0.9 #gStyle.SetLabelOffset(0.003,"X"); gStyle.SetLabelSize(.05, "X") #gStyle.SetLabelFont(42,"X"); gStyle.SetTitleSize(.05, "Y") #.055 gStyle.SetTitleOffset(1.5, "Y") #gStyle.SetLabelOffset(0.008,"Y"); gStyle.SetLabelSize(.05, "Y") #gStyle.SetLabelFont(42,"Y"); gStyle.SetTitleSize(.05, "Z") gStyle.SetTitleOffset(1.8, "Z") #gStyle.SetLabelOffset(0.008,"Z"); gStyle.SetLabelSize(0.05, "Z") #gStyle.SetLabelFont(42,"Z"); rt.TGaxis.SetMaxDigits(4) # Legend # gStyle.SetLegendTextSize(0.04); #gStyle.SetStatFontSize(0.2); #histograms properties gStyle.SetOptStat(112210) #gStyle.SetStripDecimals(False) #gStyle.SetLineStyleString(11,"20 10") # canvas #gStyle.SetCanvasColor(0); #gStyle.SetCanvasBorderSize(10); #gStyle.SetCanvasBorderMode(0); #gStyle.SetCanvasDefW(600); #gStyle.SetCanvasDefH(600); # pads # gStyle.SetPadColor(0); # gStyle.SetPadBorderSize(10); # gStyle.SetPadBorderMode(0); gStyle.SetPadLeftMargin(.14) gStyle.SetPadRightMargin(.02) gStyle.SetPadBottomMargin(.12) gStyle.SetPadTopMargin(.05) gStyle.SetPadGridX(1) gStyle.SetPadGridY(1)