From e6ad10a9c1feeb71c3eb1833c20649e5e05042ee Mon Sep 17 00:00:00 2001
From: Christian Weber <cweber@bnl.gov>
Date: Wed, 7 Dec 2022 11:30:57 -0500
Subject: [PATCH] Fix y-axis title, add 'GeV' only if xAxis also has GeV Units

---
 plotPostProcess.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plotPostProcess.py b/plotPostProcess.py
index 25caf64..79d5768 100644
--- a/plotPostProcess.py
+++ b/plotPostProcess.py
@@ -1532,9 +1532,10 @@ if __name__ == '__main__':
             #if "eta"   in backgroundMergedTH1.getTitle: yAxisUnit = ""
             #elif "phi" in backgroundMergedTH1.getTitle: yAxisUnit = " radians"
 
+            yAxisString = "Events / " + str(backgroundMergedTH1.GetBinWidth(1) )
+            if "GeV" in backgroundTHStack.GetYaxis().GetTitle(): yAxisString += " GeV"
 
-
-            backgroundTHStack.GetYaxis().SetTitle("Events / " + str(backgroundMergedTH1.GetBinWidth(1) )+" GeV" )
+            backgroundTHStack.GetYaxis().SetTitle( yAxisString )
             yAxisTitleSize = 0.055
             backgroundTHStack.GetYaxis().SetTitleSize(yAxisTitleSize)
             backgroundTHStack.GetYaxis().SetTitleOffset(0)
-- 
GitLab