ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/Configuration/scripts/mergeOutput.py
Revision: 1.6
Committed: Mon Mar 11 13:20:56 2013 UTC (12 years, 1 month ago) by lantonel
Content type: text/x-python
Branch: MAIN
Changes since 1.5: +4 -0 lines
Log Message:
propagate options to makePlots.py

File Contents

# User Rev Content
1 lantonel 1.1 #!/usr/bin/env python
2     import os
3     import sys
4     from optparse import OptionParser
5    
6    
7 lantonel 1.2 from OSUT3Analysis.Configuration.configurationOptions import *
8     from OSUT3Analysis.Configuration.processingUtilities import *
9 lantonel 1.1
10     parser = OptionParser()
11     parser = set_commandline_arguments(parser)
12    
13     (options, args) = parser.parse_args()
14    
15     if options.localConfig:
16     sys.path.append(os.getcwd())
17     exec("from " + options.localConfig.rstrip('.py') + " import *")
18    
19     condor_dir = set_condor_output_dir(options)
20    
21     #save a list of composite datasets
22     composite_datasets = get_composite_datasets(datasets)
23     #save a list of datasets with composite datasets split up
24     split_datasets = split_composite_datasets(datasets)
25    
26    
27     #merge first layer
28     for dataset in split_datasets:
29     dataset_dir = "%s/%s" % (condor_dir,dataset)
30 ahart 1.3 command = "mergeHists -p %s %s" % (dataset_dir, dataset_dir)
31 lantonel 1.1 print "Merging output for",dataset, "dataset"
32     #print command
33     os.system(command)
34    
35     #merge together components of composite datasets
36     for composite_dataset in composite_datasets:
37     component_datasets_list = ""
38     component_dataset_file_path = ""
39     composite_dataset_dir = "%s/%s" % (condor_dir,composite_dataset)
40     for component_dataset in composite_dataset_definitions[composite_dataset]:
41     component_dataset_dir = "%s/%s" % (condor_dir,component_dataset)
42     component_dataset_file_path = component_dataset_dir + ".root"
43     if os.path.isfile(component_dataset_file_path):
44     component_datasets_list = component_datasets_list + " " + component_dataset_file_path
45     command = "mergeHists -p %s %s" % (composite_dataset_dir, component_datasets_list)
46     print "Merging component datasets for",composite_dataset, "dataset"
47     #print command
48     os.system(command)
49    
50     #recreate plots file with all datasets combined and in pretty colors
51     args = "-c %s" % condor_dir.partition('/')[2]
52     if options.localConfig:
53     args = args + " -l " + options.localConfig
54 lantonel 1.5 if options.normalizeToData:
55 lantonel 1.4 args = args + " -n "
56 lantonel 1.5 if options.normalizeToUnitArea:
57     args = args + " -u "
58     if options.noStack:
59     args = args + " -e "
60 lantonel 1.6 if options.makeRatioPlots:
61     args = args + " -r "
62     if options.outputFileName:
63     args = args + " -o " + options.outputFileName
64 lantonel 1.5
65 lantonel 1.1 print "running makePlots.py"
66     os.system("makePlots.py %s" % args)
67     print "running makeCutFlows.py"
68     os.system("makeCutFlows.py %s" % args)