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

Comparing UserCode/VHbb/python/myutils/HistoMaker.py (file contents):
Revision 1.6 by nmohr, Wed Feb 6 07:10:38 2013 UTC vs.
Revision 1.7 by peller, Wed Feb 6 12:55:04 2013 UTC

# Line 105 | Line 105 | class HistoMaker:
105              gDict = {}
106              if self._rebin:
107                  gDict[group] = self.mybinning.rebin(hTree)
108 +                del hTree
109              else:
110                  gDict[group] = hTree
111              hTreeList.append(gDict)
# Line 140 | Line 141 | class HistoMaker:
141          i=0
142          #add all together:
143          for job in bg_list:
144 +            print job
145 +            htree = self.get_histos_from_tree(job)[0].values()[0]
146              if not i:
147 <                totalBG = self.get_histos_from_tree(job)[0].values()[0]
147 >                totalBG = copy(htree)
148              else:
149 <                totalBG.Add(self.get_histos_from_tree(job)[0].values()[0],1)
149 >                totalBG.Add(htree,1)
150 >            del htree
151              i+=1
152          ErrorR=0
153          ErrorL=0
# Line 200 | Line 204 | class HistoMaker:
204              for histo_dict in histo_dicts:
205                  if histo_dict.has_key(sample):
206                      if nSample == 0:
207 <                        ordered_histo_dict[sample] = histo_dict[sample]
207 >                        ordered_histo_dict[sample] = histo_dict[sample].Clone()
208                      else:
209                          printc('magenta','','\t--> added %s to %s'%(sample,sample))
210                          ordered_histo_dict[sample].Add(histo_dict[sample])
211                      nSample += 1
212 +        del histo_dicts
213          return ordered_histo_dict
214  
215   class Rebinner:
# Line 214 | Line 219 | class Rebinner:
219          self.active=active
220      def rebin(self, histo):
221          if not self.active: return histo
217        #print 'rebinning'
222          #print histo.Integral()
223          ROOT.gDirectory.Delete('hnew')
224          histo.Rebin(self.nBins,'hnew',self.lowedgearray)
# Line 228 | Line 232 | class Rebinner:
232          newhisto.SetName(binhisto.GetName())
233          newhisto.SetTitle(binhisto.GetTitle())
234          #print newhisto.Integral()
235 +        del histo
236 +        del binhisto
237          return copy(newhisto)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines