14 |
|
from OSUT3Analysis.Configuration.configurationOptions import * |
15 |
|
from OSUT3Analysis.Configuration.processingUtilities import * |
16 |
|
|
17 |
< |
from ROOT import TCut, TFile, TH1D, TTree, TStopwatch, TChain, gROOT |
17 |
> |
from ROOT import TChain, TCut, TDirectory, TFile, TH1D, TStopwatch, TTree, gROOT |
18 |
|
|
19 |
|
gROOT.SetBatch(True) # This is to prevent pop-up graphical windows |
20 |
|
|
47 |
|
ch.Add(condor_dir + "/" + dataset + "/hist_*.root") |
48 |
|
|
49 |
|
inputFile = TFile(condor_dir + "/" + dataset + ".root", "UPDATE") |
50 |
+ |
inputFile.cd("OSUAnalysis/"+hist['channel']) |
51 |
+ |
|
52 |
+ |
deleteString = hist['histName'] + ";*" # delete all existing instances of the object |
53 |
+ |
currentDir = inputFile.GetDirectory("OSUAnalysis/"+hist['channel']); |
54 |
+ |
currentDir.Delete(deleteString); |
55 |
+ |
|
56 |
|
h = TH1D(hist['histName'], hist['histName'], hist['nbins'], hist['xMin'], hist['xMax']) |
57 |
|
cut = TCut(hist['cutString']) |
58 |
< |
|
53 |
< |
ch.Draw(hist['varToPlot']+">>"+hist['histName'], cut) |
54 |
< |
|
55 |
< |
inputFile.cd("OSUAnalysis/"+hist['channel']) |
58 |
> |
ch.Draw(hist['varToPlot']+">>"+hist['histName'], cut) |
59 |
|
h.Write() |
60 |
|
inputFile.Close() |
61 |
|
print "Histogram " + hist['histName'] + " has been added to " + condor_dir + "/"+ dataset + ".root" |