19 |
|
'Logx': x-axis will be on log scale |
20 |
|
'Logy': y-axis will be on log scale""" |
21 |
|
|
22 |
< |
## Define colors |
22 |
> |
## Define colors and styles |
23 |
|
rgbvals = [[82, 124, 219], |
24 |
< |
[145, 83, 207], |
24 |
> |
[212,58,143], |
25 |
|
[231, 139, 77], |
26 |
+ |
[145, 83, 207], |
27 |
|
[114, 173, 117], |
28 |
|
[67, 77, 83]] |
29 |
+ |
marker_styles = [3, 4, 5, 25, 26, 27, 28, 30] |
30 |
|
|
31 |
|
## Import python libraries |
32 |
|
import sys |
35 |
|
import re |
36 |
|
|
37 |
|
## Import ROOT in batch mode |
38 |
< |
if '-h' not in sys.argv: |
38 |
> |
if '-h' not in sys.argv and len(sys.argv) > 1: |
39 |
|
sys.argv.append('-b') |
40 |
|
import ROOT |
41 |
< |
if os.path.exists('rootlogon.C'): ROOT.gROOT.Macro('rootlogon.C') |
41 |
> |
if os.path.exists('rootlogon.C'): |
42 |
> |
ROOT.gROOT.Macro('rootlogon.C') |
43 |
> |
else: |
44 |
> |
os.system('echo -e "{\n}\n" >> rootlogon.C') |
45 |
> |
ROOT.gROOT.Macro('rootlogon.C') |
46 |
> |
os.remove('rootlogon.C') |
47 |
|
sys.argv.remove('-b') |
48 |
|
ROOT.gErrorIgnoreLevel = ROOT.kWarning |
49 |
|
colors = [ROOT.TColor.GetColor(rgb[0], rgb[1], rgb[2]) for rgb in rgbvals] |
53 |
|
parser = optparse.OptionParser(usage=usage) |
54 |
|
parser.add_option('-n', '--normalize', action="store_true", default=False, |
55 |
|
help="area normalize all histograms") |
56 |
+ |
parser.add_option('-m', '--markers', action="store_true", default=False, |
57 |
+ |
help="add markers to histograms") |
58 |
|
parser.add_option('-e', '--ext', default="pdf", |
59 |
|
help="choose an output extension; default is pdf") |
60 |
|
parser.add_option('-o', '--output', default="overlaidHists", metavar="NAME", |
61 |
|
help="name of output directory; default is 'overlaidHists'") |
62 |
< |
parser.add_option('-m', '--match', default="", metavar="REGEX", |
62 |
> |
parser.add_option('--match', default="", metavar="REGEX", |
63 |
|
help="only make plots for paths containing the specified " |
64 |
|
"regular expression (use '.*' for wildcard)") |
65 |
|
options, arguments = parser.parse_args() |
134 |
|
hist.SetTitle(file.name) |
135 |
|
color = colors[i % len(colors)] |
136 |
|
hist.SetLineColor(color) |
137 |
< |
## hist.SetMarkerColor(color) |
138 |
< |
## hist.SetMarkerStyle(i + 1) |
137 |
> |
if options.markers: |
138 |
> |
hist.SetMarkerColor(color) |
139 |
> |
hist.SetMarkerStyle(marker_styles[i]) |
140 |
> |
else: |
141 |
> |
hist.SetMarkerSize(0) |
142 |
|
if "Norm" in name or options.normalize: |
143 |
|
integral = hist.Integral() |
144 |
|
hist.Scale(1. / integral) |