50 |
|
cmd = "condor_submit condor/"+arguments.condorDir+"/"+dataset+"/condorBNTree.sub" |
51 |
|
os.system(cmd) |
52 |
|
print "Submitting job: %s " % cmd |
53 |
+ |
|
54 |
+ |
print "Once condor jobs have finished, merge the composite datasets and then make plots with:" |
55 |
+ |
print " makeBNTreePlot.py -q -l " + arguments.localConfig + " -c " + arguments.condorDir |
56 |
+ |
print " makePlots.py -l " + arguments.localConfig + " -c " + arguments.condorDir |
57 |
|
|
58 |
|
return |
59 |
|
|
84 |
|
#save a list of datasets with composite datasets split up |
85 |
|
split_datasets = split_composite_datasets(datasets, composite_dataset_definitions) |
86 |
|
|
87 |
+ |
if arguments.quickMerge and arguments.runOnCondor: |
88 |
+ |
print "Cannot use -q (--quickMerge) and -C (--runOnCondor) options simultaneously. Please choose one or the other." |
89 |
+ |
exit() |
90 |
+ |
|
91 |
|
if arguments.runOnCondor: |
92 |
|
RunOnCondor(arguments, split_datasets) |
93 |
< |
exit() |
86 |
< |
|
87 |
< |
print "Running interactively instead" |
88 |
< |
|
93 |
> |
exit() |
94 |
|
|
95 |
|
#write new histogram to dataset |
96 |
< |
for dataset in split_datasets: |
97 |
< |
for hist in input_histograms: |
98 |
< |
#chain trees together |
99 |
< |
ch = TChain("OSUAnalysis/"+hist['channel']+"/BNTree_"+hist['channel']) |
100 |
< |
ch.Add(condor_dir + "/" + dataset + "/hist_*.root") |
101 |
< |
print "Looping over chain with # entries = %f" % ch.GetEntries() |
102 |
< |
|
103 |
< |
outputFile = TFile(condor_dir + "/" + dataset + ".root", "UPDATE") |
104 |
< |
if not outputFile or outputFile.IsZombie(): print "Could not open file: %s/%s.root" % (condor_dir, dataset) |
105 |
< |
outputFile.cd("OSUAnalysis/"+hist['channel']) |
106 |
< |
|
107 |
< |
deleteString = hist['histName'] + ";*" # delete all existing instances of the object |
108 |
< |
currentDir = outputFile.GetDirectory("OSUAnalysis/"+hist['channel']); |
109 |
< |
if not currentDir: print "Could not find directory OSUAnalysis/%s in file %s" % (hist['channel'], outputFile.GetName()) |
110 |
< |
currentDir.Delete(deleteString); |
111 |
< |
if 'nbinsY' in hist: # only make a 2D histogram if the key "nbinsY" is defined |
112 |
< |
h = TH2D(hist['histName'], hist['histName'], |
113 |
< |
hist['nbins'], hist['xMin'], hist['xMax'], |
114 |
< |
hist['nbinsY'], hist['yMin'], hist['yMax']) |
115 |
< |
else: |
116 |
< |
h = TH1D(hist['histName'], hist['histName'], hist['nbins'], hist['xMin'], hist['xMax']) |
117 |
< |
h.Sumw2() # Needed to get weights correct. |
118 |
< |
cut = TCut(hist['cutString']) |
119 |
< |
ch.Draw(hist['varToPlot']+">>"+hist['histName'], cut) |
120 |
< |
h.Write() |
121 |
< |
outputFile.Close() |
122 |
< |
print "Histogram " + hist['histName'] + " has been added to " + condor_dir + "/"+ dataset + ".root" |
96 |
> |
if not arguments.quickMerge: |
97 |
> |
for dataset in split_datasets: |
98 |
> |
for hist in input_histograms: |
99 |
> |
#chain trees together |
100 |
> |
ch = TChain("OSUAnalysis/"+hist['channel']+"/BNTree_"+hist['channel']) |
101 |
> |
ch.Add(condor_dir + "/" + dataset + "/hist_*.root") |
102 |
> |
print "Looping over chain with # entries = %f" % ch.GetEntries() |
103 |
> |
|
104 |
> |
outputFile = TFile(condor_dir + "/" + dataset + ".root", "UPDATE") |
105 |
> |
if not outputFile or outputFile.IsZombie(): print "Could not open file: %s/%s.root" % (condor_dir, dataset) |
106 |
> |
outputFile.cd("OSUAnalysis/"+hist['channel']) |
107 |
> |
|
108 |
> |
deleteString = hist['histName'] + ";*" # delete all existing instances of the object |
109 |
> |
currentDir = outputFile.GetDirectory("OSUAnalysis/"+hist['channel']); |
110 |
> |
if not currentDir: print "Could not find directory OSUAnalysis/%s in file %s" % (hist['channel'], outputFile.GetName()) |
111 |
> |
currentDir.Delete(deleteString); |
112 |
> |
if 'nbinsY' in hist: # only make a 2D histogram if the key "nbinsY" is defined |
113 |
> |
h = TH2D(hist['histName'], hist['histName'], |
114 |
> |
hist['nbins'], hist['xMin'], hist['xMax'], |
115 |
> |
hist['nbinsY'], hist['yMin'], hist['yMax']) |
116 |
> |
else: |
117 |
> |
h = TH1D(hist['histName'], hist['histName'], hist['nbins'], hist['xMin'], hist['xMax']) |
118 |
> |
h.Sumw2() # Needed to get weights correct. |
119 |
> |
cut = TCut(hist['cutString']) |
120 |
> |
ch.Draw(hist['varToPlot']+">>"+hist['histName'], cut) |
121 |
> |
h.Write() |
122 |
> |
outputFile.Close() |
123 |
> |
print "Histogram " + hist['histName'] + " has been added to " + condor_dir + "/"+ dataset + ".root" |
124 |
|
|
125 |
|
#merge output if composite dataset |
126 |
|
for composite_dataset in composite_datasets: |