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" |
18 |
|
m_file = NULL; |
19 |
|
m_hists = NULL; |
20 |
|
debug = false; |
21 |
+ |
m_do_cumulative = true; |
22 |
|
} |
23 |
|
|
24 |
|
FileParser::~FileParser() |
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){ |
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()); |