From 6bfab92bfd955a5eeaf2247e43e6661bf3e13e9f Mon Sep 17 00:00:00 2001 From: Christian Weber <ChristianTMWeber@gmal.com> Date: Sun, 27 Sep 2020 21:06:41 -0400 Subject: [PATCH] Add ability to deal with regular tGraphs in tGraphHelpers.py --- functions/tGraphHelpers.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/functions/tGraphHelpers.py b/functions/tGraphHelpers.py index adae064..95d4b8d 100644 --- a/functions/tGraphHelpers.py +++ b/functions/tGraphHelpers.py @@ -18,6 +18,10 @@ def getTGraphWithoutError( errorTGraph , ySetpoint = "median"): return noErrorTGraph +def createNamedTGraph( objectName): + graph = ROOT.TGraph() + graph.SetName(objectName) + return graph def createNamedTGraphAsymmErrors( objectName): graph = ROOT.TGraphAsymmErrors() @@ -32,9 +36,11 @@ def fillTGraphWithRooRealVar(graph, xFill, yFill): graph.SetPoint( pointNr, xFill, yFill.getVal() ) - yErrorHi = abs( yFill.getMax()-yFill.getVal() ) - yErrorLo = abs( -yFill.getMin() + yFill.getVal() ) - graph.SetPointError( pointNr, 0,0, yErrorLo , yErrorHi ) + if isinstance(graph,ROOT.TGraphAsymmErrors): + + yErrorHi = abs( yFill.getMax()-yFill.getVal() ) + yErrorLo = abs( -yFill.getMin() + yFill.getVal() ) + graph.SetPointError( pointNr, 0,0, yErrorLo , yErrorHi ) return graph -- GitLab