ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/SFramePlotter/FileParser.cxx
(Generate patch)

Comparing UserCode/UHHAnalysis/SFramePlotter/FileParser.cxx (file contents):
Revision 1.2 by rkogler, Fri Feb 22 14:08:29 2013 UTC vs.
Revision 1.3 by rkogler, Wed Feb 27 14:32:39 2013 UTC

# Line 6 | Line 6
6   #include <TKey.h>
7   #include <TDirectory.h>
8   #include <TClass.h>
9 + #include <TMath.h>
10  
11   #include "FileParser.h"
12   #include "SHist.h"
# Line 17 | Line 18 | FileParser::FileParser()
18    m_file = NULL;
19    m_hists = NULL;
20    debug = false;
21 +  m_do_cumulative = true;
22   }
23  
24   FileParser::~FileParser()
# Line 165 | Line 167 | void FileParser::BrowseFile()
167  
168          // histogram found
169          TH1* thist = (TH1*) obj;
170 +        if (m_do_cumulative) MakeCumulativeHist(thist);
171          TH1* rebinned = Rebin(thist, dirname);
172          SHist* shist = NULL;
173          if (rebinned){
# Line 189 | Line 192 | void FileParser::BrowseFile()
192  
193   }
194  
195 + void FileParser::MakeCumulativeHist(TH1* hist)
196 + {
197 +  for (Int_t i=1; i<hist->GetNbinsX()+1; ++i){
198 +    Double_t sum = 0;
199 +    Double_t sumw2 = 0;
200 +    for (int j=i; j<hist->GetNbinsX()+1; ++j){
201 +      sum += hist->GetBinContent(j);
202 +      sumw2 += hist->GetSumw2()->At(j);
203 +    }
204 +    hist->SetBinContent(i, sum);
205 +    hist->SetBinError(i, TMath::Sqrt(sumw2));
206 +  }
207 +
208 + }
209 +
210 +
211   TH1* FileParser::Rebin(TH1* hist, TString dirname)
212   {                                              
213    TString name(hist->GetName());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines