4 |
|
import sys |
5 |
|
import math |
6 |
|
import datetime |
7 |
+ |
import copy |
8 |
|
from optparse import OptionParser |
9 |
< |
#from OSUT3Analysis.Configuration.configurationOptions import * |
9 |
> |
import OSUT3Analysis.DBTools.osusub_cfg as osusub |
10 |
> |
import FWCore.ParameterSet.Config as cms |
11 |
|
|
12 |
|
def split_composite_datasets(datasets, composite_dataset_definitions): |
13 |
|
for dataset in datasets: |
46 |
|
sys.exit("Cannot find last condor working directory") |
47 |
|
dir_list.sort(reverse=True) |
48 |
|
condor_dir = "condor/%s" % dir_list[0] |
49 |
< |
print "Condor output directory set to ",condor_dir |
49 |
> |
#print "Condor output directory set to ",condor_dir |
50 |
|
return condor_dir |
51 |
|
|
52 |
|
def set_commandline_arguments(parser): |
57 |
|
help="condor output directory") |
58 |
|
parser.add_option("-o", "--output-file", dest="outputFileName", |
59 |
|
help="specify an output file name for the histogram file, default is 'stacked_histograms.root'") |
58 |
– |
parser.add_option("-t", "--no-weights", action="store_true", dest="noWeights", default=False, |
59 |
– |
help="do not apply cross section weights") |
60 |
– |
parser.add_option("-q", "--quickMerge", action="store_true", dest="quickMerge", default=False, |
61 |
– |
help="do merge without making cutflow or plots") |
60 |
|
|
61 |
|
|
62 |
|
#### Histogram Formatting Options |
69 |
|
|
70 |
|
parser.add_option("-r", "--ratio", action="store_true", dest="makeRatioPlots", default=False, |
71 |
|
help="draw (data-MC)/MC plots below all 1D histograms") |
72 |
< |
parser.add_option("-R", "--ratioYRange", dest="ratioYRange", default=1.15, |
72 |
> |
parser.add_option("-R", "--ratioYRange", dest="ratioYRange", |
73 |
|
help="maximum of range of vertical scale for ratio plots") |
74 |
|
parser.add_option("-d", "--diff", action="store_true", dest="makeDiffPlots", default=False, |
75 |
|
help="draw data-MC plots below all 1D histograms") |
82 |
|
parser.add_option("-p", "--pdfs", action="store_true", dest="savePDFs", default=False, |
83 |
|
help="Save pdfs files for all plots made") |
84 |
|
|
87 |
– |
|
85 |
|
return parser |
86 |
|
|
87 |
|
def get_short_name(dataset, dataset_names): |
136 |
|
options['labels'][bottomDatasetName] = "#tilde{t}#tilde{t}#rightarrowbbll (#LTc#tau#GT = " + str (ctau) + " mm)" |
137 |
|
options['labels'][topDatasetName] = "#tilde{t}#tilde{t}#rightarrowtt#nu#nu (#LTc#tau#GT = " + str (ctau) + " mm)" |
138 |
|
options['labels'][mixedDatasetName] = "#tilde{t}#tilde{t}#rightarrowbtl#nu (#LTc#tau#GT = " + str (ctau) + " mm)" |
139 |
+ |
|
140 |
+ |
def add_channels (process, channels, outputCommands = ["keep *"]): |
141 |
+ |
suffix = "" |
142 |
+ |
if osusub.batchMode: |
143 |
+ |
suffix = "_" + str (osusub.jobNumber) |
144 |
+ |
i = 0 |
145 |
+ |
for channel in channels: |
146 |
+ |
channelName = channel.name.pythonValue () |
147 |
+ |
channelName = channelName[1:-1] |
148 |
+ |
try: |
149 |
+ |
os.mkdir (channelName) |
150 |
+ |
except OSError: |
151 |
+ |
pass |
152 |
+ |
out = cms.OutputModule ("PoolOutputModule", |
153 |
+ |
fileName = cms.untracked.string (channelName + "/bean" + suffix + ".root"), |
154 |
+ |
SelectEvents = cms.untracked.PSet ( |
155 |
+ |
SelectEvents = cms.vstring ("myFilterPath" + str (i)) |
156 |
+ |
), |
157 |
+ |
outputCommands = cms.untracked.vstring ( |
158 |
+ |
outputCommands |
159 |
+ |
), |
160 |
+ |
dropMetaData = cms.untracked.string ("ALL") |
161 |
+ |
) |
162 |
+ |
myFilter = cms.EDFilter ("FilterOnChannelDecision", |
163 |
+ |
src = cms.InputTag ("OSUAnalysis", "channelDecisions"), |
164 |
+ |
channelName = cms.string (channelName) |
165 |
+ |
) |
166 |
+ |
myFilterPath = cms.Path (myFilter) |
167 |
+ |
myEndPath = cms.EndPath (out) |
168 |
+ |
process.__setattr__ ("out" + str (i), out) |
169 |
+ |
process.OSUAnalysis.channels.append (channel) |
170 |
+ |
process.OSUAnalysis.useEDMFormat = cms.bool (True) |
171 |
+ |
process.__setattr__ ("myFilter" + str (i), myFilter) |
172 |
+ |
process.__setattr__ ("myFilterPath" + str (i), myFilterPath) |
173 |
+ |
process.__setattr__ ("myEndPath" + str (i), myEndPath) |
174 |
+ |
i += 1 |