ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/Configuration/scripts/makeBNTreePlot.py
(Generate patch)

Comparing UserCode/OSUT3Analysis/Configuration/scripts/makeBNTreePlot.py (file contents):
Revision 1.4 by wulsin, Wed Jun 5 14:04:47 2013 UTC vs.
Revision 1.5 by wulsin, Wed Jun 5 16:11:17 2013 UTC

# Line 14 | Line 14 | from decimal import *
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  
# Line 47 | Line 47 | for dataset in split_datasets:
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"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines