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.1 by jbrinson, Fri May 31 14:19:23 2013 UTC vs.
Revision 1.2 by jbrinson, Tue Jun 4 13:13:18 2013 UTC

# Line 27 | Line 27 | if not arguments.condorDir:
27   if arguments.condorDir:
28      condor_dir = "condor/%s" % arguments.condorDir
29  
30 < for dataset in datasets:
30 > #save a list of composite datasets
31 > composite_datasets = get_composite_datasets(datasets, composite_dataset_definitions)
32 > #save a list of datasets with composite datasets split up
33 > split_datasets = split_composite_datasets(datasets, composite_dataset_definitions)
34 >
35 > #write new histogram to dataset
36 > for dataset in split_datasets:
37      for hist in input_histograms:
38 +        #chain trees together
39          ch = TChain("OSUAnalysis/"+hist['channel']+"/BNTree_"+hist['channel'])
40          ch.Add(condor_dir + "/" + dataset + "/hist_*.root")
41 +
42          inputFile = TFile(condor_dir + "/" + dataset + ".root", "UPDATE")
43          h = TH1D(hist['histName'], hist['histName'], hist['nbins'], hist['xMin'], hist['xMax'])
36        
44          cut = TCut(hist['cutString'])
45 <
45 >  
46          ch.Draw(hist['varToPlot']+">>"+hist['histName'], cut)
47 <
47 >  
48          inputFile.cd("OSUAnalysis/"+hist['channel'])
49          h.Write()
50          inputFile.Close()
51          print "Histogram " + hist['histName'] + " has been added to " + condor_dir + "/"+ dataset + ".root"
52 <    
52 >
53 > #merge output if composite dataset
54 > for composite_dataset in composite_datasets:
55 >    component_datasets_list = ""
56 >    component_dataset_file_path = ""
57 >    for component_dataset in composite_dataset_definitions[composite_dataset]:
58 >        component_dataset_dir = "%s/%s" % (condor_dir,component_dataset)
59 >        component_dataset_file_path = component_dataset_dir + ".root"
60 >        if os.path.isfile(component_dataset_file_path):
61 >            component_datasets_list += " " + component_dataset_file_path
62 >    composite_dataset_dir = "%s/%s" % (condor_dir,composite_dataset)
63 >    command = "mergeHists -p %s %s" % (composite_dataset_dir, component_datasets_list)
64 >    print "Merging output for composite dataset: " + composite_dataset
65 >    os.system(command)
66 >      
67   watch.Stop()
68   watch.Print()
69 +            
70  
71  
72  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines