296 def fillPlots(plots,plotopts,rootopts,eventVal) :
301 for plotopt
in plotopts :
302 listmin[plotopt] = 99999.9
303 listmax[plotopt] = -99999.9
304 listmin2[plotopt] = 99999.9
305 listmax2[plotopt] = -99999.9
306 for rootopt
in rootopts :
307 for event
in rootopt.tree :
308 for plotopt
in plotopts :
311 if (len(plotopt.restricts) > 0) :
312 for rest
in plotopt.restricts :
313 eventval = eventVal(event,rest.var)
314 if (eventval ==
"False") :
316 eventval = event.__getattr__(rest.var)
317 except AttributeError:
318 print (
"ERROR: Non-existent variable in plot restrict:", rest.var)
321 if not rest.checkVar(eventval) :
324 if (len(rootopt.restricts) > 0) :
325 for rest
in rootopt.restricts :
326 eventval = eventVal(event,rest.var)
327 if (eventval ==
"False") :
329 eventval = event.__getattr__(rest.var)
331 print (
"ERROR: Non-existent variable in rootfile restrict:", rest.var)
334 if not rest.checkVar(eventval) :
339 plot = plots[plotopt][rootopt]
340 plotvars = plotopt.vars_to_draw
343 for plotvar
in plotvars :
346 if plotvar.startswith(
"+") :
347 locvar = plotvar.lstrip(
"+")
349 eventval = eventVal(event,locvar)
350 if (eventval ==
"False") :
352 eventval = event.__getattr__(locvar)
353 except AttributeError:
354 print (
"ERROR: Non-existent variable:", locvar)
359 eventvals.append(eventval)
360 if (plotopt.profile) :
362 plot.Fill(eventvals[0],eventvals[1],eventvals[2])
364 plot.Fill(eventvals[0],eventvals[1])
367 plot.Fill(eventvals[0],eventvals[1])
369 plot.Fill(eventvals[0])
371 if (eventvals[0] < plotopt.givenmax)
or (plotopt.givenmin == plotopt.givenmax) :
372 listmax[plotopt] =
max(listmax[plotopt], eventvals[0])
373 if (eventvals[0] > plotopt.givenmin)
or (plotopt.givenmin == plotopt.givenmax) :
374 listmin[plotopt] =
min(listmin[plotopt], eventvals[0])
376 if (eventvals[1] < plotopt.givenmax)
or (plotopt.givenmin == plotopt.givenmax) :
377 listmax2[plotopt] =
max(listmax2[plotopt], eventvals[1])
378 if (eventvals[1] > plotopt.givenmin)
or (plotopt.givenmin == plotopt.givenmax) :
379 listmin2[plotopt] =
min(listmin2[plotopt], eventvals[1])
381 for plotopt
in plotopts :
385 plot = plots[plotopt][rootopt]
386 plot.SetLineColor(rootopt.color)
387 plot.SetLineWidth(rootopt.thickness)
388 if rootopt.markerstyle > 0 :
389 plot.SetMarkerStyle(rootopt.markerstyle)
391 plot.SetMarkerStyle(1)
392 plot.SetFillColor(rootopt.color)
394 plot.SetMarkerSize(rootopt.markersize)
395 plot.SetMarkerColor(rootopt.color)
397 for plotopt
in plotopts :
399 plot.GetXaxis().SetLimits(listmin[plotopt],listmax[plotopt])
401 plot.GetYaxis().SetLimits(listmin2[plotopt],listmax2[plotopt])