@@ -74,7 +74,7 @@ def SetExtraText(text):
74
74
75
75
def SetCmsTextFont (font ):
76
76
"""
77
- Function that allows to edit th default font of the
77
+ Function that allows to edit the default font of the
78
78
"CMS" string
79
79
80
80
Args:
@@ -119,7 +119,7 @@ def AppendAdditionalInfo(text):
119
119
120
120
def SetCmsTextSize (size ):
121
121
"""
122
- Function that allows to edit th default fontsize of the
122
+ Function that allows to edit the default fontsize of the
123
123
"CMS" string
124
124
125
125
Args:
@@ -351,13 +351,13 @@ def UpdatePad(pad=None):
351
351
rt .gPad .Update ()
352
352
353
353
354
- def setCMSStyle ():
354
+ def setCMSStyle (force = rt . kTRUE ):
355
355
global cmsStyle
356
356
if cmsStyle != None :
357
357
del cmsStyle
358
358
cmsStyle = rt .TStyle ("cmsStyle" , "Style for P-CMS" )
359
359
rt .gROOT .SetStyle (cmsStyle .GetName ())
360
- rt .gROOT .ForceStyle ()
360
+ rt .gROOT .ForceStyle (force )
361
361
# for the canvas:
362
362
cmsStyle .SetCanvasBorderMode (0 )
363
363
cmsStyle .SetCanvasColor (rt .kWhite )
@@ -629,7 +629,7 @@ def cmsCanvas(
629
629
"""
630
630
631
631
# Set CMS style
632
- setCMSStyle ()
632
+ if cmsStyle is None : setCMSStyle ()
633
633
634
634
# Set canvas dimensions and margins
635
635
W_ref = 600 if square else 800
@@ -965,7 +965,7 @@ def is_valid_hex_color(hex_color):
965
965
bool: True if the string is a valid hexadecimal color code, False otherwise.
966
966
"""
967
967
hex_color_pattern = re .compile (r'^#(?:[0-9a-fA-F]{3}){1,2}$' )
968
-
968
+
969
969
return bool (hex_color_pattern .match (hex_color ))
970
970
971
971
@@ -991,7 +991,7 @@ def cmsDrawStack(stack, legend, MC, data = None, palette = None, invertLegendEnt
991
991
print ("Length of provided palette is smaller than the number of histograms to be drawn, wrap around is enabled" )
992
992
else :
993
993
print ("Invalid palette elements provided, default palette will be used" )
994
-
994
+
995
995
if palette == None or is_user_palette_valid == False :
996
996
if len (MC .keys ()) < 7 :
997
997
palette_ = petroff_6
@@ -1013,7 +1013,7 @@ def cmsDrawStack(stack, legend, MC, data = None, palette = None, invertLegendEnt
1013
1013
if not invertLegendEntries :
1014
1014
legend .AddEntry (item [1 ], item [0 ], "f" )
1015
1015
stack .Draw ("HIST SAME" )
1016
-
1016
+
1017
1017
if data != None :
1018
1018
cmsDraw (data , "P" , mcolor = rt .kBlack )
1019
1019
legend .AddEntry (data , "Data" , "lp" )
0 commit comments