78 const string bname =
hist2D_->GetName();
79 const string rebinName = bname +
"_rebin";
81 if (binxmax >
hist2D_->GetNbinsX()) {
82 std::cout <<
"Error: TH2Analyzer.cc: binxmax>hist2D_->GetNbinsX()" << std::endl;
97 binxmax - binxmin + 1,
98 hist2D_->GetXaxis()->GetBinLowEdge(binxmin),
99 hist2D_->GetXaxis()->GetBinUpEdge(binxmax),
101 hist2D_->GetYaxis()->GetXmin(),
102 hist2D_->GetYaxis()->GetXmax());
103 for (
int binyc = 1; binyc <
hist2D_->GetNbinsY() + 1; ++binyc) {
104 for (
int binxc = binxmin; binxc < binxmax + 1; ++binxc) {
116 const string averageName = bname +
"_average";
117 average_ =
new TH1D(averageName.c_str(),
118 "arithmetic average",
123 const string rmsName = bname +
"_RMS";
124 RMS_ =
new TH1D(rmsName.c_str(),
130 const string sigmaGaussName = bname +
"_sigmaGauss";
137 const string meanXName = bname +
"_meanX";
156 unsigned int nbin = 0;
157 if (((binxmax - binxmin + 1) % rebinFactor) != 0.0) {
158 nbin =
std::abs((binxmax - binxmin + 1) / rebinFactor) + 1;
160 nbin = (binxmax - binxmin + 1) / rebinFactor;
162 double *xlow =
new double[nbin + 1];
163 int *binlow =
new int[nbin + 1];
165 TH1D *h0_slice1 =
hist2D_->ProjectionY(
"h0_slice1", binxmin, binxmax,
"");
166 const unsigned int totalNumberOfEvents =
static_cast<unsigned int>(h0_slice1->GetEntries());
171 unsigned int neventsc = 0;
172 unsigned int binXmaxc = binxmin + 1;
173 xlow[0] =
hist2D_->GetXaxis()->GetBinLowEdge(binxmin);
175 for (
unsigned int binc = 1; binc < nbin; ++binc) {
176 while (neventsc < binc * totalNumberOfEvents / nbin) {
177 TH1D *h0_slice1c =
hist2D_->ProjectionY(
"h0_slice1", binxmin, binXmaxc,
"");
178 neventsc =
static_cast<unsigned int>(h0_slice1c->GetEntries());
185 binlow[binc] = binXmaxc - 1;
186 xlow[binc] =
hist2D_->GetXaxis()->GetBinLowEdge(binXmaxc - 1);
188 xlow[nbin] =
hist2D_->GetXaxis()->GetBinUpEdge(binxmax);
189 binlow[nbin] = binxmax;
201 hist2D_->GetYaxis()->GetXmin(),
202 hist2D_->GetYaxis()->GetXmax());
203 for (
int binyc = 1; binyc <
hist2D_->GetNbinsY() + 1; ++binyc) {
204 for (
unsigned int binxc = 1; binxc < nbin + 1; ++binxc) {
206 for (
int binxh2c = binlow[binxc - 1]; binxh2c < binlow[binxc]; ++binxh2c) {
207 sum +=
hist2D_->GetBinContent(binxh2c, binyc);
213 const string averageName = bname +
"_average";
214 average_ =
new TH1D(averageName.c_str(),
"arithmetic average", nbin, xlow);
216 const string rmsName = bname +
"_RMS";
217 RMS_ =
new TH1D(rmsName.c_str(),
"RMS", nbin, xlow);
219 const string sigmaGaussName = bname +
"_sigmaGauss";
220 sigmaGauss_ =
new TH1D(sigmaGaussName.c_str(),
"sigmaGauss", nbin, xlow);
222 const string meanXName = bname +
"_meanX";
223 meanXslice_ =
new TH1D(meanXName.c_str(),
"meanX", nbin, xlow);
Abs< T >::type abs(const T &t)
void ProcessSlices(const TH2D *histo)