ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/addingSamples.py
(Generate patch)

Comparing UserCode/VHbb/python/addingSamples.py (file contents):
Revision 1.6 by nmohr, Tue Mar 5 12:48:33 2013 UTC vs.
Revision 1.7 by nmohr, Tue Mar 5 17:02:59 2013 UTC

# Line 95 | Line 95 | def apply_weights(fileList,weight_map,in
95      for file in fileList:
96          outfile = ROOT.TFile.Open(file[0].replace('.root',newpostfix),'RECREATE')
97          infile = ROOT.TFile.Open(file[0],"READ")
98 <        histoInfile = ROOT.TFile.Open(inclusive,"READ")
98 >        histoInfile = ROOT.TFile.Open(inclusive+'.root',"READ")
99          histoInfile.cd()
100          obj = ROOT.TObject
101          for key in ROOT.gDirectory.GetListOfKeys():
# Line 175 | Line 175 | if opts.weights:
175      weight_map = get_weights(fileList,lheBin)
176      config.set('LHEWeights', 'weights_per_bin', '%s' %weight_map)
177      f = open('8TeVconfig/lhe_weights', 'w')
178 +    for section in config.sections():
179 +        if not section == 'LHEWeights':
180 +            config.remove_section(section)
181      config.write(f)
182      f.close()
183   elif opts.apply:
184 <    weight_map = config.get('LHEWeights', 'weights_per_bin')
184 >    weight_map = eval(config.get('LHEWeights', 'weights_per_bin'))
185   if opts.apply:
186      apply_weights(fileList,weight_map,prefix+inclusive,newpostfix)
187   if opts.validate:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines