71 const string bname =
hist2D_->GetName();
72 const string rebinName = bname +
"_rebin";
74 if (binxmax>
hist2D_->GetNbinsX())
76 std::cout <<
"Error: TH2Analyzer.cc: binxmax>hist2D_->GetNbinsX()" << std::endl;
89 hist2D_->GetXaxis()->GetBinLowEdge(binxmin),
90 hist2D_->GetXaxis()->GetBinUpEdge(binxmax),
93 hist2D_->GetYaxis()->GetXmax() );
94 for (
int binyc=1;binyc<
hist2D_->GetNbinsY()+1;++binyc)
96 for (
int binxc=binxmin;binxc<binxmax+1;++binxc)
107 const string averageName = bname +
"_average";
108 average_ =
new TH1D( averageName.c_str(),
"arithmetic average",
113 const string rmsName = bname +
"_RMS";
114 RMS_ =
new TH1D( rmsName.c_str(),
"RMS",
119 const string sigmaGaussName = bname +
"_sigmaGauss";
120 sigmaGauss_ =
new TH1D(sigmaGaussName.c_str(),
"sigmaGauss",
125 const string meanXName = bname +
"_meanX";
142 if (((binxmax-binxmin+1)%rebinFactor)!=0.0)
144 nbin=
std::abs((binxmax-binxmin+1)/rebinFactor)+1;
146 else nbin=(binxmax-binxmin+1)/rebinFactor;
148 double *xlow =
new double[nbin+1];
149 int *binlow =
new int[nbin+1];
151 TH1D* h0_slice1 =
hist2D_->ProjectionY(
"h0_slice1", binxmin, binxmax,
"");
152 const unsigned int totalNumberOfEvents=
static_cast<unsigned int>(h0_slice1->GetEntries());
156 unsigned int neventsc=0;
157 unsigned int binXmaxc=binxmin+1;
158 xlow[0]=
hist2D_->GetXaxis()->GetBinLowEdge(binxmin);
160 for (
unsigned int binc=1;binc<nbin;++binc)
162 while (neventsc<binc*totalNumberOfEvents/nbin)
164 TH1D* h0_slice1c =
hist2D_->ProjectionY(
"h0_slice1",binxmin, binXmaxc,
"");
165 neventsc=
static_cast<unsigned int>(h0_slice1c->GetEntries());
172 binlow[binc]=binXmaxc-1;
173 xlow[binc]=
hist2D_->GetXaxis()->GetBinLowEdge(binXmaxc-1);
175 xlow[nbin]=
hist2D_->GetXaxis()->GetBinUpEdge(binxmax);
176 binlow[nbin]=binxmax;
184 nbin, xlow,
hist2D_->GetNbinsY(),
185 hist2D_->GetYaxis()->GetXmin(),
186 hist2D_->GetYaxis()->GetXmax() );
187 for (
int binyc=1;binyc<
hist2D_->GetNbinsY()+1;++binyc)
189 for (
unsigned int binxc=1;binxc<nbin+1;++binxc)
192 for (
int binxh2c=binlow[binxc-1];binxh2c<binlow[binxc];++binxh2c)
194 sum+=
hist2D_->GetBinContent(binxh2c,binyc);
200 const string averageName = bname +
"_average";
201 average_ =
new TH1D( averageName.c_str(),
"arithmetic average", nbin, xlow);
203 const string rmsName = bname +
"_RMS";
204 RMS_ =
new TH1D( rmsName.c_str(),
"RMS", nbin, xlow);
206 const string sigmaGaussName = bname +
"_sigmaGauss";
207 sigmaGauss_ =
new TH1D(sigmaGaussName.c_str(),
"sigmaGauss", nbin, xlow);
209 const string meanXName = bname +
"_meanX";
210 meanXslice_ =
new TH1D(meanXName.c_str(),
"meanX", nbin, xlow);
Abs< T >::type abs(const T &t)
void ProcessSlices(const TH2D *histo)