Hi, I have the problem that I am using the import ROOT library, to use the ROOT CERN functions. But when I want to graph my histogram nothing appears, empty space appears for the histogram without canvas or anything, only space but nothing is seen, part of my code is as follows:
from root import TFile, TCanvas, TPad, TChain, TLegend, TLine, THStack, TArrow, TEfficiency
from root import kGreen, kBlue, kRed, kBlack, kOrange, kGreen, kCyan, kMagenta, kAzure
from root import TH1D
import numpy as np
% jsroot on
chalpa = TChain ("alpa")
chalpa.AddFile ("alpaprub.root")
def getHistogram (chain, leaf, name, title, bins, minHist, maxHist):
hist = TH1D (name, title, bins, minHist, maxHist)
for i in range (chain.GetEntries ()):
chain.GetEntry (i)
#some cuts
if chain.alpa_3prong_chiProb <= 0:
continue
hist.Fill (chain.GetLeaf (leaf) .GetValue ())
return hist
alpaThr = getHistogram (chalpa, "thrust", "alpaThr", "", 50,0.6,1.0)
alpaSC3 = getHistogram (chalpa "sumCos3prong", "alpaSC3", "", 50, -1,3.2)
alpaThr.SetStats (0)
alpaThr.SetLineColor (kBlue + 4)
alpaThr.SetFillColorAlpha (kBlue + 4, 0.25)
alpaSC3.SetStats (0)
alpaSC3.SetLineColor (kBlue + 4)
alpaSC3.SetFillColorAlpha (kBlue + 4, 0.5)
c1 = TCanvas ("c1", "Thrust", 900, 400)
c1.cd ()
alpaThr.Draw ("HIST")
label = TLegend (.2, .60, .45, .85);
label.AddEntry (alpaThr, "#tau +} #tau -", "f")
label.SetBorderSize (0)
label.Draw ()
alpaSC3.Draw ("HIST same")
label.Draw ()
c1.Draw ()
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided