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.2 by jbrinson, Tue Jun 4 13:13:18 2013 UTC vs.
Revision 1.5 by wulsin, Wed Jun 5 16:11:17 2013 UTC

# Line 1 | Line 1
1   #!/usr/bin/env python
2 +
3 + # Must specify options with -l argument, e.g.:  
4 + # > makeBNTreePlot.py -l sampleBNTreePlotConfig.py  
5 +
6 +
7   import sys
8   import os
9   import re
# Line 9 | 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
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  
21   watch = TStopwatch()
22  
# Line 40 | 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 <  
46 <        ch.Draw(hist['varToPlot']+">>"+hist['histName'], cut)
47 <  
48 <        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