297 def fillPlots(plots,plotopts,rootopts,eventVal) :
302 for plotopt
in plotopts :
303 listmin[plotopt] = 99999.9
304 listmax[plotopt] = -99999.9
305 listmin2[plotopt] = 99999.9
306 listmax2[plotopt] = -99999.9
307 for rootopt
in rootopts :
308 for event
in rootopt.tree :
309 for plotopt
in plotopts :
312 if (len(plotopt.restricts) > 0) :
313 for rest
in plotopt.restricts :
314 eventval = eventVal(event,rest.var)
315 if (eventval ==
"False") :
317 eventval = event.__getattr__(rest.var)
318 except AttributeError:
319 print (
"ERROR: Non-existent variable in plot restrict:", rest.var)
322 if not rest.checkVar(eventval) :
325 if (len(rootopt.restricts) > 0) :
326 for rest
in rootopt.restricts :
327 eventval = eventVal(event,rest.var)
328 if (eventval ==
"False") :
330 eventval = event.__getattr__(rest.var)
332 print (
"ERROR: Non-existent variable in rootfile restrict:", rest.var)
335 if not rest.checkVar(eventval) :
340 plot = plots[plotopt][rootopt]
341 plotvars = plotopt.vars_to_draw
344 for plotvar
in plotvars :
347 if plotvar.startswith(
"+") :
348 locvar = plotvar.lstrip(
"+")
350 eventval = eventVal(event,locvar)
351 if (eventval ==
"False") :
353 eventval = event.__getattr__(locvar)
354 except AttributeError:
355 print (
"ERROR: Non-existent variable:", locvar)
360 eventvals.append(eventval)
361 if (plotopt.profile) :
363 plot.Fill(eventvals[0],eventvals[1],eventvals[2])
365 plot.Fill(eventvals[0],eventvals[1])
368 plot.Fill(eventvals[0],eventvals[1])
370 plot.Fill(eventvals[0])
372 if (eventvals[0] < plotopt.givenmax)
or (plotopt.givenmin == plotopt.givenmax) :
373 listmax[plotopt] =
max(listmax[plotopt], eventvals[0])
374 if (eventvals[0] > plotopt.givenmin)
or (plotopt.givenmin == plotopt.givenmax) :
375 listmin[plotopt] =
min(listmin[plotopt], eventvals[0])
377 if (eventvals[1] < plotopt.givenmax)
or (plotopt.givenmin == plotopt.givenmax) :
378 listmax2[plotopt] =
max(listmax2[plotopt], eventvals[1])
379 if (eventvals[1] > plotopt.givenmin)
or (plotopt.givenmin == plotopt.givenmax) :
380 listmin2[plotopt] =
min(listmin2[plotopt], eventvals[1])
382 for plotopt
in plotopts :
386 plot = plots[plotopt][rootopt]
387 plot.SetLineColor(rootopt.color)
388 plot.SetLineWidth(rootopt.thickness)
389 if rootopt.markerstyle > 0 :
390 plot.SetMarkerStyle(rootopt.markerstyle)
392 plot.SetMarkerStyle(1)
393 plot.SetFillColor(rootopt.color)
395 plot.SetMarkerSize(rootopt.markersize)
396 plot.SetMarkerColor(rootopt.color)
398 for plotopt
in plotopts :
400 plot.GetXaxis().SetLimits(listmin[plotopt],listmax[plotopt])
402 plot.GetYaxis().SetLimits(listmin2[plotopt],listmax2[plotopt])