Pyroot gstyle and SetOptStat

Dear all,
I’m trying to exclude the statistic part from a canvas created in pyroot.
The code I used is reported in the follow.
I tried to use also kFALSE (but it is not recognize as defined variable).
Please could you provide me some help?

---------------------------------- The code ------------------------------------

from ROOT import *

   ROOT.gStyle.SetOptStat(0)
    
    c_wheel_m1_near = TCanvas("c_wheel_m1_near","Wheel -1 near",16,58,1415,498)
    c_wheel_m1_near.SetHighLightColor(2);
    c_wheel_m1_near.Range(-10.75452,-73.54839,117.0138,125.3226);
    c_wheel_m1_near.SetFillColor(0);
    c_wheel_m1_near.SetBorderMode(0);
    c_wheel_m1_near.SetBorderSize(2);
    c_wheel_m1_near.SetLeftMargin(0.084172);
    c_wheel_m1_near.SetRightMargin(0.05489479);
    c_wheel_m1_near.SetBottomMargin(0.3698297);
    c_wheel_m1_near.SetFrameBorderMode(0);

    hWm1Near_eff.SetMarkerColor(1)
    hWm1Near_eff.SetMarkerStyle(22)
    hWm1Near_eff.GetXaxis().SetLabelFont(32);
    hWm1Near_eff.GetXaxis().SetTitleFont(32);
    hWm1Near_eff.GetYaxis().SetTitle("%");
    hWm1Near_eff.GetYaxis().SetLabelFont(32);
    hWm1Near_eff.GetYaxis().SetTitleFont(32);

    hWm1Near_eff.Draw()
    hWm1Near_masked.Draw("same")
    c_wheel_m1_near.Update()

    hWm1Near_bx.SetMarkerColor(ROOT.kRed)
    hWm1Near_bx.SetMarkerStyle(23)
    scale = 110./20.
    hWm1Near_bx.SetLineColor(ROOT.kRed);
    hWm1Near_bx.Scale(scale)
    hWm1Near_bx.Draw("same")
    htemp = hWm1Near_eff.Clone()
    for k in range(htemp.GetNbinsX()+1):
        htemp.SetBinContent(k,scale*10)
    hWm1Near_bx.Add(htemp)
    
    axis = TGaxis(ROOT.gPad.GetUxmax(),ROOT.gPad.GetUymin(),ROOT.gPad.GetUxmax(), ROOT.gPad.GetUymax(),-10.,10,510,"+L")
    axis.SetLineColor(ROOT.kRed)
    axis.SetLabelColor(ROOT.kRed)
    axis.SetLabelOffset(0.005);
    axis.SetLabelSize(0.04);
    axis.SetTickSize(0.03);
    axis.SetGridLength(0);
    axis.SetTitleOffset(1);
    axis.SetTitleSize(0.04);
    axis.SetTitleColor(1);
    axis.SetTitleFont(62);

    axis.Draw();
    c_wheel_m1_near.Write()

Hi,

couple of things that I don’t understand: the “hWm1Near_eff” variable is not defined, so the code won’t run. You use “from ROOT import *” but also the “ROOT” namespace? Either one would suffice. Finally, what is the question? Passing 0 or kFalse through SetOptStat works (for me, anyway)?

Cheers,
Wim

To the first question of course the TH1F is defined in an other part of the code that I omitted, therefore the software actually is working.
For the second question, I tried all the possibilities, but of course it is enough do “import ROOT”, or “from ROOT import *”.
About the third question, in my case it doesn’t work.
I tried with 0 and with ROOT.kFALSE.

Do you have some suggestion?

Thanks a lot in advance
Raffaello

Ok, I found the problem. It was simply the position of the gStyle.
I put it where I fill the canvas istead of putting it where I create the histograms for that canvas.
Thanks a lot anyway

Bye
Raffaello