1 |
|
#!/usr/bin/env python |
2 |
|
|
3 |
|
## Created by Jeff Klukas (klukas@wisc.edu), November 2009 |
4 |
+ |
## Updated January 2010 |
5 |
|
|
6 |
|
## For more information, use the -h option: |
7 |
|
## ./overlayHists.py -h |
11 |
|
|
12 |
|
function: overlays corresponding histograms from several files, dumping the |
13 |
|
images into an identical directory structure in the local directory |
14 |
< |
and also merging all images into a single file (if output is pdf)""" |
14 |
> |
and also merging all images into a single file (if output is pdf); |
15 |
> |
most style options can be controlled from your rootlogon.C macro""" |
16 |
|
|
17 |
|
|
18 |
|
#### Define colors and styles |
76 |
|
"you choose. To affect all plots, simply include the option on the " |
77 |
|
"command line. With the '-s' option, however, you may instead include " |
78 |
|
"a keyword (such as 'Norm') in the ROOT name of a histogram and it will " |
79 |
< |
"have the option turned on regardless of the command line." |
79 |
> |
"always have that option turned on." |
80 |
|
) |
81 |
|
group1.add_option('-n', '--normalize', action="store_true", default=False, |
82 |
|
help="'Norm': area normalize the histograms") |
189 |
|
hist.AddBinContent(1, underflow) |
190 |
|
if options.normalize or (options.special and "Norm" in name): |
191 |
|
integral = hist.Integral() |
192 |
< |
hist.Scale(1. / integral) |
192 |
> |
if integral: hist.Scale(1. / integral) |
193 |
|
stack.Add(hist) |
194 |
|
legend.AddEntry(hist) |
195 |
|
#### Draw the stack and apply text overlays |