From 34efa38b4038d7a03c2db85ec5db8579d7e05405 Mon Sep 17 00:00:00 2001
From: Mark Sutton <mark.sutton@cern.ch>
Date: Fri, 19 Mar 2021 16:29:53 +0000
Subject: [PATCH] Fix the legend size when plotting only a single cost entry

Fix incorrectly reduction the legend size if there was no reference in the key, as the legend was automatically adjusted dependendig on the number of entries already
---
 .../Analysis/src/comparitor.cxx                 | 17 +++++++++--------
 .../Readcards/src/ReadCards.cxx                 | 11 +++++++++--
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx
index 20433a823735..1189dab86dd0 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx
@@ -1723,14 +1723,7 @@ int main(int argc, char** argv) {
 	    htestnum = Get( *fftest, chains[j]+"/"+effhist+"_n", testrun, 0, &savedhistos ) ;
 	    htestden = Get( *fftest, chains[j]+"/"+effhist+"_d", testrun, 0, &savedhistos ) ;
 
-	    if ( rebin!=0 ) { 
-    	      htestnum = Rebin(htestnum, rebin );
-	      htestden = Rebin(htestden, rebin );
-	    }
-
-	    std::cout << "test histogram name: : " << htestnum->GetName() << "\txaxis: " << xaxis << "\t" << std::endl;
 
-	    //	if ( xaxis.find("p_{T}")!=std::string::npos || xaxis.find("pt")!=std::string::npos ) { 
 	    //    b.range( chains[j], htestnum );
 	    //    b.range( chains[j], htestden );
 	    //  }
@@ -1739,8 +1732,16 @@ int main(int argc, char** argv) {
 
 	    if ( htestnum && htestden ) { 
 
+	      if ( rebin!=0 ) { 
+		htestnum = Rebin(htestnum, rebin );
+		htestden = Rebin(htestden, rebin );
+	      }
+	      
+	      std::cout << "test histogram name: : " << htestnum->GetName() << "\txaxis: " << xaxis << "\t" << std::endl;
+	      
+	      //	if ( xaxis.find("p_{T}")!=std::string::npos || xaxis.find("pt")!=std::string::npos ) { 
 	      if ( std::string(htestnum->GetName()).find("ntrax_eff")!=std::string::npos ) {
-
+		
 		bool low = true;
 
 		//		if ( chains[j].find("j55")!=std::string::npos ) low = false;
diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Readcards/src/ReadCards.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Readcards/src/ReadCards.cxx
index c063383f956e..cf112b3c1442 100644
--- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Readcards/src/ReadCards.cxx
+++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Readcards/src/ReadCards.cxx
@@ -224,7 +224,7 @@ void ReadCards::parse()
 	mString.replace( pos, 1, "|");
       }
       else { 
-	mString.replace( pos, 1, "_");
+	mString.replace( pos, 1, "####");
       }
 
       //      std::cout << "duff: " << duff << " : " << n << " " << std::endl;
@@ -378,7 +378,14 @@ void ReadCards::parse()
       
       // missing value
       if ( qo.size()==0 && token.size()==0 ) error("missing token : " + input);
-            
+           
+
+      size_t pos = token.find("####");
+      while ( pos !=std::string::npos ) {  
+	token.replace( pos, 4, ";" );
+	pos = token.find("####");
+      }
+
       values.push_back(token);
     }
 
-- 
GitLab