Esempio n. 1
0
def SetStyle(styleName="MyStyle"):

    ## MyStyle or tdrStyle
    from ROOT import gROOT, gStyle

    gROOT.Reset()
    gROOT.ProcessLine(".x ~/rootmacros/myStyle.cc")
    gROOT.ProcessLine(".x ~/rootmacros/setTDRStyle.C")
    # gROOT.SetStyle("tdrStyle");
    # gROOT.SetStyle("MyStyle");
    gROOT.SetStyle(styleName)
    gStyle.SetOptLogy(0)
    gStyle.SetPalette(1)
    gStyle.SetOptTitle(0)
    gStyle.SetOptStat(0)
    gStyle.SetPadTopMargin(0.02)
    gStyle.SetPadTickX(1)

    gStyle.SetLabelSize(0.045, "XYZ")
    gStyle.SetLabelSize(0.04, "Y")
    gStyle.SetTitleSize(0.045, "XYZ")

    gROOT.ForceStyle()

    return
Esempio n. 2
0
    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.)
Esempio n. 3
0
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()
Esempio n. 4
0
def SED(flist):

    gStyle.SetOptLogx()
    gStyle.SetOptLogy()
    gStyle.SetPadGridX(True)
    gStyle.SetPadGridY(True)
    gStyle.SetEndErrorSize(10)

    l = TLegend(.65, .6, .96, .95)

    g = []
    gUL = []

    pubdir = "/home/smasuda/storage/.Fermi2/Data/DataPoint/GammaCygni/"

    # g.append(GetPubData(pubdir+"GCyg_FermiLande_data.csv",
    #                     pubdir+"GCyg_FermiLande_error.csv"))
    # g[-1].SetName('gLande12')
    # g[-1].SetLineColor(kCyan)
    # g[-1].SetMarkerColor(g[-1].GetLineColor())
    # g[-1].SetMarkerStyle(21)
    # gUL.append(TGraph(0))
    # l.AddEntry(g[-1],'Lande+ \'12','p')

    g.append(
        GetPubData(pubdir + "GCyg_FermiFraija_data.csv",
                   pubdir + "GCyg_FermiFraija_error.csv"))
    g[-1].SetName('gFraija16')
    g[-1].SetLineColor(kPink + 1)
    g[-1].SetLineColor(kCyan)
    g[-1].SetMarkerColor(g[-1].GetLineColor())
    g[-1].SetMarkerStyle(22)
    gUL1 = GetPubData(pubdir + "GCyg_FermiFraija_UL.csv")
    gUL1.SetName('gFraija16UL')
    gUL1.SetLineColor(g[-1].GetLineColor())
    gUL1.SetMarkerColor(g[-1].GetLineColor())
    gUL.append(gUL1)
    l.AddEntry(g[-1], 'Fraija+ \'16', 'p')

    # g.append(GetPubData(pubdir+"GCyg_MAGIC_data.csv",
    #                     pubdir+"GCyg_MAGIC_error.csv"))
    # g[-1].SetLineColor(kMagenta)
    # g[-1].SetMarkerColor(kMagenta)
    # g[-1].SetMarkerStyle(29)
    # gUL.append(TGraph(0))

    def ConvertFluxUnit(glist):
        g = glist[-1]
        n = g.GetN()
        x = g.GetX()
        y = g.GetY()
        ey = g.GetEY()
        for i in range(n):
            y[i] *= x[i] * x[i] * 1e-6 * 1e-4
            if g.ClassName() == "TGraphErrors":
                ey[i] *= x[i] * x[i] * 1e-6 * 1e-4

    rfile = TFile(
        "/home/smasuda/storage/Fermi/Data/GammaCygni2017/VERJ2019p407_spec.root"
    )
    gVER = rfile.Get("gVER")
    gVERUL = rfile.Get("gVERUL")
    fVER = rfile.Get("fVER")
    rfile.Close()
    g.append(gVER)
    gUL.append(gVERUL)
    fVER.SetParameter(0, fVER.GetParameter(0) * 1e-4)
    fVER.SetParameter(1, fVER.GetParameter(1) - 2.)
    ConvertFluxUnit(g)
    ConvertFluxUnit(gUL)
    colV = kGreen
    gVER.SetMarkerColor(colV)
    gVER.SetLineColor(colV)
    gVERUL.SetMarkerColor(colV)
    gVERUL.SetLineColor(colV)
    fVER.SetLineColor(colV)
    l.AddEntry(g[-1], 'VER J2019+407', 'p')

    rfile = TFile(
        '/home/smasuda/storage/MAGIC/GammaCygni2017_ST7/analysis/flute/CombAll/Unfolding_Output_combunfold_2-Tikhonov.root'
    )
    g.append(rfile.Get("fGraph1E2"))
    rfile.Close()
    g[-1].SetMarkerStyle(21)
    g[-1].SetMarkerColor(kMagenta + 1)
    g[-1].SetLineColor(g[-1].GetMarkerColor())
    gUL.append(TGraph(0))
    l.AddEntry(g[-1], 'MAGIC this work', 'lp')

    rfile = TFile(
        "/home/smasuda/storage/Fermi/Data/GammaCygni2017/MarcelFermi.root")
    gtmp = []
    for key in rfile.GetListOfKeys():
        obj = key.ReadObj()
        if obj.InheritsFrom(TGraph.Class()):
            gtmp.append(obj)

    # g.append(gtmp[0])
    # gUL.append(TGraph(0))
    # g.append(gtmp[1])
    # gUL.append(TGraph(0))
    # l.AddEntry(g[-1],'Marcel disk','lp')
    # g.append(gtmp[2])
    # gUL.append(gtmp[3])
    # l.AddEntry(g[-1],'Marcel gaus','lp')
    # g.append(TGraph(0))
    # gUL.append(gtmp[4])
    # l.AddEntry(gUL[-1],'Marcel arc','lp')

    # arr1=rfile.Get("aGausUL")
    # arr2=rfile.Get("aArcUL")

    rfile.Close()

    # XX=np.array([1.])
    # YY=np.array([1.e-10])
    # g.append(TGraph(1,XX,YY))
    # gUL.append(TGraph(0))

    for f in flist:
        tmpg, tmpgUL = GetData(f.file, f.scale, title=f.title)
        tmpg.SetLineColor(f.col)
        tmpg.SetMarkerColor(f.col)
        tmpg.SetMarkerStyle(f.sty)
        tmpgUL.SetLineColor(f.col)
        if f.leg != '':
            l.AddEntry(tmpg, f.leg, 'p')
        g.append(tmpg)
        gUL.append(tmpgUL)

    # l.AddEntry('p')

    ng = len(g)

    mg = TMultiGraph()
    for i in range(ng):
        if g[i].GetName() == 'gLP':
            mg.Add(g[i], '3')
        else:
            mg.Add(g[i], 'pz')

        if gUL[i].GetN() > 0:
            if gUL[i].GetName() == 'gGausUL' or gUL[i].GetName() == 'gArcUL':
                mg.Add(gUL[i], 'pz')
            else:
                mg.Add(gUL[i], 'p')

    xbin = np.logspace(np.log10(0.9), np.log10(8079.765852892145), 101)
    # ybin=np.logspace(np.log10(1.565210892602076e-14),np.log10(1.675199606589398e-10),101)
    ybin = np.logspace(np.log10(3.786556805899183e-14), np.log10(1.05e-10),
                       101)
    frame = TH2F("frame", "SED;Energy [GeV];E^{2}dN/dE [TeV cm^{-2} s^{-1}]",
                 100, xbin, 100, ybin)
    frame.SetStats(False)
    frame.SetDirectory(0)
    frame.Draw("0")
    mg.SetTitle("SED;Energy [GeV];E^{2}dN/dE [TeV cm^{-2} s^{-1}]")
    mg.Draw()
    fVER.Draw("same")

    arr = []
    for i in range(len(gUL)):
        if gUL[i].GetN() > 0:
            arr.append(DrawUL(gUL[i]))
    # arr.append(arr1)
    # arr.append(arr2)
    # arr1.Draw()
    # arr2.Draw()
    l.Draw()

    gROOT.frame = frame
    gROOT.mg = mg
    gROOT.arr = arr
    gROOT.l = l
    gROOT.fVER = fVER

    gStyle.SetOptLogx(False)
    gStyle.SetOptLogy(False)
def makePerSamplePlots():
    for ref in HISTS:
        print "ref: ,", ref
        if type(ref) == tuple:
            if ref[0] == '4Mu':
                name = 'HTo2XTo4Mu_'
                latexFS = '4#mu'
            elif ref[0] == '2Mu2J':
                name = 'HTo2XTo2Mu2J_'
                latexFS = '2#mu2j'
            if TRIGGER:
                name = 'Trig-' + name
            name += SPStr(ref[1])
            lumi = SPLumiStr(ref[0], *ref[1])
            legName = HistogramGetter.PLOTCONFIG['HTo2XTo' + ref[0]]['LATEX']
            print "name: ", name, " lumi: ", lumi, " legName: ", legName
        else:
            name = ref
            lumi = HistogramGetter.PLOTCONFIG[ref]['LATEX']
            legName = HistogramGetter.PLOTCONFIG[ref]['LATEX']

        # histo filename
        fname = 'pdfs/muonQualityPlots_{}.pdf'.format(name)

        # canvas
        canvas = R.TCanvas('c', 'canvas', 0, 0, 800, 600)

        gStyle.SetOptStat(111111)
        #        gStyle.SetStatW(0.25)        # width of statistics box; default is 0.19
        #        gStyle.SetStatH(0.10)        # height of statistics box; default is 0.1
        #        gStyle.SetStatFontSize(0.07) # size for stat. box

        # delta R between nearest HLT and DSA muons
        canvas.Clear()
        htit = 'dR_HLT_DSA'
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(1, 2)
        pad.cd(1)
        HISTS[ref][htit].Draw("hist")
        pad.cd(2)
        HISTS[ref][htit].Draw("hist")
        gPad.SetLogy(1)
        canvas.Print(fname + "(", "Title:" + htit)

        # delta R between nearest HLT and DSA muons for good events failing the default HLT-RECO match
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        pad.cd(1)
        HISTS[ref]['dR1_HLT_DSA_GoodEvent'].Draw("hist")
        pad.cd(2)
        HISTS[ref]['dR1_HLT_DSA_GoodEvent'].Draw("hist")
        gPad.SetLogy(1)
        pad.cd(3)
        HISTS[ref]['dR2_HLT_DSA_GoodEvent'].Draw("hist")
        pad.cd(4)
        HISTS[ref]['dR2_HLT_DSA_GoodEvent'].Draw("hist")
        gPad.SetLogy(1)
        canvas.Print(fname, "Title:dR_HLT_DSA, no HLT-RECO match, good events")

        # delta R between nearest HLT and DSA muons for bad events failing the default HLT-RECO match
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        pad.cd(1)
        HISTS[ref]['dR1_HLT_DSA_BadEvent'].Draw("hist")
        pad.cd(2)
        HISTS[ref]['dR1_HLT_DSA_BadEvent'].Draw("hist")
        gPad.SetLogy(1)
        pad.cd(3)
        HISTS[ref]['dR2_HLT_DSA_BadEvent'].Draw("hist")
        pad.cd(4)
        HISTS[ref]['dR2_HLT_DSA_BadEvent'].Draw("hist")
        gPad.SetLogy(1)
        canvas.Print(fname, "Title:dR_HLT_DSA, no HLT-RECO match, bad events")

        # number of unsuccessful and successful HLT-DSA matches
        canvas.Clear()
        htit = 'matches_HLT_DSA'
        HISTS[ref][htit].Draw("hist")
        HISTS[ref][htit].Draw("same text")
        canvas.Print(fname, "Title:" + htit)

        # some diagnostics for RECO muons matched to signal GEN muons but not matched to HLT muons
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        pad.cd(1)
        HISTS[ref]['unmatched_pt_res'].Draw("hist")
        pad.cd(2)
        HISTS[ref]['unmatched_invm_res'].Draw("hist")
        pad.cd(3)
        HISTS[ref]['unmatched_pt_rec_vs_pt_gen'].Draw("")
        pad.cd(4)
        HISTS[ref]['unmatched_pt_rec_vs_pt_gen_zoomed'].Draw("")
        canvas.Print(
            fname,
            "Title:RECO muons matched to signal GEN muons but not matched to HLT muons"
        )

        # N(CSC stations) vs N(DT stations)
        canvas.Clear()
        htit = 'CSC_vs_DT_Stations'
        HISTS[ref][htit].Draw("text")
        canvas.Print(fname, "Title:" + htit)

        # Nhits
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        pad.cd(1)
        HISTS[ref]['nMuonHits'].Draw("hist")
        pad.cd(2)
        HISTS[ref]['nDTCSCHits'].Draw("hist")
        pad.cd(3)
        HISTS[ref]['nDTHits'].Draw("hist")
        pad.cd(4)
        HISTS[ref]['nCSCHits'].Draw("hist")
        #        HISTS[ref]['nRPCHits'].Draw("hist")
        canvas.Print(fname, "Title:total number of hits")

        # Nhits for various Nstations
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nMuonHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:muon hits per station")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nRPCHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:RPC hits per station")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nCSCHits_vs_nDTHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("text")
        canvas.Print(fname, "Title:CSC hits vs DT hits, per station")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nDTCSCHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:DT+CSC hits per station, lin scale")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        gStyle.SetOptLogy(1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nDTCSCHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        gStyle.SetOptLogy(0)
        canvas.Print(fname, "Title:DT+CSC hits per station, log scale")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nDTHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:DT hits per station, lin scale")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        gStyle.SetOptLogy(1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nDTHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        gStyle.SetOptLogy(0)
        canvas.Print(fname, "Title:DT hits per station, log scale")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nCSCHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:CSC hits per station, lin scale")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        gStyle.SetOptLogy(1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'nCSCHits_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        gStyle.SetOptLogy(0)
        canvas.Print(fname, "Title:CSC hits per station, log scale")

        # pT resolutions for groups of 3 DT+CSC hits
        htot = 17
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_DTCSChits_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname, "Title:pT res for groups of 3 hits")

        # pT res for groups of 3 hits, N(stat) > 1
        htot = 8
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_DTCSChits_Stat234_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:pT res for groups of 3 hits, N(stat) > 1")

        # pT res for 12-19 DTCSC hits, N(stat) > 1
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(4, 2)
        for ihits in range(12, 20):
            pad.cd(ihits - 11)
            htit = 'pTres_Stat234_' + str(ihits) + 'DTCSChits'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:pT res for 12-19 DTCSC hits, N(stat) > 1")

        # resolutions in barrel, endcap, and overlap
        htot = 8  # hist8 and hist9 are empty
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_DThits_barrel_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:pT res for groups of 6 hits, barrel")

        htot = 10
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_CSChits_endcap_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:pT res for groups of 3 hits, endcap")

        htot = 8  # hist8 and hist9 are empty
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_DTCSChits_overlap_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:pT res for groups of 6 hits, overlap")

        # 1/pT resolutions for groups of 3 DT+CSC hits
        htot = 17
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'invpTres_DTCSChits_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname, "Title:1/pT res for groups of 3 hits")

        # 1/pT resolutions for groups of 3 hits, N(stat) > 1
        htot = 8
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'invpTres_DTCSChits_Stat234_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(
                    fname, "Title:1/pT res for groups of 3 hits, N(stat) > 1")

        # charge difference for groups of 3 hits
        htot = 17
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'qdif_DTCSChits_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname, "Title:q dif for groups of 3 hits")

        # charge difference for groups of 3 hits, N(stat) > 1
        htot = 8
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'qdif_DTCSChits_Stat234_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:q dif for groups of 3 hits, N(stat) > 1")

        # charge difference for 12-19 DTCSC hits, N(stat) > 1
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(4, 2)
        for ihits in range(12, 20):
            pad.cd(ihits - 11)
            htit = 'qdif_Stat234_' + str(ihits) + 'DTCSChits'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:q dif for 12-19 DTCSC hits, N(stat) > 1")

        # d0 difference for groups of 3 hits
        htot = 17
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'd0dif_DTCSChits_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname, "Title:d0 dif for groups of 3 hits")

        # d0 difference for groups of 6 hits in barrel, endcap, and overlap
        htot = 8  # hist8 and hist9 are empty
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'd0dif_DThits_barrel_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:d0 dif for groups of 6 hits, barrel")

        htot = 10
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'd0dif_CSChits_endcap_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:d0 dif for groups of 3 hits, endcap")

        htot = 8  # hist8 and hist9 are empty
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'd0dif_DTCSChits_overlap_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:d0 dif for groups of 6 hits, overlap")

        # d0 difference for groups of 3 hits, N(stat) > 1
        htot = 8
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'd0dif_DTCSChits_Stat234_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname,
                             "Title:d0 dif for groups of 3 hits, N(stat) > 1")

        # sigma(pt)/pt vs chi2/ndof
        canvas.Clear()
        htit = 'dpt_over_pt_vs_chi2_over_ndof'
        HISTS[ref][htit].Draw("")
        canvas.Print(fname, "Title:" + htit)

        # sigma(pT)/pT per station
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'dpt_over_pt_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:sigma(pT)/pT per station, lin scale")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        gStyle.SetOptLogy(1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'dpt_over_pt_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        gStyle.SetOptLogy(0)
        canvas.Print(fname, "Title:sigma(pT)/pT per station, log scale")

        # sigma(pT)/pT for groups of 3 hits
        htot = 17
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'dpt_over_pt_DTCSChits_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname, "Title:sigma(pT)/pT for groups of 3 hits")

        # sigma(pT)/pT for groups of 3 hits, N(stat) > 1
        htot = 8
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'dpt_over_pt_DTCSChits_Stat234_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(
                    fname,
                    "Title:sigma(pT)/pT for groups of 3 hits, N(stat) > 1")

        # pT resolution in slices of sigma(pT)/pT
        htot = 10
        for ihist in range(0, htot):
            ipad = ihist % 10
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(5, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_for_dpt_over_pt_hist' + str(ihist)
            HISTS[ref][htit].Fit("gaus", "Q")
            #            HISTS[ref][htit].Draw("hist")
            if ipad == 9 or ihist == htot - 1:
                canvas.Print(fname, "Title:pT res in slices of sigma(pT)/pT")

        # pT resolution in slices of sigma(pT)/pT, Nhits > 12
        htot = 10
        for ihist in range(0, htot):
            ipad = ihist % 10
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(5, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_for_dpt_over_pt_passed_hist' + str(ihist)
            HISTS[ref][htit].Fit("gaus", "Q")
            #            HISTS[ref][htit].Draw("hist")
            if ipad == 9 or ihist == htot - 1:
                canvas.Print(
                    fname,
                    "Title:pT res in slices of sigma(pT)/pT, Nhits > 12")

        # pT pull in slices of sigma(pT)/pT
        htot = 10
        for ihist in range(0, htot):
            ipad = ihist % 10
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(5, 2)
            pad.cd(ipad + 1)
            htit = 'pTpull_for_dpt_over_pt_hist' + str(ihist)
            #            HISTS[ref][htit].Fit("gaus","Q")
            HISTS[ref][htit].Draw("hist")
            if ipad == 9 or ihist == htot - 1:
                canvas.Print(fname, "Title:pT pull in slices of sigma(pT)/pT")

        # refitted muons for DSA muons failing dpT/pT cut
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        pad.cd(1)
        HISTS[ref]['eta_for_dpt_over_pt_gt_1'].Draw("hist")
        pad.cd(2)
        HISTS[ref]['pTres_ref_for_dpt_over_pt_gt_1'].Draw("hist")
        pad.cd(3)
        HISTS[ref]['dpt_over_pt_ref_for_dpt_over_pt_gt_1'].Draw("hist")
        pad.cd(4)
        HISTS[ref]['pTres_ref_for_dpt_over_pt_gt_1_ref_lt_1'].Draw("hist")
        canvas.Print(fname, "Title:refitted muons, sigma(pT)/pT > 1")

        # chi2/ndof per station
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'chi2_over_ndof_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname, "Title:chi2/ndof per station, lin scale")

        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        gStyle.SetOptLogy(1)
        pad.Draw()
        pad.Divide(2, 2)
        for istat in range(1, 5):
            pad.cd(istat)
            htit = 'chi2_over_ndof_' + str(istat) + 'Stat'
            HISTS[ref][htit].Draw("hist")
        gStyle.SetOptLogy(0)
        canvas.Print(fname, "Title:chi2/ndof per station, log scale")

        # chi2/ndof for groups of 3 hits
        htot = 17
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'chi2_over_ndof_DTCSChits_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(fname, "Title:chi2/ndof for groups of 3 hits")

        # chi2/ndof for groups of 3 hits, N(stat) > 1
        htot = 8
        for ihist in range(0, htot):
            ipad = ihist % 8
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(4, 2)
            pad.cd(ipad + 1)
            htit = 'chi2_over_ndof_DTCSChits_Stat234_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
            if ipad == 7 or ihist == htot - 1:
                canvas.Print(
                    fname, "Title:chi2/ndof for groups of 3 hits, N(stat) > 1")

        # pT resolution in slices of chi2/ndof
        htot = 10
        for ihist in range(0, htot):
            ipad = ihist % 10
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(5, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_for_chi2_over_ndof_hist' + str(ihist)
            HISTS[ref][htit].Fit("gaus", "Q")
            #            HISTS[ref][htit].Draw("hist")
            if ipad == 9 or ihist == htot - 1:
                canvas.Print(fname, "Title:pT res in slices of chi2/ndof")

        # pT resolution in slices of chi2/ndof, Nhits > 12
        htot = 10
        for ihist in range(0, htot):
            ipad = ihist % 10
            if ipad == 0:
                canvas.Clear()
                pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
                pad.Draw()
                pad.Divide(5, 2)
            pad.cd(ipad + 1)
            htit = 'pTres_for_chi2_over_ndof_passed_hist' + str(ihist)
            HISTS[ref][htit].Fit("gaus", "Q")
            #            HISTS[ref][htit].Draw("hist")
            if ipad == 9 or ihist == htot - 1:
                canvas.Print(
                    fname, "Title:pT res in slices of chi2/ndof, Nhits > 12")

        # placeholder for future histograms
        canvas.Clear()
        pad = R.TPad('pad', 'pad', 0, 0, 1, 1)
        pad.Draw()
        pad.Divide(4, 2)
        for ihist in range(16, 17):
            pad.cd(ihist - 15)
            htit = 'pTres_DTCSChits_hist' + str(ihist)
            HISTS[ref][htit].Draw("hist")
        canvas.Print(fname + ")", "Title:placeholder")
Esempio n. 6
0
    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"
Esempio n. 7
0
    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)