ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/Configuration/scripts/mergeOutput.py
Revision: 1.3
Committed: Mon Feb 4 08:13:00 2013 UTC (12 years, 2 months ago) by ahart
Content type: text/x-python
Branch: MAIN
Changes since 1.2: +1 -1 lines
Log Message:
Weight to a default luminosity of 10/fb.

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     print "running makePlots.py"
55     os.system("makePlots.py %s" % args)
56     print "running makeCutFlows.py"
57     os.system("makeCutFlows.py %s" % args)