8 |
|
## Define usage string for help option |
9 |
|
usage="""usage: %prog [options] file1.root file2.root file3.root ... |
10 |
|
|
11 |
< |
function: overlays histograms from several files with identical structure |
11 |
> |
function: overlays corresponding histograms from several files, dumping the |
12 |
> |
images into an identical directory structure in the local directory |
13 |
> |
and also merging all images into a single file (if output is pdf) |
14 |
|
|
15 |
|
naming: histograms whose names contain certain key terms will be handled |
16 |
|
specially. Use this to your advantage! |
49 |
|
parser.add_option('-n', '--normalize', action="store_true", default=False, |
50 |
|
help="area normalize all histograms") |
51 |
|
parser.add_option('-e', '--ext', default="pdf", |
52 |
< |
help="specify the type (extension) of the output files") |
52 |
> |
help="choose an output extension; default is pdf") |
53 |
|
parser.add_option('-o', '--output', default="overlaidHists", metavar="NAME", |
54 |
< |
help="specify the name of the output file/directory") |
54 |
> |
help="name of output directory; default is 'overlaidHists'") |
55 |
|
parser.add_option('-m', '--match', default="", metavar="REGEX", |
56 |
< |
help="only make plots for paths containing REGEX") |
56 |
> |
help="only make plots for paths containing the specified " |
57 |
> |
"regular expression (use '.*' for wildcard)") |
58 |
|
options, arguments = parser.parse_args() |
59 |
|
plot_dir = "%s/%s" % (os.path.abspath('.'), options.output) |
60 |
|
regex = re.compile(options.match) |
75 |
|
def main(): |
76 |
|
files = [] |
77 |
|
for filename in arguments: files.append(RootFile(filename)) |
78 |
+ |
if len(files) == 0: |
79 |
+ |
parser.print_help() |
80 |
+ |
sys.exit(0) |
81 |
|
process_directory("", files) |
82 |
|
if options.ext == "pdf": |
83 |
|
os.system("gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite " |