I’m just trying to draw some plots using TTree::Draw and hitting some memory problem. It appears that it depends on the size of available memory as the error occurs at different points depending on the machine.
I’m doing the following
def DelR(histo, chain , inserted, obj): varString= inserted+obj+"DeltaR" cutString= inserted+"N>0"+" && "+inserted+obj+"DeltaR<"+str(dRMax) +" && "+inserted+obj+"DeltaR>=0" entry = chain.Draw(varString+">>"+histo.GetName(),cutString) print "entry:", entry gPad.SetLogx() histo.GetXaxis().SetTitle("#Delta R (Log Scale)") for inserted in listAOD: canvas=TCanvas() canvas.SetCanvasSize(600, 400) canvas.Divide(3,2) canvasNo=1 plots= for obj in listAOD: canvas.cd(canvasNo) histoName="DeltaR_"+inserted+obj plot=TH1F(histoName, "DelR - "+inserted+obj, 100, Logbin(100,0.000000001, 10.)) plots+=[plot] DelR(plot, chain, inserted, obj ) plot.Draw("") canvasNo+=1 canvas.Print(inserted+"DelR_"+FileSuffix+".eps")
Logbin just returns an array suitable for log binning.
I’m trying to plot 6 of these plots and I have 11000 events. At some point, I get
C++ exception caught: St9bad_alloc C++ exception caught: St9bad_alloc Traceback (most recent call last): File "../../rootMacro/DeltaRPlots.py", line 39, in ? DelR(plot, chain, inserted, obj ) File "../../rootMacro/DeltaRPlots.py", line 18, in DelR entry = chain.Draw(varString+">>"+histo.GetName(),cutString) TypeError: none of the 3 overloaded methods succeeded
and as I noted above, this doesn’t always happens at the same time but it is more like it needs more memory or something like that…
Is my code above leaking some memory or is it that this is the limit of what I can do on this machine?
Thanks for your help.